Exemple #1
0
        /// <summary>
        /// Generates the datas.
        /// </summary>
        public override void GenerateDatas()
        {
            LowPoints.Clear();
            HighPoints.Clear();
            OpenPoints.Clear();
            ClosePoints.Clear();
            //if (!IsPointsGenerated)
            Parts.Clear();
            if (this.Points != null && this.SeriesContainer != null)
            {
                CalculateMinAndMax();
                OpenOffPoints  = new PointCollection();
                CloseOffPoints = new PointCollection();
                ChartPoint oldPoint = new ChartPoint()
                {
                    XValue = double.MinValue, YValue = double.MinValue
                };
                IntializePoints();
                int   index            = 0;
                Point startAndEndPoint = CalculateSeriesInfo();
                foreach (ChartPoint point in this.Points)
                {
                    if (CheckValuePoint(oldPoint, point))
                    {
                        Point highPoint     = NormalizePoint(new Point(point.XValue, point.YValue));
                        Point lowPoint      = NormalizePoint(new Point(lowPoints[index].XValue, lowPoints[index].YValue));
                        Point openPoint     = NormalizePoint(new Point(openPoints[index].XValue - startAndEndPoint.X / 4, openPoints[index].YValue));
                        Point closePoint    = NormalizePoint(new Point(closePoints[index].XValue + startAndEndPoint.X / 4, closePoints[index].YValue));
                        Point openOffPoint  = NormalizePoint(new Point(openPoints[index].XValue + startAndEndPoint.X / 4, openPoints[index].YValue));
                        Point closeOffPoint = NormalizePoint(new Point(closePoints[index].XValue - startAndEndPoint.X / 4, closePoints[index].YValue));
                        HighPoints.Add(highPoint);
                        LowPoints.Add(lowPoint);
                        OpenPoints.Add(openPoint);
                        ClosePoints.Add(closePoint);
                        OpenOffPoints.Add(openOffPoint);
                        CloseOffPoints.Add(closeOffPoint);
                        oldPoint = point;
                    }
                    index++;
                }
                if (this.RenderingMode == RenderingMode.Default)
                {
                    //if (!IsPointsGenerated)
                    {
                        StrokeThickness = HighPoints.Count > 3 ? NormalizePoint(new Point(1, 0)).X / (HighPoints.Count) : 30;
                        for (int i = 0; i < this.HighPoints.Count; i++)
                        {
                            BarErrorPart barErrorPart = new BarErrorPart(this.HighPoints[i], this.LowPoints[i], this.ClosePoints[i], this.CloseOffPoints[i], this.OpenPoints[i], this.OpenOffPoints[i], HighValues[i], ErrorValues[i], Chart.ActualCategoryValues[i]);
                            if (this.openPoints[i].YValue <= this.closePoints[i].YValue)
                            {
                                barErrorPart.IsBearfill = true;
                            }
                            else
                            {
                                barErrorPart.IsBearfill = false;
                            }
                            SetBindingForStrokeandStrokeThickness(barErrorPart);

                            this.Parts.Add(barErrorPart);
                        }
                        IsPointsGenerated = true;
                    }
                    //else
                    //{

                    //int i = 0;
                    //foreach (BarErrorPart part in this.Parts)
                    //{
                    //    part.Point1 = this.HighPoints[i];
                    //    part.Point2 = this.LowPoints[i];
                    //    part.Point3 = this.ClosePoints[i];
                    //    part.Point4 = this.CloseOffPoints[i];
                    //    part.Point5 = this.OpenPoints[i];
                    //    part.Point6 = this.OpenOffPoints[i];
                    //    part.Mean =  HighValues[i];
                    //    part.Error = ErrorValues[i];
                    //    part.XName = Chart.ActualCategoryValues[i];
                    //    part.Refresh();

                    //    i++;
                    //  }
                    //}
                }
            }
            else
            {
                Parts.Clear();
            }
            if (this.SeriesContainer != null)
            {
                this.SeriesContainer.Invalidate();
            }
            IsRefreshed = false;
            //Refresh();
        }
 /// <summary>
 /// Generates the datas.
 /// </summary>
 public override void GenerateDatas()
 {
     LowPoints.Clear();
     HighPoints.Clear();
     OpenPoints.Clear();
     ClosePoints.Clear();
     if (!IsPointsGenerated)
     {
         Parts.Clear();
     }
     if (this.Points != null && this.SeriesContainer != null)
     {
         CalculateMinAndMax();
         OpenOffPoints  = new PointCollection();
         CloseOffPoints = new PointCollection();
         ChartPoint oldPoint = new ChartPoint()
         {
             XValue = double.MinValue, YValue = double.MinValue
         };
         IntializePoints();
         int   index            = 0;
         Point startAndEndPoint = CalculateSeriesInfo();
         foreach (ChartPoint point in this.Points)
         {
             if (CheckValuePoint(oldPoint, point))
             {
                 Point highPoint     = NormalizePoint(new Point(point.XValue, point.YValue));
                 Point lowPoint      = NormalizePoint(new Point(lowPoints[index].XValue, lowPoints[index].YValue));
                 Point openPoint     = NormalizePoint(new Point(openPoints[index].XValue, openPoints[index].YValue));
                 Point closePoint    = NormalizePoint(new Point(closePoints[index].XValue, closePoints[index].YValue));
                 Point openOffPoint  = NormalizePoint(new Point(openPoints[index].XValue + startAndEndPoint.X, openPoints[index].YValue));
                 Point closeOffPoint = NormalizePoint(new Point(closePoints[index].XValue - startAndEndPoint.X, closePoints[index].YValue));
                 HighPoints.Add(highPoint);
                 LowPoints.Add(lowPoint);
                 OpenPoints.Add(openPoint);
                 ClosePoints.Add(closePoint);
                 OpenOffPoints.Add(openOffPoint);
                 CloseOffPoints.Add(closeOffPoint);
                 oldPoint = point;
             }
             index++;
         }
         if (this.RenderingMode == RenderingMode.Default)
         {
             if (!IsPointsGenerated)
             {
                 for (int i = 0; i < this.HighPoints.Count; i++)
                 {
                     HiLoOpenClosePart hiLoOpenClosePart = new HiLoOpenClosePart(this.HighPoints[i], this.LowPoints[i], this.ClosePoints[i], this.CloseOffPoints[i], this.OpenPoints[i], this.OpenOffPoints[i]);
                     if (this.openPoints[i].YValue <= this.closePoints[i].YValue)
                     {
                         hiLoOpenClosePart.IsBearfill = true;
                     }
                     else
                     {
                         hiLoOpenClosePart.IsBearfill = false;
                     }
                     SetBindingForStrokeandStrokeThickness(hiLoOpenClosePart);
                     this.Parts.Add(hiLoOpenClosePart);
                 }
                 IsPointsGenerated = true;
             }
             else
             {
                 int i = 0;
                 foreach (HiLoOpenClosePart part in this.Parts)
                 {
                     part.Point1 = this.HighPoints[i];
                     part.Point2 = this.LowPoints[i];
                     part.Point3 = this.ClosePoints[i];
                     part.Point4 = this.CloseOffPoints[i];
                     part.Point5 = this.OpenPoints[i];
                     part.Point6 = this.OpenOffPoints[i];
                     part.Refresh();
                     i++;
                 }
             }
         }
     }
     else
     {
         Parts.Clear();
     }
     if (this.SeriesContainer != null)
     {
         this.SeriesContainer.Invalidate();
     }
     IsRefreshed = false;
 }
 /// <summary>
 /// Generates the datas.
 /// </summary>
 override public void GenerateDatas()
 {
     LowPoints.Clear();
     HighPoints.Clear();
     if (!IsPointsGenerated)
     {
         Parts.Clear();
     }
     if (Points != null && SeriesContainer != null)
     {
         CalculateMinAndMax();
         ChartPoint oldPoint = new ChartPoint {
             XValue = double.MinValue, YValue = double.MinValue
         };
         IntializePoints();
         int index = 0;
         foreach (ChartPoint point in Points)
         {
             if (CheckValuePoint(oldPoint, point))
             {
                 Point highPoint = NormalizePoint(new Point(point.XValue, point.YValue));
                 Point lowPoint  = NormalizePoint(new Point(lowPoints[index].XValue, lowPoints[index].YValue));
                 HighPoints.Add(highPoint);
                 LowPoints.Add(lowPoint);
                 oldPoint = point;
             }
             index++;
         }
         if (RenderingMode == RenderingMode.Default)
         {
             if (!IsPointsGenerated)
             {
                 for (int i = 0; i < HighPoints.Count; i++)
                 {
                     LinePart linePart = new LinePart(HighPoints[i], LowPoints[i]);
                     SetBindingForStrokeandStrokeThickness(linePart);
                     Parts.Add(linePart);
                 }
                 IsPointsGenerated = true;
             }
             else
             {
                 int i = 0;
                 foreach (LinePart part in Parts)
                 {
                     part.X1 = HighPoints[i].X;
                     part.Y1 = HighPoints[i].Y;
                     part.X2 = LowPoints[i].X;
                     part.Y2 = LowPoints[i].Y;
                     part.Refresh();
                     i++;
                 }
             }
         }
     }
     else
     {
         Parts.Clear();
     }
     if (this.SeriesContainer != null)
     {
         this.SeriesContainer.Invalidate();
     }
     IsRefreshed = false;
 }