deck.gl icon indicating copy to clipboard operation
deck.gl copied to clipboard

[Bug] pydeck tooltips doesn't support displaying nested JSON values

Open andhuang-CLGX opened this issue 3 years ago • 1 comments

Description

Trying to show

       "html": '<b>value:</b> {properties.valuePerSqm}',

But it doesn't seem to support the substitution. image

Flavors

  • [ ] React
  • [X] Python/Jupyter notebook
  • [ ] MapboxLayer
  • [ ] GoogleMapsOverlay
  • [ ] CartoLayer
  • [ ] DeckLayer/DeckRenderer for ArcGIS

Expected Behavior

No response

Steps to Reproduce

import pydeck

DATA_URL = "https://raw.githubusercontent.com/visgl/deck.gl-data/master/examples/geojson/vancouver-blocks.json"
LAND_COVER = [[[-123.0, 49.196], [-123.0, 49.324], [-123.306, 49.324], [-123.306, 49.196]]]

INITIAL_VIEW_STATE = pydeck.ViewState(
  latitude=49.254,
  longitude=-123.13,
  zoom=11,
  max_zoom=16,
  pitch=45,
  bearing=0
)

geojson = pydeck.Layer(
    'GeoJsonLayer',
    DATA_URL,
    opacity=0.8,
    stroked=False,
    filled=True,
    extruded=True,
    wireframe=True,
    get_elevation='properties.valuePerSqm / 20',
    get_fill_color='[255, 255, properties.growth * 255]',
    get_line_color=[255, 255, 255],
    pickable=True
)

r = pydeck.Deck(
    layers=[geojson],
    initial_view_state=INITIAL_VIEW_STATE,
    tooltip={
       "html": '<b>value:</b> {properties.valuePerSqm}',
       "style": {
            "backgroundColor": "steelblue",
            "color": "white"
       }
    }
)

r

Environment

Logs

No response

andhuang-CLGX avatar Jan 27 '22 00:01 andhuang-CLGX

Using plain JSON works https://github.com/holoviz/panel/issues/3145#issuecomment-1023736626

andhuang-CLGX avatar Jan 27 '22 23:01 andhuang-CLGX

This is already supported in pydeck v0.8.0

Jesus89 avatar Apr 01 '23 08:04 Jesus89