如何从 asp.net 中的 MS 图表中删除图例
how to remove legends from MS chart in asp.net
我正在尝试从 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>
var options = {
legend: 'none'
};
见https://developers.google.com/chart/interactive/docs/gallery/piechart?csw=1#Configuration_Options
我正在尝试从 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>
var options = {
legend: 'none'
};
见https://developers.google.com/chart/interactive/docs/gallery/piechart?csw=1#Configuration_Options