How to make google gauge not to load default size values

79 views
Skip to first unread message

Denonth

unread,
Jun 19, 2012, 3:42:01 PM6/19/12
to google-visua...@googlegroups.com
Does anyone has some idea?

asgallant

unread,
Jun 20, 2012, 11:00:58 PM6/20/12
to google-visua...@googlegroups.com
What is happening here is that the document's 'ready' event is firing before the gauge finishes drawing, so the dimensions are all messed up.  The solution is to move the document 'ready' code into a 'ready' event handler for the gauge.  You might also want to consider changing the  $("#chart_div").hide(); and  $("#chart_div").show(); lines to target the 'right' div instead.

On Tuesday, June 19, 2012 3:42:01 PM UTC-4, Denonth wrote:
Does anyone has some idea?

Denonth

unread,
Jun 21, 2012, 11:44:22 AM6/21/12
to google-visua...@googlegroups.com
Thank you for your help. This is working. But here is a another question. What if I have more than one gauge in the div? Here we can see only one, but as a matter of fact I have 3 inside it. How to put listener for that if you got an idea?

Each gauge is draw separately and they have different options and so on. Its like you have that code for one gauge X 3 but each is different.

Thank you

asgallant

unread,
Jun 21, 2012, 12:37:22 PM6/21/12
to google-visua...@googlegroups.com
You need to track the 'ready' state of each gauge and run the code only if all gauges are done.  See an example here: http://jsfiddle.net/asgallant/NdRx8/5/ 
Message has been deleted

Denonth

unread,
Jun 25, 2012, 6:14:31 AM6/25/12
to google-visua...@googlegroups.com
Thank you for your solution, one more question. 
How can I write functions to animate gauges? For example is this correct function?

function change(dir) 
{
           views[0].setValue(0, 1, dir);
          charts[0].draw(views[0], options[0]);
}


Thank you




On Tuesday, June 19, 2012 5:48:48 PM UTC+2, Denonth wrote:
Hi all I am having this problem.

I am using google gauge and I am setting my size of it in the inline html tag. I ahve a problem when I am showing or hiding a gauge's. When it shows again it's probbably refreshed and it has his default size which is too big for me. 

This is my code I could really use some help:


Thank you

asgallant

unread,
Jun 25, 2012, 10:38:36 AM6/25/12
to google-visua...@googlegroups.com
You are close.  Use data.setValue(0, 1, dir) as views are read-only.
Reply all
Reply to author
Forward
0 new messages