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
150
Sync Axis Label Width between two xamDataCharts?
posted

Hello *,

I need to display two charts one below the other, where the format and tickmarks of the axis-labels are customizable by the user.

actual:

|Axis1|Chart1|

|Axis2 with longer Labels|Chart2|

suggested:

|                        Axis1|Chart1|

|Axis2 with longer labels|Chart2|

Is there a simple way to sync the start of the chartareas or to sync the width of the axis-labels?

Parents Reply
  • 29105
    Offline posted in reply to Andreas S

    Andreas,

    This was previously discussed here:
    http://ko.infragistics.com/community/forums/t/70296.aspx

    You'll need to synchronize the extent properties and manage the VerticalAxisLabelPanel based the ActualWidth of the two charts.

    eg.

     private void MainWindow_Loaded(object sender, RoutedEventArgs e)
            {
                VerticalAxisLabelPanel panel1 = Utilities.GetDescendantFromType(chart1, typeof(VerticalAxisLabelPanel), false) as VerticalAxisLabelPanel;
                VerticalAxisLabelPanel panel2 = Utilities.GetDescendantFromType(chart2, typeof(VerticalAxisLabelPanel), false) as VerticalAxisLabelPanel;
                double c = panel1.Width;
                double f = panel2.Width;
               
                //Determine which one is panel is wider, then set the Extent based on the smallest of the two.
                if (c > f)
                {
                    yAxis5.LabelSettings.Extent = c;
                }
                else
                {
                    yAxis.LabelSettings.Extent = f;
                }
            }

    Let me know if you have any questions regarding this matter.

Children