The ColorFormatter only works on "number" data type, so you can't use it
with your boolean values, but you can emulate its effect. The
ColorFormatter changes the "style" property of the DataTable cells, which
the Table visualization assigns as the style attribute of the td's, so all
you have to do is parse the DataTable and set the "style" property of the
boolean cells:
for (var i = 0; i < data.getNumberOfRows(); i++) {
if (data.getValue(i, 7)) {
data.setProperty(i, 7, 'style', 'background-color: red');
}
else {
data.setProperty(i, 7, 'style', 'background-color: white');
}
if (data.getValue(i, 8)) {
data.setProperty(i, 8, 'style', 'background-color: red');
}
else {
data.setProperty(i, 8, 'style', 'background-color: white');
}
}
On Wednesday, July 30, 2014 7:03:49 PM UTC-4, Rashed Islam wrote:
>
> Hi,
> As shown in the attached file, two columns in my table will have
> true/false values. I want to do ColorFormat, so that all the "false" cells
> will get red background.
> I tried the one shown in the attached code, but it's not working.
> Any suggestion?
>
> Thanks.
>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.