【问题标题】:Google Charts works in IE7 but not IE8 or IE9Google Charts 适用于 IE7,但不适用于 IE8 或 IE9
【发布时间】:2012-06-01 05:14:58
【问题描述】:

谷歌图表有问题。它适用于除 IE8 和 9 之外的所有浏览器。如果我切换到 IE 7 甚至 quirks 模式,它就可以工作。这是我的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);
}

【问题讨论】:

  • 如果你使用新的包:packages:["corechart"]而不是'packages': ['ColumnChart'],效果会更好吗?
  • 我可能说得太早了。它现在可以在 IE9 中运行。但它没有出现在 IE 8 中。如果我在文档模式 IE 9 中使用它,它可以工作,但是一旦我将它更改为 IE8 标准,它就会中断。
  • @numerical25 找到解决方案了吗?我有完全相同的问题。适用于除 IE8 以外的所有浏览器。适用于 IE8 和文档模式 IE9

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


【解决方案1】:

您应该使用新的软件包。

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

【讨论】:

  • 一位同事告诉我,它可以在 IE 8 中独立运行,所以对我来说已经足够了。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-06-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-05-13
  • 1970-01-01
相关资源
最近更新 更多