Pre loader

DateTimeNumericAxis label format

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

I’m using a DateTimeNumericAxis as my xAxis.
As an example, 1 of my records date time is set to: 2024-08-02T15:00:00+10:00

They are converted to a timestamp value of 1722574800 and add it to the series.xValues, because it’s the format that SciChart reads. However, the xAxis label is being translated as August 2, 2024 5:00:00 AM instead of August 2, 2024 3:00:00 PM.

My current workaround is to create custom labels by updating the xAxis.labelProvider.formatLabel and labelProvider.formatCursorLabel of the xAxis. So now, I can convert it to toLocaleDateString with options: month: ‘short’, day: ‘numeric’ . But it’s not as compact as the default labels.

Default Axis Labels: Jul 27 28 29 30 31 Aug 02
Custom Axis Labels: 26 Jul 27 Jul 28 Jul 29 Jul 30 Jul 31 Jul 01 Aug 02Aug

See attached images with default vs custom labels

Question: How do I go about making sure that the Axis Labels and Axis Cursor labels follows the actual DateTime (2024-08-02T15:00:00+10:00) without making any custom axis labels?

Version
3.4.636
Images
  • You must to post comments
0
0

A solution for this would be to override label provider methods:

 formatDateWide(labelRange: ETradeChartLabelFormat | string, value: number);
 formatDatePrecise(labelRange: ETradeChartLabelFormat | string, value: number);
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.