gpt4 book ai didi

javascript - 谷歌可视化饼图文本 anchor 问题和文本被切断

转载 作者:行者123 更新时间:2023-12-03 06:08:02 24 4
gpt4 key购买 nike

我正在使用谷歌饼图,一切正常,但右侧的图例标签被切断。 enter image description here

Google API 中也没有选项来控制这些标签。这是文档 https://developers.google.com/chart/interactive/docs/gallery/piechart#configuration-options

针对白帽请看这里的图片..第一 hide-div与隐藏div

并且 div 不隐藏...

no-hide div

最佳答案

图例通常会换行,请参阅以下工作片段,
使用附图中显示的选项

google.charts.load('current', {
callback: function () {
var container = document.getElementById('chart_div');
var chart = new google.visualization.PieChart(container);

var data = google.visualization.arrayToDataTable([
['Education', 'People'],
['less than high school', 10],
['high school', 10],
['college associate', 10],
]);

var options = {
width: '470',
height: '450',
chartArea: {
width: '80%',
height: '80%',
left: 100,
},
pieSliceTextStyle: {
color: 'white',
fontSize: '17.5'
},
colors: ['#90c458', '#ff7f66', '#ffce55', '#52c2e8']
};

chart.draw(data, options);
},
packages: ['corechart']
});
<script src="https://www.gstatic.com/charts/loader.js"></script>
<div id="chart_div"></div>

关于javascript - 谷歌可视化饼图文本 anchor 问题和文本被切断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39448507/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com