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?
Setting the Extent property should have no affect of other properties or default behavior. I ran you sample and noticed no difference in the margin or font. Can you please upload a screenshot illustrating the change in behavior.
There is no auto size method on the Axis object; you need to recalculate the extent back down to their default size manually. When you do you need to auto size?
As you have already suspected the code will look similar to this:
if (yAxis1.LabelSettings.Extent >= 119) { yAxis1.LabelSettings.Extent = 50; yAxis2.LabelSettings.Extent = 50; } else { yAxis1.LabelSettings.Extent = 119; yAxis2.LabelSettings.Extent = 119; }
1. In the attached screenshot only for the first chart AxisLabelSettings(<ig:AxisLabelSettings/>) are set. As you can see font, font-color, margin and alignment are not the same on the charts. When you need to reproduce this behavior just remove the AxisLabelSettings of one of the charts in my previous attached sample!
2. If I do not set the Extend of the axis and push the ExpandLabel button in my sample the space of the axis is automatically expanded to fit the size of the labels. If I set the Extend this behavior is broken, so i need a way to go back to the default behavior. To reproduce this behavior just remove the event handle(RefreshCompleted="UpdateExtend") from the second chart in my sample and use the ExpandLabel buttton.
1. The reason you are seeing a difference when removing the AxisLabelSettings in Xaml for your first chart is because we provide our own styles internally. Removing it intentionally will strip away the margin, font color etc. If you add a new AxisLabelSettings in code-behind to set the Extent property you will see the default behavior again. Keep in mind by excluding the AxisLabelSettings in XAML, you are nullifying the object and will get an exception if you attempt to reference it during code-behind. Therefore you must define an AxisLabelSetting object in code beforehand.
2. You need a flag and conditionally check when to set the extent, otherwise the code you want to fire will never happen when UpdateExtend is fired.
1. My actual sample is setting/resetting the AxisLabelSettings in codebehind but the axis labels did not have the default style applied. Can you please modify my sample in the way you have outlined in your last post?
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.
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.
Andreas,
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.