Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1401
Maximum size of the label on any AxisItem of a composite chart
posted

I want to get the maximum size of the label on any AxisItem of a composite chart.

Any idea how I can get this maximumsize occupied as a size object?

Also please throw some light on how the AxisLabelInfoCollection is being used

internally.

Parents
No Data
Reply
  • 28496
    Suggested Answer
    Offline posted

    Kumar_Nagaraju said:

    I want to get the maximum size of the label on any AxisItem of a composite chart.

    Any idea how I can get this maximumsize occupied as a size object?

    i think this code will help:

            private void ultraChart1_FillSceneGraph(object sender, FillSceneGraphEventArgs e)
            {

                Axis layerXAxis = this.ultraChart1.CompositeChart.ChartLayers[0].ChartLayer.Grid["X"] as Axis;
                float maxLabelWidth = float.MinValue;
                float maxLabelHeight = float.MinValue;
               
                foreach (Primitive p in e.SceneGraph)
                {
                    Text t = p as Text;
                    if (t != null && t.bounds.Top > layerXAxis.startPoint.Y)
                    {
                        // assume this is an x-axis label since it's below the x axis
                        SizeF labelSize = Platform.GetLabelSizePixels(t.GetTextString(), t.labelStyle);
                        maxLabelWidth = Math.Max(maxLabelWidth, labelSize.Width);
                        maxLabelHeight = Math.Max(maxLabelHeight, labelSize.Height);
                    }
                }
            }

    Kumar_Nagaraju said:

    Also please throw some light on how the AxisLabelInfoCollection is being used

    internally.

    it's used for processing the labels through anti-collision algorithms when Axis.N.Labels.Layout.Behavior is set to Auto or UseCollection.  i don't there is any use for this class in an application.

Children
No Data