var options = {
width: 400,
height: 240,
title: 'Toppings I Like On My Pizza',
colors: ['#e0440e', '#e6693e', '#ec8f6e', '#f3b49f', '#f6c7b6']
};
chart.draw(data, options);
这是此代码创建的图表。
您也可以从字面上在 draw() 方法中指定选项:
chart.draw(data, {
width: 400,
height: 240,
title: 'Toppings I Like On My Pizza',
colors: ['#e0440e', '#e6693e', '#ec8f6e', '#f3b49f', '#f6c7b6'],
is3D: true
});
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2024-07-10。"],[],[],null,["# How to Customize Charts\n\nYou can use Google Chart Tools with their default setting - all customization is optional and the basic setup is launch-ready. However, charts can be easily customizable in case your webpage adopts a style which is at odds with provided defaults. Every chart exposes a number of options that customize its look and feel. These options are expressed as name:value pairs in the options object passed into a chart's [draw()](/chart/interactive/docs/reference#visdraw) method.\n\nCharts usually support custom options appropriate to that visualization.\nFor example, the [table chart](/chart/interactive/docs/gallery/table) supports\na `sortColumn` option to specify the default sorting column, and the [pie\nchart](/chart/interactive/docs/gallery/piechart#Configuration_Options) visualization supports a `colors` option that lets you specify\nslice colors. Each chart's documentation should describe the options\nthat it supports.\n\nYou will pass your options in as an optional second parameter\nto the chart's [draw()](/chart/interactive/docs/reference#visdraw) method\ndescribed previously. You specify options by creating an object with properties\nspecific to each chart.\n\nThe following example demonstrates creating an options object that specifies all\nof these properties: \n\n```\nvar options = {\n width: 400,\n height: 240,\n title: 'Toppings I Like On My Pizza',\n colors: ['#e0440e', '#e6693e', '#ec8f6e', '#f3b49f', '#f6c7b6']\n};\n\nchart.draw(data, options);\n```\n\nHere's the chart that this code creates.\n\n|---|\n| |\n\nYou can also specify options literally within the `draw()` method: \n\n```\nchart.draw(data, {\n width: 400,\n height: 240,\n title: 'Toppings I Like On My Pizza',\n colors: ['#e0440e', '#e6693e', '#ec8f6e', '#f3b49f', '#f6c7b6'],\n is3D: true\n});\n```\n\nHere's the chart that this code creates.\n\n|---|\n| |\n\n**More Information**\n\n- [Customized branding example](/chart/interactive/docs/examples#customized_branding)\n- [Customized table example](/chart/interactive/docs/examples#custom_table_example)"]]