Friday, May 3, 2013

Asp.net Chart: Labels Not Showing Up

You might have noticed that when you are making your fancy little asp.net chart that quite a few of your x-axis labels are missing. This wasn't a major issue when you were making a line chart, but when you got to the column graph, missing those labels was kind of a big deal. Not to worry, the solution is fairly simple; although, hard to find if your googling skills are as bad as mine.

You merely have to set the Interval attribute to 1 in the LabelStyle tag. Markup sample below:
















I also set the Interval to 1 in MajorGrid to make sure every column had its own tick mark. Additionally, I set the Angle to 45 to give each label more room (and it looks cool); but, in order for this to take effect you have to set IsLabelAutoFit to false  in the AxisX tag.

Happy coding!

No comments:

Post a Comment