Class NumberRangeFilterBuilder
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
数字范围过滤器构建器
数字范围过滤条件控件的构建器。
数字范围过滤器是一个带有两个滑块的滑块,可让用户选择数字值范围。如果有一列类型编号和匹配选项,此控件会滤除与所选范围不匹配的行。
如需了解详情,请参阅 Gviz
文档。
详细文档
setMaxValue(maxValue)
设置范围下限范围的允许最大值。如果未定义,系统会根据控件管理的 DataTable 的内容推断出值。
// Builds a number range filter and sets the maximum value to 100.
const numberRangeFilter = Charts.newNumberRangeFilter()
.setFilterColumnLabel('Col2')
.setMaxValue(100)
.build();
参数
名称 | 类型 | 说明 |
maxValue | Integer | 滑块的最大值。 |
返回
NumberRangeFilterBuilder
- 此构建器适用于链接。
setMinValue(minValue)
设置范围下限的最小值。如果未定义,系统会根据控件管理的 DataTable 的内容推断出值。
// Builds a number range filter and sets the minimum value to 10.
const numberRangeFilter = Charts.newNumberRangeFilter()
.setFilterColumnLabel('Col2')
.setMinValue(10)
.build();
参数
名称 | 类型 | 说明 |
minValue | Integer | 滑块的最小值。 |
返回
NumberRangeFilterBuilder
- 此构建器适用于链接。
setOrientation(orientation)
设置滑块方向。
// Builds a number range filter and sets it to have a horizontal orientation.
const numberRangeFilter = Charts.newNumberRangeFilter()
.setFilterColumnLabel('Col2')
.setOrientation(Charts.Orientation.HORIZONTAL)
.build();
参数
返回
NumberRangeFilterBuilder
- 此构建器适用于链接。
另请参阅
setShowRangeValues(showRangeValues)
设置是否在滑块旁边显示所选范围的范围。
// Builds a number range filter and enables showing of the number range values.
const numberRangeFilter = Charts.newNumberRangeFilter()
.setFilterColumnLabel('Col2')
.setShowRangeValues(true)
.build();
参数
名称 | 类型 | 说明 |
showRangeValues | Boolean | 如果为 true ,则启用在滑块旁边显示标签。 |
返回
NumberRangeFilterBuilder
- 此构建器适用于链接。
setTicks(ticks)
设置数字范围过滤条件滑块滑块头可落在的刻度数(范围栏中的固定位置)。
// Builds a number range filter and sets the number of ticks for the range
// to 10.
const numberRangeFilter = Charts.newNumberRangeFilter()
.setFilterColumnLabel('Col2')
.setTicks(10)
.build();
参数
名称 | 类型 | 说明 |
ticks | Integer | 滑块上的刻度数。 |
返回
NumberRangeFilterBuilder
- 此构建器适用于链接。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003eThe \u003ccode\u003eNumberRangeFilterBuilder\u003c/code\u003e helps create interactive number range filter controls for your charts, which are essentially sliders for selecting numeric value ranges.\u003c/p\u003e\n"],["\u003cp\u003eThis builder allows you to customize the filter's minimum and maximum values, orientation (horizontal or vertical), display of range values, and the number of ticks on the slider.\u003c/p\u003e\n"],["\u003cp\u003eUse this builder to refine data visualization by filtering out rows that fall outside the specified numeric range, enhancing user interaction with the chart.\u003c/p\u003e\n"],["\u003cp\u003eBy chaining the builder's methods, you can easily configure various aspects of the number range filter and seamlessly integrate it into your Google Charts.\u003c/p\u003e\n"]]],["The `NumberRangeFilterBuilder` creates a slider for filtering numeric data ranges. Key actions include setting the `maxValue` and `minValue` to define the range's boundaries, or letting them be inferred from the data. The `setOrientation` method controls slider direction. `setShowRangeValues` toggles labels displaying the selected range. Lastly, `setTicks` defines the number of fixed positions on the slider, limiting where the thumbs can be placed.\n"],null,["# Class NumberRangeFilterBuilder\n\nNumberRangeFilterBuilder\n\nA builder for number range filter controls.\n\nA number range filter is a slider with two thumbs that lets the user select ranges of numeric\nvalues. Given a column of type number and matching options, this control filters out the rows\nthat don't match the range that was selected.\n\nFor more details, see the Gviz [documentation.](http://developers.google.com/chart/interactive/docs/gallery/controls.html#numberrangefilter) \n\n### Methods\n\n| Method | Return type | Brief description |\n|---------------------------------------------------------------------|-------------------------------|------------------------------------------------------------------------------------------------------------|\n| [setMaxValue(maxValue)](#setMaxValue(Integer)) | [NumberRangeFilterBuilder](#) | Sets the maximum allowed value for the range lower extent. |\n| [setMinValue(minValue)](#setMinValue(Integer)) | [NumberRangeFilterBuilder](#) | Sets the minimum allowed value for the range lower extent. |\n| [setOrientation(orientation)](#setOrientation(Orientation)) | [NumberRangeFilterBuilder](#) | Sets the slider orientation. |\n| [setShowRangeValues(showRangeValues)](#setShowRangeValues(Boolean)) | [NumberRangeFilterBuilder](#) | Sets whether to have labels next to the slider displaying extents of the selected range. |\n| [setTicks(ticks)](#setTicks(Integer)) | [NumberRangeFilterBuilder](#) | Sets the number of ticks (fixed positions in a range bar) a number range filter slider thumbs can fall in. |\n\nDetailed documentation\n----------------------\n\n### `set``Max``Value(maxValue)`\n\nSets the maximum allowed value for the range lower extent. If undefined, the value is inferred\nfrom the contents of the DataTable managed by the control.\n\n```javascript\n// Builds a number range filter and sets the maximum value to 100.\nconst numberRangeFilter = Charts.newNumberRangeFilter()\n .setFilterColumnLabel('Col2')\n .setMaxValue(100)\n .build();\n```\n\n#### Parameters\n\n| Name | Type | Description |\n|--------------|-----------|----------------------------------|\n| `max``Value` | `Integer` | The maximum value of the slider. |\n\n#### Return\n\n\n[NumberRangeFilterBuilder](#) --- This builder, useful for chaining.\n\n*** ** * ** ***\n\n### `set``Min``Value(minValue)`\n\nSets the minimum allowed value for the range lower extent. If undefined, the value is inferred\nfrom the contents of the DataTable managed by the control.\n\n```javascript\n// Builds a number range filter and sets the minimum value to 10.\nconst numberRangeFilter = Charts.newNumberRangeFilter()\n .setFilterColumnLabel('Col2')\n .setMinValue(10)\n .build();\n```\n\n#### Parameters\n\n| Name | Type | Description |\n|--------------|-----------|----------------------------------|\n| `min``Value` | `Integer` | The minimum value of the slider. |\n\n#### Return\n\n\n[NumberRangeFilterBuilder](#) --- This builder, useful for chaining.\n\n*** ** * ** ***\n\n### `set``Orientation(orientation)`\n\nSets the slider orientation.\n\n```javascript\n// Builds a number range filter and sets it to have a horizontal orientation.\nconst numberRangeFilter = Charts.newNumberRangeFilter()\n .setFilterColumnLabel('Col2')\n .setOrientation(Charts.Orientation.HORIZONTAL)\n .build();\n```\n\n#### Parameters\n\n| Name | Type | Description |\n|---------------|----------------------------------------------------------|--------------------------------|\n| `orientation` | [Orientation](/apps-script/reference/charts/orientation) | The slider orientation to set. |\n\n#### Return\n\n\n[NumberRangeFilterBuilder](#) --- This builder, useful for chaining.\n\n#### See also\n\n- [Orientation](/apps-script/reference/charts/orientation)\n\n*** ** * ** ***\n\n### `set``Show``Range``Values(showRangeValues)`\n\nSets whether to have labels next to the slider displaying extents of the selected range.\n\n```javascript\n// Builds a number range filter and enables showing of the number range values.\nconst numberRangeFilter = Charts.newNumberRangeFilter()\n .setFilterColumnLabel('Col2')\n .setShowRangeValues(true)\n .build();\n```\n\n#### Parameters\n\n| Name | Type | Description |\n|-----------------------|-----------|----------------------------------------------------------|\n| `show``Range``Values` | `Boolean` | If `true`, enables showing of labels next to the slider. |\n\n#### Return\n\n\n[NumberRangeFilterBuilder](#) --- This builder, useful for chaining.\n\n*** ** * ** ***\n\n### `set``Ticks(ticks)`\n\nSets the number of ticks (fixed positions in a range bar) a number range filter slider thumbs\ncan fall in.\n\n```javascript\n// Builds a number range filter and sets the number of ticks for the range\n// to 10.\nconst numberRangeFilter = Charts.newNumberRangeFilter()\n .setFilterColumnLabel('Col2')\n .setTicks(10)\n .build();\n```\n\n#### Parameters\n\n| Name | Type | Description |\n|---------|-----------|------------------------------------|\n| `ticks` | `Integer` | The number of ticks on the slider. |\n\n#### Return\n\n\n[NumberRangeFilterBuilder](#) --- This builder, useful for chaining."]]