Pre loader

Format DateTimeAxis

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0
0

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
0
0

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.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies