Google Visualization's formatter can be called on a specific column, but not on a particular row.
I want to color code by the row, where each entry per row has a specific condition to meet. How can I achieve that?
Call formatter.format(table, colIndex), passing in the DataTable and the >(zero-based) column number of the data to reformat.
along with the options in this answer,
Google table Chart : how do I change the row background color based on a value,
you can set properties on the data table cell.
the table chart will accept cell properties for both
style
andclassName
when using object notation to load the data, use the
p:
key to set properties.where
v:
= value,f:
= formatted value, &p:
= cell propertiesto set the properties after the data has been loaded,
you can use any of the following methods.
1)
setCell(rowIndex, columnIndex, value, formattedValue, properties)
when using
setCell
, properties is the 5th argument, pass an object with the properties you want to set, e.g.2)
setProperty(rowIndex, columnIndex, name, value)
when using
setProperty
, pass the name and value of the property you want to set, e.g.3)
setProperties(rowIndex, columnIndex, properties)
when using
setProperties
, pass an object with the properties you want to set, e.g.see following working snippet for examples...