我有一张用Google图表开发的饼图,图例标签太长,因为图例标签有多行。由于我有动态数据,我想知道是否有一个用于操纵图例宽度的属性。
请找到js小提琴:https://jsfiddle.net/ak8wqt6f/
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Task', 'Hours per Day'],
['Work, some text related to work', 11],
['Eat, some text related to eat', 2],
['Commute, some text related to commute', 2],
['Watch TV, some text related to watch tv', 2],
['Sleep, some text related to sleep', 7]
]);
var options = {
title: 'My Daily Activities',
legend: {
position: 'right',
alignment: 'center',
width: 400,
floating: true
},
chartArea: {
left: -100,
width: 450
}
};
var chart = new google.visualization.PieChart(document.getElementById('piechart'));
chart.draw(data, options);
}
有人可以帮我包装各个图例标签吗?
此致 尔汉