3 Answers, 1 is accepted
Hello Alan,
If you use LinearAxis, you can try its MajorStep property. It allows you to define an interval between the generated ticks on the axis. For example, if you have a minimum of 0 on the axis and maximum of 10, a major step of 2, will generate ticks on 0, 2, 4, 6, 8 and 10.
Additionally, you can check the LogarithmicAxis and see if this would help.
If those suggestions are not helpful may I ask you send me a drawing of the expected result with the range you mentioned (-750000 and 1000000)?
Regards,
Martin Ivanov
Progress Telerik
Hello,
MajorStep isn't what I'm looking for. Right now my graph looks like Graph1. I want it to look more like Graph2.
Thanks!
Alan
Hello Alan,
Thank you for the attached images. I think I understand your case better now.
To achieve this, you can use a couple of approaches. The first one is to alter your data before pass it to the chart. Instead, of populating the data points with values that range between -750000 and 1000000, you can multiply the values beforehand and provide values between 75 and 100.
The second approach is to use a custom template for the labels. You can do this via the LabelTemplate property of the axis. This way you can define a TextBlock element, bind it to the default label, and use an IValueConverter to return the multiplied value. Here is an example in code:
<telerik:LinearAxis.LabelTemplate>
<DataTemplate>
<TextBlock Text="{Binding Converter={StaticResource LabelConverter}}" />
</DataTemplate>
</telerik:LinearAxis.LabelTemplate>
public class LabelConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var labelValue = double.Parse(value.ToString());
return labelValue * 0.0001;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
Regards,
Martin Ivanov
Progress Telerik