Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DataTable Column Role for "color" #1267

Closed
orwant opened this issue May 9, 2015 · 5 comments
Closed

Add DataTable Column Role for "color" #1267

orwant opened this issue May 9, 2015 · 5 comments

Comments

@orwant
Copy link
Collaborator

orwant commented May 9, 2015

What would you like to see us add to this API?

DataTable column roles can currently be used to provide unique tooltips on particular
pieces of data. This allows the corresponding point or bar to behave differently than
the ones around it. Often times I want to highlight one particular data point (similar
to an annotation), but I'd like to do that by specifying a unique color for that data.

I'd like to request that a new column role for "color" be added, which allows individual
cells to be assigned a custom color. e.g.

var data = new google.visualization.DataTable();
data.addColumn('string', 'Month');
data.addColumn('number', 'Sales');
data.addColumn({type:'string', role:'color'});
data.addColumn('number', 'Profit');
data.addRows([
['April',1000, null, 200],
['May', 1170, '#ff0000', 130],
['June', 660, null, 120],
['July', 1030, null, 200]
]);


In this example, May's "Sales" bar/column/point/etc. would be colored red (#ff0000),
regardless of the rest of the series color.

What component is this issue related to (PieChart, LineChart, DataTable,
Query, etc)?

DataTable (but would affect to nearly all chart types)

*********************************************************
For developers viewing this issue: please click the 'star' icon to be
notified of future changes, and to let us know how many of you are
interested in seeing it resolved.
*********************************************************

Original issue reported on code.google.com by quicksketch on 2013-07-25 21:45:43

@orwant
Copy link
Collaborator Author

orwant commented May 9, 2015

Very useful functionality, was using in previous API but now cannot apply to my chart.

Original issue reported on code.google.com by harp@appnovation.com on 2014-05-15 10:18:26

@orwant
Copy link
Collaborator Author

orwant commented May 9, 2015

The "style" column role can do this already for some charts.  The ColumnChart documentation
has examples for this: https://developers.google.com/chart/interactive/docs/gallery/columnchart#Colors

Original issue reported on code.google.com by asgallant571 on 2014-05-22 17:23:40

@orwant
Copy link
Collaborator Author

orwant commented May 9, 2015

Like asgallant said, the style role should do this for you. As such, the style role
is effectively a color role. So I am going to close this Issue. If you believe that
the style role doesn't have all the functionality that you need, or if a certain chart
that you are using doesn't support it, please post here again and I will change the
description appropriately and reopen the bug.

Original issue reported on code.google.com by grabks@google.com on 2014-05-22 17:27:42

@orwant
Copy link
Collaborator Author

orwant commented May 9, 2015

Excellent, thanks I was not aware of the style role. The seems like it should work in
most situations. I'll open a more specific issue for the style role if I encounter
somewhere this won't work.

Original issue reported on code.google.com by quicksketch on 2014-05-22 17:51:42

@orwant orwant closed this as completed May 9, 2015
@sharadugalmugale
Copy link

hi
i am using timeline chart in my project ,i want each column should be in different color for that i have maintained color array .doing like this
var options = {
colors : colorsList,
};
but it's not working in some condtion.plz help me
Thanks in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants