I am having trouble calling a function inside my webview from my code in titanium. I simply want to pass a value from my slider to my google charts functionality to redraw my chart. Anybody ever tried something similar? Any thoughts would be much appreciated.
Here is my code inside my app.s
var chartView = Ti.UI.createWebView({ width: '300', height: '400', backgroundColor: 'transparent', top: '300', left: '50', url: 'test.html' }); sliderBarOne.addEventListener('change', function(e) { chartView.evalJS("updateChart('" + e.value + "');"); });Here is my code inside my webview.
<script type="text/javascript"> google.load("visualization", "1", {packages:["corechart"]}); google.setOnLoadCallback(drawChart); function drawChart() { var data = new google.visualization.DataTable(); data.addColumn('string', 'Importance'); data.addColumn('number', 'Earning'); data.addColumn({type: 'string', role: 'style'}); data.addRows([['',5,'#000000'], ['',5,'#ffffff'],['',5,'#666666'],['', 5,'#cccccc']]); var options = { width: 200, height: 240, legend: { position: 'none' }, chartArea: { backgroundColor: 'none' }, bar: { groupWidth: '100%' }, animation: { duration: 1000, easing: 'out' } }; function updateChart(value) { console.log(value); data.setValue(0, 1, value); chart.draw(data, options); } var chart = new google.visualization.ColumnChart(document.getElementById('chart_div')); chart.draw(data, options); } </script>As you can see I am running a console.log, but that is not showing up on my console. Is my function syntax off to call a function inside the evaljs?