SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components
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.
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:
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.
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!
Please login first to submit.