I have a chart of lineseries bound to dynamic data which is always a count of events filtered by time. So the data points are always going to be whole numbers. For large time filter the y axis may be 0 to 500 points or more for small filter it may be 0 to < 4 . For the small filters the labels on the Y show up with decimal places e.g. 0, 0.5, 1, 1.5 etc and it doesn't look good. Is there an easy way to style for whole numbers only on the y axis? Below is my current setting as is done in a multi value converter. I tried {N} also but can't find anything to work. The format syntax for the labels seems mysterious to me. What does it map to? Please help.
NumericYAxis yAxis = new NumericYAxis { Label = "{0}", LabelSettings = new AxisLabelSettings() { Location = AxisLabelsLocation.OutsideLeft } };
Not sure I understand how a converter is going to help in this case. I have lots of zero data points also. There is no way I see to set origin to less than my start or to set the unit. I see reference to that on the old chart I think (xamChart?).
If I set MinimumValue= -1 to show the 0's better it doesn't look good. It can sometimes show all the y scale labels as a x.5 depending on the data. I want to keep the autorange tho as the data is quite variable in maximums. Ideally I'd like a little bit of padding below and to the left of my start point and to the top of my maximim y and left of my maximum x. And I"d always like whole numbers for the unit and the labels.
What would I do in a converter to achieve this? If the y interval line is at 10.5 I can't relabel it so say its 10? I'm confused.
Hello ,
I am just checking your progress on the issue. Please do not hesitate to let me know if you have any further questions on the matter.
Hello,
Thank you for your post. I have been looking into it and can suggest to create a template for the YAxis labels as follows:
<ig:NumericYAxis.Label>
<DataTemplate>
<TextBlock Text="{Binding Item, Converter={StaticResource AxisConverter}}"/>
</DataTemplate>
</ig:NumericYAxis.Label>
In the AxisConverter you can style the labels the way you want. Please do not hesitate to let me know if you have any further questions on the matter.