Assigning Colors To Specific Columns In Google Charts
I would like to assign a specific color to each column in a Google Bar Chart. I was wondering what the best way is to go about doing this. I would like to include a color Hex code
Solution 1:
Use a "style" role column:
vardata = new google.visualization.DataTable();
data.addColumn('string', 'N');
data.addColumn('number', 'Value');
data.addColumn({type: 'string', role: 'style'});
data.addRow(['Orange', 0, 'color: #FF8000']);
data.addRow(['Red', 0, 'color: #FF0000']);
data.addRow(['Green', 0, 'color: #00FF00']);
data.addRow(['Blue', 0, 'color: #0000FF']);
data.addRow(['Purple', 0, 'color: #800080']);
Post a Comment for "Assigning Colors To Specific Columns In Google Charts"