创建两个相互接触的甜甜圈派后,如果我调整图表的大小,它们之间的比例会发生变化。如果我减少一个超过另一个,如果我增加它们会进一步分开。
我怎样才能保持两个馅饼之间的比例?
$(function () {
var chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
type: 'pie',
backgroundColor: "black",
borderColor: "black",
margin: [0, 0, 0, 0],
spacingTop: 0,
spacingBottom: 0,
spacingLeft: 0,
spacingRight: 0,
height:150,
width:150
},
plotOptions: {
pie: {
size:'100%',
center: ['50%', '50%'],
dataLabels: {
enabled: false,
}
}
},
title: {
text: null
},
"legend": {
"enabled": false
},
"credits": {
"enabled": false
},
tooltip: {
enabled: false,
},
series: [{
size: '85%',
innerSize: '75%',
borderColor: "transparent",
data: [
{y: 12, color: 'green'},
{y: 10, color: 'gray' },
{y: 33, color: 'red'},
{y: 20, color: 'blue'}
]
},{
size: '100%',
innerSize: '90%',
borderColor: "transparent",
data: [
{y: 18, color: 'gray'},
{y: 11, color: 'orange' },
{y: 13, color: 'yellow'},
{y: 30, color: 'transparent'}
]
}]
});
});
示例 1: http: //jsfiddle.net/pwUC7/1/ 示例 2:http: //jsfiddle.net/pwUC7/2/