Wednesday, October 3, 2012

SSRS - Show All Skipped Labels on the X-Axis

My SSRS report does not show all the labels on the horizontal axis. Please see below.



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:
intervalauto

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

The short answer is, set the Interval property on the x-axis to 1:
1// Show all labels on the x-axis
2Chart1.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:
intervalautolabel1

No comments:

Post a Comment