GitHub user dosubot[bot] added a comment to the discussion: Superset Dev Image 
Not Exposing ECharts via API + Issues Connecting to Trino in Superset 5.0

<!-- Answer -->
The correct `viz_type` for a bar chart in Superset 5.0 is 
`echarts_timeseries_bar` (not `bar`). The legacy `bar` type is deprecated and 
not supported for new chart creation via the API—modern ECharts chart types use 
identifiers like `echarts_timeseries_bar` instead 
[example](https://github.com/apache/superset/discussions/34750), 
[example](https://github.com/apache/superset/pull/34436).

Here’s a minimal example of the JSON payload you’d use in a Python script to 
create or query a bar chart:

```python
payload = {
    "slice_name": "My Bar Chart",
    "viz_type": "echarts_timeseries_bar",
    "datasource_id": 1,  # your dataset/table ID
    "datasource_type": "table",
    "params": json.dumps({
        "viz_type": "echarts_timeseries_bar",
        "metrics": ["count"],  # or your metric
        "groupby": ["your_column"],
        # ...other chart options as needed
    }),
}
```

There isn’t an API endpoint that lists all supported `viz_type` values. To 
discover the right parameters for a chart type, create a chart in the UI and 
inspect it with `GET /api/v1/chart/{id}`—the `params` field will show the 
config you need. You can also export dashboards or inspect the frontend plugin 
code for more details 
[reference](https://github.com/apache/superset/discussions/35978).

Let me know if you want a full example for a specific use case!


<!-- Dosu Comment Footer -->
*To reply, just mention [@dosu](https://go.dosu.dev/dosubot).*

---
<sup>How did I do? 
[Good](https://app.dosu.dev/response-feedback/f74035eb-79a0-4c57-a22b-05840b36c457?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/f74035eb-79a0-4c57-a22b-05840b36c457?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/f74035eb-79a0-4c57-a22b-05840b36c457?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/f74035eb-79a0-4c57-a22b-05840b36c457?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/f74035eb-79a0-4c57-a22b-05840b36c457?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/f74035eb-79a0-4c57-a22b-05840b36c457?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/f74035eb-79a0-4c57-a22b-05840b36c457?feedback_type=other)</sup>

[![Chat with 
Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github)&nbsp;[![Open
 in 
Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=The%20correct%20%60viz_type%60%20for%20a%20bar%20chart%20in%20Superset%205.0%20is%20%60echarts_timeseries_bar%60%20%28not%20%60bar%60%29.%20The%20legacy%20%60bar%60%20type%20is%20deprecated%20and%20not%20supported%20for%20new%20chart%20creation%20via%20the%20API%E2%80%94modern%20ECharts%20chart%20types%20use%20identifiers%20like%20%60echarts_timeseries_bar%60%20instead%C2%A0%5Bexample%5D%28https%3A//github.com/apache/superset/discussions/34750%29%2C%C2%A0%5Bexample%5D%28https%3A//github.com/apache/superset/pull/34436%29.%0A%0AHere%E2%80%99s%20a%20minimal%20example%20of%20the%20JSON%20payload%20you%E2%80%99d%20use%20in%20a%20Python%20script%20to%20create%20or%20query%20a%20bar%20chart%3A%0A%0A%60%60%60python%0Apayload%20%3D%20%7B%0A%20%20%20%20%22slice
 
_name%22%3A%20%22My%20Bar%20Chart%22%2C%0A%20%20%20%20%22viz_type%22%3A%20%22echarts_timeseries_bar%22%2C%0A%20%20%20%20%22datasource_id%22%3A%201%2C%20%20%23%20your%20dataset/table%20ID%0A%20%20%20%20%22datasource_type%22%3A%20%22table%22%2C%0A%20%20%20%20%22params%22%3A%20json.dumps%28%7B%0A%20%20%20%20%20%20%20%20%22viz_type%22%3A%20%22echarts_timeseries_bar%22%2C%0A%20%20%20%20%20%20%20%20%22metrics%22%3A%20%5B%22count%22%5D%2C%20%20%23%20or%20your%20metric%0A%20%20%20%20%20%20%20%20%22groupby%22%3A%20%5B%22your_column%22%5D%2C%0A%20%20%20%20%20%20%20%20%23%20...other%20chart%20options%20as%20needed%0A%20%20%20%20%7D%29%2C%0A%7D%0A%60%60%60%0A%0AThere%20isn%E2%80%99t%20an%20API%20endpoint%20that%20lists%20all%20supported%20%60viz_type%60%20values.%20To%20discover%20the%20right%20parameters%20for%20a%20chart%20type%2C%20create%20a%20chart%20in%20the%20UI%20and%20inspect%20it%20with%20%60GET%20/api/v1/chart/%7Bid%7D%60%E2%80%94the%20%60params%60%20field%20will%20show%20the%20confi
 
g%20you%20need.%20You%20can%20also%20export%20dashboards%20or%20inspect%20the%20frontend%20plugin%20code%20for%20more%20details%C2%A0%5Breference%5D%28https%3A//github.com/apache/superset/discussions/35978%29.%0A%0ALet%20me%20know%20if%20you%20want%20a%20full%20example%20for%20a%20specific%20use%20case%21)&nbsp;[![Join
 
Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share
 on 
X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/discussions/36434)

GitHub link: 
https://github.com/apache/superset/discussions/36434#discussioncomment-15234291

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: 
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to