用于确定何时在折线图上显示点的算法

时间:2014-08-08 09:40:51

标签: algorithm graph dhtmlx

我有一个系统每隔5分钟从服务器收集统计信息,并使用dhtmlxChart显示一个折线图,如下所示。我想在统计数据中趋势发生重大变化时为图表添加点数,例如,当下图中00-14到06:00的线图看起来像锯齿时,图表将显示方形点期刊的高低价值。如您所见,我现有的算法效果不佳。

interate over each point:
   if last visible point not defined then:
      set current point as visible
      store current point as last visible point
   else:
      compare absolute difference between last visible point and current point
      if difference exceeds threshold or current point is the last point then:
         set current point as visible
         store current point as last visible point

确定折线图中可见点的正确算法是什么?

Graph

1 个答案:

答案 0 :(得分:0)

无法添加点,但您可以使用更新的数据源重绘图表。 查看this theme

中的示例

您可以使用" line"图表类型