interval property Null safety

double? interval
final

Splits the range selector into given interval. It is mandatory if labels, major ticks and dividers are needed.

For example, if min is 0.0 and max is 10.0 and interval is 2.0, the range selector will render the labels, major ticks, and dividers at 0.0, 2.0, 4.0 and so on.

For date values, the range selector doesn’t have auto interval support. So, you may need to set interval, dateIntervalType, and dateFormat for date values, if labels, ticks, and dividers are needed.

For example, if min is DateTime(2000, 01, 01, 00) and max is DateTime(2005, 12, 31, 24), interval is 1.0, dateFormat is DateFormat.y(), and dateIntervalType is DateIntervalType.years, then the range selector will render the labels, major ticks, and dividers at 2000, 2001, 2002 and so on.

Defaults to null. Must be greater than 0.

This snippet shows how to set numeric interval in SfRangeSelector.

SfRangeValues _initialValues = SfRangeValues(4.0, 8.0);

SfRangeSelector(
  min: 0.0,
  max: 10.0,
  initialValues: _initialValues,
  interval: 2,
  showTicks: true,
  showLabels: true,
   child: Container(
      height: 200,
      color: Colors.green[100],
   )
)

This snippet shows how to set date interval in SfRangeSelector.

SfRangeValues _initialValues = SfRangeValues(
     DateTime(2002, 01, 01), DateTime(2003, 01, 01));

SfRangeSelector(
  min: DateTime(2000, 01, 01, 00),
  max: DateTime(2005, 12, 31, 24),
  initialValues: _initialValues,
  interval: 1,
  showTicks: true,
  showLabels: true,
  dateFormat: DateFormat.y(),
  dateIntervalType: DateIntervalType.years,
   child: Container(
      height: 200,
      color: Colors.green[100],
   ),
)

See also:

Implementation

final double? interval;