C# MSChart control

I have a C# Winform that creates a simple bar graph using the MSChart control from the toolbox.  The chart populates with the data correctly and overall looks good.  However, I need to provide an x-axis label for every bar that is appears on the graph.  Currently, the graph only seems to label every other bar which simply won't work for me.  Is there a way to make the graph add a specific x-axis label for each bar?  I currently have these labels as a column in a datatable so they are easily accessible.

I have attached a picture of the bar graph I am creating.  As you can see, the x-axis does not label each bar and instead only labels every other bar (which is also where the major tick marks are located).  I have tried to add more tick marks but that doesn't seem to work either.  Any help is appreciated. Graph Picture
MarkKristieAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ukerandiCommented:
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
alagurjanTechnology LeadCommented:
Hi,

You can set label for each item in x- axis

MyChart.Series["Default"].Points[0].AxisLabel = "Bar 1";
MyChart.Series["Default"].Points[1].AxisLabel = "Bar 2";

also you can set tool tip for each bar's

Chart1.Series["SeriesName"].LabelToolTip = "#VALX [#VALY]";
0
Bob LearnedCommented:
I don't believe that the problem is the labeling, I believe that the problem is how the text is going to fit for the width of the chart.  I would suggest turning the label text at a 45 or 90 degree orientation, so that it will fit better.  I don't use the Windows Forms version, and I would need to find the properties for text orientation.

Here is a WPF/Silverlight example of what I mean, using the DataVisualization chart control.  

http://blogs.msdn.com/b/delay/archive/2010/03/06/turn-your-head-and-check-out-this-post-how-to-easily-rotate-the-axis-labels-of-a-silverlight-wpf-toolkit-chart.aspx


RotatedAxisLabels-WPF.png
0
MarkKristieAuthor Commented:
This wasn't a full solution but it pointed me in the correct direction.  The actual solution was to go into the series collection, in the form control properties, and se the IsValueShownAsLabel property to True.  This allowed all fo the labels to be shown for each 'bar' on the x-axis.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.