Reputation:
I am using this Google Timeline Component. I need to use colors based on the one of the column property is there a way to do that? I want all bars with one property to have same color not different.
Upvotes: 0
Views: 192
Reputation: 21
You can create arrays to define bar color for each different property.
When you define the data, you can use the role property to define a color of bar. https://developers.google.com/chart/interactive/docs/roles#stylerole const data = [ [ { type: "string", id: "Phases" }, { type: "string", id: "Name" }, { type: 'string', role: 'style' }, { type: "date", id: "Start" }, { type: "date", id: "End" } ]];
Finally, you concat the arrays in Chart data. data={[...data, ...firstArray, ...secondArray]}
This is my first answer in stackoverflow. I hope I helped you.
Upvotes: 1
Reputation: 563
use this code
export const options = {
title: "Company Performance",
curveType: "function",
legend: { position: "bottom" },
colors:["green"]
};
change the color key to have different colors
Upvotes: 0