Charts 谷歌图表日历在11月和12月不起作用

Charts 谷歌图表日历在11月和12月不起作用,charts,calendar,Charts,Calendar,当我使用带有日历包的GoogleChartAPI时,当日期是11月或12月时,它不会绘制数据 我使用的是谷歌的代码示例 而且,即使使用google示例,如果我将月份更改为11月或12月(索引10或11),数据也不会绘制出来,但其他月份都可以 谷歌的示例代码: <html> <head> <script type="text/javascript" src="https://www.google.com/jsapi"></script&

当我使用带有日历包的GoogleChartAPI时,当日期是11月或12月时,它不会绘制数据

我使用的是谷歌的代码示例

而且,即使使用google示例,如果我将月份更改为11月或12月(索引10或11),数据也不会绘制出来,但其他月份都可以

谷歌的示例代码:

    <html>
  <head>
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load("visualization", "1.1", {packages:["calendar"]});
      google.setOnLoadCallback(drawChart);

   function drawChart() {
       var dataTable = new google.visualization.DataTable();
       dataTable.addColumn({ type: 'date', id: 'Date' });
       dataTable.addColumn({ type: 'number', id: 'Won/Loss' });
       dataTable.addRows([
          [ new Date(2012, 3, 13), 37032 ],
          [ new Date(2012, 3, 14), 38024 ],
          [ new Date(2012, 3, 15), 38024 ],
          [ new Date(2012, 3, 16), 38108 ],
          [ new Date(2012, 3, 17), 38229 ],
          // Many rows omitted for brevity.
          [ new Date(2013, 9, 4), 38177 ],
          [ new Date(2013, 9, 5), 38705 ],
          [ new Date(2013, 9, 12), 38210 ],
          [ new Date(2013, 9, 13), 38029 ],
          [ new Date(2013, 9, 19), 38823 ],
          [ new Date(2013, 9, 23), 38345 ],
          [ new Date(2013, 9, 24), 38436 ],
          [ new Date(2013, 9, 30), 38447 ]
        ]);

       var chart = new google.visualization.Calendar(document.getElementById('calendar_basic'));

       var options = {
         title: "Red Sox Attendance",
         height: 350,
       };

       chart.draw(dataTable, options);
   }
    </script>
  </head>
  <body>
    <div id="calendar_basic" style="width: 1000px; height: 350px;"></div>
  </body>
</html>

load(“可视化”,“1.1”,“{packages:[“calendar”]});
setOnLoadCallback(drawChart);
函数绘图图(){
var dataTable=new google.visualization.dataTable();
addColumn({type:'date',id:'date'});
addColumn({type:'number',id:'Won/Loss'});
dataTable.addRows([
[新日期(2012年3月13日),37032],
[新日期(2012年3月14日),38024],
[新日期(2012年3月15日),38024],
[新日期(2012年3月16日),38108],
[新日期(2012年3月17日),38229],
//为简洁起见,省略了许多行。
[新日期(2013年9月4日),38177],
[新日期(2013年9月5日),38705],
[新日期(2013年9月12日),38210],
[新日期(2013年9月13日),38029],
[新日期(2013年9月19日),38823],
[新日期(2013年9月23日),38345],
[新日期(2013年9月24日),38436],
[新日期(2013年9月30日),38447]
]);
var chart=new google.visualization.Calendar(document.getElementById('Calendar_basic');
变量选项={
标题:“红袜队出席人数”,
身高:350,
};
图表绘制(数据表、选项);
}

您确定问题不是因为月份大小而没有显示吗? 以上面的示例代码为例,将月份更改为10(11月)和11(12月),效果良好

看看这个结果。您可能会注意到,您必须滚动查看最近几个月的情况。我怀疑你在css上有一些限制,从而切断了后面几个月的工作

JSFIDLE中的代码:

<html>
  <head>
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load("visualization", "1.1", {packages:["calendar"]});
      google.setOnLoadCallback(drawChart);

   function drawChart() {
       var dataTable = new google.visualization.DataTable();
       dataTable.addColumn({ type: 'date', id: 'Date' });
       dataTable.addColumn({ type: 'number', id: 'Won/Loss' });
       dataTable.addRows([
          [ new Date(2012, 10, 13), 37032 ],
          [ new Date(2012, 10, 14), 38024 ],
          [ new Date(2012, 10, 15), 38024 ],
          [ new Date(2012, 11, 16), 38108 ],
          [ new Date(2012, 11, 17), 38229 ],
          // Many rows omitted for brevity.
          [ new Date(2013, 10, 4), 38177 ],
          [ new Date(2013, 10, 5), 38705 ],
          [ new Date(2013, 10, 12), 38210 ],
          [ new Date(2013, 10, 13), 38029 ],
          [ new Date(2013, 11, 19), 38823 ],
          [ new Date(2013, 11, 23), 38345 ],
          [ new Date(2013, 11, 24), 38436 ],
          [ new Date(2013, 11, 30), 38447 ]
        ]);

       var chart = new google.visualization.Calendar(document.getElementById('calendar_basic'));

       var options = {
         title: "Red Sox Attendance",
         height: 350,
       };

       chart.draw(dataTable, options);
   }
    </script>
  </head>
  <body>
    <div id="calendar_basic" style="width: 1000px; height: 350px;"></div>
  </body>
</html>

load(“可视化”,“1.1”,“{packages:[“calendar”]});
setOnLoadCallback(drawChart);
函数绘图图(){
var dataTable=new google.visualization.dataTable();
addColumn({type:'date',id:'date'});
addColumn({type:'number',id:'Won/Loss'});
dataTable.addRows([
[新日期(2012年10月13日),37032],
[新日期(2012年10月14日),38024],
[新日期(2012年10月15日),38024],
[新日期(2012年11月16日),38108],
[新日期(2012年11月17日),38229],
//为简洁起见,省略了许多行。
[新日期(2013年10月4日),38177],
[新日期(2013年10月5日),38705],
[新日期(2013年10月12日),38210],
[新日期(2013年10月13日),38029],
[新日期(2013年11月19日),38823],
[新日期(2013年11月23日),38345],
[新日期(2013年11月24日),38436],
[新日期(2013年11月30日),38447]
]);
var chart=new google.visualization.Calendar(document.getElementById('Calendar_basic');
变量选项={
标题:“红袜队出席人数”,
身高:350,
};
图表绘制(数据表、选项);
}

该示例没有显示它是否工作。我赞成。11月和12月不适用于Google日历。这是否意味着您在示例JSFIDLE中看不到它们?请详细说明,我看到标注的日期是11月和12月。是的。我联系了Google Vis的Daniel,他知道这个问题。它与时区有关。我在GMT-3的巴西。他告诉我很快就会有解决办法的。我明白了!这就解释了为什么它对我有效(我在不同的时区)。谢谢:)这在2015年仍然是一个bug。