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

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy. We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.

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.