本文整理汇总了Python中bokeh.models.widgets.TextInput.js_on_change方法的典型用法代码示例。如果您正苦于以下问题:Python TextInput.js_on_change方法的具体用法?Python TextInput.js_on_change怎么用?Python TextInput.js_on_change使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bokeh.models.widgets.TextInput
的用法示例。
在下文中一共展示了TextInput.js_on_change方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: compare
# 需要导入模块: from bokeh.models.widgets import TextInput [as 别名]
# 或者: from bokeh.models.widgets.TextInput import js_on_change [as 别名]
#.........这里部分代码省略.........
pa.title.text = xlabel
pb.title.text = ylabel
pa.title_location, pa.title.align = 'below', 'center'
pb.title_location, pb.title.align = 'left', 'center'
# WIDGETS
q_input = TextInput(value='', title="P* cutoff",
placeholder='e.g. 0.05')
gene_input = TextInput(value='', title="Gene list",
placeholder='e.g. TP53,BRAF')
radio_include = RadioGroup(labels=["Include", "Exclude"], active=0)
widgets = widgetbox(q_input, gene_input, radio_include, width=200,
css_classes=['widgets_sg'])
grid = gridplot([[pb, p, widgets],
[Spacer(width=DIM_COMP_SM), pa, Spacer()]],
sizing_mode='fixed')
cb_inclusion = CustomJS(args=dict(genes=gene_input), code="""
var gene_str = genes.value
if (!gene_str)
return;
var include = cb_obj.active == 0 ? true : false
selectPathwaysByGenes(gene_str, include);
""")
cb_genes = CustomJS(args=dict(radio=radio_include), code="""
var gene_str = cb_obj.value
if (!gene_str)
return;
var include = radio.active == 0 ? true : false
selectPathwaysByGenes(gene_str, include);
""")
radio_include.js_on_change('active', cb_inclusion)
gene_input.js_on_change('value', cb_genes)
# SCATTER
p.circle("e1", "e2", source=source, **SCATTER_KW)
pa.circle('e1_only', 1, source=source, **SCATTER_KW)
pb.circle(1, 'e2_only', source=source, **SCATTER_KW)
# HOVER
for hover in grid.select(dict(type=HoverTool)):
hover.tooltips = OrderedDict([
("name", "@pname"),
("effects", "(@e1, @e2)"),
("P*", ("(@q1, @q2)"))
])
# ADD Q FILTERING CALLBACK
callback = CustomJS(args=dict(source=source, full=source_full), code="""
// get old selection indices, if any
var prv_selected = source.selected['1d'].indices;
var prv_select_full = []
for(var i=0; i<prv_selected.length; i++){
prv_select_full.push(scatter_array[prv_selected[i]])
}
var new_selected = []
var q_val = cb_obj.value;
if(q_val == '')
q_val = 1
var fullset = full.data;
var n_total = fullset['e1'].length;
// Convert float64arrays to array
var col_names = %s ;
col_names.forEach(function(col_name){