doutu9810 2017-01-04 15:19 采纳率: 0%
浏览 9

如果只有一种类型的值,Google图表会更改表格

i have a issue with google charts I want to have ColumnChart when have multiple (more than one) types of data, and change it to PieChart when have only one value This is my code:

this is how i get the data:

var <?php echo $divName;?>_data = new google.visualization.DataTable();

how I(now) set the PieChart:

var <?php echo $divName;?>_chart = new google.visualization.PieChart(document.getElementById('<?php echo $divName;?>'));

and for ColumnChart:

var <?php echo $divName;?>_chart = new google.visualization.ColumnChart(document.getElementById('<?php echo $divName;?>'));

and the echo the chart

<?php echo $divName;?>_chart.draw(<?php echo $divName;?>_data

I know it should be a simple if (<?php echo $divName;?>_chart) < 2types then draw PieChart but i don't know how to get the information about how many types have the DataTable Can someone help me? I'll be very grateful

  • 写回答

0条回答 默认 最新

    报告相同问题?