C# 如何设置图表栏的宽度?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12525997/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to set chart bar's width?
提问by carl.xie87
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?
我正在使用 Visual Studio 2010 在 C# 中编写 Winforms 应用程序。我正在使用常规工具箱中的图表控件来查看我的 SQL 数据库中的数据。如您所见,酒吧很宽。是否有一些属性或方法可以使它更小并固定?


采纳答案by Pilgerstorfer Franz
I did a small example binding three valuesand set the PixelPointWidthof dataPointCustomProperties.
我做了一个小例子结合三个值和设定PixelPointWidth的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
将导致此图表


回答by Guest
You can use the following Code :
您可以使用以下代码:
Chart1.Series["Series1"]["PixelPointWidth"] = "15";
Thank you.
谢谢你。
回答by jeyaramg
You can also set the PixelPointWidthin the report designer as below.
您还可以PixelPointWidth在报表设计器中进行如下设置。
- Click on the chart series, press
F4to show the properties. - Change the
PixelPointWidthinCustomAttributesnode.
- 单击图表系列,按
F4显示属性。 - 更改
PixelPointWidthinCustomAttributes节点。



