Closed iliatimofeev closed 1 year ago
Geo markers do not yet support interaction in Vega-Lite. The issue is being tracked here: https://github.com/vega/vega-lite/issues/3306
Looking closer, the particular error you're getting is not related to geographic markers; you're asking for interactive x/y encodings, but you've not mapped those encodings to any data. You get the same error with a simpler chart; e.g.
alt.Chart('data.csv').mark_point().interactive()
I expected that interactive()
give me a zoomable version of the chart which i can get without it :)
Something like https://vega.github.io/vega/examples/zoomable-world-map/ Or better like https://bl.ocks.org/mbostock/2374239 it works more natural
So i think that for simplicity details like encoding of x or longitude should be hidden from me in that case.
By the way according to documentation { "type": "interval", "bind": "scales" }
will be enough to zooming, so adding encoding
block in interactive()
looks unnecessary.
Another problem that it shows empty cell without any explanation or hints on the causes. I know that it's another issue and is somewhere tracked :) but I lost the link.
The zoomable plot you linked to is a vega plot; vega supports interactive geographic scales, but vega-lite does not, so there's no way to make the Altair API create zoomable geographic visualizations. If that is ever supported by vega-lite, then we can think about details of what the Altair API might look like.
Regarding the empty plot: we're working on a solution that will display javascript errors in the notebook in cases like this. See #512 and #666.
This will available in Altair after https://github.com/vega/vega-lite/issues/3306 is merged, so closing this as there is nothing to do on the Altair side of things.
Chart(...).mark_geoshape(...)...interactive()
generates invalid json that couldn't be shown.Vega Editor shows error
on this generated json