I want to create chart using Google Chart. I have created a webview and set the url to a local html file wich contains the google chart code. Now I have to pass from titanium to the webview 2 array (data and option) to generate my chart. I have read the documentation but I didn't success. How can I do this?
Webview code:
var webview = Titanium.UI.createWebView({ url:'resuorces/mychart.htm' }); scrollView.add(webview);I generate 2 variables (dati and option) as an array, this is the mychart.html code: (this is the google example, i have to set the data and options variable with my ("dati" and "option" variable)
<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 = google.visualization.arrayToDataTable([
['Year', 'Sales', 'Expenses'],
['2004', 1000, 400],
['2005', 1170, 460],
['2006', 660, 1120],
['2007', 1030, 540]
]);
var options = {
title: 'Company Performance',
hAxis: {title: 'Year', titleTextStyle: {color: 'red'}}
};
var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="chart_div" style="width: 900px; height: 500px;"></div>
</body>
</html>Thanks in advance!