I am trying to create a chart in Earth Engine using the ui.Chart.feature.byFeature function. I am basing my code off of the following example provided by Google Developers...

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

// Define the chart and print it to the console.
var chart =
          features: ecoregions.select('[0-9][0-9]_tmean|label'),
          xProperty: 'label',
          'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct',
          'Nov', 'Dec'
          title: 'Average Monthly Temperature by Ecoregion',
              {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'

For my feature collection, I have a series of properties (F2010 - F2020) that represent annual values. I would like to use the feature chart function to plot the annual values for each feature in the collection.

The syntax in the Developers example shows the feature class properties indexed using the following language [0-9][0-9]_tmean. I am struggling to make sense of this because there are 12 months of data plotted in this example. I have tried indexing my feaure class properties in a similar manner to isolate the F2010-F2020 properties, but I cannot figure out the proper way to do this.

Here is a snippet of my code...

var chart =
          features: table.select('F[2010-2020][2010-2020]|County'),
          xProperty: 'County',

Link to Code

What am I doing wrong here?

  • Have you tried putting the F inside the brackets? [F2010-2020][F2010-2020] Just thinking of regular expressions but I'm guessing.
    – jbalk
    Sep 14, 2021 at 22:04

1 Answer 1


The problem with your script has to do with understanding how regular expressions are written. In this case, you are interested in selecting all the properties that start with an 'F' and are followed by four numbers ([0-9]{4}). The following expression does exactly that. In addition, notice that the select method should take as an argument a list (defined by the []), where the properties should be separated by a coma.

  • Thank you for explaining this logic and syntax to me. Sep 15, 2021 at 13:54

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.