Google Chart Tools truncating y axis labels

折月煮酒 提交于 2019-12-22 01:40:36

问题


Working with a Google bar chart, here is what I got:

Here my custom options

var options = {
    width: 500, height: 240,
    legend : 'none',
    vAxis:{title:'Answers',textStyle:{color: '#005500',fontSize: '12', paddingRight: '100',marginRight: '100'}},
    hAxis: { title: 'Percentage', textStyle: { color: '#005500', fontSize: '12', paddingRight: '100', marginRight: '100'} } 
 };

Can't I set a width for these <g> / <rect> tags?


回答1:


I believe the chartArea.left option is what you are looking for. Try something like this, and mess around with chartArea.left and chartArea.width values (should add up to your total width of 500 though) until your y labels are all visible:

var options = {
    width: 500, height: 240,
    legend : 'none',
    vAxis:{title:'Answers',textStyle:{color: '#005500',fontSize: '12', paddingRight: '100',marginRight: '100'}},
    hAxis: { title: 'Percentage', textStyle: { color: '#005500', fontSize: '12', paddingRight: '100', marginRight: '100'} },
    chartArea: {left:100, width: 400} 
 };



回答2:


chartArea width can be set in percentage. chartArea: {width: 50%}. This will leave up to 50% of the total chart width to the left column.



来源:https://stackoverflow.com/questions/8899132/google-chart-tools-truncating-y-axis-labels

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!