Restrict the number of rows displayed in DataTable on Bokeh Server - python

I have a Bokeh application, accessed through the command prompt using bokeh serve --show my_app.
On one of the tabs, there is a DataTable widget displaying millions of rows, which makes the page choppy and unresponsive.
Is there any way to restrict the number of rows that are displayed in a DataTable without explicitly restricting the data source behind it? It's important that the user is able to sort the DataTable and see the extremities of the full dataset.

The Bokeh CDSView is probably what you are after (see Filtering Data section)

Related

Are dashboards/maps created with Python's Bokeh and Folium modules secured? Is the data uploaded to any external server?

The work I do requires some level of security so that only intended parties have access to the data that would be displayed in the dashboards/maps. I just want to make sure Bokeh and Folium are secured choices. So are the HTML files containing the Bokeh dashboards and Folium maps self-contained?
I assume you are speaking about standalone Bokeh content, e.g. created with output_file and show or embedded in web pages with components or json_items, and not speaking about Bokeh server applications.
In that case, all data for the Bokeh data sources, etc. resides purely in the HTML page that is loaded by the browser. Depending on how you configure BokehJS resources, the page may load the BokehJS runtime externally from the Bokeh CDN at cdn.bokeh.org. This is the default configuration. If you prefer, it is possible to create completely self-contained HTML that includes the BokehJS scripts directly in the page. One way to do that is to specify the environment variable BOKEH_RESOURCES=inline.
It should probably go without saying that whatever Python process of yours generates the Bokeh content also necessarily has access to the data, but securing that would be your responsibility. Also, of course, limiting the distribution or access to the resulting generated HTML is also your responsibility.
Folium is a completely separate question that can't comment on. Presumably it will always need to call out to some remote service to load the map tiles, at least.

multi-select dropdown Bokeh

I know that there are a bunch of widgets available in Bokeh, here:
https://docs.bokeh.org/en/latest/docs/user_guide/interaction/widgets.html
How can I integrate Bokeh Dropdown Menu with MultiSelect (or extend the Dropdown) in order to have a Multi-Select Dropdown? Is there anything built-in?
My expected result is a dropdown which one can select/deselect multiple options.
You can write you own custom Bokeh model extension using TypeScript. See Extending Bokeh for more information. Scroll down for links to some nice examples. You will need to install nodejs on your system to be able to compile TypeScript.
If the widget height is your main consideration than you could think of replacing the MultiSelect with CheckboxButtonGroup.

Real time charting with Plotly and Flask?

I need to add a real-time chart to my Flask-SocketIO app, for that i found Plotly.
Would it be possible with Plotly to generate a chart which shows both real-time data and past data? When the user opens the page he should be able to see both the data from before the webpage was opened and the new data. How would it be possible to accomplish that with Plotly? Is there an example for it?
For this kind of apps it's highly recommended to feed your real time data to a database and connect your visualization with said database, however I think it is possible to achieve what you want in jupyter notebook with plotly 3 FigureWidget's batch_update. I can't quite get the idea of what you want without some code though.

Hosting interactive Bokeh plots independent of the Bokeh server

I have created a Bokeh Document that currently hosts two plots. The first employs two widgets that control a barchart while the other is a standalone choropleth map. Using the Bokeh server, the plots are completely interactive and dropdown and button widgets are able to dynamically update the source data and sort barchart respectively, but I am trying to share this Document with colleagues that simply want to visualize these data in the same fashion on a web page independent of the Bokeh server.
Is this possible?
Thanks in advance!

How to draw an html table using bokeh?

I am new to bokeh, I search for examples in the documentation but it appears to me there is not in built method for creating tables. I have some data that I want to show in tabular format. I was wondering what is the easiest way to do that using Bokeh?
The reason I want to draw tables using Bokeh is because I am trying to put a table and two bar charts in the same html report. I was hoping to use one library(Bokeh) to do all my drawing because otherwise I will have to generate table using html generator and then add the html for bar chart generated via Bokeh to that. Hope that explains.
There's no built-in support to create an HTML table as of Bokeh 0.9.1, however it is very simple to embed Bokeh plots and widgets inside your own custom HTML templates. For instance, the new spectrogram shows a very customized HTML document with Bokeh plots and widgets embedded:
https://www.youtube.com/watch?v=L6p7Cd3uDis
So, I would recommend taking this approach. The documentation for embedding is located here:
http://docs.bokeh.org/en/latest/docs/user_guide/embed.html

Categories