Re: Styling & Aligning cell of DataTable

453 views
Skip to first unread message

asgallant

unread,
Aug 10, 2012, 1:20:34 PM8/10/12
to google-visua...@googlegroups.com
You have to set the "allowHtml" option to true.

On Friday, August 10, 2012 1:04:59 PM UTC-4, MT wrote:
Hi,

I am new to the Visualization API and have been trying to style and center a certain set of cells in the table and I cannot seem to do it.

Below is a quick overview of the code:

var data = new google.visualization.DataTable();

data.addColumn( "string", "Col 1" );
data.addColumn( "number", "Col 2" );
data.addColumn( "string", "Col 3" );

data.addRow( [{v: "cell 11"}, {v: 12}, {v: "cell 13", p:{style: 'color:red; text-align: center;'}}] );

data.addRow( [{v: "cell 21"}, {v: 22}, {v: "cell 23"}] );

data.addRow( [{v: "cell 31",p:{style: 'text-align: center;'}}, {v: 32}, {v: "cell 33"}] );

var options = { 'showRowNumber': true, 'sortColumn': 1, 'sortAscending': false };

var table = new google.visualization.Table( document.getElementById( 'tbl' ) );
chartTable.draw( data, options );

Thanks for all the help. =)

MT

unread,
Aug 10, 2012, 1:48:16 PM8/10/12
to google-visua...@googlegroups.com


On Friday, August 10, 2012 1:20:34 PM UTC-4, asgallant wrote:
You have to set the "allowHtml" option to true.



That did it. Thanks for the help asgallant. =)
Reply all
Reply to author
Forward
0 new messages