Reputation: 51
I'm using Visual Studio 2015, working with WinForms.
I link 2 images to make you guys easier to understand what I want to do:
In the example 1 we have 10 values with an automatic width, this is the size I want always for bars, but this is a dynamic chart so when there are less than 10 values it just fills to graph as you can see in example 2. I want the same size always, the size of the example 1, have tried to specify using:
chrt_ventesArticles.Series[Conversion.Texto(f_cursor.Campo(1))]["PixelPointWidth"] = "100";
And tried too:
chrt_ventesArticles.Series[Conversion.Texto(f_cursor.Campo(1))]["PixelPointWidth"] = Conversion.Texto(Math.Round(chrt_ventesArticles.ChartAreas[0].InnerPlotPosition.Height, 0));
But it isn't working as it should, depending on the number of values it haves a different size.
Any ideas about how to do it?
Upvotes: 0
Views: 3440
Reputation: 54433
To space the bars evenly over a fixed number of slots you need to set the Minimum
and Maximum
values to display on an Axis
.
Here you have a Bar chart and want to display the bars in a 10 slots.
So you write maybe:
yourCharArea.AxisX.Minimum = 0;
yourCharArea.AxisX.Maximum = 10;
Now you get both:
DataPoints
are missing.Chart
itself.The latter will not work when you set the with of the Bars in pixels..!
Before and after:
Upvotes: 1