[IPython-dev] Interactive SVG is not interactive in a notebook

Matthias BUSSONNIER bussonniermatthias at gmail.com
Sat Jun 8 11:15:15 EDT 2013


Hi Ben,

I was able to have it work (at least tooltip showing some text), with the help of jQuery ,  with the following.


    function ShowTooltip(evt, mouseovertext)
    {
        console.log(mouseovertext, tooltip_bg)
        $(tooltip).text(mouseovertext);
        $(tooltip).attr('visibility','visible');
        length = tooltip.getComputedTextLength();
        $(tooltip_bg).attr('width',length+10);
        $(tooltip_bg).attr('visibility','visible');
    }


the script tag in the sag is not visible while inspecting the dom, but It is definitively saved in the notebook. 
My guess is that firefox/chrome…etc are stripping JS. 

Hope it will help you to start achieving what you want. 
-- 
Matthias


Le 8 juin 2013 à 16:20, Benjamin Root a écrit :

> 
> On Mon, Jun 3, 2013 at 10:58 AM, Matthias BUSSONNIER <bussonniermatthias at gmail.com> wrote:
> 
> Le 3 juin 2013 à 15:31, Benjamin Root a écrit :
> 
>> 
>> On Mon, Jun 3, 2013 at 2:58 AM, Matthias BUSSONNIER <bussonniermatthias at gmail.com> wrote:
>> Hi ben,
>> Le 3 juin 2013 à 00:43, Benjamin Root a écrit :
>> 
>> > Digging further, I see that the xml data is making it to the browser, but the javascript embedded within the svg file is completely stripped out.  Is that on purpose?  Is there a way I can override that behavior?
>> 
>> No we don't strip js out of XML by intent (yet). Have you try to use HTML that itself contain a script tag, and an svg  tag with an ID so that you can refer to it ?
>> 
>> Well, something is stripping it out, between the call to IPython.display.SVG() and what Firefox tells me it sees.  Since I need this to work for the tutorial, I am just going to have to assume that this is a bug somewhere and go for the embedded HTML approach that you suggest, since most of those at the tutorial would have this bug.
> 
> Could it be linked to 
> https://github.com/ipython/ipython/issues/1866 ?
> 
> Can you share an ipynb so that I can take a look ? 
> 
> Sorry for the delay... hurricane season has started.  Anyway, I attached an ipynb and the svg for your perusal.  That notebook also has an attempt at adding the javascript separately, but I think I am doing it wrong.  I am not a web dev, so this is all very new to me.
> 
> Thanks!
> Ben Root
> <SVG test.ipynb><plot_demo.svg>_______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20130608/6da2f482/attachment.html>


More information about the IPython-dev mailing list