I want to customize the bar chart with the user's data, and redraw it accordingly on run time. user should give details on both axis and their values. What code i should write to it ? Can angular variables be a good choice for doing it ?
<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>