Hello,
My NumericXAxis is binded to values from 0 to 280. In the label, I want to show Label as -> value/28. (i.e. the value it obtains from binding and then divided by 28)
How can I do such formatting.
I tried these:
<ig:NumericXAxis x:Name="xmXAxis" Label="{}{0%28}" MinimumValue="0" MaximumValue="280" MajorStroke="DarkGray" MajorStrokeThickness="0.3" MinorStroke="DarkGray" MinorStrokeThickness="0" Interval="28">
or Label="{}/28"
But its not working.
Any help?
Thanks!
You would also need to define that converter in your resources section of the page:
<UserControl.Resources> <local:DivBy28 x:Key="divBy28" /> </UserControl.Resources>
-Graham
Here's one way of going about it:
<ig:XamDataChart x:Name="theChart"> <ig:XamDataChart.Axes> <ig:NumericXAxis x:Name="xmXAxis" MinimumValue="0" MaximumValue="280" MajorStroke="DarkGray" MajorStrokeThickness="0.3" MinorStroke="DarkGray" MinorStrokeThickness="0" Interval="28" > <ig:NumericXAxis.Label> <DataTemplate> <TextBlock Text="{Binding Item, Converter={StaticResource divBy28}}" /> </DataTemplate> </ig:NumericXAxis.Label> </ig:NumericXAxis> </ig:XamDataChart.Axes> </ig:XamDataChart>
With code behind:
public class DivBy28 : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { return (double)value / 28.0; } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { throw new NotImplementedException(); } }
Hope this helps! -Graham