Label alignment on chart


https://www.nevron.com/Forum/Topic9485.aspx
Print Topic | Close Window

By Greg Hupp - 9 Years Ago

I am trying to create a linear plot as shown below.  However, I would like to align the X-axis labels(value labels) with the tick marks instead of between the marks (for clarity).  Can someone provide some guidance for doing this?  Probably not a hard problem, just can't find the correct settings.
By Nevron Support - 9 Years Ago
Hi Gregg,

The problem in this case is that you're using an ordinal (categorical) scale which by default displays the labels between the tick marks. To fix this you have two options:

1. Switch to numeric scale:
NCartesianChart chart = (NCartesianChart)nChartControl1.Charts[0];
chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = new NLinearScaleConfigurator();

2. Display the ticks aligned to the labels on the ordinal scale:
NCartesianChart chart = (NCartesianChart)nChartControl1.Charts[0];
((NOrdinalScaleConfigurator)chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator).DisplayDataPointsBetweenTicks = false;

Hope this helps - let us know if you meet any problems or have any questions.