GoogleCloudPlatform / GoogleCloudPlatform/Open_Data_QnA

Visualization Not Displaying in UI; Backend Returns js_chart as Dictionary

Open
#79 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Dart
Stars
233
Forks
74
PR merge metrics
No merged PRs in 30d

Description

The Open Data QnA application successfully generates SQL queries and natural language responses. However, despite the backend (opendataqna Cloud Run service) returning the generated JavaScript chart data (js_chart), the visualization does not render on the frontend UI. No explicit error message is displayed on the UI itself related to the visualization failure, but the browser console shows a JavaScript error, and backend logs indicate that the js_chart is a dictionary.

Expected Behavior:

Upon receiving a valid SQL query and results, the backend's visualize function should return valid Google Charts JavaScript code (or a structured JSON for charting libraries like Vega-Lite/Altair) that the frontend can correctly interpret and render as a chart.

Actual Behavior:

The backend (opendataqna service) processes the visualization request and returns a JSON response containing js_chart data.
The js_chart content, as seen in backend logs and frontend network response, is a Python dictionary (representing the two charts, "chart_div" and "chart_div_1", with their respective JavaScript strings as values).
The frontend UI does not display any chart.
The browser's developer console shows a TypeError: Cannot convert undefined or null to object related to Object.entries in the main-PIBBDJBX.js (Angular compiled JavaScript).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.