Bokeh diagram in html code example
Example: embed Bokeh components to HTML
def _metrics_script_divs(report, metrics):
cds = figures.construct_metrics_cds(metrics, 'total', index='forecast',
rename=figures.abbreviate)
data_table = figures.metrics_table(cds)
figures_bar = []
for num, metric in enumerate(report.metrics):
fig = figures.bar(cds, metric)
figures_bar.append(fig)
script, (data_table_div, *figures_bar_divs) = components((data_table,
*figures_bar))
script_metrics = script
figures_dict = dict(total=figures_bar_divs)
for category in report.categories:
if category == 'total':
continue
script_cat, figures_bar_cat = _loop_over_metrics(report, metrics,
category)
script_metrics += script_cat
figures_dict[category] = figures_bar_cat
return script_metrics, data_table_div, figures_dict