-
Notifications
You must be signed in to change notification settings - Fork 355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mpld3 + html elements + communication between javascript / notebook server #237
Conversation
…l communication between IPython server and Javascript code
Hi - this is really cool! I have a couple comments... give me a few minutes... |
I just did a small PR to your branch with a couple changes to the notebook. This is an awesome example: I'd been thinking about how to do something like this! Eventually it would be great to do something like this using the IPython widget framework, but for now I think merging this example would be useful. Could you add a couple words at the top of the notebook explaining what it does? |
Also, another thought: I just realized that |
This is so cool! Thanks. Two questions (not necessarily for @ahojukka5 or needed to be resolved before merging): how does this differ from ipython widgets? why did the Travis CI build fail? |
Regarding the build failure: the error is I have no idea what that means, but I can't imagine it has any relation to the content of this PR. |
@aflaxman: I think the biggest difference between this approach and ipython widgets is that you can add all kind of html elements, not just buttons, sliders or checkboxes. In principle it should be possible to create a complex user interface around mpld3 canvas that looks good and plays nicely inside notebook. I might give a more complete example of that if I have some spare time on next weekend. |
Got it, very cool! A demo that includes a custom UI element outside of the IPython widget scope would be a great demonstration, and I have just the Bayesian stats problem to use it on. I'll see if I can cobble it together in my copious spare time. |
I updated the example a bit. Added some descriptions what's happening and added another example which uses Backbone to get some structure to Javascript side. The second example is quite long but it describes better what was on my mind. Here we have all kind of input elements what we can use to control the visualisation of data. |
Very cool! There seems to be several not-implemented features of this demo. Are you planning to add those later, or are they meant as place-holders? |
That's a good question!
|
I think leaving the not implemented features is fine... we can just add a line or two to emphasize that they're "not implemented" on purpose. Also, I know it's in there once, but perhaps below each visualization remind the viewer that "this demo only works within a live notebook". If it's in the examples directory, a static version will automatically go onto the mpld3 webpage when I re-build it, and I don't want to cause people too much confusion. Thanks for all this work! |
@danielballan - I think that's a great idea. I'd love to see a demo like that. |
…not implemented on purpose, added warnings that this notebook uses backend to to calculations and therefore it must be downloaded in order to see any changes
I also noticed that it's somewhat hacky to fix some styles and add another div for toolbar in latter example. This is again something that "works for me" but definitely it's not a preferred way to go. I'm not proposing anything at the moment, but just saying that it should be easier to define some kind of layout around . |
Great! I'm pretty happy with this. @aflaxman – any other comments? If not then go ahead and merge. |
This is so amazing! @ahojukka5 thank you so much for putting this together. I think that it is good to merge, for sure. Some thoughts for this sort of thing going forward:
|
mpld3 + html elements + communication between javascript / notebook server
@aflaxman you may be interested in @damianavila's Scipy 2014 talk on live reveal.js slideshows with live IPython embedded. He shows it off using Bokeh plots but I AFAIK it would work perfectly well with mpld3. |
Sorry, forgot to incude the link to the talk: https://www.youtube.com/watch?v=sZBKruEh0jI |
I am interested! Thanks for sharing this, @bryevdv ! |
Added an example plugin how to combine html elements with two-directional communication between IPython server and Javascript code. This demonstrates clearly how to add your own html widgets and use them to study e.g. how changing parameters affect to results. Probably there is a better way to access parent element of svg element...