Hi Marcel,
Responses inline
Hi, I am writing a web application and I am looking for some plotting tool that is interactive (selecting points, callbacks to server...) and can handle large data, so I am trying Bokeh.
Downsampling.
I will be working with multiple timeseries. Each of them can have around 1 point per second, thus this is 24*60*60=86400 points /day. This is 31M points per year. Thus downsampling in python before sending the data to the client is essential for me. At the same time users should be able to zoom and receive more detailed data. Is it possible to handle such downsampling e.g. using callback functions? Can you give me a hint how to start?
I hope to have an actual example to point people to very soon. It's on my list, but there are many many things on the list and only so many hours in a day.
That said I can give you some general direction. The first it to look over the examples here:
https://github.com/bokeh/bokeh/blob/master/examples/app
And in particular, maybe the simple exmaple
https://github.com/bokeh/bokeh/blob/master/examples/app/sliders.py
The thing to notice is that any changes you make to a Bokeh model (e.g., updating the .data on a ColumnDataSource) are automatically and transparently mirrored to the browser, which updates. The converse is also true. So putting those two things together, the general outline would be:
* add an .on_change callback a range(s) on the plot.
* that callback computes the downsampled data however you want
* then updates the .data on the data sources
* which updates the plot
Embedding
Is it possible to embed a bokeh plot into website and have the data be transferred e.g. using websocket from bokeh server for such plot? I might have 2GB of timeseries data on HDD of server or in HDFS and I want user to be able to view parts of data. E.g. when fully zoomed out to view a downsampled version of timeseries. When embedding js+divs generated by script, div = components(plots) I understand that the data for the plot is embedded within the script. Can this be avoided? Generally I am interested in a combination of embedded plots + dynamic loading of data.
Yes, certainly. Configure the initial plot data to have just whatever subset is appropriate to the resolution you want to display initially, and then you can update the data dynamically in the manner described above.
Bokeh server
I am having a hard time understanding a role of bokeh server. E.g. when I plot points in python and use output_server("name"), is the data for the plot transferred to bokeh server via network? Is the data transfered to bokeh server as json or binary or is bokeh server using the same in-memory data as I worked with in python script before constructing the plot? What if I want to change the data or e.g. colors of the points in reaction to user actions or asynchroneously when I measure new data points for my timeseries? Can I just add new rows into my Pandas DataFrame and issue some kind of update to server?
"output_server" is very limited, and I will suggest for your use case, you will really want to create an "app" for the server. There is a larger discussion of use-cases for the server and ways to use it here:
Bokeh server — Bokeh 3.3.2 Documentation
Please let me know what questions you have after looking at that, so that I may update the docs with more or different explanations.
Currently all data is converted to a JSON format before being sent over a websocket wire protocol. The protocol has been designed with the ability to send multi-part messages and binary frames in mind, but this capability has not been used yet.
Binary data transfer
I have seen a proposal on github regarding binary transfer of data (Issues · bokeh/bokeh · GitHub). I think it is not implemented yet, is it possible to hack this in e.g. using callbacks? E.g. on zoom get the data from my python API where I will downsample and provide data in binary format from Pandas/numpy and use them as typed array in JS? Constucting JSONs in python can take a lot of time.
As you mention, the binary transfer for arrays is not yet implemented. I don't see an easy way to "hack" this. Given that any disturbance in a webscket protocol is gong to be difficult or impossible to recover from, we have not easily exposed direct access to the websocket connection to users.
Thanks,
Bryan
···
On Jan 13, 2016, at 6:37 AM, Marcel Német <[email protected]> wrote:
Thank you for any help
--
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 an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/64890475-d18d-417c-9801-20cb7ce60028%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.