如何从谷歌图表中获取所有值?

时间:2017-06-29 08:46:56

标签: graph charts google-visualization

图表上未显示最大输入值。 如何从图表上的00:10:01到23:59:01获得完整数据? 此外,谷歌图表中看到的最大值是多少?

enter image description here

*谷歌图表代码

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

      function drawChart() {
        var data = google.visualization.arrayToDataTable(%(ddata)s)
        var options = {
          title: 'CPU',
          dataOpacity : 0.0,
          explorer : { actions : 'dragToZoom' },
          fontSize : 10,
          hAxis: {title: 'Year',  titleTextStyle: {color: '#333'},
                logScale: true, textStyle: { color : 'red' }, textPosition: 'out', title: 'new', viewWindow : { max : 100 }
        },
          legend : {alignment:'end'},
        tooltip: {trigger:'selection'},
        trendlines: { 0: { color: 'green'}},
        vAxis: { title : 'using CPU(%%)', gridlines: {color : 'blue'}}
        };
        var chart = new google.visualization.AreaChart(document.getElementById('chart_div'));
        chart.draw(data, options);
      }
    </script>
  </head>
  <body>
    <div id="chart_div" style="width: 100%%; height: 500px;"></div>
  </body>
</html>



#Read the file with Python code and save it to the list(%(ddata)s)

%(ddata)s =
1 20170628 00:10:01 all 0.38 0.00 0.23 0.20 99.19
2 20170628 00:20:02 all 0.51 0.00 0.20 0.28 99.01
3 20170628 00:30:01 all 0.72 0.00 0.65 0.17 98.46
...(omit)
496 20170628 23:57:01 all 0.13 0.00 0.03 0.10 99.74
497 20170628 23:58:01 all 1.00 0.00 0.27 0.16 98.57
498 20170628 23:59:01 all 1.92 0.00 1.99 0.16 95.93

total: 498 line

1 个答案:

答案 0 :(得分:1)

删除选项 - &gt; hAxis.viewWindow: {max : 100}

viewWindow控制轴的开始位置(min)和结束位置(max

min&amp;的价值max应与轴列的数据类型相匹配 在这个例子中似乎是'date'

所以100将其抛弃,删除该选项将允许轴
完全展示