The docs describe how to change the color of an entire bar by specifying a style data role column.
var data = google.visualization.arrayToDataTable([
['Element', 'Density', { role: 'style' }],
['Copper', 8.94, '#b87333'], // RGB value
['Silver', 10.49, 'silver'], // English color name
['Gold', 19.30, 'gold'],
['Platinum', 21.45, 'color: #e5e4e2' ], // CSS-style declaration
]);
Then, each record/item of the datatable can specify a color to represent itself.
But what if I am creating a stacked bar chart? Each record/item has multiple values for its different sections. How do I choose the colorings of each section (coloring based on columns/attributes), instead of choosing a color for each item record?
You can fiddle around with the colors configuration option:
columnChart.options = {
....
colors: ['steelblue','orange','red']
...
}
The colors key is associated with an array where each string element specifies a color to be used to color the sections of a bar (the column attributes). Change the order around to achieve the desired section coloring.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다