Here are a couple code sample demonstrating this. Both will run in a notebook.
Multiple filters, send the filtered data somewhere:
Neither example deals with editable data in the data table.
Hope this helps. If there are other (simpler) ways to do this let me know.
On Tue, Feb 16, 2016 at 1:26 AM Dennis O’Brien [email protected] wrote:
I don’t have an example I can share at the moment (it was for a work project) but I have done what you are mentioning using CustomJS. The basic gist is this:
- In your CustomJS callback, pass two datasource objects, one for the original and one for the filtered. The original is not touched, the filtered is rebuilt in the filtering process. The filtered data source is also the source used by your chart.
- Get the values of the widgets you will use for filtering.
- If your data is editable (e.g., a DataTable with editable columns) you will update your “original source” with the edited values before the next filter stage.
- Iterate through each key of the original data source. For each item in original_data[key], if it passes the filter criteria, add it to filtered_data[key]. (The iteration could be sped up by something like crossfilter, but in my case with about 10k rows and 20 columns, performance was fine.)
- Trigger changes.
There is just one generic CustomJS object which is attached to all the filtering widgets.
There is a similar process as above when you want to save the results of your filtered data.
I’ll try to get an example to share. In the meantime, I hope this is helpful.
On Mon, Feb 15, 2016 at 8:35 PM [email protected] wrote:
I’m creating a very simple dashboard using bokeh and flask right now, and it needs to have basic filtering functionality (think two multiselect widgets with customer state, type, and a textinput with a product partial string).
I’d like for the widgets to subset a dataframe I’ve loaded in when they are modified, without using bokeh-server. Can it be done using just CustomJS callbacks which I believe are the alternative? Can anyone find an example of this using these?
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/931d5016-a4a6-4414-be0c-fca75e8c0837%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.