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?
Hello Andreas,
The behavior your looking for is controlled by a combination of two AxisLabelSettings
1. Extent - increase the value to add more space between the label and the edge of the chart.
2. Location (I recommend setting this to one of the Inside members - depends on the axis)
Let me know if you have any questions regarding this matter.
Hello Michael,
Sorry for my late response.
I understand the propose of the properties you have pointed out, but I can´t see how to set them if the axis labels are dynamic set(controlled by XamDataChart).
To make it more clear in one case the first chart is labeled by 0,10,...,100 and the second by 0.001,0.002,...,0,009 and with another kind of data bound to it is 0,1000,2000,10000 and 0,1,2,...,10.
So at design time I do not know which will be the correct value for the Extend properties of the two charts.
I am looking for something like the Grids ShreSizeGroup or anything else to control the axis widths?
Andreas,
This was previously discussed here:http://es.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; } }
Thanks again for your help.
The suggested solution works if the size of the labels is constant. In our application the labels can change because of new data added to the charts. (I think the same problem occurs when zooming is used.)
Is there a way to reset the labelsettings extend so that the LabelPanel will autosize(to fit the labels) again? I have attached a demo which contains a button to simulate changing labels.
Another noticeable behavior is that you have to specify
<ig:NumericYAxis.LabelSettings> <ig:AxisLabelSettings/> </ig:NumericYAxis.LabelSettings>
to be able to change the extend in code behind. Doing so applies other default settings to the AxisLabelSettings (e.g. Margin and Font). Is this an expected behavior? And how to apply the original default settings?
The labels in your sample do have the same style but not the original style that is applied to AxisLabels which have no AxisLabelSettings set in Xaml or Code-behind. For reference compare the y-axis labels with the x-axis labels.
Setting AxisLabelSettings will actual mean that you lose support for infragistics theming. If not please provide a sample where you set the AxisLabelSetting.Extend to 150 that has a theme chooser like the one in your Sample Browser (xamDataChart->Style->Theming).
Actual we do not rely on switching themes but to workaround the style to match the one used theme feels like a maintenance hell for every new release from IG.
I've uploaded another modified sample. Please clarify what it does/does not achieve. The axis label settings appear the same and are created in code behind. As far as the extents, you'll need to manually calculate that yourself.
I recommend submitting a new product idea for auto size axis feature on our website at ideas.infragistics.com
Let me know if you have any questions.
Setting the AxisLabelSettings.Extend to 50 does not reset the AxisLabelsetting to Autosizing. If you compare my last sample with the one you have modified you can see that the second click on the expand label button do not shrink the label area on the charts.
P.S.: There are several samples in the SampleBrowser setting the AxisLabelSettings in XAML, so it would be nice if you can provide a solution to apply the default styles.
Hi,
You need to set the AxisLabelSettings prior to expanding the labels for the default style to be applied. Let me know if you have any questions.
Hi
I attached my sample with the AxisLabelSettings defined in code behind and the default style is present. Without this defined in code behind an exception will occur.