Announcement: All noncommercial projects registered to use Earth Engine beforeApril 15, 2025 mustverify noncommercial eligibility to maintain access. If you have not verified by September 26, 2025, your access may be on hold.
ui.Chart.setChartType Stay organized with collections Save and categorize content based on your preferences.
Page Summary
Chart.setChartTypesets the chart type of aui.Chartinstance.This method returns the
ui.Chartinstance, allowing for method chaining.The
chartTypeargument is a String specifying the desired chart type, such as 'ScatterChart', 'LineChart', or 'ColumnChart'.A variety of chart types can be set using this method, including Scatter, Line, Column, Bar, Pie, Area, and Table charts.
Returns this chart.
| Usage | Returns |
|---|---|
Chart.setChartType(chartType) | ui.Chart |
| Argument | Type | Details |
|---|---|---|
this:ui.chart | ui.Chart | The ui.Chart instance. |
chartType | String | The chart type; e.g 'ScatterChart', 'LineChart', and 'ColumnChart'. For the complete list of charts, see: https://developers.google.com/chart/interactive/docs/gallery |
Examples
Code Editor (JavaScript)
// A data table of population for selected states.vardataTable=[[{role:'domain',label:'State'},{role:'data',label:'Population'}],['CA',37253956],['NY',19378102],['IL',12830632],['MI',9883640],['OR',3831074],];// Chart the data using accepted chart types.print('Scatter chart',ui.Chart(dataTable).setChartType('ScatterChart'));print('Line chart',ui.Chart(dataTable).setChartType('LineChart'));print('Column chart',ui.Chart(dataTable).setChartType('ColumnChart'));print('Bar chart',ui.Chart(dataTable).setChartType('BarChart'));print('Pie chart',ui.Chart(dataTable).setChartType('PieChart'));print('Area chart',ui.Chart(dataTable).setChartType('AreaChart'));print('Table',ui.Chart(dataTable).setChartType('Table'));
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-10-06 UTC.