ArrayMath& selectStartOfDay(int majorTickStep = 1, double initialMargin = 10800);
Selects the elements of the ArrayMath object that represents a different day from the previous element.
This method assumes the elements of the ArrayMath object are dates/times
The primary purpose of this method is to select the appropriate elements as ticks on an enumerated axis.
Suppose you want to plot a variable against time. The x-values of the data points will be an array of dates/times. If an enumerated x-axis is used (see Axis.setLabels
), there will be a tick at every data point, which may be too dense if there are too many data points.
This method can be used to reduce the ticks to one tick per day (or one tick per multiple days). This is by selecting the dates/times in the data array only if it is not the same day as the previous element in the array. The selected elements will be left unchanged, while the elements not select will be replaced by NoValue
. The resulting array can be used directly in Axis.setLabels2
For the first data point, there is no previous data point to compare, so it is handled differently. The first data point will be selected if it is near the beginning of the day it represents. By default, near means within 3 hours (10800 seconds). This is configurable using the initialMargin
Note that if the data points does not have data in a certain time range, no element can be selected in that time range, and so there will be no tick for that time range. This is appropriate for many chart types, such as finance charts, in which missing time ranges (non-trading hours, holidays, etc) are traditionally skipped.
However, if the data points may contain missing time ranges, but the ticks cannot be skipped, it may be more appropriate to use a non-enumerated x-axis by using Layer.setXData
© 2017 Advanced Software Engineering Limited. All rights reserved.