GitHub user dosubot[bot] added a comment to the discussion: Is there a way to 
embed a Bar Chart within a Pivot Table in Apache Superset?

<!-- Greeting -->
Hi @serdukow! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the 
superset team.

<!-- Answer -->
Superset's Pivot Table now supports rendering HTML in cells if you enable the 
"Render columns in html" option. This lets you use SQL metrics to output 
HTML/CSS, so you can create simple in-cell bar-like graphics using styled 
`<span>` elements or even inline SVG. For example, you could use a SQL CASE 
statement to output a colored span whose width reflects the sales value:

```sql
CONCAT(
  '<span style="display:inline-block;background:#4caf50;height:12px;width:',
  ROUND(SUM(sales)/10000), 'px"></span> ', SUM(sales)
)
```

To use this, check the "Render columns in html" option in your Pivot Table 
chart controls. This approach enables basic graphical cues in cells, but it's 
not a full charting solution—complexity, performance, and security (HTML 
injection) should be considered. For more advanced in-cell charts, you’d need 
to develop a custom visualization plugin or extend the frontend renderer. See 
the [recent PR for details and 
examples](https://github.com/apache/superset/pull/34351).


<!-- 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/231f6a43-480a-438c-8c88-9daa6571f0e0?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/231f6a43-480a-438c-8c88-9daa6571f0e0?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/231f6a43-480a-438c-8c88-9daa6571f0e0?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/231f6a43-480a-438c-8c88-9daa6571f0e0?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/231f6a43-480a-438c-8c88-9daa6571f0e0?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/231f6a43-480a-438c-8c88-9daa6571f0e0?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/231f6a43-480a-438c-8c88-9daa6571f0e0?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat
 with 
Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github)&
 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/35053)

GitHub link: 
https://github.com/apache/superset/discussions/35053#discussioncomment-14338960

----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: 
notifications-unsubscr...@superset.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to