Is there a "colspan" equivalent option in the Table visualization?

750 views
Skip to first unread message

asgallant

unread,
Jan 24, 2011, 3:14:05 PM1/24/11
to Google Visualization API
Is it possible to make a cell span multiple columns in the Table
visualization? As an example, the following script:

<script type="text/javascript">
google.load("visualization", "1", {packages:["table"]});
google.setOnLoadCallback(drawTable);

function drawTable(){
var data = new google.visualization.DataTable();

data.addColumn("string", "Column 1");
data.addColumn("string", "Column 2");
data.addColumn("string", "Column 3");
data.addColumn("string", "Column 4");
data.addColumn("string", "Column 5");
data.addRow();
data.setValue(0,0,"1, 1");
data.setValue(0,1,"1, 2");
data.setValue(0,2,"1, 3");
data.setValue(0,3,"1, 4");
data.setValue(0,4,"1, 5");
data.addRow();
data.setValue(1,0,"2, 1");
data.setValue(1,1,"2, 2");
data.setValue(1,2,"2, 3");
data.setValue(1,3,"2, 4");
data.setValue(1,4,"2, 5");
data.addRow();
data.setValue(2,0,"Blank Row");
data.addRow();
data.setValue(3,0,"4, 1");
data.setValue(3,1,"4, 2");
data.setValue(3,2,"4, 3");
data.setValue(3,3,"4, 4");
data.setValue(3,4,"4, 5");

var table = new
google.visualization.Table(document.getElementById("table"));
table.draw(data);
}
</script>

generates a table with the (2,1), (2,2), (2,3), and (2,4) cells
empty. Is there a way to make cell (2,0) span multiple columns? In
straight-up HTML, I would just use <td colspan="[number of columns to
span]">...</td>, but that doesn't work here.

ChartMan

unread,
Jan 27, 2011, 3:54:22 AM1/27/11
to google-visua...@googlegroups.com
You can try playing around with the table cells, remove the ones you don't need and set the colSpan on others.
However there is no built in solution for this.

 ChartMan


--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To post to this group, send email to google-visua...@googlegroups.com.
To unsubscribe from this group, send email to google-visualizati...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.


Reply all
Reply to author
Forward
0 new messages