Array Data Charts

Arrays represent table data in matrix form. (Learn more about arrays in Earth Engine from the Arrays section). To plot these data, use `ui.Chart.array.values()`. Both X-data and Y-data are supplied to the constructor as arrays. For example, consider the following script which plots Landsat 8 band correlations for a region in San Francisco:

```// Define an arbitrary region of interest.
var sanFrancisco = ee.Geometry.Rectangle([-122.45, 37.74, -122.4, 37.8]);

// Load a Landsat 8 image.
var image = ee.Image('LANDSAT/LC08/C01/T1_TOA/LC08_044034_20140318');

// Get a dictionary with band names as keys, pixel lists as values.
var result = image.reduceRegion(ee.Reducer.toList(), sanFrancisco, 120);

// Convert the band data to plot on the y-axis to arrays.
var y1 = ee.Array(result.get('B5'));
var y2 = ee.Array(result.get('B6'));
// Concatenate the y-axis data by stacking the arrays on the 1-axis.
var yValues = ee.Array.cat([y1, y2], 1);

// The band data to plot on the x-axis is a List.
var xValues = result.get('B4');

// Make a band correlation chart.
var chart = ui.Chart.array.values(yValues, 0, xValues)
.setSeriesNames(['B5', 'B6'])
.setOptions({
title: 'LC8 TOA B4 vs. {B5,B6}',
hAxis: {'title': 'B4'},
vAxis: {'title': '{B5,B6}'},
pointSize: 3,
});

// Print the chart.
print(chart);
```

In this example, note that the data to plot on the y-axis are in an `Array` (`yValues`) and the x-coordinates of the data are provided in a `List` (`xValues`). The second parameter (`0`) of `ui.Chart.array.values()` tells Earth Engine along which array axis the chart data vary. The output should look something like Figure 1.