Javascript 固定的Highchart甜甜圈图表大小
我在highcharts中有一个三个圆环图,但在大小方面面临一个问题,比如当datapoint增加每个图表的大小时,每个图表的大小会随着datapoints的变化而变化 让我解释一下,我有3个图表,你们可以在图片中看到,它们有多个数据点,以百分比的形式,当某些百分比值增加或减少时,图表大小也在减少我需要的东西?我需要修正图表的大小,就像每个图表的大小一样,请帮我解决这个高度赞赏 这是我正在使用的代码: var图表=新的Highcharts.图表({ 图例:{Javascript 固定的Highchart甜甜圈图表大小,javascript,jquery,highcharts,Javascript,Jquery,Highcharts,我在highcharts中有一个三个圆环图,但在大小方面面临一个问题,比如当datapoint增加每个图表的大小时,每个图表的大小会随着datapoints的变化而变化 让我解释一下,我有3个图表,你们可以在图片中看到,它们有多个数据点,以百分比的形式,当某些百分比值增加或减少时,图表大小也在减少我需要的东西?我需要修正图表的大小,就像每个图表的大小一样,请帮我解决这个高度赞赏 这是我正在使用的代码: var图表=新的Highcharts.图表({ 图例:{ enable
enabled: true,
labelFormatter: function () {
return '<b>' + this.y + '<b>' + ' ' + this.name;
}
},
chart: {
renderTo: 'total-traffic',
type: 'pie',
dataLabels: {
formatter: function () {
// return 'h';
},
enabled: true
},
height: 350
},
tooltip: {
shadow: false,
formatter: function () {
if (this.key.toUpperCase().includes('UN-DEFINED')) {
return '<div>' +
'<p>Club: <b>' + extendedVersion[0] + '</b></p><br/>' +
'<p>New Club: <b>' + extendedVersion[1] + '</b></p><br/>' +
'<p>Retail: <b>' + extendedVersion[2] + '</b></p><br/>' +
'<p>Un-Defined_Un-Classified: <b>' + extendedVersion[3] + '</b></p><br/>' +
'</div>';
}
else if (this.key.toUpperCase().includes('UN-CLASSIFIED')) {
return '<div>' +
'<p>Monitored: <b>' + extendedVersion[4] + '</b></p><br/>' +
'<p>Un-Monitored: <b>' + extendedVersion[5] + '</b></p><br/>' +
'</div>';
}
else if (this.key.toUpperCase().includes('UN-MONITORED')) {
return '<div>' +
'<p>Club: <b>' + extendedVersion[6] + '</b></p><br/>' +
'<p>New Club: <b>' + extendedVersion[7] + '</b></p><br/>' +
'<p>Retail: <b>' + extendedVersion[8] + '</b></p><br/>' +
'</div>';
}
else {
return '<div>' +
'<p>' + this.key + '(Monitored): ' + ' <b>' + this.y + '</b></p><br/>' +
'</div>';
}
},
},
credits: { enabled: false },
exporting: { enabled: false },
title: {
text: undefined
},
subtitle: {
text: undefined
},
plotOptions: {
series: {
states: {
hover: {
enabled: false
}
},
dataLabels: {
enabled: true,
formatter: function () {
return percentageArray[this.colorIndex] + '%';
}
},
shadow: false
},
pie: {
// height: 350,
borderColor: '#FFFFFF',
innerSize: '80%'
}
},
series: [{
data: data, showInLegend: true,
},
],
},// using
function (chart) {
text = chart.renderer.text('<span style="color: black; font-size:32px; font-weight:bold;">' + total + '</span>').add();
textBBox = text.getBBox();
x = chart.plotLeft + (chart.plotWidth * 0.5) - (textBBox.width * 0.5);
y = chart.plotTop + (chart.plotHeight * 0.5) + (textBBox.height * 0.25);
text.attr({ x: x, y: y });
// on complete
});
$('.highcharts-legend text, .highcharts-legend span').each(function (index, element) {
$(element).hover(function () {
chart.tooltip.refresh(chart.series[0].data[index]);
}, function () {
chart.tooltip.hide();
})
});
}
enabled:true,
labelFormatter:函数(){
返回“”+this.y+“”+“”+this.name;
}
},
图表:{
renderTo:“总流量”,
键入“pie”,
数据标签:{
格式化程序:函数(){
//返回“h”;
},
已启用:true
},
身高:350
},
工具提示:{
影子:错,
格式化程序:函数(){
if(this.key.toUpperCase().包括('undefined')){
返回“”+
“俱乐部:”+扩展版[0]+“
”+
“新俱乐部:”+扩展版[1]+“
”+
“零售:”+扩展版[2]+“
”+
“未定义\未分类:”+扩展版本[3]+“
”+
'';
}
else if(this.key.toUpperCase().包括('UN-CLASSIFIED')){
返回“”+
“受监控:“+extendedVersion[4]+”
”+
“未监视:”+extendedVersion[5]+“
”+
'';
}
else if(this.key.toUpperCase().包括('UN-MONITORED')){
返回“”+
“俱乐部:”+扩展版[6]+“
”+
“新俱乐部:”+扩展版[7]+“
”+
“零售:”+扩展版[8]+“
”+
'';
}
否则{
返回“”+
“”+this.key+”(监控):“+”+this.y+”
”+
'';
}
},
},
信用证:{已启用:错误},
正在导出:{enabled:false},
标题:{
文本:未定义
},
副标题:{
文本:未定义
},
打印选项:{
系列:{
国家:{
悬停:{
已启用:false
}
},
数据标签:{
启用:对,
格式化程序:函数(){
返回percentageArray[this.colorIndex]+'%';
}
},
影子:错
},
馅饼:{
//身高:350,
边框颜色:'#FFFFFF',
内部尺寸:“80%”
}
},
系列:[{
数据:数据,显示结果:true,
},
],
},//使用
功能(图表){
text=chart.renderer.text(“”+total+“”).add();
textBBox=text.getBBox();
x=chart.plotLeft+(chart.plotWidth*0.5)-(textBBox.width*0.5);
y=chart.plotTop+(chart.plotHeight*0.5)+(textBBox.height*0.25);
attr({x:x,y:y});
//完全
});
$('.highcharts图例文本,.highcharts图例span')。每个(函数(索引,元素){
$(元素)。悬停(函数(){
chart.tooltip.refresh(chart.series[0].数据[index]);
},函数(){
chart.tooltip.hide();
})
});
}
你能在我可以使用的在线编辑器上重现这个问题吗?