【发布时间】:2014-10-09 16:03:38
【问题描述】:
使用 Highchart。我使用距离将标签定位在切片内,它在移动设备上很好地居中,但在平板电脑或台式机上却不行。随着尺寸变大,标签会离边缘太近。如何根据视口尺寸定位标签?
plotOptions: {
pie: {
allowPointSelect: true,
cursor: "pointer",
dataLabels: {
enabled: true,
format: "<strong>{point.name}</strong><br>{point.percentage:.0f}%",
distance: -60,
color: "white"
}
},
series: [ {
type: "pie",
data: [
{
name: "Not too much text here",
color: "#5cb85c",
y: 35
},
{
name: "Not too much text here",
color: "#5bc0de",
y: 30
},
{
name: "Less text here",
color: "#78629b",
y: 15
},
{
name: "Less text here",
color: "#f0ad4e",
y: 10
},
{
name: "Less text here",
color: "#d9534f",
y: 10
}
]
} ]
【问题讨论】:
-
你有完整的 JSFiddle 吗?
-
@Ondkloss jsfiddle.net/TimNguyenBSM/rL1bwam6/1
标签: javascript jquery highcharts pie-chart