- X 轴 = 由 xProperty 标记的图片(默认值:'system:time_start')。
- Y 轴 = Reducer 输出。
- 序列 = 由 seriesProperty 标记的区域(默认值:'system:index')。
返回图表。
用法 | 返回 |
---|---|
ui.Chart.image.seriesByRegion(imageCollection, regions, reducer, band, scale, xProperty, seriesProperty) | ui.Chart |
参数 | 类型 | 详细信息 |
---|---|---|
imageCollection | ImageCollection | 包含要纳入图表中的数据的 ImageCollection。 |
regions | Feature|FeatureCollection|Geometry|List<Feature>|List<Geometry> | 要缩减的区域。 |
reducer | 缩减器 | 用于生成 y 轴值的精简器。必须返回单个值。 |
band | Number|String,可选 | 要使用精简器减少的频段名称。默认为第一个频段。 |
scale | 数字,可选 | 用于与缩减器搭配使用的缩放比例(以米为单位)。 |
xProperty | 字符串,可选 | 用作 x 轴上每张图片的标签的属性。默认值为“system:time_start”。 |
seriesProperty | 字符串,可选 | opt_regions 中用于序列标签的功能的属性。默认为“system:index”。 |
示例
代码编辑器 (JavaScript)
// Define regions of pixels to reduce and chart a time series for. var regions = ee.FeatureCollection([ ee.Feature( ee.Geometry.BBox(-121.916, 37.130, -121.844, 37.076), {label: 'Forest'}), ee.Feature( ee.Geometry.BBox(-122.438, 37.765, -122.396, 37.800), {label: 'Urban'}) ]); // Define an image collection time series to chart, MODIS vegetation indices // in this case. var imgCol = ee.ImageCollection('MODIS/006/MOD13A1') .filter(ee.Filter.date('2015-01-01', '2020-01-01')) .select(['NDVI', 'EVI']); // Define the chart and print it to the console. var chart = ui.Chart.image.seriesByRegion({ imageCollection: imgCol, band: 'NDVI', regions: regions, reducer: ee.Reducer.mean(), scale: 500, seriesProperty: 'label', xProperty: 'system:time_start' }) .setOptions({ title: 'Average NDVI Value by Date', hAxis: {title: 'Date', titleTextStyle: {italic: false, bold: true}}, vAxis: { title: 'NDVI (x1e4)', titleTextStyle: {italic: false, bold: true} }, lineWidth: 5, colors: ['0f8755', '808080'], }); print(chart);