2015-07-09 75 views
2

Flot是否为我们提供了一个函数,该函数将返回图表中使用的数据的最小和最大日期?如何从Flot图获取最小/最大日期

为了清楚起见,我没有找到函数返回x轴的最小/最大日期,而是查看图表使用的所有数据集中存在的最小/最大日期。 (即我知道返回在xaxis上显示的日期的plot.getAxes().xaxis.max/min函数)。

我猜Flot确实知道数据集中的最小/最大日期,因为它能够正确动态地创建xaxis日期范围。我希望能让这些日期适合我们。

回答

1

这里是所有属性从plot.getAxes().yaxis:你想要什么

yaxis: Object 
    box: Object 
    c2p: (c) { return m + c/s; } 
-> datamax: 116.2 
-> datamin: 0 
    direction: "y" 
    innermost: true 
    labelHeight: 11 
    labelWidth: 18 
    max: 118 
    min: 0 
    n: 1 
    options: Object 
    p2c: (p) { return (p - m) * s; } 
    position: "left" 
    reserveSpace: true 
    scale: 6.3559322033898304 
    show: true 
    tickDecimals: 0 
    tickFormatter: (v, axis) { 
    tickGenerator: (axis) { 
    tickLength: "full" 
    tickSize: 10 
    ticks: Array[13] 
    used: true 

datamaxdatamin性能。

+0

感谢您的回答,@Raidri。你能告诉我你在哪里/如何发现这些房产?我查看了[Flot文档](https://github.com/flot/flot/blob/master/API.md),但找不到这样的信息。 – Jed

+1

我记得我曾经看过类似的东西,并快速浏览了'console.log(plot.getAxes())'来找到它们。 – Raidri