Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
570
numericYAxis line series label format
posted

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 } };

Parents
No Data
Reply
  • 22015
    posted

    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.

Children