[IPython-dev] Seeing javascript visualization from nbviewer?

Doug Blank doug.blank at gmail.com
Tue Apr 8 06:41:30 EDT 2014


On Fri, Mar 14, 2014 at 11:33 AM, Brian Granger <ellisonbg at gmail.com> wrote:
> I should note that nbviewer 2.0 is not yet deployed - should be in the
> next few days. These things don't currently work on the nbviewer that
> is deployed today.

Is nbviewer 2.0 deployed now? Should I expect to see Javascript output
in nbviewer?

This notebook has javascript output as you can see:

https://bitbucket.org/ipre/calico/raw/master/notebooks/Python/Travelling%20Salesperson.ipynb

But isn't rendered:

http://nbviewer.ipython.org/urls/bitbucket.org/ipre/calico/raw/master/notebooks/Python/Travelling%20Salesperson.ipynb

-Doug

> On Fri, Mar 14, 2014 at 8:32 AM, Brian Granger <ellisonbg at gmail.com> wrote:
>> If the library is aware of require.js, you should use that. But the
>> calling syntax for require is similar to `getScript` is similar - the
>> second argument is a function that gets called when the libraries are
>> loaded. These days, many JavaScript libraries have to be loaded with
>> require.js in the notebook. With IPython 2.0, all different ways
>> should work fine on nbviewer/nbconvert though.
>>
>> On Fri, Mar 14, 2014 at 5:45 AM, Doug Blank <doug.blank at gmail.com> wrote:
>>> 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
>>> _______________________________________________
>>> IPython-dev mailing list
>>> IPython-dev at scipy.org
>>> http://mail.scipy.org/mailman/listinfo/ipython-dev
>>
>>
>>
>> --
>> Brian E. Granger
>> Cal Poly State University, San Luis Obispo
>> bgranger at calpoly.edu and ellisonbg at gmail.com
>
>
>
> --
> Brian E. Granger
> Cal Poly State University, San Luis Obispo
> bgranger at calpoly.edu and ellisonbg at gmail.com
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev



More information about the IPython-dev mailing list