Exemplo n.º 1
0
        /// <summary>
        /// Sets the binding for strokeand stroke thickness.
        /// </summary>
        /// <param name="part">The part.</param>
        protected override void SetBindingForStrokeandStrokeThickness(SeriesPartBase part)
        {
            BarErrorPart barErrorPart  = part as BarErrorPart;
            Binding      strokeBinding = new Binding {
                Source = this
            };

            if (barErrorPart.IsBearfill)
            {
                strokeBinding.Path = new PropertyPath("BearFill");
            }
            else
            {
                strokeBinding.Path = new PropertyPath("BullFill");
            }
            Binding strokeThicknessBinding = new Binding {
                Path = new PropertyPath("StrokeThickness"), Source = this
            };

            part.SetBinding(SeriesPartBase.StrokeProperty, strokeBinding);
            part.SetBinding(SeriesPartBase.StrokeThicknessProperty, strokeThicknessBinding);
        }
Exemplo n.º 2
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();
        }