If the features to be charted have a property that defines groups, use
ui.Chart.feature.groups() to plot each group as a different series. In the
following example, first a group is defined based on an existing property, then a
ui.Chart is made using the two groups:
// Load a table of average seasonal temperatures in U.S. cities.
var seasonalTemps = ee.FeatureCollection('ft:1G3RZbWoTiCiYv_LEwc7xKZq8aYoPZlL5_KuVhyDM');
// Define groups in the data by mapping a function to set a new property.
var grouped = seasonalTemps.map(function(feature) {
var skiable = ee.Number(feature.get('avg_temp_jan')).lte(0);
return feature.set('skiing', skiable);
});
// Create the chart.
var chart = ui.Chart.feature.groups(grouped, 'avg_temp_jan', 'avg_temp_jul', 'skiing')
.setChartType('ScatterChart')
.setOptions({
hAxis: {title: 'Average January Temperature (C)'},
vAxis: {title: 'Average July Temperature (C)'},
}).setSeriesNames(["ski", "don't ski"]);
// Print the chart.
print(chart);
The result should look something like Figure 1.