Custom Table Styling

Style specific rows from a table with CSS

HTML

<script src="https://d26b395fwzu5fz.cloudfront.net/3.4.0/keen.js?date=2016-02-17"></script>
<div id="table"></div>

CSS

.custom {
  background: pink;
  font-weight: 900;
}
.custom-left {
  text-align: left;
}
.custom-right {
  text-align: right;
}

JavaScript

var client = new Keen({
    projectId: "53eab6e12481962467000000",
    readKey: "d1b97982ce67ad4b411af30e53dd75be6cf610213c35f3bd3dd2ef62eaeac14632164890413e2cc2df2e489da88e87430af43628b0c9e0b2870d0a70580d5f5fe8d9ba2a6d56f9448a3b6f62a5e6cdd1be435c227253fbe3fab27beb0d14f91b710d9a6e657ecf47775281abc17ec455"
});

Keen.ready(function(){
    // Create a new Query instance
    var query = new Keen.Query("count", {
        event_collection: "user_action",
        group_by: "user.name",
        timeframe: {
  				start: "2013-12-01",
  				end: "2014-12-01"
				}
    });
    
    // Create a new Dataviz instance
    var table = new Keen.Dataviz()
    	.chartType('table')
      .el(document.getElementById('table'))
      .chartOptions({
        width: '100%'
      });
    
    // Run the query and the result
    client.run(query, function(err, res){
        table
        	.parseRequest(this)
          .dateFormat(function(googleDataTable){
          	// .setProperty(rowIndex, colIndex, 'className', 'your-class-here')
            googleDataTable.setProperty(4, 0, 'className', 'custom custom-left');
            googleDataTable.setProperty(3, 1, 'className', 'custom custom-right');
            return googleDataTable;
          })
          .render();
    });
});