Nevron Forum

Bar alignement

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

By K DR - Monday, March 29, 2010

Hi,

I would like to align a bar on its left side, to have the gap on the other side, instead of having a gap on each side. I couldn't find the property or method that could change the alignement of the bars. See the picture of what I'm looking for.

By Blagovest Milanov 1 - Tuesday, March 30, 2010

Hi,

You need to set the bar width to 100% and then enable view range inflate for the X axis - the code below introduces ten point inflate to the right:

NChart chart = nChartControl1.Charts[0];

NBarSeries bar = new NBarSeries();
bar.Values.Add(10);
bar.InflateMargins = false;
bar.WidthPercent = 100;
chart.Series.Add(bar);

NOrdinalScaleConfigurator scale = new NOrdinalScaleConfigurator();
scale.InflateViewRangeBegin = false;
scale.InflateViewRangeEnd = true;
scale.ViewRangeInflateMode = ScaleViewRangeInflateMode.Absolute;

scale.AbsoluteInflate = new NRange1DL(0, 15);
chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scale;

Hope this helps - let me know if you meet any problems.

Best regards,
Bob

 

By Ed Espinoza - Wednesday, March 31, 2010

How do you do this with a Line or Area graph, or multi type graph?  I would like the x axis values to start right under the y axis.

Thanks

By Blagovest Milanov 1 - Wednesday, March 31, 2010

Hi Ed,

Generally you need to switch the X axis to linear scale and provide X values to the series in question. Almost all Cartesian series support XY Scatter mode (with the exception of few specific series such as Kagi/Renko). For example:

NChart chart = nChartControl1.Charts[0];
NLineSeries line = new NLineSeries();

line.DataLabelStyle.Visible = false;
line.UseXValues = true;

line.Values.Add(10);
line.XValues.Add(10);

line.Values.Add(23);
line.XValues.Add(20);

line.Values.Add(18);
line.XValues.Add(35);

chart.Series.Add(line);
chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = new NLinearScaleConfigurator();

Produces a simple XY scatter line, with a linear X axis.

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

Best regards,
Bob

By Ed Espinoza - Friday, April 2, 2010

Here is what I am trying to do...we have the old chart done in an earlier version of Nevron and I need to replicate it in the new chart.  As you can see the old chart goes from border to border with the xAxis values starting right up against the yAxis where as the new chart's tickmark starts to the right of the y Axis.

Thanks

By Blagovest Milanov 1 - Tuesday, April 6, 2010

Hi Ed,

You should clear the implicit content inflate added by the ordinal scale to the scale definition:

chart.Axis(StandardAxis.PrimaryX).UpdateScale();
chart.Axis(
StandardAxis.PrimaryX).Scale.ContentRangeInflators.Clear();

Let me know if you meet any problems...

Best reagrds,
Bob

By K DR - Tuesday, April 13, 2010

Thanks for your answers