How to set chart bar's width?

匿名 (未验证) 提交于 2019-12-03 02:56:01

问题:

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?

回答1:

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



回答2:

You can use the following Code :

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

Thank you.



回答3:

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.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!