// Called when the AppendDataCommand is invoked via button click on the view
        private void AppendData()
        {
            var newData = _dataSource.GetRandomWalkSeries(50);

            _dataSeries0.Append(newData.XData, newData.YData);
            ViewportManager.ZoomExtents();
        }
        public BindToDataSeriesSetViewModel()
        {
            ViewportManager = new DefaultViewportManager();

            // Create a DataSeriesSet
            _dataSeries0 = new XyDataSeries <double, double>();

            // Create a single data-series
            _dataSource = new RandomWalkGenerator();
            var data = _dataSource.GetRandomWalkSeries(1000);

            // Append data to series.
            _dataSeries0.Append(data.XData, data.YData);
        }
        public TradeOverlayExampleViewModel()
        {
            // Create some data to show on the chart
            _chartDataSeries            = new XyDataSeries <DateTime, double>();
            _chartDataSeries.SeriesName = "CL FUT JUN15 2013";

            // Get some price data, trades
            List <Trade>     trades;
            List <NewsEvent> newsEvents;
            var priceData = DataManager.Instance.GetRandomTrades(out trades, out newsEvents);

            // Buffer above and append all in one go to avoid multiple recalculations of series range
            _chartDataSeries.Append(priceData.TimeData, priceData.CloseData);

            // Create annotations
            TradeAnnotations = CreateAnnotations(trades, newsEvents);

            _chartDataSeries.InvalidateParentSurface(RangeMode.ZoomToFit);
        }