'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?

http://priv.hiphotos.baidu.com/album/s%3D308%3Bq%3D90/sign=131a1ec68bd4b31cf43c92bbbfed5642/d4628535e5dde711c9184673a7efce1b9c166168.jpg?psign=de6394777d1ed21b3ae15fd4ad4712a551da81cb3bdb1fb1



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.

  1. Click on the chart series, press F4 to show the properties.
  2. Change the PixelPointWidth in CustomAttributes node.

Settting PixelPointWidth

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