It’s sometimes useful to plot a cumulative values s.t. when you zoom in the cumulation starts at 0 again. For instance plotting a cumulative timeseries then zooming in on a particular year would restart the cumulation from the beginning of the year. I’m guessing one could write a little javascript that does the cumulation and trigger it when the x range changes.
Does anyone have any advice for what the right way to do this is or have any examples of something similar.
I don't know if you'd had any success. Depending on your use case, this
sounds like something that it would be easiest to express using the new
bokeh server.
You would just write some python code that updated your data source when
the range changes. Check out the examples directory for some ideas maybe?
Sincerely,
Sarah Bird
···
On 1/3/16 10:00 AM, Tom wrote:
It's sometimes useful to plot a cumulative values s.t. when you zoom in
the cumulation starts at 0 again. For instance plotting a cumulative
timeseries then zooming in on a particular year would restart the
cumulation from the beginning of the year. I'm guessing one could
write a little javascript that does the cumulation and trigger it when
the x range changes.
Does anyone have any advice for what the right way to do this is or have
any examples of something similar.
Thanks for your answer. I was thinking that a client side solution might be more appropriate in this case because you want really good responsiveness. Does that make sense?
–Tom
···
On Thursday, January 14, 2016 at 1:47:34 AM UTC-5, Sarah Bird wrote:
Hi Tom,
I don’t know if you’d had any success. Depending on your use case, this
sounds like something that it would be easiest to express using the new
bokeh server.
You would just write some python code that updated your data source when
the range changes. Check out the examples directory for some ideas maybe?
Sincerely,
Sarah Bird
On 1/3/16 10:00 AM, Tom wrote:
It’s sometimes useful to plot a cumulative values s.t. when you zoom in
the cumulation starts at 0 again. For instance plotting a cumulative
timeseries then zooming in on a particular year would restart the
cumulation from the beginning of the year. I’m guessing one could
write a little javascript that does the cumulation and trigger it when
the x range changes.
Does anyone have any advice for what the right way to do this is or have
any examples of something similar.
–Tom
–
You received this message because you are subscribed to the Google
Groups “Bokeh Discussion - Public” group.
To unsubscribe from this group and stop receiving emails from it, send
Seems quite good? It is doing a several histogram re-binnings on every selection, which I would imagine is more intensive than a simple cumulation.
That said, this could also be accomplished using a CustomJS callback on a plot's x_range, but it might require some cleverness. For instance, you would need to have all the data sent to the client and available. But that's not actually what you want to plot. We would like to add the notion "namespace variables" on a document, and that might be good for this, but that does not exist yet. So in the mean time, you could make a ColumnDataSource with all the data, attach that to an invisible glyph that doesn't actually get rendered, and then use that full data set to derive the summarized data for a glyph that does get rendered, in the callback.
Thanks for your answer. I was thinking that a client side solution might be more appropriate in this case because you want really good responsiveness. Does that make sense?
--Tom
On Thursday, January 14, 2016 at 1:47:34 AM UTC-5, Sarah Bird wrote:
Hi Tom,
I don't know if you'd had any success. Depending on your use case, this
sounds like something that it would be easiest to express using the new
bokeh server.
You would just write some python code that updated your data source when
the range changes. Check out the examples directory for some ideas maybe?
It would totally be possible, but given that someone can select an
arbitrary range, you will need to do the computation yourself and write
that in JS. Assuming the JS isn't a problem for you, it should still be
straight forward:
- get the range
- compute the new cumulative data
- set the data source with this new data
See CustomJS for RangeUpdate and the other CustomJS examples in the User
Guide for inspiration:
Seems quite good? It is doing a several histogram re-binnings on every selection, which I would imagine is more intensive than a simple cumulation.
That said, this could also be accomplished using a CustomJS callback on a plot's x_range, but it might require some cleverness. For instance, you would need to have all the data sent to the client and available. But that's not actually what you want to plot. We would like to add the notion "namespace variables" on a document, and that might be good for this, but that does not exist yet. So in the mean time, you could make a ColumnDataSource with all the data, attach that to an invisible glyph that doesn't actually get rendered, and then use that full data set to derive the summarized data for a glyph that does get rendered, in the callback.
Thanks for your answer. I was thinking that a client side solution might be more appropriate in this case because you want really good responsiveness. Does that make sense?
--Tom
On Thursday, January 14, 2016 at 1:47:34 AM UTC-5, Sarah Bird wrote:
Hi Tom,
I don't know if you'd had any success. Depending on your use case, this
sounds like something that it would be easiest to express using the new
bokeh server.
You would just write some python code that updated your data source when
the range changes. Check out the examples directory for some ideas maybe?
Sincerely,
Sarah Bird
On 1/3/16 10:00 AM, Tom wrote:
It's sometimes useful to plot a cumulative values s.t. when you zoom in
the cumulation starts at 0 again. For instance plotting a cumulative
timeseries then zooming in on a particular year would restart the
cumulation from the beginning of the year. I'm guessing one could
write a little javascript that does the cumulation and trigger it when
the x range changes.
Does anyone have any advice for what the right way to do this is or have
any examples of something similar.