Table Visualization - maxHeight

338 views
Skip to first unread message

Tjeerd Kramer

unread,
Apr 11, 2012, 8:41:21 AM4/11/12
to google-c...@googlegroups.com
I know I can set the height of a table visualisation in the options field, however, this seems limited to a fixed height. Is it possible to somehow set a maxheight instead, so that if the table is less then the defined number of pixels in height, it's size automatically shrinks?

Henrik Aronsson

unread,
Apr 1, 2015, 11:30:17 AM4/1/15
to google-c...@googlegroups.com
Hi,

Quite late answer, but I found it when googling around.

A solution I found to this problem was the following:
1) Count rows in the table
2) Defin a variable that is equal to the amount of rows multiplied with the height of one row (and add 1 extra pixel, to avoid the scroll bar)
3) Added an "if" total height > YOUR MAX HEIGHT then the height changes to your set max height.
var HeightOfTable = (data.getNumberOfRows()+1.5) * 20 + 1
if (HeightOfTable > 601) {
HeightOfTable = 601 
}

I added 1.5 to my rows to compensate for the header row.

Yay, first post :)
Reply all
Reply to author
Forward
0 new messages