Re: Updating chart causes it to shrink

502 views
Skip to first unread message

asgallant

unread,
Aug 8, 2012, 11:49:19 PM8/8/12
to google-visua...@googlegroups.com
You need to specify height and width parameters for the chart.  See: http://jsfiddle.net/asgallant/T4S8x/ 

On Wednesday, August 8, 2012 6:03:28 PM UTC-4, Christian Sciberras wrote:
This is my first time trying out this system.

I'd like to point out that its setup is quite complicated as opposed to just throwing a script tag on a page. But this is mostly a problem with Google JS API.

The next complaint (which is the object of this post) is the fact that try as I might, I can't get an existing chart to update, without having it redrawing itself completely.
I couldn't figure out this problem so in the end, I just copy & pasted the code in question on my website - to no effect!

The code I've been using:

function drawVisualization({
  // Create and populate the data table.
  var dgoogle.visualization.arrayToDataTable([
    ['Label''Value'],
    ['Memory'80]
  ]);

  // Create and draw the visualization.
  var new google.visualization.Gauge(document.getElementById('visualization'));
  v.draw(d);
  
  // The following fails on my site
  setInterval(function(){
    d.setValue(01Math.round(Math.random()*99));
    v.draw(d);
  }500);
}
 
Go on, try it out here.

The effect I'm getting is that the chart, on each iteration, is redrawn from scratch a little smaller than it was previously.
I also noticed two network requests to "about:blank"

I know this sounds strange (impossible even), but I can't figure out what's going wrong here.

Perhaps it may be of interest the fact that I'm running this along side html5shif.js and jhtmlarea.js


Regards,
Chris.

Shreepad Patil

unread,
Sep 2, 2014, 4:08:51 AM9/2/14
to google-visua...@googlegroups.com
Even I am getting a similar issue, this problem appears especially when even when I give the height and width parameters in 'em'.

Daniel LaLiberte

unread,
Sep 2, 2014, 9:13:20 AM9/2/14
to google-visua...@googlegroups.com
There is a flaw in the gauge chart in which, if you don't specify a fixed size container, repeated redraws will shrink the height and width by 4px each time.  The problem involves the cellpadding on the table which is 2px.  We can remove it, but I'd like to move the padding to another place where it won't have this effect.


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

Andrew Gallant

unread,
Sep 3, 2014, 7:05:56 PM9/3/14
to google-visua...@googlegroups.com
Are you specifying the dimensions on the chart container or in the chart options?
Reply all
Reply to author
Forward
0 new messages