Flot ::突出显示时间点系列图

时间:2013-08-12 08:17:56

标签: javascript flot

我使用最漂亮的javascript绘图插件flot在折线图的帮助下描绘一些实时数据。

我有以下一组选项:

{
          colors: ['#7999BB'],
          grid: { borderWidth: 1, borderColor:"#4572A7"},
          xaxis:  {
                   axisLabel: "Time (H:M)",
                   axisLabelUseCanvas: true,
                   axisLabelFontSizePixels: 11,
                   axisLabelFontFamily: 'sans-serif',
                   axisLabelPadding: 9,

                   mode:"time",
                   tickSize: [25, "minute"],
                   tickLength:5,
                   tickFormatter: function (v, axis) {
                   var date = new Date(v);
                   var hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
                   var minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
                   var seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
                   return hours + ":" + minutes;
                }
            },
            series: { shadowSize: 0,
                      lines: {
                              show: true,
                              lineWidth: 1.2,
                              fill: true,
                              fillColor: { colors: [ { opacity: 0.3 }, { opacity: 0 } ] }
                       }
                    },
            yaxis:  { show: true,
                      min:0,
                    }
}

一切都很好。但我想强调图中的单点。我尝试使用

plot.highlight(seriesIndex,dataPoint);

我做了

plot.highlight(0, 99);
0 -  I have just single series.
99 - I am plotting 100 points and lets say for example I want to highlight 99th point. 

控制台没有错误。 但它不起作用?如何突出显示时间序列图表?

任何帮助都将受到高度赞赏。

1 个答案:

答案 0 :(得分:1)

经过长时间的浪费研究后,我找到了一个解决方案。实际上这个问题与flot版本有关。它与最新的flot 0.8.1.插件一起工作正常。谢谢您的宝贵时间和帮助。