正在加载“flot” (图形插件)具有默认缩放值?
我正在尝试创建一个数据与时间图表,该图表允许用户放大/缩小到更大/更小的时间段。您可以在此处查看此类图表的示例: http://people.iola.dk/olau/flot/examples/visitors.html
虽然 API 可以轻而易举地设置该级别的功能,但当我试图弄清楚如何创建默认的“缩放”值时,我已经了解了 - 例如,将默认缩放设置为过去 30 天(同时保留用户缩小并查看全年数据的能力)。
有谁有任何经验或知道这样做的方法吗?或者是挖掘源代码并定制它的问题?
谢谢! 沃克
I'm trying to create a data vs time graph which allows the user to zoom in/out to large/smaller time periods. You can see an example of one such graph here:
http://people.iola.dk/olau/flot/examples/visitors.html
While the API has been a breeze for setting up that level of functionality, I've gotten stock when trying to figure out how to create a default "zoom" value - to, for instance, set the default zoom to the past 30 days (while retaining the ability for the user to zoom out and view an entire year of data).
Does anyone have any experience or know a way of doing this? Or is it a matter of digging into the source code and customizing it?
Thanks!
Walker
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
例如,如果您查看flot 缩放示例中的代码,然后您可以这样修改变量“选项”的定义:
...您会发现图形以这种级别的 y 轴缩放开始,但较小的图形仍然保留您可以缩小到的完整范围,如果你想要的。添加的行位于“yaxis”定义中,即“min”和“max”。如果您想预缩放 x 轴,您可以对“xaxis”执行类似的操作。
If you look at the code in, for example, flot zooming example, and you modify the definitions of the variable "options" thusly:
... you'll find that the graph starts out with this level of y-axis zoom, but the smaller graph still retains the full range that you can zoom out to if you want. The lines added are in the "yaxis" definition, "min" and "max". You would do something similar for "xaxis" if you want to pre-zoom the x-axis.