Profile Picture

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

Posted By Keith Mason 12 Years Ago

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

Author
Message
Keith Mason
Posted 12 Years Ago
View Quick Profile
Forum Newbie

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
Last Active: 11 Years Ago
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 (97 views, 29.00 KB)
image2.PNG (96 views, 20.00 KB)
image3.PNG (91 views, 26.00 KB)
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 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





Similar Topics


Reading This Topic