问题描述
我们已经使用amCharts实现了饼图.但是,当发生向下钻取时,将剪切拉出的切片标签.我们如何解决这个问题?
We have implemented pie chart using amCharts. But when drill down occurs, the pulled slices label are cropped. How can we fix this issue?
chart = AmCharts.makeChart( "chart_1", {
"type": "pie",
"autoMargins": false,
"marginRight": 10,
"marginBottom": 10,
"dataProvider": generateChartData(),
"titleField": "SubTypeName",
"valueField": "Weight",
"outlineColor": "#FFFFFF",
"colorField": "Color",
"balloonText": "[[title]]<br><span style='font-size:14px'><b>[[value]]</b> ([[percents]]%)</span>",
"pulledField": "pulled",
"addClassNames": true,
"labelRadius": 3,
"radius": "40%",
"innerRadius": "30%",
"angle": 25,
"depth3D": 13,
"legend": {
"autoMargins": false,
"marginTop": 10,
"marginBottom": 10,
}
} );
推荐答案
您可以采取一些措施来解决此问题.您可以应用以下一项或组合:
There are a few things you can do work around this issue. You can apply one or combination of the below:
1)降低 radius
属性.拉出时,这将为切片标签留出更多空间.或完全删除此参数.然后,图表将自动计算饼图半径,以便即使拔出标签也始终可见.
1) Lower radius
property. This will leave more room for slice labels when pulled out. Or remove this parameter altogether. The chart will then auto-calculate the pie radius so that labels are always visible even if pulled out.
2)将 pullOutRadius
设置为低于默认值20的百分比值%.这样可以减少切片的拉出量.
2) Set pullOutRadius
to some lower percent value than default 20%. This will make slices pull out less.
3)通过设置 maxLabelWidth
来限制标签的宽度(默认200像素).这将使标签分成多行,从而有效地减少了标签的宽度和被切掉的机会.
3) Limit width of the labels by setting maxLabelWidth
(default 200 pixels). This will make the labels break into multiple lines, effectively reducing it's width and chance being cut off.
这篇关于标签在向下的饼状图(amCharts)中裁剪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!