Nevron Forum

Auto scale does not work with just negative numbers

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

By Daniel Csimszi - Thursday, September 26, 2013

Hi,

I have a graph which has 2 axis; "Left" and "Right". Both of the axis can be set to auto scale or user input max, min. The problem of mine, when I leave the scaling automatic and I load in data with just negative values it does not work.

Do you have any idea what could be the problem?

Here is the method how I set the axis to auto scale:

internal void turnOnAutoscale(string axis)
{
if (axis.Equals("Left"))
{
m_Chart.Axis(StandardAxis.PrimaryY).View = new NRangeAxisView(new NRange1DD(0, 0), true, false);
NStandardScaleConfigurator scale = m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NStandardScaleConfigurator;
scale.RoundToTickMax = true;
}
else
{
m_Chart.Axis(StandardAxis.SecondaryY).View = new NRangeAxisView(new NRange1DD(0, 0), true, false);
NStandardScaleConfigurator scale = m_Chart.Axis(StandardAxis.SecondaryY).ScaleConfigurator as NStandardScaleConfigurator;
scale.RoundToTickMax = true;
}
}

Thank you,
Daniel
By Nevron Support - Thursday, September 26, 2013

Hi Daniel,

You explicitly specify that the axis range should start from 0:

new NRangeAxisView(new NRange1DD(0, 0), true, false);

(second parameter is true) and therefore the axis range can never be negative. If you want automatic range you should use:

someAxis.View = new NContentAxisView();

which is the default setting.

By Daniel Csimszi - Thursday, September 26, 2013

Thanks, works perfectly. silly me