【发布时间】:2015-06-01 16:10:20
【问题描述】:
我正在 Highcharts 中创建一个极地面积图。我在将标签放置在图表内时遇到问题。在此处查看示例:
$('#container').highcharts({
chart: {
polar: true,
backgroundColor: 'transparent',
plotBorderWidth: null,
margin: [0, 0, 0, 0],
spacingTop: 0,
spacingBottom: 0,
spacingLeft: 0,
spacingRight: 0
},
title:{
text:''
},
subTitle:{
text:''
},
pane: {
startAngle: 0,
endAngle: 360
},
legend: {
enabled: false
},
xAxis: {
tickInterval: 45,
min: 0,
max: 360,
lineWidth: 0,
minorGridLineWidth: 0,
gridLineColor: 'transparent',
labels: {
enabled: false
},
},
yAxis: {
min: 0,
lineWidth: 0,
minorGridLineWidth: 0,
gridLineColor: 'transparent',
labels: {
enabled: false
},
},
plotOptions: {
series: {
pointStart: 0,
pointInterval: 45,
pointPlacement: 'between',
states: {
hover: {
enabled: true
}
},
dataLabels: {
enabled: true,
format: '<span class="wheel-label" style="color: {point.color}">{point.name}</span>',
style: {
textShadow: false,
width: 150,
fontSize: "16px"
},
}
},
column: {
pointPadding: 0,
groupPadding: 0,
borderWidth: borderWidth
},
},
series: [{
showInLegend: false,
type: 'column',
name: 'Column',
data: data
}],
credits: {
enabled: false
}
});
我注意到饼图有“距离”选项,但极坐标图没有这样的选项。如果可能的话,我也希望能够使用“连接器”,但我认为这也不适用于极地。如何更好地控制这些标签?
【问题讨论】:
-
饼图有特定的选项。您的极坐标图看起来像一个饼图,所以也许可以使用带有您想要使用的选项的饼图? Here 您可以找到列系列类型的 dataLabels 的所有选项列表。有用的是
x/y/align/verticalAlign等。 -
我在 JSFiddle 中将所有列的值设置为 10,但在生产中,某些列会比其他列短,所以饼图不起作用。
标签: highcharts