我一直试图以pdf格式输出图表,但由于某种原因,它无法使用图表呈现模板。 使用时。 但是对于一些解决方案,我已经看到他们使用 。但是我想要上层解决方案。
<script type="text/javascript">
// Load Charts and the corechart and barchart packages.
function init(){
//google.charts.load('current','1.0',{'packages':['corechart']});
//google.charts.setOnLoadCallback(drawChart);
window.onload = function () {
google.charts.load('current','1.0',{'packages':['corechart']});
setTimeout(function(){drawChart();}, 500);
};
}
// Draw the pie chart and bar chart when Charts is loaded.
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'number');
data.addColumn('number', 'Number of users');
data.addRows([
['Admin', {{ count_4 }}],
['Farmers', {{ count_1 }}],
['Wholesalers', {{ count_2 }}],
['Retailers', {{ count_3 }}]
]);
var piechart_options = {title:'Pie Chart: Showing number of users of the Marketing survey Assistant Web Service',
width:400,
height:300};
var piechart = new google.visualization.PieChart(document.getElementById('piechart_div'));
piechart.draw(data, piechart_options);
}
</script>