Pre loader

Major Delta and Minor Delta in DateAxis

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

Hello,
I want to display a chart using a DateAxis as X-Axis. The data set contains values for each basic unit of chosen time base, e.g. for a time base of one month, I get 31 data points, with one value assigned for each day. I want the chart to display a label for each value assigned, but using automatic settings I get the following output:
enter image description here

I wanted to manipulate the ticks by setting the MajorDelta and MinorDelta properties, but it expects a value of type Date, and I’m not sure which value I should provide to get a timespan of 1 day, 1 hour etc.
I set EnableLabelCulling to false, but somehow it doesn’t seem to take any effect.

Version
2.0.1884
  • You must to post comments
Best Answer
1
0

Hi Anna,

Yes, DateAxis expects Date as Major/MinorDelta values because Android SDK doesn’t provide any classes which allow to specify time span.

So to provide a Major/MinorDelta for DateAxis you need to create a Date which has desired time span:

Date majorDelta = new Date(DateIntervalUtil.fromHours(1)));
Date minorDelta = new Date(DateIntervalUtil.fromMinutes(15));

DateIntervalUtil class which is part of SciChart library contains some methods which allow to return intervals in milliseconds. Then you can use this long value with interval to create Date and pass it into DateAxis.


Also if you want to specify Major/MinorDelta values explicitly on axis you need to disable auto tick generation for this axis because by default Major/MinorDelta values are calculated based on current VisibleRange and MaxAutoTicks value of axis:

   final DateAxis xAxis = sciChartBuilder.newDateAxis()
            .withMajorDelta(new Date(DateIntervalUtil.fromHours(1)))
            .withMinorDelta(new Date(DateIntervalUtil.fromMinutes(15)))
            .withAutoTicks(false)
            .build();

Hope this will help you!

Best regards,
Yura

  • 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