How to inflate an ordinal scale so that 0 is touching the left axis wall?


How to inflate an ordinal scale so that 0 is touching the left axis...
Author
Message
Keith Mason
Keith Mason
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 stretch out the X axis data of an NLineSeries so that the first point touches the left side of the chart and the last point touches the right (see image 1 for a photoshopped version of what I'm trying to do). By default, the data tick line is at the point, so I change that with

ordinalScaleConfigurator.DisplayDataPointsBetweenTicks = false;

This works OK, but there is still a gap between the axis wall and the beginning of the line (see image 2).

It appears that the flags needed to stretch it out are InflateViewRangeBegin and InflateViewRangeEnd.

ordinalScaleConfigurator.InflateViewRangeBegin = true;
ordinalScaleConfigurator.InflateViewRangeEnd = true;

When I do that, however, the chart gets smaller to make room for a second 0 and an unlabelled last tick (see image 3). This isn't right at all. What do I need to do to accomplish the effect in image 1?

Thanks!
Attachments
image1.PNG (115 views, 29.00 KB)
image2.PNG (114 views, 20.00 KB)
image3.PNG (109 views, 26.00 KB)
Reply
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 Keith,

By default the oridnal scale on the x axis will inflate the content range by 0.5. In order to show the line exactly at the begin / end of the axis you need to turn off that inflate:

NChart chart = nChartControl1.Charts[0];
NLineSeries line = new NLineSeries();
line.Values.Add(10);
line.Values.Add(20);
line.Values.Add(15);
chart.Series.Add(line);

NOrdinalScaleConfigurator scaleX = chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NOrdinalScaleConfigurator;
scaleX.DisplayDataPointsBetweenTicks = false;
scaleX.InflateContentRange = false;

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



Best Regards,
Nevron Support Team


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