public void Initialize(double samplingFrequency, string title, XAxisScrollMode scrollMode = XAxisScrollMode.None) { SampleFrequency = samplingFrequency; ContainerChart.BeginUpdate(); ContainerChart.Title.Text = title; ContainerChart.ViewXY.SampleDataSeries[0].Clear(); ContainerChart.ViewXY.SampleDataSeries[0].SamplingFrequency = 1; ContainerChart.ViewXY.ZoomPanOptions.MouseWheelZooming = MouseWheelZooming.Off; ContainerChart.ViewXY.ZoomPanOptions.LeftMouseButtonAction = MouseButtonAction.None; ContainerChart.ViewXY.ZoomPanOptions.RightMouseButtonAction = MouseButtonAction.None; _xAxis.Minimum = -SampleFrequency / 2; _xAxis.Maximum = SampleFrequency / 2; _xAxis.ScrollMode = scrollMode; _xAxis.ScrollPosition = _xAxis.Minimum; _xAxis.Position = _xAxis.Minimum; _xAxis.Title.Text = string.Format("{0} s", SampleFrequency.ToString("0.000")); ContainerChart.ViewXY.SampleDataSeries[0].FirstSampleTimeStamp = _xAxis.Minimum; ContainerChart.ViewXY.DropOldSeriesData = true; var samples = new double[(int)SampleFrequency]; FeedData(samples); ContainerChart.EndUpdate(); }
public void Dispose() { if (ContainerChart == null) { return; } ContainerChart.Dispose(); ContainerChart = null; }
public void FeedData(double[] samples) { if (samples == null) { return; } ContainerChart.BeginUpdate(); var half = SampleFrequency / 2; var skip = half - half * _zoomFactor; var take = SampleFrequency * _zoomFactor; var selected = samples.Skip((int)skip).Take((int)take).ToArray(); ContainerChart.ViewXY.SampleDataSeries[0].SamplesDouble = selected; ContainerChart.EndUpdate(); }
internal void Zoom(double factor) { if (_zoomFactor == 1.0 && factor > 1.0) { return; } if (_zoomFactor == 0.0625 && factor < 1.0) { return; } _zoomFactor *= factor; ContainerChart.BeginUpdate(); _xAxis.SetRange(_xAxis.Minimum * factor, _xAxis.Maximum * factor); _xAxis.ScrollPosition = _xAxis.Minimum; _xAxis.Position = _xAxis.Minimum; //var defaultMin = -SampleFrequency/2; ContainerChart.ViewXY.SampleDataSeries[0].FirstSampleTimeStamp = _xAxis.Minimum; ContainerChart.EndUpdate(); }
public void Stop() { ContainerChart.BeginUpdate(); ContainerChart.EndUpdate(); }