Table formatter for boolean values

34 views
Skip to first unread message

Ryan

unread,
Jan 31, 2017, 6:35:33 AM1/31/17
to Google Visualization API

Hello,


I have linked my google charts table to my google sheets and on my google sheet I have this:

It is achieved with conditional formatting.


When I display my table in google charts it changes my true and false to ticks and crosses, this means that it is recognised as boolean.



Is there a way I can apply a formatter to these values to match the behaviour above. I have tried this:


var boolFormat = new google.visualization.ColorFormat();
boolFormat.addRange(false, "", 'black', '#ff8787');
boolFormat.addRange(true, "", 'black', '#98d381');
boolFormat.format(data, 3);


But it doesn't work and I can't think of any other ways to achieve this.

Any help is greatly appreciated.

DevOp42

unread,
May 25, 2017, 1:35:14 PM5/25/17
to Google Visualization API
its a bit of a hack, but in the ready event you can modify the table:
google.visualization.events.addListener(Table, 'ready',function () {
   $TableTarget
.find('.google-visualization-table-td-bool:contains("✗")').css('color', 'red');
   $TableTarget
.find('.google-visualization-table-td-bool:contains("✔")').css('color', 'green');      
 
});
Reply all
Reply to author
Forward
0 new messages