Can you please provide some examples of how to alter the formatting of a DateTimeAxis axis. I’d like to show the date and the time component that also supports localization based on the user regional settings.
- sdemooy asked 12 years ago
- You must login to post comments
DateTimeAxis (and NumericAxis) has a TextFormatting property. The property is used in code like this:
public override string FormatText(IComparable value, string format) { string textFormat = format.IsNullOrEmpty() ? TextFormatting : format; return ((DateTime)value).ToString(textFormat); }
You can supply any format that .NET accepts, for instance:
- dd MMM yyyy: formats day, Month, year
- HH:mm:ss: formats Hours:Minutes:seconds
- dd MMM yyyy HH:mm:ss.fff formats date, time and milliseconds
Beyond that you can provide a LabelProvider to an axis for fine-grained control over the label output.
There are detailed KB articles on Label Formatting, Text Formatting and Cursor Formatting here:
Axis Text Formatting, Cursor Text Formatting
Specifying Text Labels with ILabelProvider
Hope this is helpful,
- Andrew Burnett-Thompson answered 12 years ago
- You must login to post comments
Please login first to submit.