Pre loader

Datetime in X axis

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

Answered
1
0

Hi There,

I’m new to SciChart, I have a question regarding DateTimeAxis that is it possible to display the date when plotting data based on hours for multiple days?

For example, I’m plotting data for Aug/07, Aug/06, and Aug/05, so I have 72 data points to display, but the problem is the user can see all the data based on hours however, they will not be able to see when the day has changed. Is there any way I can achieve this.

Version
2.2.2404
Images
  • You must to post comments
Best Answer
1
1

Hi Umer

Are you using the DateTimeAxis or CategoryDateTimeAxis?

DateTimeAxis uses something called SmartDateLabelProvider out of the box. This shows Year, Month, Day as well as hours dynamically depending on zoom.

CategoryDateTimeAxis doesn’t, but you can set this label provider by applying this line of code:

import {CategoryAxis} from "scichart/Charting/Visuals/Axis/CategoryAxis";
import { SmartDateLabelProvider } from "scichart/Charting/Visuals/Axis/LabelProvider/SmartDateLabelProvider";

sciChartSurface.xAxes.add(new CategoryAxis(wasmContext, {
                labelProvider: new SmartDateLabelProvider()
}));

Note that you can have precise control over axis labels using the LabelProvider feature. So if you wanted to format dates that are on the next day with a date prefix, you can.

Take look at the LabelProvider documentation here and specifically Custom LabelProviders.

I welcome your feedback if you need a specific behaviour. Let me know exactly how you want the axis to behave and I will give some suggestions.

Best regards
Andrew

  • You must to post comments
1
0

Hi Andrew,

Thank you for your answer. I was able to achieve what I wanted to do using Custom LabelProviders

  • You must to post comments
Showing 2 results
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