SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and iOS Chart & Android Chart Components
I’d like to set line chart’s date xAxis ticks to be exactly one day apart in a way that where the label is shown, the time would be exactly 24:00.
I know I can set the minorDelta() and majorDelta(), but what value should I provide them? The minor tick when I zoom in should be 2 minutes and the major tick should be 24 hours.
I think I have easier way for you to provide desired output in DateAxis. Date is usually represent UTC time and we calculate ticks assuming that they are in UTC ( so when you set major tick = 1 day it rounds ticks to midnight in UTC time ), but we format labels in local time zone. So you can try to format labels in UTC time as well:
axis.setLabelProvider(new DateLabelProvider(new DateLabelFormatter(Locale.getDefault(), TimeZone.getTimeZone("UTC"))));
Can you try it? Is it suitable for your needs?
For DateAxis, since Android doesn’t provide built-in type for specifying time spans, it expects Date which store long representation of desired time span:
final long oneDay = DateIntervalUtil.fromDays(1); final long twoMinutes = DateIntervalUtil.fromMinutes(2); final IAxis xBottomAxis = sciChartBuilder.newDateAxis().withMajorDelta(new Date(oneDay)).withMinorDelta(new Date(twoMinutes)).withAutoTicks(false).build();
Please login first to submit.