wrobstory / vincent

A Python to Vega translator
MIT License
2.04k stars 227 forks source link

Using vincent in folium popup, ipython notebook #109

Closed birdage closed 10 years ago

birdage commented 10 years ago

im using folium in an ipython notebook for a map, and i im trying to get vincent to work and create a plot as a popup. I followed the instruction of adding the json file to static/custom so it can be served by the notebook instance, but im now getting an exception on the object. it looks like its trying to get at an object of the same name? it appears as this is something that should be easy to do, am i missing something?

Uncaught SyntaxError: Failed to execute 'querySelector' on 'Document': '#static/custom/bar' is not a valid selector.

birdage commented 10 years ago

seems i missed something very important when looking at the folium implementation on the following link it does state that to use json data, you have to use an embeded map not an inline one.

def inline_map(map):
    """
    Embeds the HTML source of the map directly into the IPython notebook.

    This method will not work if the map depends on any files (json data). Also this uses
    the HTML5 srcdoc attribute, which may not be supported in all browsers.
    """
def embed_map(map, path="map.html"):
    """
    Embeds a linked iframe to the map into the IPython notebook.

    Note: this method will not capture the source of the map into the notebook.
    This method should work for all maps (as long as they use relative urls).
    """