Domanda

I am using the google pie chart. Pie chart visible in jsfiddle but not HTML file in IE8 document type. I am using pie chart code in jsfiddle and I am using the same code in the HTML file, The jsfiddle is showing the answer what I expected but the HTML file didn't show the pie chart.

Here the fiddle: http://jsfiddle.net/gL7Hm/2/

Here the html code

<html>
  <head>
    <script type="text/javascript" src="https://www.google.com/jsapi?fake=.js"></script>
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
    <script type="text/javascript">
      google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawVisualization);
      function drawVisualization() {
        var data = google.visualization.arrayToDataTable([
          ['Task', 'Hours per Day'],
          ['Work',     11],
          ['Eat',      2],
          ['Commute',  2],
          ['Watch TV', 2],
          ['Sleep',    7]
        ]);

        var options = {
          title: 'My Daily Activities'
        };

        var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
        chart.draw(data, options);
      }
    </script>
      </head>
  <body>
    <div id="chart_div" style="width: 900px; height: 500px;"></div>
  </body>
</html>

May I know whats wrong in this, Its my code bug or jsfiddle bug.

Thanks for your advice.

È stato utile?

Soluzione

This is likely a small bug in the emulation of IE8's Standards Mode in later browsers. Clearly, these modern versions of IE cannot replicate the behavior of their predecessors perfectly (but they do to sufficient degrees the vast majority of the time).

Using http://browserstack.com I was able to test in an actual IE8 instance. As you can see from the image below, the results were good, and IE8 (actual instance) doesn't have any issue.

enter image description here

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top