// TODO 后期优化,记录当前Series的Plot范围,然后再判断是否需要重新Plot // 在begin和end区间内绘制单条曲线,分区视图使用。如果forceRefresh为true时(调用Plot方法时)始终更新绘图。 // 如果forceRefresh为false时(用户进行缩放等操作时)如果判断数据区间和原来的兼容(稀疏比相同且是上次绘图范围的子集则无需更新) // 使用forceRefresh是为了避免在数据量过大,用户缩放后拖动滚动条会比较卡顿的问题 internal void PlotDataInRange(double beginXValue, double endXValue, int seriesIndex, bool forceRefresh, bool isLogView) { int lineIndex; DataEntity dataEntity = GetDataEntityBySeriesIndex(seriesIndex, out lineIndex); if (null == dataEntity) { return; } bool isNeedRefreshPlot = dataEntity.FillPlotDataInRange(beginXValue, endXValue, forceRefresh, lineIndex, isLogView); if (isNeedRefreshPlot) { PlotBuffer plotBuffer = dataEntity.PlotBuf; if (PlotSeries[seriesIndex].Points.Count == plotBuffer.PlotSize) { for (int i = 0; i < plotBuffer.PlotSize; i++) { double yValue = plotBuffer.YPlotBuffer[lineIndex][i]; PlotSeries[seriesIndex].Points[i].SetValueXY(plotBuffer.XPlotBuffer[i], yValue); if (PlotSeries[seriesIndex].Points[i].IsEmpty && !double.IsNaN(yValue)) { PlotSeries[seriesIndex].Points[i].IsEmpty = false; } } } else { IList <double> xDataBuf = plotBuffer.GetXPlotDataCollection(); IList <double> yDataBuf = plotBuffer.GetYPlotDataCollection(lineIndex); PlotSeries[seriesIndex].Points.DataBindXY(xDataBuf, yDataBuf); } // 如果有校验Nan数据,则将标记为Nan数据的点不显示 if (DataCheckParams.CheckNaN) { HideNanDataPoint(seriesIndex); } //if (dataEntity.DataInfo.XDataType != XDataType.Number) //{ // RefreshTimeToXLabel(seriesIndex); //} } }
// TODO 后期优化,记录当前Series的Plot范围,然后再判断是否需要重新Plot // 在begin和end区间内绘制单条曲线。如果forceRefresh为true时(调用Plot方法时)始终更新绘图。 // 如果forceRefresh为false时(用户进行缩放等操作时)如果判断数据区间和原来的兼容(稀疏比相同且是上次绘图范围的子集则无需更新) // 使用forceRefresh是为了避免在数据量过大,用户缩放后拖动滚动条会比较卡顿的问题 internal void PlotDataInRange(double beginXValue, double endXValue, int seriesIndex, bool forceRefresh = false) { int lineIndex; DataEntity dataEntity = GetDataEntityBySeriesIndex(seriesIndex, out lineIndex); if (null == dataEntity) { return; } bool isNeedRefreshPlot = dataEntity.FillPlotDataInRange(beginXValue, endXValue, forceRefresh, lineIndex); if (isNeedRefreshPlot) { IList <double> xDataBuf = dataEntity.PlotBuf.GetXData(); IList <IList <double> > yDataBuf = dataEntity.PlotBuf.GetYData(); if (PlotSeries[seriesIndex].Points.Count == dataEntity.PlotBuf.PlotSize) { for (int i = 0; i < dataEntity.PlotBuf.PlotSize; i++) { if (PlotSeries[seriesIndex].Points[i].IsEmpty && !double.IsNaN(yDataBuf[lineIndex][i])) { PlotSeries[seriesIndex].Points[i].IsEmpty = false; } PlotSeries[seriesIndex].Points[i].SetValueXY(xDataBuf[i], yDataBuf[lineIndex][i]); } } else { PlotSeries[seriesIndex].Points.DataBindXY(xDataBuf, yDataBuf[lineIndex]); } // 如果有校验Nan数据,则将标记为Nan数据的点不显示 if (DataCheckParams.CheckNaN) { HideNanDataPoint(seriesIndex); } //if (dataEntity.DataInfo.XDataType != XDataType.Number) //{ // RefreshTimeToXLabel(seriesIndex); //} } }