Google is committed to advancing racial equity for Black communities. See how.

Class NumberRangeFilterBuilder

NumberRangeFilterBuilder

A builder for number range filter controls.

A number range filter is a slider with two thumbs that lets the user select ranges of numeric values. Given a column of type number and matching options, this control filters out the rows that don't match the range that was selected.

For more details, see the Gviz documentation.

Methods

MethodReturn typeBrief description
setMaxValue(maxValue)NumberRangeFilterBuilderSets the maximum allowed value for the range lower extent.
setMinValue(minValue)NumberRangeFilterBuilderSets the minimum allowed value for the range lower extent.
setOrientation(orientation)NumberRangeFilterBuilderSets the slider orientation.
setShowRangeValues(showRangeValues)NumberRangeFilterBuilderSets whether to have labels next to the slider displaying extents of the selected range.
setTicks(ticks)NumberRangeFilterBuilderSets the number of ticks (fixed positions in a range bar) a number range filter slider thumbs can fall in.

Detailed documentation

setMaxValue(maxValue)

Sets the maximum allowed value for the range lower extent. If undefined, the value is inferred from the contents of the DataTable managed by the control.

// Builds a number range filter and sets the maximum value to 100.
var numberRangeFilter = Charts.newNumberRangeFilter()
  .setFilterColumnLabel("Col2")
  .setMaxValue(100)
  .build();

Parameters

NameTypeDescription
maxValueIntegerThe maximum value of the slider.

Return

NumberRangeFilterBuilder — This builder, useful for chaining.


setMinValue(minValue)

Sets the minimum allowed value for the range lower extent. If undefined, the value is inferred from the contents of the DataTable managed by the control.

// Builds a number range filter and sets the minimum value to 10.
var numberRangeFilter = Charts.newNumberRangeFilter()
  .setFilterColumnLabel("Col2")
  .setMinValue(10)
  .build();

Parameters

NameTypeDescription
minValueIntegerThe minimum value of the slider.

Return

NumberRangeFilterBuilder — This builder, useful for chaining.


setOrientation(orientation)

Sets the slider orientation.

// Builds a number range filter and sets it to have a horizontal orientation.
var numberRangeFilter = Charts.newNumberRangeFilter()
  .setFilterColumnLabel("Col2")
  .setOrientation(Charts.Orientation.HORIZONTAL)
  .build();

Parameters

NameTypeDescription
orientationOrientationThe slider orientation to set.

Return

NumberRangeFilterBuilder — This builder, useful for chaining.

See also


setShowRangeValues(showRangeValues)

Sets whether to have labels next to the slider displaying extents of the selected range.

// Builds a number range filter and enables showing of the number range values.
var numberRangeFilter = Charts.newNumberRangeFilter()
  .setFilterColumnLabel("Col2")
  .setShowRangeValues(true)
  .build();

Parameters

NameTypeDescription
showRangeValuesBooleanIf true, enables showing of labels next to the slider.

Return

NumberRangeFilterBuilder — This builder, useful for chaining.


setTicks(ticks)

Sets the number of ticks (fixed positions in a range bar) a number range filter slider thumbs can fall in.

// Builds a number range filter and sets the number of ticks for the range to 10.
var numberRangeFilter = Charts.newNumberRangeFilter()
  .setFilterColumnLabel("Col2")
  .setTicks(10)
  .build();

Parameters

NameTypeDescription
ticksIntegerThe number of ticks on the slider.

Return

NumberRangeFilterBuilder — This builder, useful for chaining.