简体   繁体   English

如何自定义Google Chart日历?

[英]how to customize Google Chart calendar?

I want to add comment in Google chart (calendar chart). 我想在Google图表(日历图表)中添加评论。

but, I don't understand Google chart's options and How to use. 但是,我不了解Google图表的选项和使用方法。

when I add addcolumn, This work can not. 当我添加addcolumn时,此工作不能。

Please give me some help.. 请给我一些帮助。

enter image description here 在此处输入图片说明

<<<source code>>>>
<html>
  <head>
    <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
    <script type="text/javascript">
      google.charts.load("current", {packages:["calendar"]});
      google.charts.setOnLoadCallback(drawChart);

   function drawChart() {
       var dataTable = new google.visualization.DataTable();

       dataTable.addColumn({ type: 'date', id: 'Date' });
       dataTable.addColumn({ type: 'number', id: 'Won/Loss' });
      // dataTable.addColumn({ type: 'string', id:'comment'});  // Error 
       dataTable.addRows([

          [ new Date(2015, 3, 11), 4],  // I want to add comment
          [ new Date(2015, 3, 12), 3],
          [ new Date(2015, 3, 10), 8],
          [ new Date(2015, 1, 13), 5],
          [ new Date(2015, 3, 14), 7]

          ]);

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

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

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

    enter code here

Are you trying to get your comment to appear in a tooltip? 您是否要让评论显示在工具提示中? How would you like to see the comment information rendered? 您想如何查看呈现的评论信息?

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

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