Пример #1
0
        private void UpdateLabels(RadSize availableSize)
        {
            RadRect availableRect = new RadRect(availableSize.Width, availableSize.Height);
            RadRect ellipseRect   = RadRect.ToSquare(availableRect, false);

            ellipseRect = RadRect.CenterRect(ellipseRect, availableRect);
            double   radius = ellipseRect.Width / 2;
            RadPoint center = ellipseRect.Center;
            RadPoint arcPosition;

            foreach (AxisLabelModel label in this.owner.labels)
            {
                if (!label.isVisible)
                {
                    continue;
                }

                double angle = this.owner.IsInverse ? 360 - (double)label.normalizedPosition * 360 : (double)label.normalizedPosition * 360;
                arcPosition = RadMath.GetArcPoint(angle, center, radius);

                this.UpdateMargins(ellipseRect, label.desiredSize, arcPosition);
            }

            double offset = this.owner.LineThickness + this.owner.MajorTickLength;

            this.margins.Left   += offset;
            this.margins.Top    += offset;
            this.margins.Right  += offset;
            this.margins.Bottom += offset;
        }
Пример #2
0
        protected override RadRect ArrangeAxes(RadRect rect)
        {
            IRadialAxis angleAxis = this.primarySecondAxis as IRadialAxis;

            if (angleAxis == null)
            {
                throw new InvalidOperationException("AngleAxis of a polar chart area must be radial.");
            }

            RadRect ellipseRect = RadRect.ToSquare(rect, false);

            ellipseRect = RadRect.CenterRect(ellipseRect, rect);
            RadSize ellipseSize = new RadSize(ellipseRect.Width, ellipseRect.Height);
            RadRect remaining   = ellipseRect;

            // Measure the second (radial) axis first; it will inflate the plot area
            this.primarySecondAxis.Measure(ellipseSize);
            this.primarySecondAxis.Arrange(ellipseRect);

            RadThickness margins = this.primarySecondAxis.desiredMargin;

            remaining.X      += margins.Left;
            remaining.Y      += margins.Top;
            remaining.Width  -= margins.Left + margins.Right;
            remaining.Height -= margins.Top + margins.Bottom;

            remaining = RadRect.ToSquare(remaining, false);
            remaining = RadRect.CenterRect(remaining, ellipseRect);

            this.primaryFirstAxis.Measure(ellipseSize);
            this.primaryFirstAxis.Arrange(remaining);

            return(remaining);
        }