Beispiel #1
0
        /// <summary>
        /// Calculate grid points for circular chart
        /// </summary>
        /// <param name="radius"></param>
        /// <param name="center"></param>
        /// <param name="spikesCount"></param>
        /// <returns></returns>
        private List <Point> GetGridPoints4Radar(Double radius, Point center, Double spikesCount)
        {
            Double startAngle = -Math.PI / 2;

            Double actualAngle = startAngle;

            Int32 nextIteration = 1;

            Double minAngle = 0;

            List <Point> points = new List <Point>();

            Double minAngleInDegree = 360 / spikesCount;

            for (Int32 i = 0; i < spikesCount; i++)
            {
                Double x = radius * Math.Cos(actualAngle) + center.X;
                Double y = radius * Math.Sin(actualAngle) + center.Y;

                points.Add(new Point(x, y));

                minAngle    = minAngleInDegree * nextIteration++;
                actualAngle = AxisLabel.GetRadians(minAngle) - (Math.PI / 2);
            }

            return(points);
        }
Beispiel #2
0
        /// <summary>
        /// Get point for Radar
        /// </summary>
        /// <param name="circularPlotDetails"></param>
        /// <param name="plotGroup"></param>
        /// <param name="dp"></param>
        /// <param name="dataPointIndex"></param>
        /// <returns></returns>
        private static Point GetRadarPoint(CircularPlotDetails circularPlotDetails, PlotGroup plotGroup, DataPoint dp, Double dataPointIndex)
        {
            Double yValue;

            if (Double.IsNaN(dp.InternalYValue))
            {
                yValue = 0;
            }
            else
            {
                yValue = dp.InternalYValue;
            }

            Double yPosition = Graphics.ValueToPixelPosition(circularPlotDetails.Radius, 0, plotGroup.AxisY.InternalAxisMinimum, plotGroup.AxisY.InternalAxisMaximum, yValue);

            Double radius = circularPlotDetails.Radius - yPosition;

            Double minAngle    = circularPlotDetails.MinAngleInDegree * dataPointIndex;
            Double actualAngle = AxisLabel.GetRadians(minAngle) - (Math.PI / 2);

            Double x = radius * Math.Cos(actualAngle) + circularPlotDetails.Center.X;
            Double y = radius * Math.Sin(actualAngle) + circularPlotDetails.Center.Y;

            return(new Point(x, y));
        }
Beispiel #3
0
        /// <summary>
        /// Calculate AxisX points for Circular chart
        /// </summary>
        /// <param name="width"></param>
        /// <param name="height"></param>
        /// <param name="axisX"></param>
        /// <param name="maxDataPointsCount"></param>
        internal void CalculateAxisXLabelsPoints4Polar(Double width, Double height, Boolean isAxisLabelsEnabled, List<Double> angles, Double minValue, Double maxValue)
        {
            Double radius = Math.Min(width, height) / 2;

            Double reducedPercent = 10;
            if (isAxisLabelsEnabled)
                reducedPercent = 20;

            Radius = radius - (radius * reducedPercent / 100);

            Center = new Point(width / 2, height / 2);

            AnglesInRadian = new List<Double>();

            Double minValInRadian;

            if (minValue != 0)
                minValInRadian = AxisLabel.GetRadians(minValue - 90);
            else
                minValInRadian = 2 * Math.PI - Math.PI / 2;

            Double minAngle = Graphics.ValueToPixelPosition(minValInRadian, 2 * Math.PI + minValInRadian, AxisLabel.GetRadians(minValue), AxisLabel.GetRadians(maxValue), AxisLabel.GetRadians(minValue));
            MinAngleInDegree = minAngle * 180 / Math.PI;

            for (Int32 i = 0; i < angles.Count; i++)
            {
                Double actualAngle = Graphics.ValueToPixelPosition(minValInRadian, 2 * Math.PI + minValInRadian, AxisLabel.GetRadians(minValue), AxisLabel.GetRadians(maxValue), AxisLabel.GetRadians(angles[i]));

                Double x = Radius * Math.Cos(actualAngle) + Center.X;
                Double y = Radius * Math.Sin(actualAngle) + Center.Y;

                ListOfPoints4CircularAxis.Add(new Point(x, y));
                AnglesInRadian.Add(actualAngle);
            }
        }
        /// <summary>
        /// Calculate AxisX points for Circular chart
        /// </summary>
        /// <param name="width"></param>
        /// <param name="height"></param>
        /// <param name="axisX"></param>
        /// <param name="maxDataPointsCount"></param>
        internal void CalculateAxisXLabelsPoints4Radar(Double width, Double height, Boolean isAxisLabelsEnabled, Int32 maxDataPointsCount)
        {
            Int32  noOfSpikes = maxDataPointsCount;
            Double startAngle = -Math.PI / 2;

            Double actualAngle = startAngle;

            Int32 nextIteration = 1;

            Double minAngle = 0;

            Double radius = Math.Min(width, height) / 2;

            Double reducedPercent = 10;

            if (isAxisLabelsEnabled)
            {
                reducedPercent = 20;
            }

            Radius = radius - (radius * reducedPercent / 100);

            Center = new Point(width / 2, height / 2);

            //ListOfPoints4CircularAxis = new List<Point>();
            AnglesInRadian = new List <Double>();

            MinAngleInDegree = 360.0 / noOfSpikes;

            for (Int32 i = 0; i < noOfSpikes; i++)
            {
                Double x = Radius * Math.Cos(actualAngle) + Center.X;
                Double y = Radius * Math.Sin(actualAngle) + Center.Y;

                ListOfPoints4CircularAxis.Add(new Point(x, y));
                AnglesInRadian.Add(actualAngle);

                minAngle    = MinAngleInDegree * nextIteration++;
                actualAngle = AxisLabel.GetRadians(minAngle) - (Math.PI / 2);
            }
        }
Beispiel #5
0
        /// <summary>
        /// Get point for Polar
        /// </summary>
        /// <param name="circularPlotDetails"></param>
        /// <param name="plotGroup"></param>
        /// <param name="dp"></param>
        /// <returns></returns>
        private static Point GetPolarPoint(CircularPlotDetails circularPlotDetails, PlotGroup plotGroup, DataPoint dp)
        {
            Double yValue = dp.InternalYValue;

            Double yPosition = Graphics.ValueToPixelPosition(circularPlotDetails.Radius, 0, plotGroup.AxisY.InternalAxisMinimum, plotGroup.AxisY.InternalAxisMaximum, yValue);

            Double radius = circularPlotDetails.Radius - yPosition;

            Axis axisX = plotGroup.AxisX;

            Double minValInRadian;

            if (axisX.InternalAxisMinimum != 0)
            {
                minValInRadian = AxisLabel.GetRadians(axisX.InternalAxisMinimum - 90);
            }
            else
            {
                minValInRadian = 2 * Math.PI - Math.PI / 2;
            }

            Double actualAngle;

            if (dp.Parent.XValueType == ChartValueTypes.Time)
            {
                actualAngle = Graphics.ValueToPixelPosition(minValInRadian, 2 * Math.PI + minValInRadian, AxisLabel.GetRadians(0), AxisLabel.GetRadians(360), AxisLabel.GetRadians(dp.InternalXValue));
            }
            else
            {
                actualAngle = Graphics.ValueToPixelPosition(minValInRadian, 2 * Math.PI + minValInRadian, AxisLabel.GetRadians(axisX.InternalAxisMinimum), AxisLabel.GetRadians(axisX.InternalAxisMaximum), AxisLabel.GetRadians(axisX.InternalAxisMinimum + dp.InternalXValue));
            }

            Double x = radius * Math.Cos(actualAngle) + circularPlotDetails.Center.X;
            Double y = radius * Math.Sin(actualAngle) + circularPlotDetails.Center.Y;

            return(new Point(x, y));
        }