dateTimeInterval function

num dateTimeInterval(
  1. CartesianSeriesRenderer seriesRenderer
)

calculate the dateTime intervals for cardinal spline type

Implementation

num dateTimeInterval(CartesianSeriesRenderer seriesRenderer) {
  final DateTimeAxis xAxis =
      seriesRenderer._xAxisRenderer!._axis as DateTimeAxis;
  final DateTimeIntervalType _actualIntervalType = xAxis.intervalType;
  num intervalInMilliseconds;
  if (_actualIntervalType == DateTimeIntervalType.years) {
    intervalInMilliseconds = 365 * 24 * 60 * 60 * 1000;
  } else if (_actualIntervalType == DateTimeIntervalType.months) {
    intervalInMilliseconds = 30 * 24 * 60 * 60 * 1000;
  } else if (_actualIntervalType == DateTimeIntervalType.days) {
    intervalInMilliseconds = 24 * 60 * 60 * 1000;
  } else if (_actualIntervalType == DateTimeIntervalType.hours) {
    intervalInMilliseconds = 60 * 60 * 1000;
  } else if (_actualIntervalType == DateTimeIntervalType.minutes) {
    intervalInMilliseconds = 60 * 1000;
  } else if (_actualIntervalType == DateTimeIntervalType.seconds) {
    intervalInMilliseconds = 1000;
  } else {
    intervalInMilliseconds = 30 * 24 * 60 * 60 * 1000;
  }
  return intervalInMilliseconds;
}