How to set min and max y-axis and tick values


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

By jerry tovar - 10 Years Ago
I have a nevron chart that shows percentages, 0% to 100+%.

I want the y-Axis to display a range of min=0% to max=110%. But when I run my code, the chart displays fine, but the y-Axis values or ticks are (0%, 50%, 100%). The 110% label or tick does not display.

How can I force the y-Axis labels or ticks to display a minimum of 0% and a max of 110%?

Here is my code:
Snippet
var yAxis = chart.Axis(StandardAxis.PrimaryY);SnippetyAxis.View = new NRangeAxisView(new NRange1DD(.0, 1.10), true, true);Snippetvar scale = (NLinearScaleConfigurator)yAxis.ScaleConfigurator;Snippetscale.LabelValueFormatter = new NNumericValueFormatter("P0");Snippetscale.RoundToTickMax = false;Snippetscale.RoundToTickMin = false;


By Nevron Support - 10 Years Ago
Hi,
The problem in this case is that the control still uses automatic tick calculation - in this case the algorithm has simply selected a step of 50 based on the default preferences for tick density. Obviously you cannot have a tick mark at 110 when the step is 50. You can work around this in two ways:
1. Specify custom major tick step - for example:

scale.MajorTickMode = MajorTickMode.CustomStep;
scale.CustomStep = 0.1;

2. Use custom ticks:
scale.MajorTickMode = MajorTickMode.CustomTicks;
scale.CustomMajorTicks.Add(0);
scale.CustomMajorTicks.Add(0.5);
scale.CustomMajorTicks.Add(1.0);
scale.CustomMajorTicks.Add(1.1);

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