Profile Picture

how can i scale axis ?

Posted By lee kc 12 Years Ago
Author
Message
lee kc
questionmark Posted 12 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: Forum Members
Last Active: 9 Years Ago
Posts: 2, Visits: 8

data range is 0 ~ 10.

but i want axis start 2 ~ end 8

and step = 3;

i want  2, 5, 8

coding) 

NAxis axisx = chart.Axis(StandardAxis.PrimaryX);

 axisx.View = new NRangeAxisView(new NRange1DD(2, 8), true, true);

 NLinearScaleConfigurator scale = axisx.ScaleConfigurator as NLinearScaleConfigurator;
 scale.MajorTickMode = MajorTickMode.CustomStep;
 scale.CustomStep = 3;

result)  3 ,  6

why not start from 2 ? Help me



Nevron Support
Posted 12 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009

Hi Lee,

When you apply a range view to the axis this will not modify the scale tick origin (0 by default). This is by design. In order modify the tick origin you need to specify a new origin for the ticks - scaleX.Origin = 2:

   NChart chart = nChartControl1.Charts[0];
   NBarSeries bar = new NBarSeries();

   Random rand = new Random ();
   for (int i = 0; i < 10; i++)
   {
    bar.Values.Add(rand.Next(100));
   }

   bar.DataLabelStyle.Visible = false;

   chart.Series.Add(bar);

   NAxis axisX = chart.Axis(StandardAxis.PrimaryX);
   axisX.View = new NRangeAxisView(new NRange1DD(2, 8), true, true);

   NLinearScaleConfigurator scaleX = new NLinearScaleConfigurator();
   axisX.ScaleConfigurator = scaleX;
   scaleX.MajorTickMode = MajorTickMode.CustomStep;
   scaleX.CustomStep = 3;
   scaleX.Origin = 2;

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

 

 



Best Regards,
Nevron Support Team



lee kc
Posted 12 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: Forum Members
Last Active: 9 Years Ago
Posts: 2, Visits: 8
Thank you Very Much.



Similar Topics


Reading This Topic