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
Who is Participating?
alagurjanTechnology LeadCommented:

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]";
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.  


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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.