散景:时间序列选择(Bokeh: Time series selection)

说我有过去50年绘制的数据,但后来我想选择上个月,去年,过去10年等等。我可以通过使用方框缩放工具大致做到这一点,但有没有办法让时间序列选择更容易超越盒子缩放?

例如,一个滑动条(如Google财经)或一个单选按钮组(选择'1M','1Y')但我希望它们是独立的,而不是服务。 它们只是一个改进的易于使用的盒子缩放版本。

Say I have data plotted for the last 50 years, but then I want to select last month, last year, last 10yrs, etc. I can do this approximately by using a box zoom tool, but is there a way for easier time series selection beyond box zoom?

For example, a slider bar (like google finance) or a radio button group (to select '1M', '1Y') but I want them to be standalone, not served. They are just an improved easy-to-use version of box zoom.

最满意答案

如果您不想使用散景服务器,则必须在客户端进行。 这可以通过在coffeescript中添加自定义工具或小部件来完成(它编译成javascript)

这个例子向您展示了前进的方向。 我为bokeh制作了另一个自定义工具,从那次经验我建议你在coffeescript方面工作(而不是直接在javascript中编写),因为散景的javascript部分在版本之间仍然发生了很大变化,咖啡脚本方式可能会抽象一点点库的细节依赖性。

If you do not want to use the bokeh server, you have to do it on the client side. This can be done by adding custom tools or widgets in coffeescript (which compiles into javascript)

This example shows you the direction to go. I made another custom tool for bokeh and from that experience I would recommend you work on the coffeescript side (instead of writing it directly in javascript) since the javascript part of bokeh is still changing quite a bit between releases, the coffee script way might abstract a bit the detail dependencies of the library.

更多推荐