Example Showing Interoperability with d3js #12808
Replies: 4 comments 10 replies
-
Thanks @gmerritt123, that is a really useful example. I've already learnt a lot from it about combining Bokeh with 3rd party libraries; something I would like to know more about but don't want to spend any time doing! I note in passing that d3-tricontour is a port of my matplotlib tricontour code and examples without any acknowledgement. This is understandable but disappointing nevertheless. I think there are two options here. You could just post it on discourse as it is, and the task is done. But a better approach would be for the Bokeh docs to be extended (the Advanced Usage section?) to include a new section on "BokehJS third-party integrations" or similar. This could be the first of a number of examples. If that is the preferred option, I would want to see separate examples of quad and tri grid contouring in this way, and eventually some non-d3 examples too. I'd also want to make the words used about this example more precise, e.g. your initial sentence "use d3 to do JS-side contouring" needs to explicitly state that this is tri grid contouring. There is a much bigger demand for quad than tri grid contouring, so an unqualified "contouring" on its own usually means quad grid. The timing of this is awkward happening just after we've added Python contouring, as some users might think that this is what we are talking about as the new functionality. When they discover that this isn't fully featured or is not geometrically robust then I'd expect we'd have to field questions that I do not wish to spend time answering as d3 is not my responsibility. But the approach of a new "BokehJS third-party integrations" section helps here as it makes the third-party aspect explicit. |
Beta Was this translation helpful? Give feedback.
-
Thanks @ianthomas23 I very much agree, and that is indeed very disappointing re lack of acknowledgement. From an optics/clarity perspective I should probably cook up something similar that avoids contours entirely, but stay focused on illustrating the key point (i.e. that bringing in a 3rd party library and using it to transform a CDS is quite powerful). I largely went to this tricontour example because a) it's a pretty simple setup, b) I already had the core JS functions on hand c) I had just used it for a day-job application (as seen in showcase), and d) JS-side contouring was recently asked about on discourse (I believe you responded). Some other ideas:
Thoughts/preferences/other ideas solicited please... thanks! |
Beta Was this translation helpful? Give feedback.
-
This is really tremendous! It almost makes me want to reconsider including d3 (optionally) in order to have a built-in voronoi capability :D But for now I agree with @ianthomas23 a new Edit: for 3.1 timeframe (soon) we could start by just adding the example and getting it in the gallery, and plan to author the section for the next release |
Beta Was this translation helpful? Give feedback.
-
Seeing this example, I started PR #12812, which allows to use |
Beta Was this translation helpful? Give feedback.
-
In response to @bryevdv 's request here, I've cooked up an example showing how you could use d3 to do JS-side contouring.
The idea was to take 100 random xy points to start, and map the equation from the bokeh contouring example to them, serving as a starting point.
Then add a PointDrawTool to move those points around, and a slider that controls the desired number of contour intervals.
The callback shows how:
Finally at the end the script shows a really basic function to build a template that allows embedding of additional CDN resources etc (Probably a better way to do this)
The output:
I dumped the code into a gist here .
I'm posting this in a discussion because I'd like to solicit feedback about it as an example (I know it's pretty rough), and get some opinions on how this example (or something along these lines) could be used to promote interoperability between d3 and bokeh (e.g. is this something to post in a section in the docs, or should I just post as a discourse showcase, etc. etc.).
G
Beta Was this translation helpful? Give feedback.
All reactions