[IPython-dev] Seeing javascript visualization from nbviewer?

Doug Blank doug.blank at gmail.com
Fri Mar 14 08:45:59 EDT 2014


I think the problem was with my implementation of Javascript(..,
lib=...). I see that the lib is used like this in the Python kernel:

$.getScript("https://www.google.com/jsapi", function () {
   [code]
}

whereas I had:

require["https://www.google.com/jsapi"];
[code];

Which did work, but only when running the cells.

Is putting Javascript(lib="") the best method for including external
Javascript libraries that are used often/many times? Or is there
something I should add to custom.js that would load it at the right
time?

-Doug

On Fri, Mar 14, 2014 at 2:01 AM, Doug Blank <doug.blank at gmail.com> wrote:
> I am working on migrating a Google visualization example [1] by
> victor_zverovich to a simpler version shown here:
>
> http://nbviewer.ipython.org/urls/bitbucket.org/ipre/calico/raw/master/notebooks/GeoChart.ipynb
>
> (users using the regular IPython Python kernel can just change
> calico.Javascript to Javascript and import it from IPython.display)
>
> What do I need to do be able to have the GeoChart render in nbviewer?
> Is that possible? Currently I get the same error I get before I
> execute the cells when I first open the notebook:
>
> """
> Javascript error adding output!
> ReferenceError: google is not defined
> """
>
> Any insight appreciated!
>
> -Doug
>
>
> [1] - http://zverovich.net/2013/06/27/visualizing-geographical-ampl-data-using-ipython-and-google-charts.html



More information about the IPython-dev mailing list