예제 #1
0
 /// <summary>
 /// Defines the pyramid path
 /// </summary>
 /// <param name="y"></param>
 /// <param name="height"></param>
 /// <param name="explodedOffset"></param>
 /// <param name="series"></param>
 /// <param name="isExploded"></param>
 public PyramidSegment(double y, double height, double explodedOffset, PyramidSeries series, bool isExploded)
 {
     base.Series         = series;
     this.y              = y;
     this.height         = height;
     this.isExploded     = isExploded;
     this.explodedOffset = explodedOffset;
 }
예제 #2
0
        private static void OnPyramidModeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            PyramidSeries pyramidSeries = d as PyramidSeries;

            if (pyramidSeries != null && pyramidSeries.Area != null)
            {
                pyramidSeries.Area.ScheduleUpdate();
            }
        }
예제 #3
0
        /// <summary>
        /// Updates the segments based on its data point value. This method is not
        /// intended to be called explicitly outside the Chart but it can be overriden by
        /// any derived class.
        /// </summary>
        /// <param name="transformer">Reresents the view port of chart control.(refer <see cref="IChartTransformer"/>)</param>
        public override void Update(IChartTransformer transformer)
        {
            if (!this.IsSegmentVisible)
            {
                segmentPath.Visibility = Visibility.Collapsed;
            }
            else
            {
                segmentPath.Visibility = Visibility.Visible;
            }

            Rect          rect   = new Rect(0, 0, transformer.Viewport.Width, transformer.Viewport.Height);
            PyramidSeries series = Series as PyramidSeries;

            if (rect.IsEmpty)
            {
                this.segmentPath.Data = null;
            }
            else
            {
                if (this.isExploded)
                {
                    rect.X += explodedOffset;
                }
                double     top          = y;
                double     bottom       = y + height;
                double     topRadius    = 0.5d * (1d - y);
                double     bottomRadius = 0.5d * (1d - bottom);
                PathFigure figure       = new PathFigure();
                figure.StartPoint = new Point(rect.X + topRadius * rect.Width, rect.Y + top * rect.Height);
                Linesegment lineSeg1 = new Linesegment();
                lineSeg1.Point = new Point(rect.X + (1 - topRadius) * rect.Width, rect.Y + top * rect.Height);
                figure.Segments.Add(lineSeg1);
                Linesegment lineSeg3 = new Linesegment();
                lineSeg3.Point = new Point(rect.X + (1 - bottomRadius) * rect.Width, rect.Y + bottom * rect.Height - series.StrokeThickness / 2);
                figure.Segments.Add(lineSeg3);
                Linesegment lineSeg4 = new Linesegment();
                lineSeg4.Point = new Point(rect.X + bottomRadius * rect.Width, rect.Y + bottom * rect.Height - series.StrokeThickness / 2);
                figure.Segments.Add(lineSeg4);
                figure.IsClosed              = true;
                this.segmentGeometry         = new PathGeometry();
                this.segmentGeometry.Figures = new PathFigureCollection()
                {
                    figure
                };
                segmentPath.Data = segmentGeometry;

                height = ((bottom - top) * rect.Height) / 2;
            }
        }