public CandleChartPanel() { InitializeComponent(); var cmdSvc = ConfigManager.GetService <IStudioCommandService>(); cmdSvc.Register <ChartDrawCommand>(this, false, cmd => _bufferedChart.Draw(cmd.Values)); cmdSvc.Register <ChartAddAreaCommand>(this, false, cmd => _bufferedChart.AddArea(cmd.Area)); cmdSvc.Register <ChartRemoveAreaCommand>(this, false, cmd => _bufferedChart.RemoveArea(cmd.Area)); cmdSvc.Register <ChartAddElementCommand>(this, false, cmd => _bufferedChart.AddElement(cmd.Area, cmd.Element)); cmdSvc.Register <ChartRemoveElementCommand>(this, false, cmd => _bufferedChart.RemoveElement(cmd.Area, cmd.Element)); cmdSvc.Register <ChartClearAreasCommand>(this, false, cmd => _bufferedChart.ClearAreas()); cmdSvc.Register <ChartResetElementsCommand>(this, false, cmd => _bufferedChart.Reset(cmd.Elements)); cmdSvc.Register <ChartAutoRangeCommand>(this, false, cmd => _bufferedChart.IsAutoRange = cmd.AutoRange); cmdSvc.Register <ResetedCommand>(this, true, cmd => OnReseted()); cmdSvc.Register <BindStrategyCommand>(this, true, cmd => { if (!cmd.CheckControl(this)) { return; } if (_strategy == cmd.Source) { return; } _strategy = cmd.Source; SetChart(true); ChartPanel.IsInteracted = _strategy != null && _strategy.GetIsInteracted(); if (_settingsStorage != null) { ChartPanel.Load(_settingsStorage); } TryCreateDefaultSeries(); }); ChartPanel.SettingsChanged += () => new ControlChangedCommand(this).Process(this); ChartPanel.RegisterOrder += order => new RegisterOrderCommand(order).Process(this); ChartPanel.SubscribeCandleElement += OnChartPanelSubscribeCandleElement; ChartPanel.SubscribeIndicatorElement += OnChartPanelSubscribeIndicatorElement; ChartPanel.SubscribeOrderElement += OnChartPanelSubscribeOrderElement; ChartPanel.SubscribeTradeElement += OnChartPanelSubscribeTradeElement; ChartPanel.UnSubscribeElement += OnChartPanelUnSubscribeElement; var indicatorTypes = ConfigManager .GetService <IAlgoService>() .IndicatorTypes; ChartPanel.MinimumRange = 200; ChartPanel.IndicatorTypes.AddRange(indicatorTypes); _bufferedChart = new BufferedChart(ChartPanel); WhenLoaded(() => new RequestBindSource(this).SyncProcess(this)); }
private void InitChart() { _bufferedChart.ClearAreas(); Curve.Clear(); PositionCurve.Clear(); _area = new ChartArea(); _bufferedChart.AddArea(_area); _candlesElem = new ChartCandleElement { ShowAxisMarker = false }; _bufferedChart.AddElement(_area, _candlesElem); _tradesElem = new ChartTradeElement { FullTitle = "Сделки" }; _bufferedChart.AddElement(_area, _tradesElem); }
private void InitChart() { bufferedChart.ClearAreas(); Curve.Clear(); PositionCurve.Clear(); area = new ChartArea(); bufferedChart.AddArea(area); candlesElem = new ChartCandleElement { ShowAxisMarker = false }; bufferedChart.AddElement(area, candlesElem); tradesElem = new ChartTradeElement { FullTitle = "Сделки", }; bufferedChart.AddElement(area, tradesElem); }
private void OnLoaded() { SecurityPicker.SecurityProvider = ConfigManager.GetService <FilterableSecurityProvider>(); _mainArea = ChartPanel.Areas.FirstOrDefault(); if (_mainArea == null) { _bufferedChart.AddArea(_mainArea = new ChartArea { Title = LocalizedStrings.Panel + " 1" }); } _candleElement = _mainArea.Elements.OfType <ChartCandleElement>().FirstOrDefault(); if (_candleElement == null) { _bufferedChart.AddElement(_mainArea, _candleElement = new ChartCandleElement(), CreateSeries()); } _mainArea .Elements .OfType <ChartIndicatorElement>() .Where(e => _indicators.TryGetValue(e) is CandlePartIndicator) .ForEach(e => _sourceElements.Add(((CandleSeries)_bufferedChart.GetSource(e)).Security, e)); _bufferedChart.AddAction(() => { _isLoaded = true; if (!HasError) { StartSeries(); } }); }