Example #1
0
        private NumericalAxisPlotInfo CreateAxisPlotInfo(double delta, double doubleValue)
        {
            NumericalAxisPlotInfo plotInfo;
            double normalizedValue;

            if (delta == 0)
            {
                normalizedValue = 0;
            }
            else
            {
                normalizedValue = (doubleValue - this.actualRange.minimum) / delta;
            }

            if (this.IsInverse)
            {
                plotInfo = NumericalAxisPlotInfo.Create(this, 1 - this.normalizedOrigin, 1 - normalizedValue, 1 - this.normalizedOrigin);
            }
            else
            {
                plotInfo = NumericalAxisPlotInfo.Create(this, this.normalizedOrigin, normalizedValue, this.normalizedOrigin);
            }

            plotInfo.SnapTickIndex = this.GetSnapTickIndex(doubleValue);

            return(plotInfo);
        }
        protected override RadRect ArrangeCore(RadRect rect)
        {
            double       radius    = rect.Width / 2;
            RadPoint     center    = rect.Center;
            AxisPlotInfo anglePlot = this.plotInfo;
            double       angle     = 0d;

            NumericalAxisPlotInfo numericalAnglePlot = anglePlot as NumericalAxisPlotInfo;

            if (numericalAnglePlot != null)
            {
                angle = numericalAnglePlot.ConvertToAngle();
            }
            else
            {
                CategoricalAxisPlotInfo categoricalAnglePlot = anglePlot as CategoricalAxisPlotInfo;
                if (categoricalAnglePlot != null)
                {
                    angle = categoricalAnglePlot.ConvertToAngle(this.GetChartArea <PolarChartAreaModel>());
                }
            }

            RadPoint arcPoint = RadMath.GetArcPoint(angle, center, radius);

            this.radialLine = new RadPolarVector()
            {
                Point = arcPoint, Angle = angle, Center = center
            };

            return(new RadRect(center, arcPoint));
        }
Example #3
0
        protected override RadRect ArrangeCore(RadRect rect)
        {
            double   radius = rect.Width / 2;
            RadPoint center = rect.Center;
            NumericalAxisPlotInfo polarPlot = this.firstPlotInfo as NumericalAxisPlotInfo;
            double       pointRadius        = polarPlot.NormalizedValue * radius;
            AxisPlotInfo anglePlot          = this.secondPlotInfo;

            this.angle = 0d;

            NumericalAxisPlotInfo numericalAnglePlot = anglePlot as NumericalAxisPlotInfo;

            if (numericalAnglePlot != null)
            {
                this.angle = numericalAnglePlot.ConvertToAngle();
            }
            else
            {
                CategoricalAxisPlotInfo categoricalAnglePlot = anglePlot as CategoricalAxisPlotInfo;
                if (categoricalAnglePlot != null)
                {
                    this.angle = categoricalAnglePlot.ConvertToAngle(this.GetChartArea <PolarChartAreaModel>());
                }
            }

            RadPoint arcPosition = RadMath.GetArcPoint(this.angle, center, pointRadius);
            RadSize  desiredSize = this.Measure();

            return(new RadRect(arcPosition.X, arcPosition.Y, desiredSize.Width, desiredSize.Height));
        }
        protected override RadRect ArrangeCore(RadRect rect)
        {
            double   radius = rect.Width / 2;
            RadPoint center = rect.Center;
            double   normalizedValue1, normalizedValue2;

            var annotationPresenter = this.presenter as PolarAxisPlotBandAnnotation;

            NumericalAxisPlotInfo polarPlot1 = this.firstPlotInfo as NumericalAxisPlotInfo;
            NumericalAxisPlotInfo polarPlot2 = this.secondPlotInfo as NumericalAxisPlotInfo;

            normalizedValue1 = polarPlot1.NormalizedValue;
            normalizedValue2 = polarPlot2.NormalizedValue;

            if (annotationPresenter != null && annotationPresenter.ClipToPlotArea)
            {
                if (normalizedValue1 > 1 && normalizedValue2 > 1)
                {
                    // annotation should not be visualized
                    this.circle1 = new RadCircle();
                    this.circle2 = new RadCircle();
                    return(new RadRect());
                }
                else
                {
                    normalizedValue1 = Math.Min(1, polarPlot1.NormalizedValue);
                    normalizedValue2 = Math.Min(1, polarPlot2.NormalizedValue);
                }
            }

            this.circle1 = new RadCircle(center, normalizedValue1 * radius);
            this.circle2 = new RadCircle(center, normalizedValue2 * radius);

            return(rect);
        }
Example #5
0
        protected override RadRect ArrangeCore(RadRect rect)
        {
            this.radius = rect.Width / 2;
            RadPoint center = rect.Center;

            AxisPlotInfo anglePlot1 = this.firstPlotInfo;
            double       angle1     = 0d;

            NumericalAxisPlotInfo numericalAnglePlot1 = anglePlot1 as NumericalAxisPlotInfo;

            if (numericalAnglePlot1 != null)
            {
                angle1 = numericalAnglePlot1.ConvertToAngle();
            }
            else
            {
                CategoricalAxisPlotInfo categoricalAnglePlot1 = anglePlot1 as CategoricalAxisPlotInfo;
                if (categoricalAnglePlot1 != null)
                {
                    angle1 = categoricalAnglePlot1.ConvertToAngle(this.GetChartArea <PolarChartAreaModel>());
                }
            }

            RadPoint arcPoint1 = RadMath.GetArcPoint(angle1, center, this.radius);

            this.polarVector1 = new RadPolarVector()
            {
                Point = arcPoint1, Angle = angle1, Center = center
            };

            AxisPlotInfo anglePlot2 = this.secondPlotInfo;
            double       angle2     = 0d;

            NumericalAxisPlotInfo numericalAnglePlot2 = anglePlot2 as NumericalAxisPlotInfo;

            if (numericalAnglePlot2 != null)
            {
                angle2 = numericalAnglePlot2.ConvertToAngle();
            }
            else
            {
                CategoricalAxisPlotInfo categoricalAnglePlot2 = anglePlot2 as CategoricalAxisPlotInfo;
                if (categoricalAnglePlot2 != null)
                {
                    angle2 = categoricalAnglePlot2.ConvertToAngle(this.GetChartArea <PolarChartAreaModel>());
                }
            }

            RadPoint arcPoint2 = RadMath.GetArcPoint(angle2, center, this.radius);

            this.polarVector2 = new RadPolarVector()
            {
                Point = arcPoint2, Angle = angle2, Center = center
            };

            return(rect);
        }
        protected override RadRect ArrangeCore(RadRect rect)
        {
            double   radius = rect.Width / 2;
            RadPoint center = rect.Center;
            NumericalAxisPlotInfo polarPlot = this.plotInfo as NumericalAxisPlotInfo;
            double pointRadius = polarPlot.NormalizedValue * radius;

            this.polarLine = new RadCircle(center, pointRadius);

            return(this.polarLine.Bounds);
        }
        public static NumericalAxisPlotInfo Create(AxisModel axis, double plotOffset, double value, double origin)
        {
            NumericalAxisPlotInfo info = new NumericalAxisPlotInfo();

            info.Axis             = axis;
            info.PlotOriginOffset = plotOffset;
            info.NormalizedValue  = value;
            info.NormalizedOrigin = origin;

            return(info);
        }
Example #8
0
        internal override void SetValueFromAxis(AxisModel axis, object value)
        {
            NumericalAxisPlotInfo plot = value as NumericalAxisPlotInfo;

            if (axis.type == AxisType.First)
            {
                this.xPlot = plot;
            }
            else
            {
                this.yPlot = plot;
            }
        }
Example #9
0
        internal override void SetValueFromAxis(AxisModel axis, object newValue)
        {
            NumericalAxisPlotInfo plotInfo = newValue as NumericalAxisPlotInfo;

            if (axis.type == AxisType.First)
            {
                this.valuePlot = plotInfo;
            }
            else
            {
                this.anglePlot = plotInfo;
            }
        }
Example #10
0
        internal override RadPoint ConvertDataToPoint(Tuple <object, object> data)
        {
            var pointRadius = double.NaN;

            if (this.primaryFirstAxis != null && this.primaryFirstAxis.isUpdated)
            {
                NumericalAxisPlotInfo plotInfo = this.primaryFirstAxis.CreatePlotInfo(data.Item1) as NumericalAxisPlotInfo;
                if (plotInfo != null)
                {
                    double radius = this.plotArea.layoutSlot.Width / 2;
                    pointRadius = plotInfo.NormalizedValue * radius;
                }
            }

            var pointAngle = double.NaN;

            if (this.primarySecondAxis != null && this.primarySecondAxis.isUpdated)
            {
                if (this.primarySecondAxis is CategoricalAxisModel)
                {
                    CategoricalAxisPlotInfo categoricalPlotInfo = this.primarySecondAxis.CreatePlotInfo(data.Item2) as CategoricalAxisPlotInfo;
                    if (categoricalPlotInfo != null)
                    {
                        pointAngle = categoricalPlotInfo.ConvertToAngle(this);
                    }
                }
                else
                {
                    NumericalAxisPlotInfo numericalPlotInfo = this.primarySecondAxis.CreatePlotInfo(data.Item2) as NumericalAxisPlotInfo;
                    if (numericalPlotInfo != null)
                    {
                        pointAngle = numericalPlotInfo.ConvertToAngle();
                    }
                }
            }

            return(RadMath.GetArcPoint(pointAngle, this.plotArea.layoutSlot.Center, pointRadius));
        }
Example #11
0
        private void PlotCombineGroup(CombineGroup group, StackValueProcessor stackValueProcessor)
        {
            double plotPositionPositiveStack, plotPositionNegativeStack;
            double value, plotOriginOffset, normalizedValue;

            double stackSum;
            double valuesSum;
            double delta = this.actualRange.maximum - this.actualRange.minimum;

            foreach (CombineStack stack in group.Stacks)
            {
                double positiveValuesSum = 0d, negativeValuesSum = 0d;
                valuesSum = 0d;
                plotPositionPositiveStack = plotPositionNegativeStack = this.normalizedOrigin;

                foreach (DataPoint point in stack.Points)
                {
                    if (point.isEmpty)
                    {
                        continue;
                    }

                    value = (double)point.GetValueForAxis(this);

                    if (value >= DefaultOrigin)
                    {
                        valuesSum        = positiveValuesSum;
                        plotOriginOffset = plotPositionPositiveStack;
                    }
                    else
                    {
                        valuesSum        = negativeValuesSum;
                        plotOriginOffset = plotPositionNegativeStack;
                    }

                    valuesSum += double.IsNaN(value) ? 0d : value;

                    // TODO: Remove insignificant datapoints from drawing stack.
                    stackSum = this.TransformValue(stackValueProcessor(stack, valuesSum));

                    if (delta == 0)
                    {
                        normalizedValue = 0;
                    }
                    else
                    {
                        normalizedValue = (stackSum - this.actualRange.minimum) / delta;
                    }

                    NumericalAxisPlotInfo plotInfo;
                    if (this.IsInverse)
                    {
                        plotInfo = NumericalAxisPlotInfo.Create(this, 1 - plotOriginOffset, 1 - normalizedValue, 1 - this.normalizedOrigin);
                    }
                    else
                    {
                        plotInfo = NumericalAxisPlotInfo.Create(this, plotOriginOffset, normalizedValue, this.normalizedOrigin);
                    }

                    plotInfo.SnapTickIndex = this.GetSnapTickIndex(stackSum);
                    point.SetValueFromAxis(this, plotInfo);

                    if (value >= DefaultOrigin)
                    {
                        positiveValuesSum         = valuesSum;
                        plotPositionPositiveStack = normalizedValue;
                    }
                    else
                    {
                        negativeValuesSum         = valuesSum;
                        plotPositionNegativeStack = normalizedValue;
                    }
                }
            }
        }