angularjs - how can i use angular js into google charts -
i want customize bar chart user's data, , redraw accordingly on run time. user should give details on both axis , values. code should write ? can angular variables choice doing ?
<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', 600, 400], ['2005', 1170, 460], ['2006', 660, 1120], ['2007', 1030, 540] ['2008', 2000, 250] ]); var options = { title: 'company performance', vaxis: {title: 'year', titletextstyle: {color: 'blue'}} }; var chart = new google.visualization.barchart(document.getelementbyid('div1')); chart.draw(data, options); } </script>
take @ angularjs google chart tools directive
if want things "angular way" should use directives of dom manipulation. suggest store of data inside controller, , in view use directive render view data
Comments
Post a Comment