Drawing figures on callback

Hello,

I’m creating a server app where I have multiple tabs with different statistical analyses. Each tab has a Panel(child=layout), where layout contains the layout elements of that given panel.

At the initial load of the app, only the first Panel of the app is processed, and the rest are simply instantiated with placeholders, e.g. row(column(button1,button2),plot)

As new tabs are activated, I then do a callback where I update the data of the new panel being loaded using e.g.

TabWidget.tabs[ panel_index ].child.children[1] = newPlot

``

That works somewhat when updating single plots; I can change between tabs, and the figures will update as intended.

However, if I try to update two plots, e.g. run

TabWidget.tabs[ panel_index ].child.children[1] = newPlot1

TabWidget.tabs[ panel_index ].child.children[2] = newPlot2

``

Then I get a RuntimeError(‘cannot apply patch to XXXXXXX which is not in the document’)

Pre-loading all the plots and updating datasources is sadly not an option for what I wish to do - at times I want to change the plot type etc. I guess I’m approaching this wrongly? I’ve noted that everytime I call an update of one plot, all other plots (in the current and other tabs) are corrupted.

Sorry this is ugly. Two problems:

  1. replacing children live is messy

                   2) Tabs are
    

currently messy.

So you’ve got a double whammy of messy…

Maybe try replac ing the whole
child object not just the children of
the child?

···

On 9/22/16 11:14 AM, Mathias Gruber
wrote:

Hello,

      I'm creating a server app where I have multiple tabs with

different statistical analyses. Each tab has a
Panel(child=layout), where layout contains the layout elements
of that given panel.

      At the initial load of the app, only the first Panel of the

app is processed, and the rest are simply instantiated with
placeholders, e.g. row(column(button1,button2),plot)

      As new tabs are activated, I then do a callback where I

update the data of the new panel being loaded using e.g.

TabWidget.tabs[
panel_index ].child.children[1] =
newPlot

``

      That works somewhat when updating single plots; I can

change between tabs, and the figures will update as intended.

However, if I try to update two plots, e.g. run

          TabWidget.tabs[
            panel_index ].child.children[1] =
            newPlot1



          TabWidget.tabs[
            panel_index ].child.children[2] =
            newPlot2

``

      Then I get a RuntimeError('cannot apply patch to XXXXXXX

which is not in the document’)

      Pre-loading all the plots and updating datasources is sadly

not an option for what I wish to do - at times I want to
change the plot type etc. I guess I’m approaching this
wrongly? I’ve noted that everytime I call an update of one
plot, all other plots (in the current and other tabs) are
corrupted.

  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/026e8199-21f4-4e70-9519-b469dd8a7946%40continuum.io](https://groups.google.com/a/continuum.io/d/msgid/bokeh/026e8199-21f4-4e70-9519-b469dd8a7946%40continuum.io?utm_medium=email&utm_source=footer).

  For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout).


Sarah Bird
Developer, Bokeh

    [
      ![Continuum Analytics](http://docs.continuum.io/_static/img/ContinuumWordmark.png)
    ](http://continuum.io)