Skip to content

Deck.gl GeoJson Polygon Plot Tooltip does not include aggregation metric #41283

Description

@pSpitzner

Since PR #34276 we have the ability to adjust the tooltip of a deck.gl GeoJson Polygon charts through a unified interface:

  • a) how to determine each polygons color, via the Metric selector (avialable before the PR)
  • b) which metrics to include, via the list of Tooltip contents
  • c) how to style them, via the Customize tooltips template

However, achieving a simple tooltip that shows an aggregated metric (say computed_metric) along with some corresponding meta data (say time and location) is currently not possible.

Desired outcome

Image

*CSP needs to be disabled

Isolation

  • To use custom sytling (c), CSP has to be disabed or adjusted (e.g. TALISMAN_ENABLED = False).
  • Without anything added to (b), the default template includes the computed_metric.
  • When adding meta data by including them in (b), the default style does not include the computed_metric. This does not require adjusting CSP.
  • The ui does not permit adding computed_metric in (b): Only real data columns can be selected, no custom sql and no predefined dataset-level metrics.

Conclusion

  • In combination, it is currently not possible, to get tooltip with a custom metric and metadata, without disabeling CSP.

Proposed solution

  • The default template that is used when columns are added into (b) should include the defined Metric (a)
  • The UI should inform the user that (c) does not use handlebars (but a javascript render), which requires disableing CSP.

Screenshots

default template without columns added to (b)
Image


default template with columns added to (b)
Image


no computed metrics can be selected in (b)
Image

Additional context

Tested in Superset v6.1.0

Related Issues and PRs

Insights from Dosu:

  • (c) is processed as JavaScript using a sandboxed vm.runInNewContext() execution environment [1]. Internally, this calls sandboxedEval() which uses dynamic code evaluation — and that's exactly what triggers the CSP 'unsafe-eval' violation you're seeing [2].

Checklist

  • I have searched Superset docs and Slack and didn't find a solution to my problem.
  • I have searched the GitHub issue tracker and didn't find a similar bug report.
  • I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.

Metadata

Metadata

Assignees

No one assigned

    Labels

    review:checkpointLast PR reviewed during the daily review standupvalidation:requiredA committer should validate the issueviz:charts:geojsonRelated to the deck.gl Geojsonviz:charts:tooltipRelated to tooltips in charts

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions