Group: Forum Members
Last Active: 11 Years Ago
Posts: 3,
Visits: 1
|
Hello,
I am trying to set a Custom Label X Axis with values 1, 2, 3, 4, 5, 20. When I set that by code, the ticks labels showed on the axis are 2,3,4,5,20. And everything is offset, so tick 1 get the label text 2, tick 2 gets the label text 3, and the last label is empty.
What I am doing wrong? Here is the code :
var numericScale = (NNumericScaleConfigurator)Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator; numericScale.AutoLabels = false;
List maturityLabelAxis = new List {1, 2, 3, 4, 5, 20};
var axisView = (NRangeAxisView)Chart.Axis(StandardAxis.PrimaryX).View; axisView.Range = new NRange1DD(maturityLabelAxis.First(), maturityLabelAxis.Last());
// Set major tick et labels numericScale.CustomMajorTicks.Clear(); numericScale.Labels.Clear(); numericScale.MajorTickMode = MajorTickMode.CustomTicks; numericScale.Origin = maturityLabelAxis.First();
foreach (double maturityLabelInYears in maturityLabelAxis) { numericScale.CustomMajorTicks.Add(maturityLabelInYears); numericScale.Labels.Add(string.Format("{0}", maturityLabelInYears)); }
Thanks for your help.
|