Open_Data_QnA icon indicating copy to clipboard operation
Open_Data_QnA copied to clipboard

Visualization Not Displaying in UI; Backend Returns js_chart as Dictionary

Open albinneopraxis opened this issue 7 months ago • 0 comments

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).

albinneopraxis avatar Jun 05 '25 06:06 albinneopraxis