Is it possible to use javascript to fill histograms from linked scatterplots?

I’ve seen nice examples for linking a filled scatterplot to an empty one + datatable, filling the latter upon selection of the filled scatterplot. That was done with javascript.

What I’d like to do is histogram those selected points. When I make histograms, I use the example of using numpy.histogram and then feed a vbar. That requires a server app to go back to python.

Is there a way to fill a histogram from JavaScript, and hence be standalone?



It’s certainly possible, but you would have to do all the binning yourself. I am not personally aware of JS code I can point you at. If you know the bins you want up front, things will be much simpler (you can define the vbar plot up front, and binning is only a matter of looping of the data and incrementing the corresponding bin count). If you need dynamic bins, that’s going to be fairly more involved.

Thanks, Bryan. I can ask around of some of my colleagues if they’re aware of any binning code. They do a lot of data display in a different framework. Good question on the dynamic binning.

I was “afraid” the answer would be it’s on me. :wink:

That said, the linked plots example I saw may provide enough enthusiasm for me to add to my server app for a telescope project to select focal plane pixels and histogram values for those pixels. Something to add to the shelter in place todo list.


To close the loop - doing the binning in JS was pretty easy after all, and works great. Pretty cool :slight_smile:

Thanks again for the tip!


1 Like