Hi Fabio,
Yes it is possible to have formatting dependent on the value - the following code shows how to create a custom value formatter which formats values greater than 1000 to 1K, 2K etc:
class CustomValueFormatter : NValueFormatter
{
public override string FormatValue(double value)
{
if (value >= 1000)
{
return ((int)value / 1000).ToString() + "K";
}
return value.ToString();
}
public override string FormatValue(object value)
{
return FormatValue((double)value);
}
}
private void Form1_Load(object sender, EventArgs e)
{
NChart chart = nChartControl1.Charts[0];
NBarSeries bar = new NBarSeries();
bar.Values.Add(10);
bar.Values.Add(100);
bar.Values.Add(1000);
chart.Series.Add(bar);
NLinearScaleConfigurator linearScale = chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator;
linearScale.LabelValueFormatter = new CustomValueFormatter();
}
Hope this helps - let us know if you meet any problems or have any questions.
Best Regards,
Nevron Support Team