1

我已经使用 google api 在我的网页上使用以下代码创建图表

我想把标签放在图表的顶部,告诉每列顶部的列的值我想把列的值放在它上面,当我将鼠标悬停在它上面时它显示为工具提示,但我希望它是总有可能

<html>
  <head>
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {
        var data = google.visualization.arrayToDataTable([
          ['Year', 'Sales', 'Expenses'],
          ['2004',  1000,      400],
          ['2005',  1170,      460],
          ['2006',  660,       1120],
          ['2007',  1030,      540]
        ]);

        var options = {
           title : 'Performance Metrics',
           vAxis: { 
              title: "marks",
              gridlines:{
              count:11,             
              },
              viewWindowMode:'explicit',
              viewWindow:{
                max:100,
                min:0
              },

            },

           hAxis: {title: "Subjects"},
           is3D: true,
           seriesType: "bars",


           };

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

0 回答 0