Thanks a lot for the suggestion.
Not only 2 tabs… many (and actually several figures).
So, maybe we should worry on the rendering speed if so many glyphs are attached to the plots, when most of them ending up being inactive (visible=false) (as they belong to different tabs) ??? (but at least no more need to sync the bulk of data, besides the visible attribute). Not sure then.
Just to give an order of mag, 10 tabs with 5 figures with ~5 curves each. And about 1000 points per curve. I.e. ~50 glyphs of 1000 points per figure.
Maybe that is not that much data after all.
It looks also a bit quite poor from our software design point of view, but that is manageable, if this is the way to go (the user can interactively add/remove an arbitrary number of curves from arbitrary observables. Curves can represent the same observable from different datasets (the different tabs)).
On Monday, November 13, 2017 at 6:46:25 PM UTC+1, Eugene Pakhomov wrote:
Regarding the first case, you can just add two glyphs and switch “visible” property: https://bokeh.pydata.org/en/latest/docs/user_guide/styling.html#visible-property
No need to juggle data sources.
Regarding the second case, it depends on what you mean by “tabs”. If it’s just a set of buttons that switch between different sources for the same plot, they can just toggle “visible” property of the corresponding glyphs.
On Tuesday, November 14, 2017 at 12:12:30 AM UTC+7, chupach wrote:
Thx Sébastien & Eugene for all the insights and for the snippet. These are useful.
i have rather large datasources which, once defined, will let’s say not often change (naturally synced).
My two cases:
- A source attached to a plot. The user changing tab means pointing to a different cds, the plot object remains the same.
We don’t want to update the cds with the full sync client-server machinery, but rather the cds to point to a different cds already in the js side.
For comfort/speed of use, avoid copying/syncing, everything already ready for use in the browser.
- A js callback use one of the cds (which corresponds to a given “tab”). Of course one can pass all the cds to the callback and have the js callback decide which one to use (and that may be what i will end up doing). I prefer to have a master cds pointing to one of them (irrelevant in the python side). —> Back to case 1.
On Monday, November 13, 2017 at 3:33:34 PM UTC+1, Eugene Pakhomov wrote:
That’s exactly my point.
I may be wrong, but I have the impression that chupach needs data synchronization.
On Monday, November 13, 2017 at 9:31:05 PM UTC+7, Sébastien Roche wrote:
They won’t “sync” because they only end up in the JS side. And it’s not actual python dictionaries, it’s just a string of JS code that gets written in one of the scripts of the templates folder. So the initial data can be generated in the python code before the page is made, but then it can only be modified accessed in customJS callbacks. I put a link to a small app that shows it.
Le lundi 13 novembre 2017 09:03:59 UTC-5, Eugene Pakhomov a écrit :
Regarding nested dictionaries - the won’t sync by themselves, will they?