小编red*_*ddy的帖子

散景多选小部件回调不起作用

我是Bokeh的新手。最近尝试实现一些小部件回调,并且很难在线找到任何资源。

场景:我有一个multi_select bokeh小部件,上面列出了公司列表。根据选择的公司,必须更改Vbar中的数据。为此,我试图基于“多选”中的值更改Vbar中使用的数据源。我无法获得理想的结果。有人可以帮我这个忙。

我在CustomJs方面很差,因此在Bokeh Server上执行Callabcks。如果在CustomJs上也有解决方案,那将对我有很大帮助。

非常感谢您抽出宝贵的时间!

下面是我正在使用的代码

source =source1[source1['year']== dt.now().year]
sourcex = source[source['month'] ==1 & 
source['CompanyNo'].isin(['01','02','03','04','05','08']) ]

Overall= ColumnDataSource(source)
Curr= ColumnDataSource(sourcex)

boolinit = source['month']==1
view = CDSView(source=Overall, filters=[BooleanFilter(boolinit)])

hover3 = HoverTool(
            tooltips = [
                ('day', '@day'),
                ('ExtendedPrice','@{ExtendedPrice}{0,0}'),
                ],
            formatters = {
                'day': 'datetime',
                'ExtendedPrice': 'numeral'}
           )

p =  figure(
    title='YEARLY SALES',  
    plot_width=600, 
    plot_height=400, 
    min_border=3,

tools = [hover3,'box_zoom','wheel_zoom', 'pan','reset'],  
toolbar_location="above")
p.vbar(x='day', top='ExtendedPrice', width=0.2, color='#e8bc76', 
source=Curr)
p.xaxis.axis_label = 'Day'
p.xaxis.axis_label_text_font_style = 'normal'
p.xaxis.axis_label_text_font_size = '12pt'
p.yaxis[0].formatter = NumeralTickFormatter(format="0,0")



def Multi_Selectupdate(attrname, old, new): …
Run Code Online (Sandbox Code Playgroud)

python callback multi-select python-3.x bokeh

3
推荐指数
1
解决办法
2663
查看次数

标签 统计

bokeh ×1

callback ×1

multi-select ×1

python ×1

python-3.x ×1