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 } };
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.
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.
I am currently researching your issue and I will get to you as soon as I further investigate your it. Thank you for understanding.
Hello Thomcat23,
Thank you for your patience, while we were looking into your issue. After researching it, I can suggest using the approach that Gergana has suggested. Since the values of your data by the Y axis will be whole numbers, the NumericYAxis should calculate the minimum and maximum values to be whole number. If you create a template for the Label of the NumericYAxis and bind the Text of a TextBlock to the value of the label and set a Converter, you can check in the converter, whether the value is whole and if not, you can return empty string for the TextBlock. By doing so, you will see only the labels on the Y axis, which corresponds to integer values. I have created a sample application for you, that shows how you can implement this approach.
Please let me know if you need any further assistance on the matter.
Sincerely,
Krasimir
Developer Support Engineer
Infragistics
www.infragistics.com/support
I am just checking if you require any further assistance on the matter.
thank you for the sample and I have saved it. I am ok for now but may try this implementation later depending on user feedback (those with small sample sets).
Hello Thomcat,
Thank you for your reply. I am very glad that my sample application was helpful for you. Please let me know if you need any further assistance on the matter.