- X 軸 = 由 xProperty 標示的圖片 (預設為「system:time_start」)。
- Y 軸 = 縮減函式輸出內容。
- 序列 = 由 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 軸值的 Reducer。必須傳回單一值。 |
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);