Profile Picture

Scale Breaks

Posted By Manal Goyal 6 Years Ago
Author
Message
Nevron Support
Posted 6 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: Today @ 1:54 AM
Posts: 3,054, Visits: 4,009
Hi Manal,
The reason for this is that by default the scale break will inflate the range in order to prevent cutting off the data - take a look at this topic:
http://helpdotnetvision.nevron.com/UsersGuide_Axes_Scale_ScaleConfigurator_ScaleBreaks.html

If you want to limit or turn off scale break inflate you need to modify the NAutoScaleBreak class - for example:

NChart chart = nChartControl1.Charts[0];

NDateTimeScaleConfigurator dateTimeScale = new NDateTimeScaleConfigurator();
NAutoScaleBreak autoScaleBreak = new NAutoScaleBreak();

DateTime dt1 = DateTime.Now;
DateTime dt2 = dt1 + TimeSpan.FromDays(1);
double halfDaySapn = (dt2.ToOADate() - dt1.ToOADate()) / 2;

NAbsoluteScaleBreakInflate scaleBreakInflate = new NAbsoluteScaleBreakInflate();
scaleBreakInflate.LeftInflate = halfDaySapn;
scaleBreakInflate.RightInflate = halfDaySapn;
autoScaleBreak.Inflate = scaleBreakInflate;

dateTimeScale.ScaleBreaks.Add(autoScaleBreak);
chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = dateTimeScale;

chart.BoundsMode = Nevron.GraphicsCore.BoundsMode.Stretch;

NLineSeries line = new NLineSeries();
line.UseXValues = true;
line.DataLabelStyle.Visible = false;

line.XValues.Add(DateTime.Now);
line.XValues.Add(DateTime.Now + TimeSpan.FromDays(1));
line.Values.Add(10);
line.Values.Add(20);

line.XValues.Add(DateTime.Now + TimeSpan.FromDays(100));
line.XValues.Add(DateTime.Now + TimeSpan.FromDays(101));
line.Values.Add(10);
line.Values.Add(20);

chart.Series.Add(line);

This code shows how to apply a half day inflate around the scale break instead of the relative scale break which is set by default. If you want to remove the inflate completely you can write:

NAutoScaleBreak autoScaleBreak = new NAutoScaleBreak();
autoScaleBreak.Inflate = new NAbsoluteScaleBreakInflate(0);

Let us know if you have any questions or meet any problems.

Best Regards,
Nevron Support Team



Manal Goyal
Question Posted 6 Years Ago
View Quick Profile
Forum Member

Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)

Group: Forum Members
Last Active: 5 Years Ago
Posts: 29, Visits: 405
I am trying to apply automatic scale breaks into my charts. I have few questions like, why there is this useless piece of chart still showing me around the breaks,(see the image for your reference).



Similar Topics


Reading This Topic