Reputation: 113
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?
Upvotes: 11
Views: 35724
Reputation: 93
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!.
Upvotes: 1
Reputation: 11
You can also set the PixelPointWidth
in the report designer as below.
F4
to show the properties.PixelPointWidth
in CustomAttributes
node.Upvotes: 1
Reputation: 71
You can use the following Code :
Chart1.Series["Series1"]["PixelPointWidth"] = "15";
Thank you.
Upvotes: 7
Reputation: 8359
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
Upvotes: 18