SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and iOS Chart & Android Chart Components


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.

  • You must 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,

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.