مخططات الصور

تحتوي وحدة ui.Chart.image على مجموعة من الدوالّ لتقليل Image العناصر حسب المناطق وعرض الرسوم البيانية من النتائج. يحدِّد اختيار الدالّة ترتيب البيانات في الرسم البياني، أي ما يحدِّد قيم محورَي السّين والصاعد وما يحدِّد السلسلة. استخدِم أوصاف الدوالّ التالية وأمثلتها لتحديد أفضل دالة ونوع رسم بياني لهدفك.

دوالّ الرسوم البيانية

استخدِم مخطّطات المخططات التالية كدليل مرئي لفهم كيفية ترتيب كل دالة لنتائج تقليل منطقة الصورة في رسم بياني، أي العناصر التي تحدد قيم x وy والسلسلة.

ui.Chart.image.byRegion

يتمّ رسم مناطق الخفض على طول محور السينات، ويتمّ تصنيفها حسب قيم ملف شخصي محدّد لسمة. يتم تحديد السلاسل من خلال أسماء النطاقات التي يتمّ رسم نتائج خفض المنطقة لها على طول محور y.

ui.Chart.image.regions

يتمّ رسم النطاقات على طول المحور السيني. يتم تصنيف السلاسل حسب قيم سمة موقع. يتمّ رسم انخفاض المنطقة المحدّدة من خلال الشكل الهندسي لسمات السلسلة المتعلّقة على محور ص.

ui.Chart.image.byClass

يتمّ رسم نطاقات البيانات على طول المحور السيني. يتم تمثيل السلاسل بقيم فريدة في نطاق فئة. يتم تحديد موضع محور Y حسب نتائج تقليل المنطقة للبكسل التي تتألف منها كل سلسلة.

ui.Chart.image.histogram

مخطّط بياني هرمي للتردد لقيم النطاقات المحدّدة

  • المحور السيني: مجموعات التوزيع البياني للقيم في النطاقات المحدّدة
  • المحور Y: تكرار وحدات البكسل المؤهَّلة لكل مجموعة في المخطّط البياني المدرَج

مثال للبيانات

تعتمد الأمثلة التالية على FeatureCollection يتألّف من ثلاث ميزات للمناطق الإيكولوجية تحدّد المناطق التي يتم من خلالها تقليل بيانات الصور. بيانات Image هي بيانات PRISM العادية عن المناخ، حيث تصف النطاقات متغيّرات المناخ شهريًا، على سبيل المثال: هطول الأمطار في شهر تموز (يوليو) أو متوسط درجة الحرارة في شهر كانون الثاني (يناير) تعرَّف على كيفية إنشاء مادة العرض هذه.

ui.Chart.image.byRegion

رسم بياني عمودي

في هذا المثال، يتم تقليل نطاقات الصور التي تمثّل متوسّط درجة الحرارة الشهرية إلى المتوسط بين وحدات البكسل التي تتقاطع مع كلّ من المناطق البيئية الثلاث. يتم تمثيل النتائج كأعمدة شهرية حسب المنطقة البيئية، حيث يشير ارتفاع العمود إلى متوسّط درجة الحرارة الشهرية ذات الصلة.

محرِّر الرموز البرمجية (JavaScript)

// Import the example feature collection.
var ecoregions = ee.FeatureCollection('projects/google/charts_feature_example');

// Load PRISM climate normals image collection; convert images to bands.
var normClim = ee.ImageCollection('OREGONSTATE/PRISM/Norm81m').toBands();

// Define the chart and print it to the console.
var chart =
    ui.Chart.image
        .byRegion({
          image: normClim.select('[0-9][0-9]_tmean'),
          regions: ecoregions,
          reducer: ee.Reducer.mean(),
          scale: 500,
          xProperty: 'label'
        })
        .setSeriesNames([
          'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct',
          'Nov', 'Dec'
        ])
        .setChartType('ColumnChart')
        .setOptions({
          title: 'Average Monthly Temperature by Ecoregion',
          hAxis:
              {title: 'Ecoregion', titleTextStyle: {italic: false, bold: true}},
          vAxis: {
            title: 'Temperature (°C)',
            titleTextStyle: {italic: false, bold: true}
          },
          colors: [
            '604791', '1d6b99', '39a8a7', '0f8755', '76b349', 'f0af07',
            'e37d05', 'cf513e', '96356f', '724173', '9c4f97', '696969'
          ]
        });
print(chart);

رسم بياني شريطي

يمكن عرض الرسم البياني للأعمدة السابق كرسم بياني شريطي من خلال تغيير الإدخال .setChartType() من 'ColumnChart' إلى 'BarChart'.

var chart =
    ui.Chart.image
        .byRegion({
          image: normClim.select('[0-9][0-9]_tmean'),
          regions: ecoregions,
          reducer: ee.Reducer.mean(),
          scale: 500,
          xProperty: 'label'
        })
        .setSeriesNames([
          'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct',
          'Nov', 'Dec'
        ])
        .setChartType('BarChart')
        .setOptions({
          title: 'Average Monthly Temperature by Ecoregion',
          hAxis: {
            title: 'Temperature (°C)',
            titleTextStyle: {italic: false, bold: true}
          },
          vAxis:
              {title: 'Ecoregion', titleTextStyle: {italic: false, bold: true}},
          colors: [
            '604791', '1d6b99', '39a8a7', '0f8755', '76b349', 'f0af07',
            'e37d05', 'cf513e', '96356f', '724173', '9c4f97', '696969'
          ]
        });

رسم بياني عمودي مكدّس

يحدِّد خيار الرسم البياني isStacked ما إذا كانت أعمدة الرسم البياني مكدّسة أم لا. تتوفّر عدة خيارات للتجميع. توضِّح الأمثلة التالية استخدام الخيارَين 'absolute' و'relative'.

صيغة مطلقة

يربط الرسم البياني الشريطي المكدس المطلق إجمالي متغيّر رقمي بمعدّلات سلسلة متغيّر فئات مُساهم. على سبيل المثال، في هذا المثال، يتمّ رسم إجمالي هطول الأمطار على أنّه تراكم هطول الأمطار شهريًا على مدار عام، حسب المنطقة البيئية. يتم تحديد إجماليات هطول الأمطار الشهرية من أشرطة الصور، حيث يمثّل كل شريط شبكة لمتوسط إجمالي هطول الأمطار لشهر معيّن، ويتم تقليلها إلى متوسّط وحدات البكسل التي تتقاطع مع كل منطقة من المناطق البيئية الثلاث. تم ضبط خيار الرسم البياني isStacked على 'absolute' لمحاولة تنسيق النتائج كقيم مطلقة.

محرِّر الرموز البرمجية (JavaScript)

// Import the example feature collection.
var ecoregions = ee.FeatureCollection('projects/google/charts_feature_example');

// Load PRISM climate normals image collection; convert images to bands.
var normClim = ee.ImageCollection('OREGONSTATE/PRISM/Norm81m').toBands();

// Define the chart and print it to the console.
var chart =
    ui.Chart.image
        .byRegion({
          image: normClim.select('[0-9][0-9]_ppt'),
          regions: ecoregions,
          reducer: ee.Reducer.mean(),
          scale: 500,
          xProperty: 'label'
        })
        .setSeriesNames([
          'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct',
          'Nov', 'Dec'
        ])
        .setChartType('ColumnChart')
        .setOptions({
          title: 'Average Monthly Precipitation by Ecoregion',
          hAxis:
              {title: 'Ecoregion', titleTextStyle: {italic: false, bold: true}},
          vAxis: {
            title: 'Precipitation (mm)',
            titleTextStyle: {italic: false, bold: true}
          },
          colors: [
            '604791', '1d6b99', '39a8a7', '0f8755', '76b349', 'f0af07',
            'e37d05', 'cf513e', '96356f', '724173', '9c4f97', '696969'
          ],
          isStacked: 'absolute'
        });
print(chart);

قريب

حوِّل الرسم البياني الشريطي المكدس المطلق السابق إلى رسم بياني شارطي مکدس نسبي بتغيير خيار الرسم البياني isStacked من 'absolute' إلى 'relative'. يربط الرسم البياني الشريطي المكدس النسبي نسبة سلسلة المتغيّرات الفئوية المساهمة إلى مجموع المتغيّر الرقمي. على سبيل المثال، في هذا المثال، يتمّ رسم هطول الأمطار الشهري كنسبة مئوية من إجمالي هطول الأمطار السنوي، حسب المنطقة البيئية.

var chart =
    ui.Chart.image
        .byRegion({
          image: normClim.select('[0-9][0-9]_ppt'),
          regions: ecoregions,
          reducer: ee.Reducer.mean(),
          scale: 500,
          xProperty: 'label'
        })
        .setSeriesNames([
          'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct',
          'Nov', 'Dec'
        ])
        .setChartType('ColumnChart')
        .setOptions({
          title: 'Average Monthly Precipitation by Ecoregion',
          hAxis:
              {title: 'Ecoregion', titleTextStyle: {italic: false, bold: true}},
          vAxis: {
            title: 'Precipitation (mm)',
            titleTextStyle: {italic: false, bold: true}
          },
          colors: [
            '604791', '1d6b99', '39a8a7', '0f8755', '76b349', 'f0af07',
            'e37d05', 'cf513e', '96356f', '724173', '9c4f97', '696969'
          ],
          isStacked: 'relative'
        });

رسم بياني للنقاط المبعثرة

تمّ رسم متوسط درجات الحرارة في شهرَي كانون الثاني (يناير) وتموز (يوليو) لعينة عشوائية من المواقع الجغرافية في ولاية كولورادو استنادًا إلى الارتفاع. يتم أخذ عيّنة من نموذج DEM باستخدام الدالة sample التي تعرض FeatureCollection مع سمة هندسة وارتفاع. بعد ذلك، يتم استخدام القيمة الناتجة FeatureCollection كأحد المَعلمات في المَعلمة regions لدالة ui.Chart.image.byRegion. يتم تحديد السلاسل من خلال نطاقات محدّدة من صورة القيم العادية للمناخ المُدخلة.

محرِّر الرموز البرمجية (JavaScript)

// Load SRTM elevation data.
var elev = ee.Image('CGIAR/SRTM90_V4').select('elevation');

// Subset Colorado from the TIGER States feature collection.
var colorado = ee.FeatureCollection('TIGER/2018/States')
                   .filter(ee.Filter.eq('NAME', 'Colorado'));

// Draw a random sample of elevation points from within Colorado.
var samp = elev.sample(
    {region: colorado, scale: 30, numPixels: 500, geometries: true});

// Load PRISM climate normals image collection; convert images to bands.
var normClim = ee.ImageCollection('OREGONSTATE/PRISM/Norm81m').toBands();

// Define the chart and print it to the console.
var chart = ui.Chart.image
                .byRegion({
                  image: normClim.select(['01_tmean', '07_tmean']),
                  regions: samp,
                  reducer: ee.Reducer.mean(),
                  scale: 500,
                  xProperty: 'elevation'
                })
                .setSeriesNames(['Jan', 'Jul'])
                .setChartType('ScatterChart')
                .setOptions({
                  title: 'Average Monthly Colorado Temperature by Elevation',
                  hAxis: {
                    title: 'Elevation (m)',
                    titleTextStyle: {italic: false, bold: true}
                  },
                  vAxis: {
                    title: 'Temperature (°C)',
                    titleTextStyle: {italic: false, bold: true}
                  },
                  pointSize: 4,
                  dataOpacity: 0.6,
                  colors: ['1d6b99', 'cf513e'],
                });
print(chart);

رسم بياني مجمّع

بالنسبة إلى ثلاث مناطق إيكولوجية في ee.FeatureCollection، يتمّ رسم متوسط درجة الحرارة وهطول الأمطار في شهر حزيران (يونيو) لكلّ منطقة. يتم الحصول على النتائج من تصغير منطقة في الصورة حيث تكون كل مجموعة نطاقات عبارة عن شبكة من القيم العادية للمناخ التي تصف هطول الأمطار ودرجة الحرارة الشهرية، وتكون مجموعات النطاقات التي تمثّل درجة حرارة حزيران (يونيو) وهطول الأمطار مجموعة فرعية. بما أنّ هطول الأمطار ودرجة الحرارة يتم قياسهما بوحدات مختلفة، يتم استخدام محورَي y من خلال ضبط خيارَي series وvAxes. يُرجى ملاحظة استخدام الخيار series.targetAxisIndex لتحديد المتغيّر الذي يتم تمثيله على محور y الأيمن واليسار. يتم استخدام الرموز الخاصة بالسلسلة (النقاط والأعمدة) للتمييز بسهولة أكبر بين المتغيّرين على أنّهما يملكان وحدات مختلفة.

محرِّر الرموز البرمجية (JavaScript)

// Import the example feature collection.
var ecoregions = ee.FeatureCollection('projects/google/charts_feature_example');

// Load PRISM climate normals image collection; convert images to bands.
var normClim = ee.ImageCollection('OREGONSTATE/PRISM/Norm81m').toBands();

// Define the chart and print it to the console.
var chart =
    ui.Chart.image
        .byRegion({
          image: normClim.select(['06_tmean', '06_ppt']),
          regions: ecoregions,
          reducer: ee.Reducer.mean(),
          scale: 500,
          xProperty: 'label'
        })
        .setSeriesNames(['Precipitation', 'Temperature'])
        .setChartType('ColumnChart')
        .setOptions({
          title: 'Average June Temperature and Precipitation by Ecoregion',
          series: {
            0: {targetAxisIndex: 1, type: 'bar', color: '1d6b99'},
            1: {
              targetAxisIndex: 0,
              type: 'line',
              lineWidth: 0,
              pointSize: 10,
              color: 'e37d05'
            }
          },
          hAxis:
              {title: 'Ecoregion', titleTextStyle: {italic: false, bold: true}},
          vAxes: {
            0: {
              title: 'Temperature (°C)',
              baseline: 0,
              titleTextStyle: {italic: false, bold: true, color: 'e37d05'}
            },
            1: {
              title: 'Precipitation (mm)',
              titleTextStyle: {italic: false, bold: true, color: '1d6b99'}
            },
          },
          bar: {groupWidth: '40%'},
        });
print(chart);

ui.Chart.image.regions

مثال على الإعداد

تقبل الدالة ui.Chart.image.regions قائمة تتيح لك التحكّم في تصنيف أسماء النطاقات وترتيبها على طول محور x من خلال إسناد قيم رقمية إليها. تستخدِم الرسوم البيانية التالية هذا الخيار لضبط أسماء النطاقات لتصنيف الأشهر وترتيبها في ترتيبٍ زمني لمتوسط هطول الأمطار الشهري.

رسم بياني عمودي

يعرض هذا الرسم البياني إجمالي متوسط هطول الأمطار شهريًا في ثلاث مناطق إيكولوجية. يتم الحصول على النتائج من خلال تقليل منطقة الصورة حيث يكون كل نطاق هو شبكة لمتوسط إجمالي هطول الأمطار لشهر معيّن. يتمّ رسم النطاقات بجانب المحور السيني، وتحدّد المناطق السلسلة. يُرجى ملاحظة العمليات من جهة العميل المستخدَمة لتحديد مدخلات خيارات الرسم البياني xLabels وticks لأجل الترتيب المخصّص للمحور x. تكون عمليات العميل مطلوبة لأنّ الخيارات التي يتم تقديمها إلى الدالة setOptions يجب أن تكون عناصر من جهة العميل (اطّلِع على العميل مقابل الخادم لفهم الفرق). لتحويلها إلى رسم بياني شريطي، استخدِم 'BarChart' كإدخال .setChartType().

محرِّر الرموز البرمجية (JavaScript)

// Import the example feature collection.
var ecoregions = ee.FeatureCollection('projects/google/charts_feature_example');

// Load PRISM climate normals image collection, convert images to bands, and
// subset precipitation bands.
var precip = ee.ImageCollection('OREGONSTATE/PRISM/Norm81m')
                 .toBands()
                 .select('[0-9][0-9]_ppt');

// Define a dictionary that associates band names with values and labels.
var precipInfo = {
  '01_ppt': {v: 1, f: 'Jan'},
  '02_ppt': {v: 2, f: 'Feb'},
  '03_ppt': {v: 3, f: 'Mar'},
  '04_ppt': {v: 4, f: 'Apr'},
  '05_ppt': {v: 5, f: 'May'},
  '06_ppt': {v: 6, f: 'Jun'},
  '07_ppt': {v: 7, f: 'Jul'},
  '08_ppt': {v: 8, f: 'Aug'},
  '09_ppt': {v: 9, f: 'Sep'},
  '10_ppt': {v: 10, f: 'Oct'},
  '11_ppt': {v: 11, f: 'Nov'},
  '12_ppt': {v: 12, f: 'Dec'}
};

// Organize precipitation information into objects for defining x values and
// their tick labels. Note that chart options provided to the .setOptions()
// function must be client-side objects, which is why a client-side for
// loop is used to iteratively populate lists from the above dictionary.
var xPropVals = [];    // List to codify x-axis band names as values.
var xPropLabels = [];  // Holds dictionaries that label codified x-axis values.
for (var key in precipInfo) {
  xPropVals.push(precipInfo[key].v);
  xPropLabels.push(precipInfo[key]);
}

// Define the chart and print it to the console.
var chart = ui.Chart.image
                .regions({
                  image: precip,
                  regions: ecoregions,
                  reducer: ee.Reducer.mean(),
                  scale: 5e3,
                  seriesProperty: 'label',
                  xLabels: xPropVals
                })
                .setChartType('ColumnChart')
                .setOptions({
                  title: 'Average Ecoregion Precipitation by Month',
                  hAxis: {
                    title: 'Month',
                    titleTextStyle: {italic: false, bold: true},
                    ticks: xPropLabels
                  },
                  vAxis: {
                    title: 'Precipitation (mm)',
                    titleTextStyle: {italic: false, bold: true}
                  },
                  colors: ['f0af07', '0f8755', '76b349'],
                });
print(chart);

رسم بياني خطي

يمكن عرض المخطط العمودي السابق كمخطط خطي من خلال تغيير الإدخال .setChartType() من 'ColumnChart' إلى 'LineChart'.

var chart = ui.Chart.image
                .regions({
                  image: precip,
                  regions: ecoregions,
                  reducer: ee.Reducer.mean(),
                  scale: 500,
                  seriesProperty: 'label',
                  xLabels: xPropVals
                })
                .setChartType('LineChart')
                .setOptions({
                  title: 'Average Ecoregion Precipitation by Month',
                  hAxis: {
                    title: 'Month',
                    titleTextStyle: {italic: false, bold: true},
                    ticks: xPropLabels
                  },
                  vAxis: {
                    title: 'Precipitation (mm)',
                    titleTextStyle: {italic: false, bold: true}
                  },
                  colors: ['f0af07', '0f8755', '76b349'],
                  lineSize: 5
                });

رسم بياني مساحي

يمكن عرض الرسم البياني العمودي السابق كرسم بياني مساحي من خلال تغيير الإدخال .setChartType() من 'ColumnChart' إلى 'AreaChart'.

var chart = ui.Chart.image
                .regions({
                  image: precip,
                  regions: ecoregions,
                  reducer: ee.Reducer.mean(),
                  scale: 500,
                  seriesProperty: 'label',
                  xLabels: xPropVals
                })
                .setChartType('AreaChart')
                .setOptions({
                  title: 'Average Ecoregion Precipitation by Month',
                  hAxis: {
                    title: 'Month',
                    titleTextStyle: {italic: false, bold: true},
                    ticks: xPropLabels
                  },
                  vAxis: {
                    title: 'Precipitation (mm)',
                    titleTextStyle: {italic: false, bold: true}
                  },
                  colors: ['f0af07', '0f8755', '76b349'],
                  lineSize: 5
                });

رسم بياني دائري

يتم عرض متوسط هطول الأمطار الشهري كنسبة مئوية من متوسط إجمالي هطول الأمطار السنوي لمنطقة بيئية غابات. نطاقات الصور التي تمثل هطول الأمطار الشهري هي مجموعة فرعية من مجموعة بيانات القيم العادية للمناخ ويتم تقليلها إلى متوسط عدد البكسلات التي تتقاطع مع المنطقة البيئية.

محرِّر الرموز البرمجية (JavaScript)

// Import the example feature collection, subset the forest ecoregion.
var forest = ee.FeatureCollection('projects/google/charts_feature_example')
                 .filter(ee.Filter.eq('label', 'Forest'));

// Load PRISM climate normals image collection, convert images to bands.
var normClim = ee.ImageCollection('OREGONSTATE/PRISM/Norm81m').toBands();

// Define x-axis labels to replace default band names.
var monthNames = [
  'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov',
  'Dec'
];

// Define the chart and print it to the console.
var chart = ui.Chart.image
                .regions({
                  image: normClim.select('[0-9][0-9]_ppt'),
                  regions: forest,
                  reducer: ee.Reducer.mean(),
                  scale: 5e3,
                  seriesProperty: 'label',
                  xLabels: monthNames
                })
                .setChartType('PieChart')
                .setOptions({
                  title: 'Average Monthly Precipitation for Forest Ecoregion',
                  colors: [
                    '604791', '1d6b99', '39a8a7', '0f8755', '76b349', 'f0af07',
                    'e37d05', 'cf513e', '96356f', '724173', '9c4f97', '696969'
                  ]
                });
print(chart);

رسم بياني دائري مجوف

حوِّل مثال الرسم البياني الدائري إلى رسم بياني على شكل فطيرة من خلال ضبط خيار الرسم البياني pieHole. جرِّب 0.4 و0.6 كقيم أولية.

var chart = ui.Chart.image
                .regions({
                  image: normClim.select('[0-9][0-9]_ppt'),
                  regions: forest,
                  reducer: ee.Reducer.mean(),
                  scale: 5e3,
                  seriesProperty: 'label',
                  xLabels: monthNames
                })
                .setChartType('PieChart')
                .setOptions({
                  title: 'Average Monthly Precipitation for Forest Ecoregion',
                  colors: [
                    '604791', '1d6b99', '39a8a7', '0f8755', '76b349', 'f0af07',
                    'e37d05', 'cf513e', '96356f', '724173', '9c4f97', '696969'
                  ],
                  pieHole: 0.4
                });

ui.Chart.image.byClass

رسم بياني خطي

ترسم الدالة ui.Chart.image.byClass إحصاءات قيم النطاق لشدَّة إشارة النقاط داخل المناطق المصنَّفة من "نطاق الفئة". في هذا المثال، يتم استخدامه لعرض الملف الشخصي الطيفي لثلاثة مناطق بيئية. يتم تحويل ميزات المناطق الإيكولوجية إلى ملف Raster وإضافة هذا الملف كشريحة إلى صورة MODIS لقياس انعكاس سطح الأرض (SR). بالنسبة إلى كل فئة من فئات المناطق الإيكولوجية ونطاق الانعكاس، يتم احتساب متوسط وحدات البكسل المعني وعرضها على المحور الصادي. تحدِّد الأطوال الموجية المركزية لفواصل قياس كثافة الأشعة الشمسية (SR) في أداة MODIS علامات المحور x وتصنيفاته. يُرجى العلم أنّه تم ضبط خيار الرسم البياني الخطي curveType على 'function' لتسوية الخطوط.

محرِّر الرموز البرمجية (JavaScript)

// Import the example feature collection.
var ecoregions = ee.FeatureCollection('projects/google/charts_feature_example');

// Convert ecoregion feature collection to a classified image.
var regionsBand =
    ecoregions
        .reduceToImage({properties: ['value'], reducer: ee.Reducer.first()})
        .rename('class');

// Define a MODIS surface reflectance composite.
var modisSr = ee.ImageCollection('MODIS/006/MOD09A1')
                  .filter(ee.Filter.date('2018-06-01', '2018-09-01'))
                  .select('sur_refl_b0[0-7]')
                  .mean();

// Reorder reflectance bands by ascending wavelength and
// add the classified ecoregions image as a band to the SR collection and
var modisSrClass = modisSr.select([2, 3, 0, 1, 4, 5, 6]).addBands(regionsBand);

// Define a list of MODIS SR wavelengths for x-axis labels.
var wavelengths = [469, 555, 655, 858, 1240, 1640, 2130];

// Define the chart and print it to the console.
var chart = ui.Chart.image
                .byClass({
                  image: modisSrClass,
                  classBand: 'class',
                  region: ecoregions,
                  reducer: ee.Reducer.mean(),
                  scale: 500,
                  classLabels: ['Desert', 'Forest', 'Grassland'],
                  xLabels: wavelengths
                })
                .setChartType('ScatterChart')
                .setOptions({
                  title: 'Ecoregion Spectral Signatures',
                  hAxis: {
                    title: 'Wavelength (nm)',
                    titleTextStyle: {italic: false, bold: true},
                    viewWindow: {min: wavelengths[0], max: wavelengths[6]}
                  },
                  vAxis: {
                    title: 'Reflectance (x1e4)',
                    titleTextStyle: {italic: false, bold: true}
                  },
                  colors: ['f0af07', '0f8755', '76b349'],
                  pointSize: 0,
                  lineSize: 5,
                  curveType: 'function'
                });
print(chart);

ui.Chart.image.histogram

يتم عرض مخطّط بياني هرمي لقيم البكسل ضمن منطقة تحيط بسولت لايك سيتي، يوتا، الولايات المتحدة الأمريكية، وذلك لثلاثة أشرطة من قياسات انعكاس سطح الأرض من أداة MODIS.

محرِّر الرموز البرمجية (JavaScript)

// Define a MODIS surface reflectance composite.
var modisSr = ee.ImageCollection('MODIS/006/MOD09A1')
                  .filter(ee.Filter.date('2018-06-01', '2018-09-01'))
                  .select(['sur_refl_b01', 'sur_refl_b02', 'sur_refl_b06'])
                  .mean();

// Define a region to calculate histogram for.
var histRegion = ee.Geometry.Rectangle([-112.60, 40.60, -111.18, 41.22]);

// Define the chart and print it to the console.
var chart =
    ui.Chart.image.histogram({image: modisSr, region: histRegion, scale: 500})
        .setSeriesNames(['Red', 'NIR', 'SWIR'])
        .setOptions({
          title: 'MODIS SR Reflectance Histogram',
          hAxis: {
            title: 'Reflectance (x1e4)',
            titleTextStyle: {italic: false, bold: true},
          },
          vAxis:
              {title: 'Count', titleTextStyle: {italic: false, bold: true}},
          colors: ['cf513e', '1d6b99', 'f0af07']
        });
print(chart);