When I try to generate chart by region, I get following error:
Error generating chart: String: Unable to convert object to string.
How can I revise my code to remove this error?
var image = ee.Image('LANDSAT/LC08/C01/T1_TOA/LC08_026047_20140216')
.select(['B[1-7]']);
Map.addLayer(image, {bands: ['B5', 'B4', 'B3'], min: 0, max: 0.5});
// Define and display a FeatureCollection of 7 known locations.
var points = ee.FeatureCollection([
ee.Feature(ee.Geometry.Point(83.978710, 283202722)),
ee.Feature(ee.Geometry.Point(84.008199, 28.218142)),
ee.Feature(ee.Geometry.Point(84.2250, 28.371391)),
ee.Feature(ee.Geometry.Point(83.947601, 28.215001)),
ee.Feature(ee.Geometry.Point(83.895411, 28.588669)),
ee.Feature(ee.Geometry.Point(84.042354, 28.523533)),
ee.Feature(ee.Geometry.Point(84.085761,28.170022))
]);
Map.addLayer(points);
// Define a list of Landsat 8 wavelengths for X-axis labels.
var wavelengths = [0.44, 0.48, 0.56, 0.65, 0.86, 1.61, 2.2];
// Create the chart and set options.
var spectraChart = ui.Chart.image.regions(
image, points, ee.Reducer.mean(), 30, 'label', wavelengths)
.setChartType('ScatterChart')
.setOptions(options);
var classNames = ee.List([ 'built_up', 'grassland', 'forest', 'water','snow','rock/barren','cultivation']);
// Define customization options.
var options = {
title: 'Landsat 8 TOA spectra at three points near City',
hAxis: {title: 'Wavelength (micrometers)'},
vAxis: {title: 'Reflectance'},
lineWidth: 1,
pointSize: 4,
series: {
0: {color: '00FF00'},// built_up
1: {color: '00FF00'}, // grassland
2: {color: '228B22'},//forest
3: {color: '0000FF'}, // water
4: {color: 'ADD8E6'}, // rock/barren
5: {color: '808080'},//snow
6: {color: 'FFFF00'}// cultivation
}};
// Define a list of Landsat 8 wavelengths for X-axis labels.
var wavelengths = [0.44, 0.48, 0.56, 0.65, 0.86, 1.61, 2.2];
// Create the chart and set options.
var spectraChart = ui.Chart.image.regions(
image, points, ee.Reducer.mean(), 30, classNames, wavelengths)
.setChartType('ScatterChart')
.setOptions(options);
// Display the chart.
print(spectraChart);
code link: https://code.earthengine.google.com/0227789fa9d4b62979aa111d2d1e99ab