/// <summary> /// Arranges the elements of the <see cref="ChartCartesianAxisPanel"/> /// </summary> /// <param name="finalSize">The Final Size</param> internal void ArrangeElements(Size finalSize) { if (Axis.AxisLayoutPanel is ChartPolarAxisLayoutPanel) { foreach (UIElement element in this.Children) { element.Arrange(new Rect(0, 0, finalSize.Width, finalSize.Height)); SetLeft(element, 0); SetTop(element, 0); } foreach (ILayoutCalculator layout in this.LayoutCalc) { layout.Arrange(finalSize); ChartPolarAxisLayoutPanel axisLayoutPanel = Axis.AxisLayoutPanel as ChartPolarAxisLayoutPanel; ChartCircularAxisPanel circularAxisPanel = layout as ChartCircularAxisPanel; axisLayoutPanel.Radius = circularAxisPanel.Radius; } } else { ArrangeCartesianElements(finalSize); } }
/// <summary> /// Computes the size of the <see cref="ChartCartesianAxisPanel"/>. /// </summary> /// <param name="availableSize">The Available Size</param> /// <returns>Returns the computed size.</returns> internal Size ComputeSize(Size availableSize) { Size size = Size.Empty; if (Axis.AxisLayoutPanel is ChartPolarAxisLayoutPanel) { foreach (UIElement element in this.Children) { element.Measure(availableSize); } (this.Children[0] as FrameworkElement).Visibility = Visibility.Collapsed;//Collapsing the visibility of polar/radar series X-Axis header foreach (ILayoutCalculator element in this.LayoutCalc) { element.Measure(availableSize); size = element.DesiredSize; ChartPolarAxisLayoutPanel axisLayoutPanel = Axis.AxisLayoutPanel as ChartPolarAxisLayoutPanel; ChartCircularAxisPanel circularAxisPanel = element as ChartCircularAxisPanel; axisLayoutPanel.Radius = circularAxisPanel.Radius; } } else { double horizontalPadding = 0; double verticalPadding = 0; double width = 0; double height = 0; double angle = 0d; //double.IsNaN(this.Axis.HeaderRotationAngle) ? 0d : this.Axis.HeaderRotationAngle; double direction = 1; if (Axis.headerContent != null) { Axis.headerContent.HorizontalAlignment = HorizontalAlignment.Center; Axis.headerContent.VerticalAlignment = VerticalAlignment.Center; if (Axis.Orientation == Orientation.Vertical) { direction = this.Axis.OpposedPosition ? 1 : -1; angle = direction * 90; var transform = new RotateTransform { Angle = angle }; Axis.headerContent.RenderTransform = transform; } else { Axis.headerContent.RenderTransform = null; } } foreach (UIElement element in this.Children) { bool isHeader = Axis.headerContent == element && this.Axis.Orientation == Orientation.Vertical; var measureSize = availableSize; if (isHeader) { measureSize.Width = Math.Max(availableSize.Width, element.DesiredSize.Width); measureSize.Height = Math.Max(availableSize.Height, element.DesiredSize.Height); } element.Measure(measureSize); if (element is SfChartResizableBar && Axis.EnableTouchMode) { continue; } width += isHeader ? element.DesiredSize.Height : element.DesiredSize.Width; height += isHeader ? element.DesiredSize.Width : element.DesiredSize.Height; } foreach (ILayoutCalculator element in LayoutCalc) { element.Measure(availableSize); if ((element is ChartCartesianAxisLabelsPanel && Axis.LabelsPosition == AxisElementPosition.Inside) || (element is ChartCartesianAxisElementsPanel && Axis.TickLinesPosition == AxisElementPosition.Inside)) { horizontalPadding += element.DesiredSize.Width; verticalPadding += element.DesiredSize.Height; } width += element.DesiredSize.Width; height += element.DesiredSize.Height; } // To measure the multi level labels panel if (Axis.MultiLevelLabels != null && Axis.MultiLevelLabels.Count > 0 && Axis.axisMultiLevelLabelsPanel != null) { Axis.axisMultiLevelLabelsPanel.Measure(availableSize); if (Axis.LabelsPosition == AxisElementPosition.Inside) { horizontalPadding += Axis.axisMultiLevelLabelsPanel.DesiredSize.Width; verticalPadding += Axis.axisMultiLevelLabelsPanel.DesiredSize.Height; } width += Axis.axisMultiLevelLabelsPanel.DesiredSize.Width; height += Axis.axisMultiLevelLabelsPanel.DesiredSize.Height; } if (Axis.Orientation == Orientation.Vertical) { Axis.InsidePadding = horizontalPadding; size = new Size(width, availableSize.Height); } else { Axis.InsidePadding = verticalPadding; size = new Size(availableSize.Width, height); } } return(ChartLayoutUtils.CheckSize(size)); }