我正在尝试删除或禁用MS图表中的图例,但我似乎无法找到删除图例的位置和方法
<script type="text/javascript">
google.load("visualization", "1", { packages: ["corechart"] });
google.setOnLoadCallback(drawChart);
function drawChart() {
var options = {
title: 'Total Hours By Project Category',
is3D: true
};
$.ajax({
type: "POST",
url: "Home.aspx/GetChartData",
data: '{}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (r) {
var data = google.visualization.arrayToDataTable(r.d);
var chart = new google.visualization.PieChart($("#chart")[0]);
chart.draw(data, options);
},
failure: function (r) {
alert(r.d);
},
error: function (r) {
alert(r.d);
}
});
}
</script>
在aspx中
<div id="chart" style="width: 500px; height: 500px; "> </div>
答案 0 :(得分:2)
var options = {
legend: 'none'
};
请参阅https://developers.google.com/chart/interactive/docs/gallery/piechart?csw=1#Configuration_Options