dosubot[bot] commented on issue #36779:
URL: https://github.com/apache/superset/issues/36779#issuecomment-3678688759
<!-- Answer -->
Yes, to customize tooltips in deck.gl polygons without custom JavaScript
(and without relaxing CSP), you need to include all the fields you want to
display in your dataset and select them in the chart configuration. Superset
will show these fields in the default tooltip.
If you want a specific format (like combining multiple values into one
tooltip), you can create a new field in your SQL query or dataset that
concatenates the values you want. For example, in SQL:
```sql
SELECT
territorio,
anno,
indicatore,
valore,
CONCAT(territorio, '\nAnno: ', anno, '\n', indicatore, '\n', valore) AS
tooltip_text
FROM your_table
```
Then, in your chart, make sure to include `tooltip_text` as one of the
columns. Superset will display this field in the tooltip. Note that HTML tags
will be escaped and not rendered as markup—only plain text formatting (like
newlines or separators) will appear in the tooltip
[[source]](https://github.com/apache/superset/issues/35182#issuecomment-3305170167).
Best practice: use clear column names and pre-format values as needed in
your data source. Avoid custom JavaScript for tooltips in production, as it's
blocked by strict CSP for security reasons
[[source]](https://github.com/apache/superset/issues/18696#issuecomment-1922293527).
<!-- 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/0844d094-57ba-4026-9f3a-6fc77d59e1dd?feedback_type=great_response)
|
[Irrelevant](https://app.dosu.dev/response-feedback/0844d094-57ba-4026-9f3a-6fc77d59e1dd?feedback_type=irrelevant_answer)
|
[Incorrect](https://app.dosu.dev/response-feedback/0844d094-57ba-4026-9f3a-6fc77d59e1dd?feedback_type=incorrect_sources)
|
[Verbose](https://app.dosu.dev/response-feedback/0844d094-57ba-4026-9f3a-6fc77d59e1dd?feedback_type=too_verbose)
|
[Hallucination](https://app.dosu.dev/response-feedback/0844d094-57ba-4026-9f3a-6fc77d59e1dd?feedback_type=hallucination)
| [Report
🐛](https://app.dosu.dev/response-feedback/0844d094-57ba-4026-9f3a-6fc77d59e1dd?feedback_type=bug_report)
|
[Other](https://app.dosu.dev/response-feedback/0844d094-57ba-4026-9f3a-6fc77d59e1dd?feedback_type=other)</sup>
[](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github) [](https://cursor.com/link/prompt?text=Yes%2C%20to%20customize%20tooltips%20in%20deck.gl%20polygons%20without%20custom%20JavaScript%20%28and%20without%20relaxing%20CSP%29%2C%20you%20need%20to%20include%20all%20the%20fields%20you%20want%20to%20display%20in%20your%20dataset%20and%20select%20them%20in%20the%20chart%20configuration.%20Superset%20will%20show%20these%20fields%20in%20the%20default%20tooltip.%0A%0AIf%20you%20want%20a%20specific%20format%20%28like%20combining%20multiple%20values%20into%20one%20tooltip%29%2C%20you%20can%20create%20a%20new%20field%20in%20your%20SQL%20query%20or%20dataset%20that%20concatenates%20the%20values%20you%20want.%20For%20example%2C%20in%20SQL%3A%0A%0A%60%60%60sql%0ASELECT%0A%20%20territorio%2C%0A%20%20anno%2C%0A%20%20indicatore%2C%0A%20%20valore%2C%0A%20%2
0CONCAT%28territorio%2C%20%27%5CnAnno%3A%20%27%2C%20anno%2C%20%27%5Cn%27%2C%20indicatore%2C%20%27%5Cn%27%2C%20valore%29%20AS%20tooltip_text%0AFROM%20your_table%0A%60%60%60%0A%0AThen%2C%20in%20your%20chart%2C%20make%20sure%20to%20include%20%60tooltip_text%60%20as%20one%20of%20the%20columns.%20Superset%20will%20display%20this%20field%20in%20the%20tooltip.%20Note%20that%20HTML%20tags%20will%20be%20escaped%20and%20not%20rendered%20as%20markup%E2%80%94only%20plain%20text%20formatting%20%28like%20newlines%20or%20separators%29%20will%20appear%20in%20the%20tooltip%20%5B%5Bsource%5D%5D%28https%3A//github.com/apache/superset/issues/35182%23issuecomment-3305170167%29.%0A%0ABest%20practice%3A%20use%20clear%20column%20names%20and%20pre-format%20values%20as%20needed%20in%20your%20data%20source.%20Avoid%20custom%20JavaScript%20for%20tooltips%20in%20production%2C%20as%20it%27s%20blocked%20by%20strict%20CSP%20for%20security%20reasons%20%5B%5Bsource%5D%5D%28https%3A//github.com/apache/superset/issues
/18696%23issuecomment-1922293527%29.) [](https://go.dosu.dev/discord-bot) [](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/36779)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]