Google グラフのツールは、デフォルトの設定で使用できます。すべてのカスタマイズは任意であり、基本設定は起動可能です。ただし、デフォルトのスタイルと相反するスタイルを採用しているウェブページでは、グラフを簡単にカスタマイズできます。すべてのグラフには、デザインをカスタマイズするためのオプションがいくつか用意されています。これらのオプションは、グラフの draw() メソッドに渡されるオプション オブジェクトで名前と値のペアとして表されます。
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"]],["最終更新日 2024-07-10 UTC。"],[],[],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)"]]