Hi Shweta,
You can control the bar width using the WidthPercent property:
NChart chart = nChartControl1.Charts[0];
NBarSeries bar = new NBarSeries();
bar.DataLabelStyle.Visible = false;
bar.BorderStyle.Width = new NLength(0);
bar.EnableXPixelSnapping = false;
bar.WidthPercent = 50;
chart.Series.Add(bar);
for (int i = 0; i < 1000; i++)
{
bar.Values.Add(i);
}
this will only work in the case the bar series is operating in categorical mode (e.g. you do not supply the xvalues). In case you provide xvalues you need to use BarWidthMode in combination with LogicalBarWidth or BarWidth depending on the mode:
NChart chart = nChartControl1.Charts[0];
NBarSeries bar = new NBarSeries();
bar.DataLabelStyle.Visible = false;
bar.BorderStyle.Width = new NLength(0);
bar.EnableXPixelSnapping = false;
bar.UseXValues = true;
bar.BarWidthMode = BarWidthMode.Logical;
bar.LogicalBarWidth = 0.5f;
chart.Series.Add(bar);
for (int i = 0; i < 1000; i++)
{
bar.Values.Add(i);
bar.XValues.Add(i);
}
Note that in both cases we would advise you to disable x pixel snapping.
We hope this helps - let us know if you have any questions.
Best Regards,
Nevron Support Team