我有一个使用Google Charts开发的饼图,但是由于传说标签太长,导致传说标签跨越多行显示。由于我的数据动态变化,我想知道是否提供了一个属性来调整传说的宽度。
请查看js fiddle: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);
}
有人能帮我把每个图例标签分行吗?
谢谢, Farhan