0

I'd like to compare LAI (Leaf Area Index) data from the same region over different times using ui.Chart.image.series in Google Earth Engine.

I'm trying to set the axis to the same range, in order to compare the charts by using min Value and maxValue like this:

var chart2 =
    ui.Chart.image
        .series({
          imageCollection: lai_august_19_broadleaf,
          region: aoi,
          reducer: ee.Reducer.mean(),
          scale: 500,
          xProperty: "system:index"
        })
        chart2.setOptions({
          title: 'Mean LAI France broadleaf forest forest June-August 2019',
          hAxis: {
            title: 'Time',
            minValue: 0,
            maxValue: 6
          },
          vAxis: {
            title: 'LAI',
          },
        });

The chart however does not adjust the axis using that method. Is this the correct way or is there another one to adjust the axis?

2 Answers 2

1

Just stumbled across this; but is this working for you:

hAxis: { title: 'Time', viewWindow: {minValue: 0, minValue: 6} }

1

Your code is almost right, just missed some details. To set the min and max axis value you need to use the viewWindow:{min: , max:} dictionary inside the hAxis and vAxis, as follows:

var chart2 =
    ui.Chart.image
        .series({
          imageCollection: lai_august_19_broadleaf,
          region: aoi,
          reducer: ee.Reducer.mean(),
          scale: 500,
          xProperty: "system:index"
        })
        chart2.setOptions({
          title: 'Mean LAI France broadleaf forest forest June-August 2019',
          hAxis: {
            title: 'Time',
            viewWindow: {min: 0, max: 6},
          },
          vAxis: {
            title: 'LAI',
            viewWindow: {min: 1, max: 7}
          },
        });

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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