How to put two figure in one TabPanel in Bokeh

27 views Asked by At

I have 2 figures

First for graph

graph = figure(
 x_range=Range1d(data.first().created, data.last().created),
 x_axis_type='datetime',
 y_range=Range1d(1, 1000),
)

and second for RangeTool

# Range Graph
range_figure = figure(
   x_axis_type='datetime',
   y_axis_type=None,
   tools='',
   toolbar_location=None,
   height=50,
   background_fill_color='#ffffff',
)
range_tool = RangeTool(x_range=composite_graph.x_range)
range_tool.overlay.fill_color = 'navy'
range_tool.overlay.fill_alpha = 0.2
            
range_figure.line(
  x=[reading.created for reading in readings],
  y=[reading.reading['ORP'] for reading in readings]
)
range_figure.xaxis.visible = False
range_figure.add_tools(range_tool)

I try to put them on TabPanel like children

...
TabPanel(
    title='Graph',
    child=layout(
    children=[
     column(
       children=[header_div],
       sizing_mode='stretch_width'
     ),
     graph,
     range_figure
    ],
  sizing_mode='stretch_width'
  ),
),
...

Everything is created perfectly, but after I try to embed it in React I have an error: models must be owned by only a single document Error shows only during rerender of the component only after 2-nd render.

When for e.i I remove one of the figures everything is working.

0

There are 0 answers