Better Dashboards

Working with Microsoft enterprise chart, dashboard and reporting technologies.

Show All Skipped Labels on the X-Axis

Posted by milang on January 11, 2009

Just about everyone who has worked with category names on the Microsoft Reporting Services or .NET chart has encountered this problem: you databind categorical values from a database, but when it is displayed on the chart, it skips labels on the x-axis, like below:


How Do I Show All Labels on the X-Axis?

The short answer is, set the Interval property on the x-axis to 1:

// Show all labels on the x-axis
Chart1.ChartAreas[0].AxisX.Interval = 1;

Issues Created by Solving the X-Axis Label Issue

Showing every x-axis label produces the intended effect of matching every name to a data point, but it also causes clutter if there are too many points or the names are too long.  For example, look at what happens when I databind first and last names of each sales person:


It gets worse if I show all sales people instead of the top 10:


One satisfactory solution is to change the chart type to Bar:


This is a cleaner version of the previous chart, with the category labels more intuitively placed on the chart.  If you’re going to use this solution, make sure you change the appropriate properties for the axes, since the x-axis and y-axis are reversed on a bar chart.

The x-axis skipping label issue tends to be a catch-22 for developers.  It usually does not make sense to show every individual date along a financial chart if you are trying to graph a six-month trend of a particular stock price; in this case, you actually want the chart to skip labels.  On the other hand, if you are showing sales performance by salesperson on a chart, there is no way you want any of those people skipped to simplify the trend of the chart.

For more information on implications of skipping axis labels, see:

Also, if you are using the SSRS chart, you might want to consider implementing the really cool TableInlineCharts solution from Robert Brucker’s whitepaper:


20 Responses to “Show All Skipped Labels on the X-Axis”

  1. Piyush Vardhan singh said

    it very help full for every body


  2. Arunkumar S P said


  3. Aykut said

    Great great line of code! Thanks.

  4. Dustin said

    Thank you very, very much. Had beat my head against this for probably 20 hours or better.

  5. sree said

    hi its a good article but i had a quick question regarding bargraph the scale in y-axis is bit of zig-zag like one value is up and other is down can you please provide me a solution for that.

  6. Timmy said

    This article was very helpful. Thank you very much.

  7. Sarvana said

    Excellent article…

  8. saved my life lol

  9. […] […]

  10. zoya mehta said

    Chart1.ChartAreas[0].AxisX.Interval = 1;
    thats it

  11. Nick said

    I have my intervals set to 1 but it is still skipping every other axis label. Why? How do I fix it?

  12. ac said

    Thanks a lot.

  13. kkkh said

    Thanks really useful

  14. Vigyan said

    Thanks for the help

  15. tigg said

    Where can I find this option?
    I couldn`t find it inside the Advanced properties

  16. Mohammed AbdulFattah said

    5 Stars for this article.
    That was very helpful. I was not able to find why my alternate labels are missing.

  17. jice said

    Thanks . It works

  18. Micky Ross said

    Wow. Can’t believe that such an esoteric solution is required to something so fundamental. Many Thanks.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: