It's not a secret anymore!
The moose likes HTML, CSS and JavaScript and the fly likes Why won't this chart display properly Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Why won Watch "Why won New topic

Why won't this chart display properly

Byron Shilly

Joined: Jul 06, 2013
Posts: 1
I have a table made from google charts, sitting inside a div that's set to display: none. I then use the jQuery function .show() to reveal it on button press, but it doesn't display properly. It shows up as a very crunched up and almost invisible box. If I don't have it set to display:none, it loads properly.

Anyone know why it is behaving like this? You can see the app and its code through the link below. As you can see, I have a line graph that works completely fine with the above method, but the table does not.

The App

the code for the app is found in CostComparer.js, linked at the top of the html document. It would not function properly in jsfiddle.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63844

Likely the chart is sensitive to the size and/or visibility of the div when it is loaded. You might have to wait until after the div is displayed to load the chart the first time.

I know this is the same for Google Maps.

[Asking smart questions] [About Bear] [Books by Bear]
It is sorta covered in the JavaRanch Style Guide.
subject: Why won't this chart display properly
It's not a secret anymore!