public AxisProperties() { Active = false; Show = false; AxisKind = AxisKinds.Angular; AxisId = 0; SeriesIndex = 0; ParamIndex = 0; DeviceNumber = 0; DeviceRank = 0; MinusStop = 0.0f; MinusStop = 0.0f; DeviceId = "None"; Description = "Axis 0"; AxisState = AxisStateKinds.AxisStateNotReady; ActualSeries = null; TargetSeries = null; DataCacheOffset = 0; DataPVTOffset = 0; AxisPortPropertiesIndex = 0; }
public void RefreshChart(int numPointsPerPlot) { if (ChartCache != null) { int k = ChartCache.FindRelativeXCoordinateInCache(BottomAxis.ActualMinimum); if (k < 0) { k = ~k; } ResetSeries(numPointsPerPlot); CurrentRelativeChartCacheIndex = k + NumPointsPerPlot; if (CurrentRelativeChartCacheIndex > ChartCache.RelativeCount) { CurrentRelativeChartCacheIndex = ChartCache.RelativeCount; } if (k < ChartCache.RelativeCount) { ChartCache.RefreshMinMax(); foreach (AxisProperties ap in Recorder.AxisOptions) { RecorderSignalLineSeries s = ap.TargetSeries; for (int i = k; i < CurrentRelativeChartCacheIndex; i++) { List <double> p = ChartCache.RelativeGetAt(i); if (p == null || (p.Count <= ap.DataCacheOffset + 1)) { break; } // Check if NaN, skip series point if so. double d = p[ap.DataCacheOffset + 1]; if (Double.IsNaN(d)) { continue; } s.Points.Add(new DataPoint(p[0] / 1000.0, d)); } } } } }
// This is called every time axis options change. public void SetupSeriesConfiguration() { ResetCache(); ResetSeries(); ChartPlotModel.Series.Clear(); foreach (AxisProperties ap in Recorder.AxisOptions) { // Note: series are installed in reverse order so that actual draws on top of signal. RecorderSignalLineSeries st = new RecorderSignalLineSeries(this, ChartCache, ap.SeriesIndex + 1); st.LineStyle = LineStyle.Solid; st.Title = ap.Description + " signal"; ChartPlotModel.Series.Add(st); ap.TargetSeries = st; // RecorderAngularLineSeries sa = new RecorderAngularLineSeries(this, ChartCache, ap.SeriesIndex + 0); sa.LineStyle = LineStyle.Solid; sa.Title = ap.Description + " position"; ChartPlotModel.Series.Add(sa); ap.ActualSeries = sa; // SetAxisVisibility(ap); } }