Nevron Forum

How to change the scale of an axis

https://www.nevron.com/Forum/Topic8845.aspx

By Joël Golinucci - Tuesday, December 9, 2014

Hi,

I'm displaying points each 0.5m using NBarSeries (each bar represents 0.5m) and thus I have my X-axis going from 0 to 180 but in fact there really is only 90m. How can I get the labels displaying half the value only so that I have my X-axis going from 0 to 90 ?

Thanks for your help,

Regards,

Joël
By Nevron Support - Thursday, December 11, 2014

Hi Joel,

You have two options:

1. Use custom labels (All Examples\Axes\General\Axis Labels).
2. Use a custom value formatter:

public class CustomValueFormatter : NValueFormatter

{

public override string FormatValue(double value)

{

return (value / 2.0).ToString();

}

public override string FormatValue(object value)

{

return FormatValue((double)value);

}

}


NOrdinalScaleConfigurator ordinalScale = chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NOrdinalScaleConfigurator;

ordinalScale.LabelValueFormatter = new CustomValueFormatter();