How to show bar graph with margin in bar


Author
Message
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 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


shweta jain
shweta jain
Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)
Group: Forum Members
Posts: 16, Visits: 192
hello,

I am using bar series like attached image, but due to large no of values, it is looking like an area.
Issue - bar chart loooking like an area.
I want to show bars which should be thinner with a margin that divides the bars.
How can update chart with thinner bar  with a margin that divides the bars?

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