private void InitCharts() { Chart.ClearAreas(); _area = new ChartArea(); var yAxis = _area.YAxises.First(); yAxis.AutoRange = true; Chart.IsAutoRange = true; Chart.IsAutoScroll = true; Chart.AddArea(_area); var series = new CandleSeries( typeof(TimeFrameCandle), _security, TimeSpan.FromMinutes(_timeframe)); _indicatorElement = null; _candleElement = new ChartCandleElement { FullTitle = "Candles", YAxisId = yAxis.Id }; Chart.AddElement(_area, _candleElement, series); if (_addIndicator) { _indicator = new MyMovingAverage(200) { Name = "MyMA" }; _indicatorElement = new ChartIndicatorElement { DrawStyle = ChartIndicatorDrawStyles.Line, AntiAliasing = true, StrokeThickness = 1, Color = Colors.Blue, YAxisId = yAxis.Id, }; Chart.AddElement(_area, _indicatorElement, series, _indicator); } }
public MainWindow() { InitializeComponent(); Title = Title.Put(LocalizedStrings.Str3200); _fpsAverage = new MyMovingAverage(10); Loaded += OnLoaded; PreviewMouseDoubleClick += (sender, args) => { Chart.IsAutoRange = true; }; PreviewMouseWheel += (sender, args) => { Chart.IsAutoRange = false; }; PreviewMouseRightButtonDown += (sender, args) => { Chart.IsAutoRange = false; }; _chartUpdateTimer.Interval = TimeSpan.FromMilliseconds(100); _chartUpdateTimer.Tick += ChartUpdateTimerOnTick; _chartUpdateTimer.Start(); }