0
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>

<script type="text/javascript">

var jsvar = '<?=$count?>';
// Load google charts
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);

// Draw the chart and set the chart values
function drawChart() {
  var data = google.visualization.arrayToDataTable([
    ['Task', 'Rating'],
  ['Good',  <?php echo $count; ?>], 
  ['Average', <?php echo $count1; ?>],
  ['Bad',  <?php echo $count2; ?>],


]);

  // Optional; add a title and set the width and height of the chart
  var options = {'title':'Windoek' , 'width':400, 'height':400};

  // Display the chart inside the <div> element with id="piechart"
  var chart = new google.visualization.PieChart(document.getElementById('piechart1'));
  chart.draw(data, options);
  

  google.visualization.events.addListener(chart, 'select', function() {
    var selection = chart.getSelection();
    window.open("table.php?myvar=" + encodeURI(selection));
});

我想获取选定的任务标题并将其发送到新页面......

例如,如果有人点击了坏饼图切片,饼图的变量 Bad 和 Title 应该通过链接发送到新页面进行处理....如果有人选择 Good 而不是带有饼图标题的变量 Good 发送到新页面

4

0 回答 0