Wrong Custom Labels Axis


Author
Message
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K

Hi Francois,

Most likely the problem with the initial approach is that you use a custom origin value - that way the value of 1 maps to the second label (not the first one). Anyway going with custom numeric labels is better as it ensures that you decorate the values correctly. Let us know if you meet any problems or have any questions.



Best Regards,
Nevron Support Team


Francois Miousse
Francois Miousse
Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)
Group: Forum Members
Posts: 3, Visits: 1
OK. I've solved my problem.

I use numericScale.CustomLabels instead of numericScale.Labels and this solved my problem.
Francois Miousse
Francois Miousse
Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)
Group: Forum Members
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.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search