How can I make combo chart in Earth Engine? I have a code that makes a chart based on image collection for given polygon. I would like to draw the mean value line in the chart as well. Is it possible to do it in Earth Engine?

var geometry = ee.Geometry.Polygon(
        [[[11.396256200031866, 51.10045908804461],
          [11.396256200031866, 51.06940343482601],
          [11.451187840656866, 51.06940343482601],
          [11.451187840656866, 51.10045908804461]]]);
var collection = ee.ImageCollection("MODIS/006/MOD13Q1")
      .filterDate(ee.Date.fromYMD(2019, 1, 1), ee.Date.fromYMD(2019, 12, 31))

var chart = ui.Chart.image.series(collection, geometry, ee.Reducer.mean())


What I have now:

enter image description here

What I want to have:

enter image description here

1 Answer 1


Add to every image in the collection th additional band you want to display. Then make a comboChart and set both series independently.

// add mean image to every image
var meanImage = collection.mean().rename('mean_NDVI');
var collection = collection.map(function(image){
  return image.addBands(meanImage);

var chart = ui.Chart.image.series(collection, geometry, ee.Reducer.mean(), 30)
      // setOptions to make a columnChart and lineChart
          series: {0: {type: 'bars'}, 1: {type: 'line'}}});



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.