how to set size of Table (height / width) and have it stick

47 views
Skip to first unread message

thegern...@gernaey.com

unread,
Sep 21, 2015, 9:42:18 AM9/21/15
to Google Visualization API
Hello,

I am using a table chart. The problem is that no matter what I set the table width too, it still only is as wide as the data / header (depending on which is long except for dates.. which is weird).

The div is say 1100, I can see this because if I set the background it works fine.

but when I specifically set the height / width properties of the chart itself it doesn't do anything, it doesn't even make itself as large as the Div itself either.

My work around
1) add blank rows
2) add blank columns


The rows one is not so bad. the columns, that looks goofy, especially since I have to make up a column title that is long enough (or have multiple) that stretch the table to be the size I want. The reason is, if I don't do this, then I can see the div color behind it and I don't want that, I don't even care if (like excel) it has headerless / text columns.

This is an easy repro, just create a div that is say 1280 x 400, then create a table with one column that is only 1 row, and call it Foo, with a value of Foo... You will see how small it is even after setting the table height / width size to say... 1260 x 380

Thanks!

Daniel LaLiberte

unread,
Sep 21, 2015, 10:07:47 AM9/21/15
to Google Visualization API
Tables shrink now if you don't specify the width or height.  You might prefer to set the width and height to '100%' since then the scrollbars will kick in as needed.

But I tried to reproduce your example, and it looks as expected to me: http://jsfiddle.net/dlaliberte/8L3eukdq/1/
With only one row, specifying the height of the table means it will expand to that height, so it is usually better to leave off the height option.

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/6bd95b96-5a91-4922-9361-a279130b9c3d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
dlaliberte@Google.com   5CC, Cambridge MA
daniel.laliberte@GMail.com 9 Juniper Ridge Road, Acton MA

thegern...@gernaey.com

unread,
Sep 24, 2015, 9:57:36 AM9/24/15
to Google Visualization API
Weird, because I am specifying the width and height and it is in a div tag that is 1280 and it shrinks to whatever the size of the data is even with me specifying it to be 100%

Let me go back and check again and I will post the example if it still keeps doing it.

Thanks!

On Monday, September 21, 2015 at 10:07:47 AM UTC-4, Daniel LaLiberte wrote:
Tables shrink now if you don't specify the width or height.  You might prefer to set the width and height to '100%' since then the scrollbars will kick in as needed.

But I tried to reproduce your example, and it looks as expected to me: http://jsfiddle.net/dlaliberte/8L3eukdq/1/
With only one row, specifying the height of the table means it will expand to that height, so it is usually better to leave off the height option.
On Mon, Sep 21, 2015 at 9:42 AM, <thegern...@gernaey.com> wrote:
Hello,

I am using a table chart. The problem is that no matter what I set the table width too, it still only is as wide as the data / header (depending on which is long except for dates.. which is weird).

The div is say 1100, I can see this because if I set the background it works fine.

but when I specifically set the height / width properties of the chart itself it doesn't do anything, it doesn't even make itself as large as the Div itself either.

My work around
1) add blank rows
2) add blank columns


The rows one is not so bad. the columns, that looks goofy, especially since I have to make up a column title that is long enough (or have multiple) that stretch the table to be the size I want. The reason is, if I don't do this, then I can see the div color behind it and I don't want that, I don't even care if (like excel) it has headerless / text columns.

This is an easy repro, just create a div that is say 1280 x 400, then create a table with one column that is only 1 row, and call it Foo, with a value of Foo... You will see how small it is even after setting the table height / width size to say... 1260 x 380

Thanks!

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsub...@googlegroups.com.



--
dlali...@Google.com   5CC, Cambridge MA
daniel.l...@GMail.com 9 Juniper Ridge Road, Acton MA
Auto Generated Inline Image 1

thegern...@gernaey.com

unread,
Sep 24, 2015, 10:00:49 AM9/24/15
to Google Visualization API
Well clearly I am a dope.. I don't know how (ok that part I know how lol), but somehow... even though I was setting it, or I thought I was, it wasn't taking. So that's a long story, but you are correct it does work.

Thanks so much and apologizes Daniel, complete waste of your time on that one.

Cheers!!!!!
Reply all
Reply to author
Forward
0 new messages