We have an issue with displaying labels on the X-Axis consistently.
We have a stacked bar chart.
We have decreased the font size of the axis, changed the extent and the angle but still get inconsistent formatting results.
Some times the axis get formatted ok and we can see values fine. Some times however we only see dashes instead of numbers.
What is the best way to format the axis so it always displays consistently?
In particular how do we set the number of labels that appear on X-Axis. Should Interval property work ?
Are you saying that some of the labels show correct strings, while others only display ellipsis, or that sometimes all labels show up correctly, while other times none of the labels show up correctly? Do you mind posting a screenshot? This could potentially be related to a recently fixed bug, but I would need more information on how to reproduce it.
The interval property can, in a way, allow you to set the number of labels. It specifies how many labels will be skipped before the next visible label. For example, an interval of 1 will display a label for every point. An interval of 3 will display a label for every third data point. By default the interval is calculated automatically.
Yes. Sometimes the labels are displayed correctly and sometimes it's only ellipsis. Some time mixed.
We obviously don't know what data will be displayed up front. Skipping number of points without knowing how many there is not very helpful.
My data is in percent form (e.g. from -50% to + 50%) but it varies with every instance.
Need a clean solution for this.
This is the example of the chart that does not work.
I will upload the one that looks ok (different data) as well
I have tried changing the angle of the labels. Same thing happens for different angle values.
Ok. I figured out the workaround
1. Multiply my actual values by 100 and use the chart delegate to create correct label formatted as %
Use the following logic
//min and max are computed by data source. Adjusted by 1 so there is a little space around the max and min bars
min = min - 1; max = max + 1; series.XAxis.Minimum = min; series.XAxis.Maximum = max; float interval = (max - min) / 4; // guarantees five labels on the axis. series.XAxis.Interval = interval;
We tried setting angle for labels (90 or 270 would both give vertical).
Here is our code for setting interval based on actual minimum and maximum values
float min = series.XAxis.ActualMinimumValue;//this.data.Select (x => (UpDownPerformance)x).Min (x => x.DnPerf.FloatValue); float max = series.XAxis.ActualMaximumValue;//this.data.Select (x => (UpDownPerformance)x).Min (x => x.UpPerf.FloatValue); float interval = (max - min) / 5; series.XAxis.Interval = interval;
The results are not encouraging. See screenshot. For some values only one label on XAxis is shown.
Forgot to mention that you can set the angle to 90 instead of 270 as a temporary workaround, if you want vertical labels. Or you can use horizontal labels for now.
Sorry, I thought your x axis was showing categories for some reason. The behavior of the interval property is a little bit different on a numeric axis, but it's still based on the minimum and maximum values. Keep in mind that you can always get the min and max values from the axis with actualMinimumValue and actualMaximumValue properties. You can then set the interval based on those. Not setting an interval will typically give you either 5 or 10 numeric labels, but there is no way to tell the chart to always display x number of labels via a single property. The clipping issue was fixed a few days ago and is currently in test.
I apologize for the inconvenience.