我有一个系统每隔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
确定折线图中可见点的正确算法是什么?