gpt4 book ai didi

javascript - 使用 KendoUI 饼图,如何删除空白区域?

转载 作者:数据小太阳 更新时间:2023-10-29 06:12:56 26 4
gpt4 key购买 nike

我使用的是 KendoUI 饼图,我有很多空白区域。删除它的最佳方法是什么。见下图:

White Space

我的 java 脚本如下所示:

<div id="divGraph1" style="width:250px; height:250px;"/>

jQuery("#divGraph1").kendoChart({
legend:{
position: "bottom",
padding: 1,
margin: 1
},
seriesDefaults:{
labels:{
visible: true,
template: "#= kendo.format('{0:P}', percentage)#"
},
visible: true
},
tooltip:{
visible: true,
template: "#= category # - #= kendo.format('{0:P}', percentage)#"
},
seriesColors: [
"#004990", "#da7633", "#8a7967", "#8b0f04", "#ead766", "#676200", "78496a"
],
title: {
padding: 1,
margin: 1
},
chartArea: { margin: 1 },
plotArea: { margin: 1 },
series:[{
type: "pie",
data: [
{ category: "Facilities in IDN", value: 3 },
{ category: "Standalone Facilities", value: 4 }
]
}]
});

如有任何建议,我们将不胜感激。

最佳答案

你能提供容器元素的宽度吗?我可以提供更准确的答案。

根据您的图片,我显示它的宽度约为 475 像素。有一个可用的高度配置选项,您可以使用它来缩小尺寸。它需要一个整数(以像素为单位)。

jQuery("#divGraph1").kendoChart({ 
legend:{
position: "bottom",
padding: 1,
margin: 1
},
seriesDefaults:{
labels:{
visible: true,
template: "#= kendo.format('{0:P}', percentage)#"
},
visible: true
},
tooltip:{
visible: true,
template: "#= category # - #= kendo.format('{0:P}', percentage)#"
},
seriesColors: [
"#004990", "#da7633", "#8a7967", "#8b0f04", "#ead766", "#676200", "78496a"
],
title: {
padding: 1,
margin: 1
},
chartArea: {
margin: 1,
height:300 /* add this option */
},
plotArea: { margin: 1 },
series:[{
type: "pie",
data: [
{ category: "Facilities in IDN", value: 3 },
{ category: "Standalone Facilities", value: 4 }
]
}]
});

如果您不喜欢在选项中传递布局信息(我不喜欢!),Kendo 将从您用来保存图表的 div 继承 CSS。以下 HTML 会将图表限制为 475x300。

<div id='divGraph1' style='width:475px;height300px'></div>

关于javascript - 使用 KendoUI 饼图,如何删除空白区域?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10148622/

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