简体   繁体   English

Google图表未显示在浏览器中

[英]Google charts not displaying on browser

Below is the code I have for displaying the Chart . 下面是我用于显示Chart的代码。 I am unsure as to what is going wrong here. 我不确定这里出了什么问题。

Please bear with me , this is the first time I have asked a question in this forum. 请多多包涵,这是我第一次在这个论坛上提问。

Thank you for your help 谢谢您的帮助

<html>
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
  google.charts.load('current', {'packages':['bar']});
  google.charts.setOnLoadCallback(DrawChart);
  function DrawChart() {
    var data = google.visualization.arrayToDataTable([
      ['Short Shipment', 'Product Questions', 'Product Service Request', 'Billing Question','Product Issue','Return or Exchange Request','- None -'],
      [1, 3, 4, 8, 8, 11, 283]]);


    var options = {
      chart: {
        title: 'Case Issue Summary'

      },
      bars: 'horizontal' 
    };

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

    chart.draw(data, options);
  }
</script>
</head>
<body padding="0.5in 0.5in 0.5in 0.5in" size="Letter">
<div id="BarChartCase" style="width: 200px; height: 100px;">&nbsp;</div>
</body>

</html>

Your code is 99/100 copied from developers.google.com/chart/.... 您的代码是从developers.google.com/chart / ....复制的99/100。

The only changes you made is the width and height to 200 and 100. 您所做的唯一更改是将widthheight为200和100。

Change it to a greater number and you'll be able to see your bar chart. 将其更改为更大的数字,您将能够看到您的条形图。

codepen copy 代码笔复制

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM