Problem with style display=''

15 views
Skip to first unread message

le...@sibmail.com

unread,
Nov 27, 2011, 9:43:03 PM11/27/11
to Google Visualization API
Hello!
I create element google visualization packages:['table'].
Default - user don't see diagram (.style.display='none').
When user click button, diagram will display (.style.display='').
My script is working, but I have strange problem. When user click
button, diagram show, but alignment is wrong. Diagram has not width
100%.
What is this, bug?

Roni Biran

unread,
Nov 28, 2011, 2:47:20 AM11/28/11
to google-visua...@googlegroups.com
can you send some code example of what went wrong? (with some demo data)



--
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.


le...@sibmail.com

unread,
Nov 28, 2011, 12:26:03 PM11/28/11
to google-visua...@googlegroups.com

Roni Biran

unread,
Nov 28, 2011, 3:20:34 PM11/28/11
to google-visua...@googlegroups.com
I understand.
Since the draw function depend on the width of the displayed element (in your case a hidden div), it does not allocate a width for the table. when a table is visible it automatically inherit the width of its containing div.
In order to allocate the correct width and hide the table, just switch between the two steps. first draw the table and only then hide it. This will ensure that the table will receive the maximal width (100%) and be hidden.

table.draw(data, {showRowNumber: true});
document.getElementById('table_div').style.display='none';



On Mon, Nov 28, 2011 at 7:26 PM, le...@sibmail.com <le...@sibmail.com> wrote:
http://lext.gb7.ru/test.html

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.

le...@sibmail.com

unread,
Nov 29, 2011, 8:34:02 AM11/29/11
to google-visua...@googlegroups.com
Hi!
Geniusly ! All is working:)
Reply all
Reply to author
Forward
0 new messages