Barchart : stacked bar Chart not Working

32 views
Skip to first unread message

Mohammad Hussain

unread,
Sep 16, 2015, 7:46:23 AM9/16/15
to Google Visualization API
Hello,


i have a problem with stacked bar Chart which is not working properly. the bars are being displayed vertically and not-stacked also.
Following is the code used(pasted form Example page) :



google.load("visualization", "1.1", { packages: ["bar"] });
google.load("visualization", "1", { packages: ["corechart"] });

 var data = google.visualization.arrayToDataTable([
        ['Genre', 'Fantasy & Sci Fi', 'Romance', 'Mystery/Crime', 'General',
         'Western', 'Literature', { role: 'annotation' }],
        ['2010', 10, 24, 20, 32, 18, 5, ''],
        ['2020', 16, 22, 23, 30, 16, 9, ''],
        ['2030', 28, 19, 29, 30, 12, 13, '']
    ]);


 var options_stacked = {
        isStacked: true,
        height: 300,
        legend: { position: 'top', maxLines: 3 },
        hAxis: { minValue: 0 }
    };

    var chart = new google.charts.Bar(document.getElementById('myChart'));

    chart.draw(data, options_stacked);


Mohammad Hussain

unread,
Sep 17, 2015, 5:26:05 AM9/17/15
to Google Visualization API
solved:
The code Worked after changing the code as:

var chart = new google.charts.Bar(document.getElementById('myChart')); 
TO
  var chart = new google.visualization.BarChart(document.getElementById('myChart'));
Reply all
Reply to author
Forward
0 new messages