Exemple #1
0
        /// <summary>
        /// Converts the specified data point coordinates to physical coordinates (in pixels) using the primary chart axes (if any).
        /// </summary>
        /// <param name="data">The data point coordinates according to the primary chart axes (if any).</param>
        public Point ConvertDataToPoint(Tuple <object, object> data)
        {
            if (data == null)
            {
                return(new Point(double.NaN, double.NaN));
            }

            RadPoint coordinates = (this.chartArea as CartesianChartAreaModel).ConvertDataToPoint(data);

            return(coordinates.ToPoint());
        }
Exemple #2
0
        /// <summary>
        /// Converts the specified data point coordinates to physical coordinates (in pixels) using the specified chart axes.
        /// </summary>
        /// <param name="data">The data point coordinates according to the specified chart axes.</param>
        /// <param name="horizontalAxis">The horizontal axis.</param>
        /// <param name="verticalAxis">The vertical axis.</param>
        public Point ConvertDataToPoint(Tuple <object, object> data, Axis horizontalAxis, Axis verticalAxis)
        {
            if (data == null || horizontalAxis == null || verticalAxis == null)
            {
                return(new Point(double.NaN, double.NaN));
            }

            RadPoint coordinates = (this.chartArea as CartesianChartAreaModel).ConvertDataToPoint(data, horizontalAxis.model, verticalAxis.model);

            return(coordinates.ToPoint());
        }
Exemple #3
0
        public static Geometry RenderArc(DoughnutSegmentData context)
        {
            PathFigure figure = new PathFigure();

            figure.IsClosed = true;
            figure.IsFilled = true;

            RadPoint startPoint = RadMath.GetArcPoint(context.StartAngle, context.Center, context.Radius1);

            figure.StartPoint = startPoint.ToPoint();

            ArcSegment firstArc = new ArcSegment();

            firstArc.Size       = new Size(context.Radius1, context.Radius1);
            firstArc.IsLargeArc = context.SweepAngle > 180 || context.SweepAngle < -180;

            var angle = context.StartAngle;

            if (context.SweepDirection == SweepDirection.Clockwise)
            {
                angle += context.SweepAngle;
            }
            else
            {
                angle -= context.SweepAngle;
            }

            firstArc.SweepDirection = context.SweepAngle > 0 ? context.SweepDirection : context.SweepDirection ^ SweepDirection.Clockwise;

            firstArc.Point = RadMath.GetArcPoint(angle, context.Center, context.Radius1).ToPoint();
            figure.Segments.Add(firstArc);

            LineSegment firstLine = new LineSegment();

            firstLine.Point = RadMath.GetArcPoint(angle, context.Center, context.Radius2).ToPoint();
            figure.Segments.Add(firstLine);

            ArcSegment secondArc = new ArcSegment();

            secondArc.Size           = new Size(context.Radius2, context.Radius2);
            secondArc.IsLargeArc     = context.SweepAngle > 180 || context.SweepAngle < -180;
            secondArc.SweepDirection = context.SweepAngle > 0 ? context.SweepDirection ^ SweepDirection.Clockwise : context.SweepDirection;
            secondArc.Point          = RadMath.GetArcPoint(context.StartAngle, context.Center, context.Radius2).ToPoint();
            figure.Segments.Add(secondArc);

            PathGeometry geometry = new PathGeometry();

            geometry.Figures.Add(figure);

            return(geometry);
        }