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 #2
0
        internal override void PlotCore(AxisUpdateContext context)
        {
            int count = this.categories.Count;

            if (count == 0)
            {
                return;
            }

            double step = this.CalculateRelativeStep(count);

            double value  = 0;
            double gap    = this.GapLength * step;
            double length = step - gap;

            double offset = this.actualPlotMode == AxisPlotMode.OnTicks ? 0 : step / 2;
            double position;

            for (int i = 0; i < count; i++)
            {
                AxisCategory category = this.categories[i];
                position = this.IsInverse ? 1 - value - offset : value + offset;
                foreach (DataPoint point in category.Points)
                {
                    CategoricalAxisPlotInfo info = CategoricalAxisPlotInfo.Create(this, value);
                    info.CategoryKey = category.KeySource;
                    info.Position    = position;
                    info.Length      = length;

                    point.SetValueFromAxis(this, info);
                }

                value += step;
            }
        }
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));
        }
Example #4
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);
        }
Example #5
0
        public static CategoricalAxisPlotInfo Create(AxisModel axis, double value)
        {
            CategoricalAxisPlotInfo info = new CategoricalAxisPlotInfo();

            info.Axis          = axis;
            info.RangePosition = value;

            return(info);
        }
Example #6
0
        internal override void PlotCore(AxisUpdateContext context)
        {
            if (!this.CanPlot)
            {
                return;
            }

            decimal delta = this.plotInfo.Max - this.plotInfo.Min;

            if (delta == 0)
            {
                Debug.Assert(false, "Invalid plot pass.");
                return;
            }

            decimal pointPosition, timeSlotPosition, timeSlotLength;
            decimal pointSlotLength;
            decimal extend = this.plotInfo.Extend / 2;

            bool uniform = this.PlotStretch == DateTimePlotStretchMode.Uniform;

            foreach (DateTimePoint value in this.values)
            {
                if (value.Slot == null)
                {
                    // We want to run the tests in both Debug and Release modes.
                    this.ThrowNoTimeSlotException();
                    continue;
                }

                decimal pointTicks = value.Date.Ticks;

                pointPosition    = (pointTicks - this.plotInfo.Min + extend) / delta;
                timeSlotLength   = value.Slot.Ticks / delta;
                timeSlotPosition = pointPosition - (timeSlotLength / 2);

                if (uniform)
                {
                    int pointCount = (value.Point.parent as ChartSeriesModel).DataPointsInternal.Count;
                    pointSlotLength = (1m - this.gapLength) / pointCount;
                }
                else
                {
                    pointSlotLength = (1m - this.gapLength) * timeSlotLength;
                }

                CategoricalAxisPlotInfo currentPlotInfo = CategoricalAxisPlotInfo.Create(this, (double)timeSlotPosition);
                currentPlotInfo.CategoryKey = value.Date;
                currentPlotInfo.Position    = this.IsInverse ? 1 - (double)pointPosition : (double)pointPosition;
                currentPlotInfo.Length      = (double)pointSlotLength;

                value.Point.SetValueFromAxis(this, currentPlotInfo);
            }
        }
        public override void Plot(CombinedSeries series, int combinedSeriesCount)
        {
            double groupPosition;
            double groupLength;
            double groupStartPosition;
            double stackPosition;
            double stackLength;
            double stackStartPosition;

            foreach (CombineGroup group in series.Groups)
            {
                CategoricalDataPointBase firstPoint = group.Stacks[0].Points[0] as CategoricalDataPointBase;
                CategoricalAxisPlotInfo  plotInfo   = firstPoint.categoricalPlot;
                if (plotInfo == null)
                {
                    continue;
                }

                groupLength = plotInfo.Length / combinedSeriesCount;
                stackLength = groupLength / group.Stacks.Count;

                groupStartPosition = plotInfo.Position - plotInfo.Length / 2;
                groupPosition      = groupStartPosition + groupLength / 2 + (series.CombineIndex * groupLength);

                stackStartPosition = groupPosition - groupLength / 2;
                stackPosition      = stackStartPosition + stackLength / 2;

                foreach (CombineStack stack in group.Stacks)
                {
                    foreach (CategoricalDataPointBase point in stack.Points)
                    {
                        plotInfo = point.categoricalPlot;
                        if (plotInfo != null)
                        {
                            plotInfo.Position = stackPosition;
                            plotInfo.Length   = stackLength;
                        }
                    }

                    stackPosition += stackLength;
                }
            }
        }
Example #8
0
        internal override AxisPlotInfo CreatePlotInfo(object value)
        {
            DateTime date;

            if (!DateTimeHelper.TryGetDateTime(value, out date) || this.plotInfo == null)
            {
                return(base.CreatePlotInfo(value));
            }

            decimal delta         = this.plotInfo.Max - this.plotInfo.Min;
            decimal extend        = this.plotInfo.Extend / 2;
            decimal pointTicks    = date.Ticks;
            decimal pointPosition = (pointTicks - this.plotInfo.Min + extend) / delta;

            CategoricalAxisPlotInfo info = CategoricalAxisPlotInfo.Create(this, (double)pointPosition);

            info.CategoryKey = date;
            info.Position    = this.IsInverse ? (double)(1 - pointPosition) : (double)pointPosition;

            return(info);
        }
Example #9
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 #10
0
        internal override AxisPlotInfo CreatePlotInfo(object value)
        {
            for (int index = 0; index < this.categories.Count; index++)
            {
                AxisCategory category = this.categories[index];
                if (object.Equals(category.KeySource, value))
                {
                    double step        = this.CalculateRelativeStep(this.categories.Count);
                    double gap         = this.GapLength * step;
                    double length      = step - gap;
                    double valueLength = index * step;
                    double offset      = this.actualPlotMode == AxisPlotMode.OnTicks ? 0 : step / 2;

                    CategoricalAxisPlotInfo info = CategoricalAxisPlotInfo.Create(this, valueLength);
                    info.CategoryKey = value;
                    info.Position    = this.IsInverse ? 1 - valueLength - offset : valueLength + offset;
                    info.Length      = length;

                    return(info);
                }
            }

            return(null);
        }