public MainViewModel()
        {
            var dummyDataProvider = new DummyDataProvider();
            var lineData          = new XyDataSeries <double, double>()
            {
                SeriesName = "TestingSeries"
            };

            _renderableSeries = new ObservableCollection <IRenderableSeriesViewModel>();
            RenderableSeries.Add(new LineRenderableSeriesViewModel()
            {
                StrokeThickness = 2,
                Stroke          = Colors.SteelBlue,
                DataSeries      = lineData,
                StyleKey        = "LineSeriesStyle"
            });

            // Append the initial values to the chart
            var initialDataValues = dummyDataProvider.GetHistoricalData();

            lineData.Append(initialDataValues.XValues, initialDataValues.YValues);

            // Subscribe to future updates
            dummyDataProvider.SubscribeUpdates((newValues) =>
            {
                // Append when new values arrive
                lineData.Append(newValues.XValues, newValues.YValues);
                // Zoom the chart to fit
                lineData.InvalidateParentSurface(RangeMode.ZoomToFit);
            });
        }
        private void SetSeries(string seriesType)
        {
            RenderableSeries.Clear();

            if (seriesType.Equals("Column Series"))
            {
                RenderableSeries.Add(_columnSeries);
            }
            else if (seriesType.Equals("Impulse Series"))
            {
                RenderableSeries.Add(_impulseSeries);
            }
            else if (seriesType.Equals("Mountain Series"))
            {
                RenderableSeries.Add(_mountainSeries);
            }
            else if (seriesType.Equals("PointLine Series"))
            {
                RenderableSeries.Add(_pointLineSeries);
            }
            else if (seriesType.Equals("SurfaceMesh Series"))
            {
                RenderableSeries.Add(_surfaceMeshSeries);
            }
            // Temporary
            //else if (seriesType.Equals("Waterfall Series"))
            //{
            //    RenderableSeries.Add(_waterfallSeries);
            //}
            else if (seriesType.Equals("Scatter Series"))
            {
                RenderableSeries.Add(_scatterSeries);
            }
        }
Esempio n. 3
0
        private void SeriesUpdate()
        {
            if (RenderableSeries != null)
            {
                RenderableSeries.Clear();

                RenderableSeries.Add(new ColumnRenderableSeriesViewModel()
                {
                    DataPointWidth = 1,
                    Stroke         = System.Windows.Media.Color.FromRgb(186, 187, 190),
                    DataSeries     = Series
                });
            }

            if (Data != null && Series != null)
            {
                XList.Clear();
                YList.Clear();

                XList = Data.Keys.ToList();
                YList = Data.Values.ToList();

                try
                {
                    Series.Clear();
                    Series.InsertRange(0, XList, YList);
                }

                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
        }
Esempio n. 4
0
 private void CreateChartSeries()
 {
     // Create a RenderableSeries. Apply the DataSeries created before
     _renderableSeries = new ObservableCollection <IRenderableSeriesViewModel>();
     RenderableSeries.Add(new LineRenderableSeriesViewModel()
     {
         StrokeThickness = 2,
         Stroke          = Colors.SteelBlue,
         DataSeries      = _lineData,
         StyleKey        = "LineSeriesStyle"
     });
 }
        private void InitializeRenderableSeries()
        {
            var renderableSeries = new  LineRenderableSeriesViewModel
            {
                Stroke          = Colors.Blue,
                StrokeThickness = 2,
                PointMarker     = new EllipsePointMarker()
            };

            var dataSeries = new XyDataSeries <double>();

            for (int i = 0; i < 11; ++i)
            {
                dataSeries.Append(i, i - 3);
            }
            renderableSeries.DataSeries = dataSeries;

            RenderableSeries.Add(renderableSeries);
        }
Esempio n. 6
0
        public MainViewModel()
        {
            var lineData = new XyDataSeries <double, double>()
            {
                SeriesName = "TestingSeries"
            };

            lineData.Append(0, 0);
            lineData.Append(1, 1);
            lineData.Append(2, 2);

            _renderableSeries = new ObservableCollection <IRenderableSeriesViewModel>();
            RenderableSeries.Add(new LineRenderableSeriesViewModel()
            {
                StrokeThickness = 2,
                Stroke          = Colors.SteelBlue,
                DataSeries      = lineData,
            });
        }