Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Contributor
don_miguel
Posts: 18
Registered: ‎12-20-2010
My Device: bold

Google Chart Tools

Hi Everybody,

 

I'm trying to display a chart in a webworks using the new google html5 chart tool.

Here is the code google gives as example (from http://code.google.com/apis/chart/interactive/docs/gallery/linechart.html):

 

<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>
   
<div id="chart_div"></div>
 
</body>
</html>

Is it posible to use the html5_init.js to work with it ?

 

Thanks for your support,

Michel

 

 

Retired
astanley
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: Google Chart Tools

It might be, although I don't fully understand what the Google Chart tools are doing under the covers.

 

The "HTML5 to Gears" init_html5.js framework is designed to translate HTML5 syntax into Gears calls when your HTML5 content is run on an OS 5.0 device.  For applications that run on BlackBerry Smartphones that support HTML5 (e.g. BlackBerry 6, Tablet OS and now BlackBerry 7) then the contents of the init_html5.js file are effectively ignored.

 

Note init_html5.js supports only a subset of HTML5 (Geolocation, Timer, Database, Worker, XmlHttpRequest), so if Google Charts uses any of these, then there might be some overlap when run on OS 5.0.

 

Cheers,

Adam

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.