'How to set chart bar's width?
I'm using Visual Studio 2010 to write a Winforms application in C#. I'm using the chart control from the regular toolbox to view data from my SQL database. As you see, the bar is very wide. Is there some property or way to make it smaller, and fixed?

Solution 1:[1]
You can use the following Code :
Chart1.Series["Series1"]["PixelPointWidth"] = "15";
Thank you.
Solution 2:[2]
You can also set the PixelPointWidth in the report designer as below.
- Click on the chart series, press
F4to show the properties. - Change the
PixelPointWidthinCustomAttributesnode.

Solution 3:[3]
VB.NET version of same problem:
Dim EL As New Series
EL.ChartType = SeriesChartType.Column
EL.Name = "Series name"
EL.SetCustomProperty("PixelPointWidth", "1")
EL.Points.AddXY(x, y)
Chart1.Series.Add(EL)
This custom property is not accessible using chart properties. If this property is uninitialized, width of the chart bar is random!.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Guest |
| Solution 2 | Eugene Berdnikov |
| Solution 3 |
