bokehjs

Bokeh update map tooltip using select or slider

不打扰是莪最后的温柔 提交于 2021-01-29 13:01:07
问题 I am trying to update a worldmap tooltip using a slicer or dropdown select. I got following question which sorted the most of the stuff for a Bokeh Slider custom JS callback import pandas as pd import random from datetime import timedelta df = pd.DataFrame({'base' : ["2017-01-01" for t in range(10000)], 'Date' : [random.randint(0, 1035) for t in range(10000)], 'Sales' : [random.random() for t in range(10000)]}) df['base'] = pd.to_datetime(df['base']) df["Date2"] = df.apply(lambda x: x["base"]

How to import external javascript library into Bokeh generated html

一笑奈何 提交于 2020-05-27 06:23:08
问题 I would like to make use of a javascript library (specifically this one) in my Bokeh javascript callback. How can I specify importing of this javascript library such that the library is accessible from Bokeh's js callback functions? The examples at: https://docs.bokeh.org/en/latest/docs/user_guide/extensions.html mainly talk about creating a custom Bokeh Model. I am not particularly interested in creating a new Model, just want to use the library functions in a callback to modify the data

How to import external javascript library into Bokeh generated html

笑着哭i 提交于 2020-05-27 06:21:09
问题 I would like to make use of a javascript library (specifically this one) in my Bokeh javascript callback. How can I specify importing of this javascript library such that the library is accessible from Bokeh's js callback functions? The examples at: https://docs.bokeh.org/en/latest/docs/user_guide/extensions.html mainly talk about creating a custom Bokeh Model. I am not particularly interested in creating a new Model, just want to use the library functions in a callback to modify the data

How to color rows and/or cells in a Bokeh DataTable?

a 夏天 提交于 2019-12-18 12:42:12
问题 Starting from Initial table , I need to highlight(color) elements as shown in either one of the table examples Ex. 1, Ex. 2, Ex. 3 . Any idea? 回答1: In case someone else might bump into the same need, here are some variants that I came up with. (Thanks to Bokeh team for hints!) Variant 1: Highlight the cell where column A > column B Code: from bokeh.io import output_notebook, show output_notebook() from random import randint from bokeh.io import output_file, show from bokeh.layouts import

How to update a source in a JavaScript Callback of Bokeh in Python?

我与影子孤独终老i 提交于 2019-12-11 16:13:11
问题 I am adapting this answer for my case, where I want an interactive, standalone graph where the slider selects which column of the data to plot in a bar chart. (Standalone is crucial, I cannot run a Bokeh server, thus the need for JavaScript callbacks.) The data is a rectangle of floats with 100 rows in each of the 38 columns, which all have string labels like '40' etc. (This is how pandas .read_csv() handles numerics in the header by default.) Here is a sample from the top left corner (3x3,

Bokeh resize plot dynamically

ⅰ亾dé卋堺 提交于 2019-12-11 15:50:02
问题 i have Bokeh 0.12.6, what i do p2 = figure(x_axis_type="datetime", plot_width=1500,plot_height=700, x_range=p1.x_range, title="") select = Select(title="SELECT", options=["val1", "val2", "val3"]) select.callback = CustomJS(args={'plot1': p1, 'plot2': p2}, code=""" if(cb_obj.value === "val1"){ plot2.width = 1500; }else{ plot2.width = 700; } plot2.document.resize(); """) I need to resize plot by clicking dropdown but i recieve js error that document.resize is not a function. Also i tried plot2

CheckboxGroup in Bokeh to plot additive plots

家住魔仙堡 提交于 2019-12-08 05:00:39
问题 I want to use a checkbox group to represent linearly additive sources. The idea is for the user to be able to turn on or turn off multiple sources of different kinds to display a plot with added values. I implemented a dropdown version where the data had the different combinations as columns of the dataframe so the CustomJS part of the code was as follows: callback = CustomJS(args={'source':source},code=""" // print the selectd value of the select widget - // this is printed in the browser

CheckboxGroup in Bokeh to plot additive plots

╄→гoц情女王★ 提交于 2019-12-07 19:24:27
I want to use a checkbox group to represent linearly additive sources. The idea is for the user to be able to turn on or turn off multiple sources of different kinds to display a plot with added values. I implemented a dropdown version where the data had the different combinations as columns of the dataframe so the CustomJS part of the code was as follows: callback = CustomJS(args={'source':source},code=""" // print the selectd value of the select widget - // this is printed in the browser console. // cb_obj is the callback object, in this case the select // widget. cb_obj.value is the

How to color rows and/or cells in a Bokeh DataTable?

自古美人都是妖i 提交于 2019-11-30 07:43:58
Starting from Initial table , I need to highlight(color) elements as shown in either one of the table examples Ex. 1, Ex. 2, Ex. 3 . Any idea? In case someone else might bump into the same need, here are some variants that I came up with. (Thanks to Bokeh team for hints!) Variant 1: Highlight the cell where column A > column B Code: from bokeh.io import output_notebook, show output_notebook() from random import randint from bokeh.io import output_file, show from bokeh.layouts import widgetbox from bokeh.models import ColumnDataSource from bokeh.models.widgets import DataTable, DateFormatter,