The value of the format string of annotation can be changed using the ChartAxis.AnnoFormatString property. Numeric and time formats can be specified using the format specfied by the NumberFormatInfo and DateTimeFormatInfo classes.
The following tables provide common patterns used in the numeric and time formats.
Numeric Format Options Table
Format Pattern | Description |
---|---|
c, C |
Currency format. |
d, D |
Decimal format. |
e, E |
Scientific format. |
f, F | Fixed point format. |
g, G | General format. |
n, N | Number format. |
p, P | Percent format. |
Date Format Options Table
Format Pattern | Description |
---|---|
d, %d |
The day of the month. Single-digit days do not have a leading zero. |
dd |
The day of the month. Single-digit days have a leading zero. |
ddd |
The abbreviated name of the day of the week. |
dddd |
The full name of the day of the week. |
f, %f |
The fraction of a second in single-digit precision. |
ff |
The fraction of a second in a double-digit precision. |
fff |
The fraction of a second in three-digit precision. |
ffff |
The fraction of a second in a four-digit precision. |
H |
Displays the hour for the specified DateTime object in the range 1-12. |
m |
Displays the minute for the specified DateTime object in the range 0-59. |
To set the AnnoFormatString property to currency, complete the following:
1. Select View | Properties Window in the Visual Studio menu.
2. Click the drop-down list at the top of the Properties window and select Panel1_C1BarChartExtender.
3. Expand the Axis->Y node and enter ‘c’ for the AnnoFormatString property.