Nevron Forum

How to manipulate X axis labels

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

By David Wilson - Monday, April 18, 2011

Hi,

In this web example for the standard 3D bar chart ( http://examplesaspnetchart.nevron.com/Frames/NExampleFrame.aspx?ExampleUrl=Examples/ChartGallery/Bar/NStandardBarUC.ascx 

How would I change the X axis labels to show the legend values instead?

So instead of seeing 1,2,3 I would see Silverlight, Ajax, JackBe

Thanks!

By Nevron Support - Monday, April 18, 2011

Hi David,

You can disable automatic labels and use custom value labels, like in the following example:

NOrdinalScaleConfigurator scaleX = chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NOrdinalScaleConfigurator;
scaleX.AutoLabels = false;
scaleX.MajorTickMode = MajorTickMode.AutoMaxCount;

scaleX.CustomLabels.Add(new NCustomValueLabel(0, "Silverlight"));
scaleX.CustomLabels.Add(new NCustomValueLabel(1, "Ajax"));
scaleX.CustomLabels.Add(new NCustomValueLabel(2, "JackBe"));
scaleX.CustomLabels.Add(new NCustomValueLabel(3, "Laszlo"));
scaleX.CustomLabels.Add(new NCustomValueLabel(4, "Java FX"));
scaleX.CustomLabels.Add(new NCustomValueLabel(5, "Flex"));

NBarSeries bar = new NBarSeries();
chart.Series.Add(bar);
bar.Values.AddRange(new double[] { 10, 20, 15, 25, 22, 43 });
By David Wilson - Tuesday, April 19, 2011

Thanks very much, Support Team