Google Charts适用于IE7,但不适用于IE8或IE9

时间:2012-05-31 19:32:04

标签: javascript internet-explorer internet-explorer-9 google-visualization

谷歌排行榜存在问题。它适用于除IE8和9之外的所有浏览器。如果我切换到IE 7甚至怪异模式,它都可以工作。这是我的javascript

// Load the Visualization API and the piechart package.
google.load('visualization', '1.0', {
    'packages': ['ColumnChart']
    });

// Set a callback to run when the Google Visualization API is loaded.
google.setOnLoadCallback(drawChart);

// Callback that creates and populates a data table,
// instantiates the pie chart, passes in the data and
// draws it.
function drawChart() {
    var data = new google.visualization.DataTable();
    data.addColumn('string', 'Date');
    data.addColumn('number', 'Affiliate Fees');
    data.addRows([['Sep 05, 2011 - Sep 11, 2011', 224.95], ['Dec 26, 2011 - Jan 01, 2012', 112.69], ['Apr 23, 2012 - Apr 29, 2012', 202.5], ['May 21, 2012 - May 27, 2012', 69.21], ['May 28, 2012 - Jun 03, 2012', 4.05]]);
    var options = {
        'title': '',
        'width': 1150,
        'height': 300,
        'colors': ['#E50278'],
        'fill': 50,
        'wmode': 'opaque'
    };
    // Instantiate and draw our chart, passing in some options.
    var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
    chart.draw(data, options);
}

1 个答案:

答案 0 :(得分:3)

您应该使用新包。

'packages': ['ColumnChart']替换为packages:["corechart"]