Send feedback
ui.Chart.setChartType
Stay organized with collections
Save and categorize content based on your preferences.
Sets the chartType of this chart.
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.
var dataTable = [
[{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'));
Send feedback
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-10-06 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
Need to tell us more?