I'm trying to incorporate Google Charts into a javascript object oriented 
web app.  After the app is loaded - the idea is that the user clicks a 
certain button which builds/displays a certain chart.

I suspect that I have a scope problem.  Firefox/Firebug throws 
"InvalidCharacterError: String contains an invalid character" which isn't 
very helpful.

Below is a snippet of what I'm trying to do.  Perhaps someone can point out 
some obvious problem with my attempt?

Thanks in advance for your help.


<html>
<head>
<script type="text/javascript" src="https://www.google.com/jsapi";></script>
<script language="JavaScript" type="text/javascript">
    google.load('visualization', '1.0', {'packages':['corechart']});
</script>
</head>
<body>
<div id="googlecharttest"></div>
</body>
</html>


BUTTON CLICK EVENT -> OBJchart.build_googlechart();

------------------
Javascript Snippet
------------------

OBJchart = new Fchart();

Fchart = function() { return {

    ...

    build_googlechart : function()
    {
        this.drawChart();
        
        // also tried this - with the same result.
        // google.load('visualization', '1.0', {'packages':['corechart'], 
'callback': this.drawChart});
    },

    drawChart : function()
    {
        var data = new google.visualization.DataTable();
        data.addColumn('string','Topping');
        data.addColumn('number','Slices');
        data.addRows([['Mushrooms', 3],['Onions', 1],['Olives', 
1],['Zucchini', 1],['Pepperoni', 2]]);

        var options = {'title':'How Much Pizza I Ate Last 
Night','width':400,'height':400};

        var chart = new 
google.visualization.LineChart(document.getElementById('googlecharttest'));

        chart.draw(data,options);
    },

    ...

};};

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/4f35c1d4-13b6-43b5-a51a-efc138667d9e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to