The .NET charting control provides the ability to create
custom labels for the X or Y axis. This means that anyone has full control
over the text that renders along the axis line. For example, take a look at
the following example.
<AxisX>
<CustomLabels>
<asp:CustomLabel FromPosition="2004.5" ToPosition="2005.5"
Text="Store Opening" />
<asp:CustomLabel FromPosition="2008.5" ToPosition="2009.5"
Text="Current Year" />
</CustomLabels>
</AxisX>
Based upon this list of custom labels, the X axis value for
the year 2005 will be transformed to the text "Store Opening", and
the current year's axis value will be transformed to "Current Year".
You may be wondering why I use values like 2004.5. I tend
to use half decimal points and search for a range. The reasoning is that the X
and Y values are doubles, and sometimes even though a value is 16, it may
really be 15.999999999999999999999 or 16.000000000000001, and thus searching
for an exact value may not produce the actual result. This is one of the many
tidbits of knowledge that I learned from reading Steve McConnell's Code
Complete.
And so I tend to choose values I'm certain will be a match.
I could have used 2004.9 and 2005.1 to fit within the range, which would have
been perfectly fine; I just tend to use .5 for whatever reason that may be.