Hi,
Is there any documentation on setting up custom label formats? the .net formats don't seem to work, and I am supporting some dynamic configuration which will mean i need to 'translate' from the .net format to something that will work for the ios and android renderers.
Thanks
Phil
3 Answers, 1 is accepted
We have this section in the documentation that has an example of applying a NumericalAxis LabelFormat depending platform.
Here's the snippet (notice the WinPhone platform target can use the .NET "N2" numerical string format):
axis.LabelFormat = Xamarin.Forms.Device.OnPlatform(
"%.2f"
,
"%.2f"
,
"N2"
);
For the Xamarin side of things, here is their documentation for the topic.
Please let us know if you have any further questions.
Regards,
Lance | Tech Support Engineer, Sr.
Telerik by Progress
Hi,
I had already found that stuff, the specific issue i am trying to work out at the moment is that i have a value of 510000, which if i dont specify a format displays as 510,000 - including the cultures formatting to add the , in the appropriate place. However i want to display to 2dp and keep the formatting, I have tried setting (for ios) "%.2f" and the display value becomes 510000.00 - if i try "%.2n" - i get nothing displayed as the axis values at all. Please advise how i can build a format to display the 510,000.00?
Thanks
I am not able to reproduce the problem you're having, see the attached screenshot. I've also attached the demo application you see in the screenshot, as you can see I'm setting the LabelFormat with the values I showed in my last reply. The axis labels properly display the 2 decimal points.
I tried with both XAML and C#, since I showed you the C# approach in my last reply, here is the XAML approach
<
telerikChart:RadCartesianChart.VerticalAxis
>
<
telerikChart:NumericalAxis
x:Name
=
"numericalAxis"
>
<
OnPlatform
x:TypeArguments
=
"x:String"
Android
=
"%.2f"
WinPhone
=
"N2"
iOS
=
"%.2f"
/>
</
telerikChart:NumericalAxis
>
</
telerikChart:RadCartesianChart.VerticalAxis
>
Just to make sure this wasn't related to an underlying value issue, I used both a value with a fractional value and one without:
// In StartPageViewModel.cs
new
ChartData { Category =
"Apples"
, Value = 510000.25 },
new
ChartData { Category =
"Oranges"
, Value = 125000 }
If you're still having an issue, please provide us with a reproducible example so that we can investigate further. You can also just update my demo so that it replicates the issue and send that back instead. Note that you'll need to open a support ticket because you can't attach zip folders to public forum posts. You can open a ticket from your Support Tickets Page.
Regards,
Lance | Tech Support Engineer, Sr.
Telerik by Progress