How can I embed a new Bokeh model/root into an existing Bokeh document using BokehJS, but render it inside a specific target div element on my HTML page?
How can I achieve this using BokehJS? Any code examples or pointers would be greatly appreciated.
// Selecting existing ajaxdatasource , model, doc
var existing_model=Bokeh.index['EURUSD M1'].model;
var existing_ajax_source = exsisting_model.select(name="price_bullet")[0].data_source
var existing_doc = Bokeh.documents[0];
// Creating a new model
new_model = Bokeh.Plotting.figure({
title: 'Example of random data',
tools: "pan,wheel_zoom,box_zoom,reset,save",
sizing_mode:'stretch_both',
x_axis_type:"datetime",
'x_range': existing_model.x_range,
'y_range': existing_model.y_range,
});
// Defining glyph
const line = new Bokeh.Line({
x: { field: "time" },
y: { field: "close" },
line_color: "blue",
line_width: 2
});
new_model.add_glyph(line, existing_ajax_source);
//Adding a new grid with a target div inside
grid.addWidget({
w: 6,
h: 3,
content:`
<div style=border: 2px solid transparent;border-radius: 10px, background-color: #f1f1f1;' class='grid-stack-item-content'>
<div id='newdiv' data-root-id='newdiv' style='display: contents;'></div>
</div>`,
});
var newDiv = document.getElementById('newdiv');
// ?? how can i embed new model to existing_doc and target div "newDiv" ?