public void SetMainSeries(DoubleSeries mainSeries, bool showVolumePad = false) { lock (this.dataLock) { if (this.mainSeries != null) { this.series.ItemAdded -= new ItemAddedEventHandler(this.HandleSeriesItemAdded); this.series.Cleared -= new EventHandler(this.HandleSeriesCleared); } this.series = mainSeries; if (mainSeries is BarSeries) { this.SetBSView(this.barSeriesStyle, true); } else { this.mainSeries = this.series; this.mainSeriesView = (SeriesView)new DSView(this.pads[0], mainSeries, mainSeries.Color, EIndexOption.Null, SmoothingMode.HighSpeed); this.pads[0].AddPrimitive(this.mainSeriesView); } this.series.ItemAdded += new ItemAddedEventHandler(this.HandleSeriesItemAdded); this.series.Cleared += new EventHandler(this.HandleSeriesCleared); this.pads[0].ScaleStyle = this.scaleStyle; if (showVolumePad) this.ShowVolumePad(); this.firstIndex = this.updateStyle != ChartUpdateStyle.WholeRange ? Math.Max(0, mainSeries.Count - this.minCountOfBars) : 0; this.lastIndex = mainSeries.Count - 1; if (mainSeries.Count == 0) this.firstIndex = -1; if (this.lastIndex >= 0) this.SetPadIntervals(this.firstIndex, this.lastIndex); this.contentUpdated = true; this.Invalidate(); } }
public void SetMainSeries(ISeries mainSeries, bool showVolumePad, Color color) { lock (this.lockObject) { ISeries temp_5 = this.mainSeries; this.series = mainSeries; if (mainSeries is BarSeries) SetBarSeriesStyle(BarSeriesStyle, true); else { this.mainSeries = this.series; this.mainSeriesView = new DSView(this.pads[0], mainSeries as TimeSeries, color, SearchOption.ExactFirst, SmoothingMode.HighSpeed); this.pads[0].AddPrimitive(this.mainSeriesView); } this.pads[0].ScaleStyle = this.scaleStyle; if (showVolumePad) this.ShowVolumePad(); this.firstIndex = this.updateStyle != ChartUpdateStyle.WholeRange ? Math.Max(0, mainSeries.Count - this.minCountOfBars) : 0; this.lastIndex = mainSeries.Count - 1; if (mainSeries.Count == 0) this.firstIndex = -1; if (this.lastIndex >= 0) SetIndexInterval(this.firstIndex, this.lastIndex); this.contentUpdated = true; Invalidate(); } }