不允许将顶部框架导航到数据URL:data:image / png; base64,Google图表中的错误

时间:2018-08-28 05:46:06

标签: javascript jquery pygooglechart

我想将Google图表创建为png,但无法在chrome中使用。请为此提供解决方案。我不明白此代码有什么问题,因为该代码在Firefox中正常工作。这是我的代码-

google.charts.load("current", {packages:['corechart']});
    google.charts.setOnLoadCallback(drawChart);
    arrayData = [
        ["Element", "Percent", { role: "style" } ],
        /*["Gross Margin", 5.94, "#00aeef"],
        ["Operating Margin", 10.49, "#00aeef"],
        ["Net Profit", 19.30, "#00aeef"],
        ["Before Interest and Tax Margin (EBIT)", 21.45, "color: #00aeef"]*/
      ]
    function drawChart() {
    //console.log(arrayData);

      var data = google.visualization.arrayToDataTable(arrayData);
      var view = new google.visualization.DataView(data);
      view.setColumns([0, 1,
                       { 
                        calc: "stringify",
                         sourceColumn: 1,
                         type: "string",
                         role: "annotation" 
                       },
                       2]);
      var options = {
        title: "Profitability Indicators(%)",
        width: 555,
        height: 400,
        bar: {groupWidth: "95%"},
        legend: { position: "none" },
         vAxis: {
            baselineColor:'Black',
            textPosition: 'none',
            gridlines: {
                color: 'transparent'
            }
        }
      };
      var chart = new google.visualization.ColumnChart(document.getElementById("columnchart_values"));
      chart.draw(view, options);

      document.getElementById('columnchart_values').outerHTML = '<a href="' + chart.getImageURI() + '">Printable version</a>';
  } 

0 个答案:

没有答案