API Google Chart

58 views
Skip to first unread message

hdufo

unread,
Oct 26, 2011, 5:15:57 AM10/26/11
to Google Visualization API
Hello,
Fist, i'm apologize for my very poor english.
I use api google chart.
If i take an exemple of graph (exemple from google site, at the end of
my mail), it work fine, no probleme.
But, if in my programme i write more than 43 tag <br> or <hr>, in
Internet Explorer V8, i lose the axes labels! (it's OK with chrome or
firefox). if i take out one <br>, it's work!
So, when the graph come after some long text and if the text have a
lot of <br>, then png have no axes labels.
have you the same problème with IE r8

Thank and sorry for my language
<html>
<head>
<script type="text/javascript" src="https://www.google.com/
jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Year');
data.addColumn('number', 'Sales');
data.addColumn('number', 'Expenses');
data.addRows(4);
data.setValue(0, 0, '2004');
data.setValue(0, 1, 1000);
data.setValue(0, 2, 400);
data.setValue(1, 0, '2005');
data.setValue(1, 1, 1170);
data.setValue(1, 2, 460);
data.setValue(2, 0, '2006');
data.setValue(2, 1, 860);
data.setValue(2, 2, 580);
data.setValue(3, 0, '2007');
data.setValue(3, 1, 1030);
data.setValue(3, 2, 540);
var chart = new
google.visualization.LineChart(document.getElementById('chart_div'));
chart.draw(data, {width: 400, height: 240, title: 'Company
Performance'});
}
</script>
</head>
<body>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<div id="chart_div"></div>
</body>
</html>

Roni Biran

unread,
Oct 26, 2011, 5:42:54 AM10/26/11
to google-visua...@googlegroups.com
why are you using so many <br> tags.
have you tried closing them <br/> or positioning the div in relative/absolute position mode?



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


hdufo

unread,
Oct 26, 2011, 6:25:07 AM10/26/11
to Google Visualization API
Hello,
i work in a health department, in France. My program make a lot of
operations and display a lot of results before the graph. <br> tags
are not for positioning the graph, but for the presentation of
results, with lot of text. With <br/>, the result is the same, no
labels on axes
The div of the graph is like this: <div id="chart_div"
style="display: none"> (with a javascript for visible or invisible)
if i make an absolute div (<div id="chart_div" style="display: none;
position: absolute; top:50px; left : 150px;">), it's does not work,
always same problem, no label on axes. But if i take out display:
none, the graph is good, i have the axes labels!
But it's not very good for the presentation.

So, a lot of thanks for your answer, i have not exactly that i want,
but nearly.
But it's curious than the png have no label when the div is hide and
when you have too many <br> (or <hr> or <table> like for me).


Roni Biran

unread,
Oct 26, 2011, 7:25:07 AM10/26/11
to google-visua...@googlegroups.com
if you place <br/> tags after the <div> and place there some text. do you see the text?


hdufo

unread,
Oct 26, 2011, 8:04:44 AM10/26/11
to Google Visualization API
Yes, i have also lot of text after the graph and no probleme

Roni Biran

unread,
Oct 26, 2011, 8:56:01 AM10/26/11
to google-visua...@googlegroups.com
this is really strange. I ran this script in both IE8 and IE9 and it looks great.
can you upload a screenshot of some sort?

On Wed, Oct 26, 2011 at 2:04 PM, hdufo <h.du...@laposte.net> wrote:
Yes, i have also lot of text after the graph and no probleme

h.dufosse

unread,
Oct 26, 2011, 9:35:09 AM10/26/11
to google-visua...@googlegroups.com
This program run in intranet at my job, but i am now at home.
But the example i put in my first mail does not work (you can copy paste, just make a
correction in a tag (BR with a space between b an r) and also perhaps make 2 or 3

more. For me, no label with ie8

thank a lot


> Message du 26/10/11 14:56
> De : "Roni Biran"
> A : google-visua...@googlegroups.com
> Copie à :
> Objet : Re: [visualization-api] Re: API Google Chart


>
> this is really strange. I ran this script in both IE8 and IE9 and it looks
> great.
> can you upload a screenshot of some sort?
>

> On Wed, Oct 26, 2011 at 2:04 PM, hdufo wrote:
>
> > Yes, i have also lot of text after the graph and no probleme
> >
> > --
> > 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.
> >
> >
>
> --
> 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-visualization-
api+uns...@googlegroups.com.


> For more options, visit this group at http://groups.google.com/group/google-
visualization-api?hl=en.
>
>

Une messagerie gratuite, garantie à vie et des services en plus, ça vous tente ?
Je crée ma boîte mail www.laposte.net

asgallant

unread,
Oct 26, 2011, 10:37:51 AM10/26/11
to google-visua...@googlegroups.com
If you draw the chart in a div with the style "display: none;", the chart will have errors (I suspect this has something to do with the way browsers draw SVG/VML rather than anything on Google's end).  Make the div visible prior to drawing and hide it when the chart throws it's 'ready' event and these kind of errors will go away.  That being said, your problem may not have anything to do with this.

I set up a jsfiddle with your example code, and it works fine for me in IE8: http://jsfiddle.net/kPxhA/

hdufo

unread,
Oct 26, 2011, 11:01:33 AM10/26/11
to Google Visualization API
hello asgallant,
it's true, in IE8 your exemple works fine, but i am not sure that the
environment is exactly the same.
I put my example on a internet site and it does not work:
http://h.dufosse.free.fr/graph.htm
you can try.

asgallant

unread,
Oct 26, 2011, 11:31:48 AM10/26/11
to google-visua...@googlegroups.com
The only substantive difference I can see between them is that you page does not have a <!DOCTYPE> declaration, which could be causing the problem with IE.

hdufo

unread,
Oct 26, 2011, 11:45:47 AM10/26/11
to Google Visualization API
i can do this, but if i erase a few <br>, it's work!

Roni Biran

unread,
Oct 26, 2011, 11:55:23 AM10/26/11
to google-visua...@googlegroups.com
i think that is due to the page length all together.
if you place a simple button that call the drawChart function it redraw the graph perfectly. I believe that this if your graph is hidden, make sure that when you show it, call the draw function that will fix everything.



On Wed, Oct 26, 2011 at 5:45 PM, hdufo <h.du...@laposte.net> wrote:
i can do this, but if i erase a few <br>, it's work!
--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.

hdufo

unread,
Oct 26, 2011, 12:00:11 PM10/26/11
to Google Visualization API
You are great!! It's works now with a doctype declaration!!
Thank a lot!
We must never forget the basis of the html

hdufo

unread,
Oct 26, 2011, 12:05:15 PM10/26/11
to Google Visualization API
Roni,
I try first tomorrow to put a doctype declaration and try again with
an hidden div before he display of the graph
I will put the result here

Thank

Roni Biran

unread,
Oct 26, 2011, 1:06:28 PM10/26/11
to google-visua...@googlegroups.com
Hope that it'll work. Please let us know for others :-)


hdufo

unread,
Oct 28, 2011, 3:25:35 AM10/28/11
to Google Visualization API
For close this topic, i think than a display none before the graph be
draw cause problem in IE.
But it's not a problem, because i can make hidden after, so, it's
good.
I have another problem now, but i put it in a new topic.
Thank to every body
Reply all
Reply to author
Forward
0 new messages