Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 352
carl.xie87 Avatar asked Sep 21 '12 07:09

carl.xie87


People also ask

How do you adjust the width of a bar chart?

Click on any bar in the Bar Chart and right click on it, then select Format Data Series from the right-clicking menu. See screenshot: 2. In the popping up Format Data Series pane, move the Zoom bar of the Gap Width to the left side until the bar width meets your needs under the Series Options section.

How do I make bars wider in Excel chart?

Larger bars The solution for this is to click the Excel chart's X axis, right click and choose Format Axis. Select Axis Options and then click on Text Axis to select it. This changes the way the axis is plotted giving wider bars. You can then adjust the gap width if necessary to make them wider.

How do you change the width of a bar chart in Word?

Right-click or control-click, and choose Format Data Series from the context menu. In the Format Data Series dialog box, select Options. Then change the Gap width. For wider bars, make the gap width smaller.

How do I make my bar chart wider in tableau?

If the bars are too narrow, the numbers are truncated; to fix this, press Ctrl + Right on the keyboard to make the bars wider."


3 Answers

I did a small example binding three values and set the PixelPointWidth of dataPointCustomProperties.

int[] liste = new int[] { 1, 2, 3 };//, 4, 5, 6, 7 };
chart1.Series["Series1"].Points.DataBind(liste, "sampleData", "count", "Tooltip=count");
// dataPointCustomProperties
chart1.Series["Series1"]["PixelPointWidth"] = "1";

will result in this chart

Chart bar width 1px

like image 87
Pilgerstorfer Franz Avatar answered Oct 16 '22 15:10

Pilgerstorfer Franz


You can use the following Code :

Chart1.Series["Series1"]["PixelPointWidth"] = "15";

Thank you.

like image 27
Guest Avatar answered Oct 16 '22 15:10

Guest


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

like image 32
jeyaramg Avatar answered Oct 16 '22 17:10

jeyaramg