简体   繁体   English

Python散景 - 链接时间序列

[英]Python bokeh - linking timeseries

Is it possible to link to high level bokeh timeseries on panning ? 是否有可能在平移时链接到高级散景时间序列? the documentation http://bokeh.pydata.org/en/0.11.1/docs/user_guide/interaction.html only speaks about low-level plot. 文档http://bokeh.pydata.org/en/0.11.1/docs/user_guide/interaction.html只谈低级情节。 I didn't find any info on the net about higher level charts. 我没有在网上找到有关更高级别图表的任何信息。 I tried to share xranges on TimeSeries: 我试图在TimeSeries上分享xranges:

x_range = ew_kpi.x_range, 
y_range = ew_kpi.y_range

and the plot are displayed, but not linked : 并显示图,但没有链接:

x      = 'Date'
y      ='ew_kpi'
ew_kpi = TimeSeries(   pd.DataFrame(data2)[[x, y]]              ,
                        x       =   x          ,
                        y       =   [y]      ,
                        color   =   [y]       ,
                        dash    =   [y]      ,
                        title   =   y        ,
                        ylabel  =   y        ,                        
                        width   = 250        , 
                        height  = 250        )

y      = 'ca'
fig_ca = TimeSeries(   pd.DataFrame(data2)[[x, y]]              ,
                        x       =   x          ,
                        y       =   [y]      ,
                        color   =   [y]       ,
                        dash    =   [y]      ,
                        title   =   y        ,
                        ylabel  =   y        ,
                        width   = 250        , 
                        height  = 250        ,
                        x_range = ew_kpi.x_range, 
                        y_range = ew_kpi.y_range,)

p = vplot(ew_kpi, fig_ca)
show(p)

Although my bokeh plots are embedded and served in a Django app, I believe I have stumbled on a solution to this. 虽然我的散景图是嵌入式并在Django应用程序中提供的,但我相信我偶然发现了一个解决方案。 Instead of specifying x_range and y_range inside the TimeSeries constructor, put these lines after the two TimeSeries objects have been created: 不是在TimeSeries构造函数中指定x_range和y_range,而是在创建两个TimeSeries对象之后放置这些行:

fig_ca.x_range = ew_kpi.x_range
fig_ca.y_range = ew_kpi.y_range

and you should find them linked together. 你应该发现它们在一起。 In my case I only linked the x_range. 在我的情况下,我只链接了x_range。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM