Atma Atma - 1 year ago 124
Javascript Question

how to change colors of cells in google visualization graph table

I am building a table in google graphs. I would like to change the color of a cell based on the numeric value of a cell. I am assuming I will do something like iterate through all of the cells and call the colorFormat object specified in docs here:

The problem is that there are no examples of exactly how to implement this method.

Does anyone know of an example or how the colorFormat can be implemented to change the color of cells?


Answer Source - did you scroll farther down?

var formatter = new google.visualization.ColorFormat();
formatter.addRange(-20000, 0, 'white', 'orange');
formatter.addRange(20000, null, 'red', '#33ff33');
formatter.format(data, 1); // Apply formatter to second column
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download