I'm trying to graph a time series of weather indices obtained from the Gridmet Drought product, but am getting the following error: Error generating graph: Data columns for axis #0 cannot be of type string.
This is my script:
var GRIDMET = ee.ImageCollection("GRIDMET/DROUGHT")
.filter(ee.Filter.date('2010-02-18', '2022-06-26'))
.filterBounds(PNI)
.select('spi30d','eddi30d','spei30d','pdsi','z');
print(GRIDMET);
var GRIDMET_2 = GRIDMET.map(function(image) {
return image.set('timeFormat', image.date().format('dd-MM-yyyy'))});
print(GRIDMET_2);
var SPI = ui.Chart.image.seriesByRegion(
GRIDMET_2, PNI.geometry().bounds(), ee.Reducer.mean(), 'spi30d', 1000, 'timeFormat', 'label')
.setChartType('ScatterChart')
.setOptions({
title: 'SPI a través del tiempo',
hAxis: { title: 'Tiempo'},
vAxis: {title: 'SPI'},
lineWidth: 1});
print(SPI)