– Trục X = Hình ảnh được gắn nhãn bằng xProperty (mặc định: "system:time_start").
– Trục Y = Đầu ra của bộ giảm tốc.
– Series = Khu vực được gắn nhãn bằng seriesProperty (mặc định: "system:index").
Trả về một biểu đồ.
Cách sử dụng | Giá trị trả về |
---|---|
ui.Chart.image.seriesByRegion(imageCollection, regions, reducer, band, scale, xProperty, seriesProperty) | ui.Chart |
Đối số | Loại | Thông tin chi tiết |
---|---|---|
imageCollection | ImageCollection | Một ImageCollection có dữ liệu sẽ được đưa vào biểu đồ. |
regions | Feature|FeatureCollection|Geometry|List<Feature>|List<Geometry> | Các khu vực cần giảm. |
reducer | Bộ giảm tốc | Hàm giảm tạo ra giá trị cho trục y. Phải trả về một giá trị duy nhất. |
band | Number|String, không bắt buộc | Tên dải tần cần giảm bằng cách sử dụng bộ giảm. Giá trị mặc định là dải tần đầu tiên. |
scale | Số, không bắt buộc | Tỷ lệ sử dụng với bộ giảm tốc theo mét. |
xProperty | Chuỗi, không bắt buộc | Thuộc tính sẽ được dùng làm nhãn cho từng hình ảnh trên trục x. Giá trị mặc định là "system:time_start". |
seriesProperty | Chuỗi, không bắt buộc | Thuộc tính của các đối tượng trong opt_regions sẽ được dùng cho nhãn của chuỗi. Mặc định là "system:index". |
Ví dụ
Trình soạn thảo mã (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);