/// <summary>
        /// Generates the datas.
        /// </summary>
        override public void GenerateDatas()
        {
            ColumnPoints.Clear();

            if (this.Points != null && this.SeriesContainer != null)
            {
                if (!IsPointsGenerated)
                {
                    Parts.Clear();
                }
                StartEndPoints = new PointCollection();
                Rects          = new List <Rect>();
                CalculateMinAndMax();
                ChartPoint oldPoint = new ChartPoint()
                {
                    XValue = double.MinValue, YValue = double.MinValue
                };
                IntializePoints();
                Point startAndEndPoint = CalculateColumnSeriesInfo();
                foreach (ChartPoint point in this.Points)
                {
                    if (CheckValuePoint(oldPoint, point))
                    {
                        Point linePoint  = NormalizePoint(new Point(point.XValue, point.YValue));
                        Point startPoint = NormalizePoint(new Point(point.XValue + startAndEndPoint.X, point.YValue));
                        Point endPoint   = NormalizePoint(new Point(point.XValue + startAndEndPoint.Y, YMin));
                        StartEndPoints.Add(startPoint);
                        StartEndPoints.Add(endPoint);
                        ColumnPoints.Add(linePoint);
                        Rects.Add(new Rect(startPoint, endPoint));
                        oldPoint = point;
                    }
                }
                if (this.RenderingMode == RenderingMode.Default)
                {
                    //if (!UseSinglePart)
                    //{
                    if (!IsPointsGenerated)
                    {
                        for (int i = 0; i <= this.StartEndPoints.Count - 2; i += 2)
                        {
                            if (CheckValue(StartEndPoints[i].X) && CheckValue(StartEndPoints[i].Y) && CheckValue(StartEndPoints[i + 1].X) && CheckValue(StartEndPoints[i + 1].Y))
                            {
                                ColumnPart columnPart = new ColumnPart(StartEndPoints[i].X, StartEndPoints[i].Y, StartEndPoints[i + 1].X, StartEndPoints[i + 1].Y);
                                SetBindingForStrokeandStrokeThickness(columnPart);
                                this.Parts.Add(columnPart);
                            }
                            //}
                            //else
                            //{
                            //    LineSinglePart singlePart = new LineSinglePart(this.ColumnPoints);
                            //    SetBindingForStrokeandStrokeThickness(singlePart);
                            //    this.Parts.Add(singlePart);
                            //}
                        }
                        IsPointsGenerated = true;
                    }
                    else
                    {
                        int i = 0;
                        foreach (ColumnPart part in this.Parts)
                        {
                            if (CheckValue(StartEndPoints[i].X) && CheckValue(StartEndPoints[i].Y) && CheckValue(StartEndPoints[i + 1].X) && CheckValue(StartEndPoints[i + 1].Y))
                            {
                                part.X1 = StartEndPoints[i].X;
                                part.Y1 = StartEndPoints[i].Y;
                                part.X2 = StartEndPoints[i + 1].X;
                                part.Y2 = StartEndPoints[i + 1].Y;
                                part.Refresh();
                            }
                            i += 2;
                        }
                    }
                }
            }
            else
            {
                Parts.Clear();
            }

            if (this.SeriesContainer != null)
            {
                this.SeriesContainer.Invalidate();
            }
            IsRefreshed = false;
        }
Esempio n. 2
0
        /// <summary>
        /// Generates the datas.
        /// </summary>
        public override void GenerateDatas()
        {
            ColumnPoints.Clear();

            if (this.Points != null && this.SeriesContainer != null)
            {
                if (!IsPointsGenerated)
                    Parts.Clear();
                StartEndPoints = new PointCollection();
                Rects = new List<Rect>();
                CalculateMinAndMax();
                ChartPoint oldPoint = new ChartPoint() { XValue = double.MinValue, YValue = double.MinValue };
                IntializePoints();
                Point startAndEndPoint = CalculateColumnSeriesInfo();
                foreach (ChartPoint point in this.Points)
                {
                    if (CheckValuePoint(oldPoint, point))
                    {
                        Point linePoint = NormalizePoint(new Point(point.XValue, point.YValue));
                        Point startPoint = NormalizePoint(new Point(point.XValue + startAndEndPoint.X, point.YValue));
                        Point endPoint = NormalizePoint(new Point(point.XValue + startAndEndPoint.Y, YMin));
                        StartEndPoints.Add(startPoint);
                        StartEndPoints.Add(endPoint);
                        ColumnPoints.Add(linePoint);
                        Rects.Add(new Rect(startPoint, endPoint));
                        oldPoint = point;
                    }
                }
                if (this.RenderingMode == RenderingMode.Default)
                {
                    //if (!UseSinglePart)
                    //{
                    if (!IsPointsGenerated)
                    {
                        for (int i = 0; i <= this.StartEndPoints.Count - 2; i += 2)
                        {
                            if (CheckValue(StartEndPoints[i].X) && CheckValue(StartEndPoints[i].Y) && CheckValue(StartEndPoints[i + 1].X) && CheckValue(StartEndPoints[i + 1].Y))
                            {
                                ColumnPart columnPart = new ColumnPart(StartEndPoints[i].X, StartEndPoints[i].Y, StartEndPoints[i + 1].X, StartEndPoints[i + 1].Y);
                                SetBindingForStrokeandStrokeThickness(columnPart);
                                this.Parts.Add(columnPart);
                            }
                            //}
                            //else
                            //{
                            //    LineSinglePart singlePart = new LineSinglePart(this.ColumnPoints);
                            //    SetBindingForStrokeandStrokeThickness(singlePart);
                            //    this.Parts.Add(singlePart);
                            //}
                        }
                        IsPointsGenerated = true;
                    }
                    else
                    {
                        int i = 0;
                        foreach (ColumnPart part in this.Parts)
                        {
                            if (CheckValue(StartEndPoints[i].X) && CheckValue(StartEndPoints[i].Y) && CheckValue(StartEndPoints[i + 1].X) && CheckValue(StartEndPoints[i + 1].Y))
                            {
                                part.X1 = StartEndPoints[i].X;
                                part.Y1 = StartEndPoints[i].Y;
                                part.X2 = StartEndPoints[i + 1].X;
                                part.Y2 = StartEndPoints[i + 1].Y;
                                part.Refresh();
                            }
                            i += 2;
                        }

                    }

                }
            }
            else
            {
              Parts.Clear();
            }

            if (this.SeriesContainer != null)
                this.SeriesContainer.Invalidate();
            IsRefreshed = false;
        }