公告:所有在
2025 年 4 月 15 日之前注册使用 Earth Engine 的非商业项目都必须
验证是否符合非商业性质的资格条件,才能继续使用 Earth Engine。
ui.DateSlider
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
可在两个日期之间线性拖动的目标。您可以将日期滑块配置为显示各种时间间隔大小的日期,包括天、8 天和年。滑块的值会显示在旁边的标签中。
用法 | 返回 |
---|
ui.DateSlider(start, end, value, period, onChange, disabled, style) | ui.DateSlider |
参数 | 类型 | 详细信息 |
---|
start | Date|Number|String,可选 | 开始日期,可以是世界协调时间 (UTC) 时间戳、日期字符串或 ee.Date。默认值为一周前。 |
end | Date|Number|String,可选 | 结束日期,可以是 UTC 时间戳、日期字符串或 ee.Date。默认值为今天。 |
value | Date|Number|String,可选 | 初始值。该值是一个数组,包含所选日期范围的开始日期和结束日期,但为方便起见,只需指定开始日期即可设置该值。默认值为昨天。 |
period | 数字,可选 | 滑块上值的间隔大小(以天为单位)。默认值为 1。 |
onChange | 函数(可选) | 当滑块状态发生变化时要触发的回调。系统会向回调传递一个表示滑块当前值的 ee.DateRange 和滑块 widget。 |
disabled | 布尔值,可选 | 滑块是否处于停用状态。默认值为 false。 |
style | 对象,可选 | 一个对象,包含允许的 CSS 样式及其要为此 widget 设置的值。默认为空对象。 |
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003eThe DateSlider widget provides a user interface for selecting a date range on a linear scale.\u003c/p\u003e\n"],["\u003cp\u003eIt offers flexibility in displaying various date intervals, including day, 8-day, and year.\u003c/p\u003e\n"],["\u003cp\u003eUsers can customize the start and end dates, initial value, interval size, and add event listeners for changes.\u003c/p\u003e\n"],["\u003cp\u003eThe slider displays a label indicating the selected date range and supports both single date selection and range selection.\u003c/p\u003e\n"],["\u003cp\u003eStyling options are available to modify the appearance of the widget.\u003c/p\u003e\n"]]],[],null,["# ui.DateSlider\n\n\u003cbr /\u003e\n\nA draggable target that ranges linearly between two dates. The date slider can be configured to display dates of various interval sizes, including day, 8-day, and year. The value of the slider is displayed as a label alongside it.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|---------------------------------------------------------------------------------------------------------|---------------|\n| `ui.DateSlider(`*start* `, `*end* `, `*value* `, `*period* `, `*onChange* `, `*disabled* `, `*style*`)` | ui.DateSlider |\n\n| Argument | Type | Details |\n|------------|--------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `start` | Date\\|Number\\|String, optional | The start date, as a UTC timestamp, date string, or ee.Date. Defaults to one week ago. |\n| `end` | Date\\|Number\\|String, optional | The end date, as a UTC timestamp, date string, or ee.Date. Defaults to today. |\n| `value` | Date\\|Number\\|String, optional | The initial value. The value is an array consisting of the start and end date for the selected date range, but for convenience, it can be set by specifying the start date alone. Defaults to yesterday. |\n| `period` | Number, optional | The interval size for values on the slider in days. Defaults to one. |\n| `onChange` | Function, optional | A callback to fire when the slider's state changes. The callback is passed an ee.DateRange representing the slider's current value and the slider widget. |\n| `disabled` | Boolean, optional | Whether the slider is disabled. Defaults to false. |\n| `style` | Object, optional | An object of allowed CSS styles with their values to be set for this widget. Defaults to an empty object. |"]]