예제 #1
0
파일: Chart.cs 프로젝트: heber/FreeOQ
		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();
			}
		}
예제 #2
0
파일: Chart.cs 프로젝트: heber/FreeOQ
		private bool SetBSView(BSStyle style, bool obj1)
		{
			bool flag = true;
			if (style == BSStyle.Candle || style == BSStyle.Bar || style == BSStyle.Line)
			{
				if (!(this.mainSeriesView is SimpleBSView) || obj1)
				{
					this.pads[0].RemovePrimitive((IChartDrawable)this.mainSeriesView);
					this.mainSeriesView = (SeriesView)new SimpleBSView(this.pads[0], this.series as BarSeries);
					(this.mainSeriesView as SimpleBSView).UpColor = this.candleUpColor;
					(this.mainSeriesView as SimpleBSView).DownColor = this.candleDownColor;
					this.mainSeries = this.mainSeriesView.MainSeries;
					this.pads[0].AddPrimitive(this.mainSeriesView);
				}
				else
					flag = false;
				if (style == BSStyle.Candle)
					(this.mainSeriesView as SimpleBSView).Style = SimpleBSStyle.Candle;
				if (style == BSStyle.Bar)
					(this.mainSeriesView as SimpleBSView).Style = SimpleBSStyle.Bar;
				if (style == BSStyle.Line)
					(this.mainSeriesView as SimpleBSView).Style = SimpleBSStyle.Line;
			}
			else if (style == BSStyle.Kagi)
			{
				if (!(this.mainSeriesView is KagiBaView) || obj1)
				{
					this.pads[0].RemovePrimitive((IChartDrawable)this.mainSeriesView);
					this.mainSeriesView = (SeriesView)new KagiBaView(this.pads[0], this.series as BarSeries);
					this.mainSeries = this.mainSeriesView.MainSeries;
					this.pads[0].AddPrimitive((IChartDrawable)this.mainSeriesView);
				}
			}
			else if (style == BSStyle.LineBreak)
			{
				if (!(this.mainSeriesView is LineBreakBSView) || obj1)
				{
					this.pads[0].RemovePrimitive((IChartDrawable)this.mainSeriesView);
					this.mainSeriesView = (SeriesView)new LineBreakBSView(this.pads[0], this.series as BarSeries);
					this.mainSeries = this.mainSeriesView.MainSeries;
					this.pads[0].AddPrimitive((IChartDrawable)this.mainSeriesView);
				}
			}
			else if (style == BSStyle.Ranko)
			{
				if (!(this.mainSeriesView is RankoBSView) || obj1)
				{
					this.pads[0].RemovePrimitive((IChartDrawable)this.mainSeriesView);
					this.mainSeriesView = (SeriesView)new RankoBSView(this.pads[0], this.series as BarSeries);
					this.mainSeries = this.mainSeriesView.MainSeries;
					this.pads[0].AddPrimitive((IChartDrawable)this.mainSeriesView);
				}
			}
			else if (style == BSStyle.PointAndFigure && (!(this.mainSeriesView is PnFBSView) || obj1))
			{
				this.pads[0].RemovePrimitive((IChartDrawable)this.mainSeriesView);
				this.mainSeriesView = (SeriesView)this.AaUga350I(this.pads[0], this.series as BarSeries);
				this.mainSeries = this.mainSeriesView.MainSeries;
				this.pads[0].AddPrimitive((IChartDrawable)this.mainSeriesView);
			}
			return flag;
		}
예제 #3
0
        internal void PaintContent(Graphics obj0)
        {
            if (this.chart.MainSeries == null || this.chart.MainSeries.Count == 0)
            {
                return;
            }
            this.graphics = obj0;
            if (this.minValue != double.MaxValue && this.maxValue != double.MinValue)
            {
                this.axis.Paint();
                obj0.SetClip(new Rectangle(this.x1, this.y1, this.width, this.height));
                foreach (IChartDrawable chartDrawable in this.notDatePrimitives)
                {
                    if (this.drawItems || chartDrawable is SeriesView)
                    {
                        chartDrawable.Paint();
                    }
                }
                if (this.drawItems)
                {
                    int nextIndex = this.datePrimitives.GetNextIndex(this.chart.MainSeries.GetDateTime(this.chart.FirstIndex));
                    int prevIndex = this.datePrimitives.GetPrevIndex(this.chart.MainSeries.GetDateTime(this.chart.LastIndex));
                    if (nextIndex != -1 && prevIndex != -1)
                    {
                        for (int index = nextIndex; index <= prevIndex; ++index)
                        {
                            foreach (IChartDrawable chartDrawable in this.datePrimitives[index])
                            {
                                if (this.selectedObject != null && chartDrawable is TransactionView && (chartDrawable as TransactionView).Compare(this.selectedObject))
                                {
                                    (chartDrawable as TransactionView).GBIw6qlqgC(true);
                                    chartDrawable.Paint();
                                    (chartDrawable as TransactionView).GBIw6qlqgC(false);
                                }
                                else
                                {
                                    chartDrawable.Paint();
                                }
                            }
                        }
                    }
                }
                obj0.ResetClip();
            }
            bool  flag = true;
            float num  = (float)(this.x1 + 2);

            foreach (IChartDrawable chartDrawable in this.notDatePrimitives)
            {
                if (chartDrawable is SeriesView)
                {
                    SeriesView seriesView = chartDrawable as SeriesView;
                    if (seriesView.DisplayNameEnabled)
                    {
                        string str;
                        if (flag)
                        {
                            str  = seriesView.DisplayName;
                            flag = false;
                        }
                        else
                        {
                            str = "" + seriesView.DisplayName;
                        }
                        SizeF sizeF = obj0.MeasureString(str, this.chart.Font);
                        obj0.FillRectangle((Brush) new SolidBrush(this.chart.CanvasColor), num + 2f, (float)(this.y1 + 2), sizeF.Width, sizeF.Height);
                        obj0.DrawString(str, this.chart.Font, (Brush) new SolidBrush(seriesView.Color), num + 2f, (float)(this.y1 + 2));
                        num += sizeF.Width;
                    }
                }
            }
            if (!this.UYFJBKF5fG)
            {
                return;
            }
            obj0.DrawRectangle(new Pen(Color.Green), this.rect);
        }