How can I get the HTML canvas in JS from a plot id?
Before version 0.12.6 I could do $(’#modelid_’+plot_id), but that got changed/removed with the latest release.
Background:
I want to add link anchors to certain plots (but not all of them) for navigation, and I currently use this: I pass the plot id’s via jinja template arguments to JS, and use the following JS code after the plots are initialized:
I have a vague recollection that the div id's are now just bare UUID's but I am not certain of that, so I have asked another core dev to comment on this thread when they can.
How can I get the HTML canvas in JS from a plot id?
Before version 0.12.6 I could do $('#modelid_'+plot_id), but that got changed/removed with the latest release.
Background:
I want to add link anchors to certain plots (but not all of them) for navigation, and I currently use this: I pass the plot id's via jinja template arguments to JS, and use the following JS code after the plots are initialized:
How can I get the HTML canvas in JS from a plot id?
Before version 0.12.6 I could do $(‘#modelid_’+plot_id), but that got changed/removed with the latest release.
Background:
I want to add link anchors to certain plots (but not all of them) for navigation, and I currently use this: I pass the plot id’s via jinja template arguments to JS, and use the following JS code after the plots are initialized:
the best solution would be to use an annotation for this purpose. Unfortunately we don’t have a link or generic HTML annotations at this point, just text label. This was supposed to be added to replace custom code we use for attributions. Previously there were model IDs assigned to DOM nodes, but that was intended mostly for testing purpose, and didn’t result best quality tests, so was removed. In my view, though we don’t have agreement on this yet, generated DOM nodes are private to bokehjs and thus shouldn’t be modified directly, unless there is really no other way to proceed. For now you can use the following:
function foreach_plot_view(view, fn) {
if (view.model instanceof Bokeh.Models(“Plot”)) {
fn(view);
} else if (view.model instanceof Bokeh.Models(“LayoutDOM”)) {
for (var id in view.child_views) {
foreach_plot_view(view.child_views[id], fn);
}
}
}
var root = Object.keys(Bokeh.index)[0] // if you have only one root
How can I get the HTML canvas in JS from a plot id?
Before version 0.12.6 I could do $(‘#modelid_’+plot_id), but that got changed/removed with the latest release.
Background:
I want to add link anchors to certain plots (but not all of them) for navigation, and I currently use this: I pass the plot id’s via jinja template arguments to JS, and use the following JS code after the plots are initialized:
the best solution would be to use an annotation for this purpose. Unfortunately we don’t have a link or generic HTML annotations at this point, just text label. This was supposed to be added to replace custom code we use for attributions. Previously there were model IDs assigned to DOM nodes, but that was intended mostly for testing purpose, and didn’t result best quality tests, so was removed. In my view, though we don’t have agreement on this yet, generated DOM nodes are private to bokehjs and thus shouldn’t be modified directly, unless there is really no other way to proceed. For now you can use the following:
function foreach_plot_view(view, fn) {
if (view.model instanceof Bokeh.Models(“Plot”)) {
fn(view);
} else if (view.model instanceof Bokeh.Models(“LayoutDOM”)) {
for (var id in view.child_views) {
foreach_plot_view(view.child_views[id], fn);
}
}
}
var root = Object.keys(Bokeh.index)[0] // if you have only one root
How can I get the HTML canvas in JS from a plot id?
Before version 0.12.6 I could do $(‘#modelid_’+plot_id), but that got changed/removed with the latest release.
Background:
I want to add link anchors to certain plots (but not all of them) for navigation, and I currently use this: I pass the plot id’s via jinja template arguments to JS, and use the following JS code after the plots are initialized:
the best solution would be to use an annotation for this purpose. Unfortunately we don’t have a link or generic HTML annotations at this point, just text label. This was supposed to be added to replace custom code we use for attributions. Previously there were model IDs assigned to DOM nodes, but that was intended mostly for testing purpose, and didn’t result best quality tests, so was removed. In my view, though we don’t have agreement on this yet, generated DOM nodes are private to bokehjs and thus shouldn’t be modified directly, unless there is really no other way to proceed. For now you can use the following:
function foreach_plot_view(view, fn) {
if (view.model instanceof Bokeh.Models(“Plot”)) {
fn(view);
} else if (view.model instanceof Bokeh.Models(“LayoutDOM”)) {
for (var id in view.child_views) {
foreach_plot_view(view.child_views[id], fn);
}
}
}
var root = Object.keys(Bokeh.index)[0] // if you have only one root