folium icon indicating copy to clipboard operation
folium copied to clipboard

Multiple Vincent/Vega charts in a popup?

Open robroc opened this issue 5 years ago • 3 comments

I'm trying to add two Vincent bar charts in a popup using Vega, one on top of the other. The two methods below are not working:


# Adding both charts to add_child: This only renders the first chart
m.add_child( folium.CircleMarker(
        location = [df['latitude'], df['longitude']],
        popup = folium.Popup(max_width = 450).add_child(chart1, chart2)
  ))

# Method-chaining: This only renders the second chart
m.add_child( folium.CircleMarker(
        location = [df['latitude'], df['longitude']],
        popup = folium.Popup(max_width = 450).add_child(chart1, name = 'c1').add_child(chart2, name = 'c2')
    ) )

Is there a way to accomplish this?

robroc avatar Jan 09 '20 19:01 robroc

I am also interested - @robroc Did you come up with a solution in the meanwhile?

dsunjka avatar Dec 03 '20 09:12 dsunjka

@dsunjka I was never able to solve this. I ended up using a different chart type that encodes the data from two charts in one.

robroc avatar Dec 03 '20 16:12 robroc

The underlying issue that you currently can't add multiple children to a popup, only the last one added will be used. It would be good if we either fix that, or not make it fail silently.

Same question as https://github.com/python-visualization/folium/issues/1387

Conengmo avatar Nov 29 '22 12:11 Conengmo