Highcharts 带有两个圆的饼图需要更改内圈的背景色
我有两个圆形饼图,它们看起来不错,但我需要更改内核的背景颜色:Highcharts 带有两个圆的饼图需要更改内圈的背景色,highcharts,Highcharts,我有两个圆形饼图,它们看起来不错,但我需要更改内核的背景颜色: $(document).ready(function () { var chart = new Highcharts.Chart({ chart: { renderTo: 'container', //backgroundColor: 'rgba(255, 255, 255, 0.0)', //
$(document).ready(function () {
var chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
//backgroundColor: 'rgba(255, 255, 255, 0.0)',
//backgroundColor: 'rgba(255, 255, 255, 0.0)',
backgroundColor: '#FCFFC5',
margin: [0, 0, 0, 0],
spacingTop: 23,
spacingBottom: 23,
spacingLeft: 23,
spacingRight: 23,
plotBorderWidth: 1,
//polar: true,
//type: 'inline'
},
exporting: { enabled: false },
credits: {
enabled: false
},
plotOptions: {
size: '100%',
series: {
states: {
hover: {
enabled: false
}
}
},
pie: {
innerSize: 100,
backgroundColor: '#CCC',
depth: 15,
dataLabels: {
connectorWidth: 0
}
}
},
tooltip: {
enabled: false
//pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
},
title: {
text: '<div style="background-color:#2cb5e1;">Today WalkIn<br>67<br>Average wait time<br> 02:00</div>',
align: 'center',
verticalAlign: 'middle',
y: 5,
style: {
color: '#000',
fontWeight: 'bold',
fontSize: '28px',
}
},
legend: {
layout: "vertical",
align: "right",
verticalAlign: "middle",
},
series: { states: { hover: { enabled: false } } },
series: [{
type: 'pie',
dataLabels: false,
shadow: false,
data: [{
name: '',
y: 7,
color: '#fc525a',
}, {
name: '',
y: 5,
color: '#2cb5e1',
}, {
name: '',
y: 18,
color: '#fc8b4d',
}],
innerSize: '65%'
},
{
type: 'pie',
data: [{
name: '',
y: 7,
color: '#fc525a',
}, {
name: '',
y: 5,
color: '#2cb5e1',
}, {
name: '',
y: 18,
color: '#fc8b4d',
}],
innerSize: '80%'
}]
});
});
$(文档).ready(函数(){
var图表=新的Highcharts.图表({
图表:{
renderTo:'容器',
//背景颜色:“rgba(255,255,255,0.0)”,
//背景颜色:“rgba(255,255,255,0.0)”,
背景颜色:“#FCFFC5”,
边距:[0,0,0,0],
间距:23,
间距底部:23,
间距:23,
spacingRight:23,
打印边框宽度:1,
//是的,
//键入:“内联”
},
正在导出:{enabled:false},
学分:{
已启用:false
},
打印选项:{
大小:“100%”,
系列:{
国家:{
悬停:{
已启用:false
}
}
},
馅饼:{
内部尺寸:100,
背景颜色:“#CCC”,
深度:15,
数据标签:{
连接器宽度:0
}
}
},
工具提示:{
已启用:false
//pointFormat:“{series.name}:{point.percentage:.1f}%”
},
标题:{
文本:“今日步行
67
平均等待时间
02:00”,
对齐:'居中',
垂直排列:'中间',
y:5,
风格:{
颜色:“#000”,
fontWeight:'粗体',
fontSize:'28px',
}
},
图例:{
布局:“垂直”,
对齐:“右”,
垂直排列:“中间”,
},
系列:{states:{hover:{enabled:false}}},
系列:[{
键入“pie”,
数据标签:false,
影子:错,
数据:[{
名称:“”,
y:7,
颜色:“#fc525a”,
}, {
名称:“”,
y:5,
颜色:“#2cb5e1”,
}, {
名称:“”,
y:18,
颜色:“#fc8b4d”,
}],
内部尺寸:“65%”
},
{
键入“pie”,
数据:[{
名称:“”,
y:7,
颜色:“#fc525a”,
}, {
名称:“”,
y:5,
颜色:“#2cb5e1”,
}, {
名称:“”,
y:18,
颜色:“#fc8b4d”,
}],
内部尺寸:“80%”
}]
});
});
黄色背景来自两个饼图圆圈;相反,我希望只在放置文本的位置显示颜色
截图
您需要绘制自定义形状,例如:
chart: {
...,
events: {
load: function() {
var x = this.chartWidth / 2,
y = this.chartHeight / 2,
r = x > y ? y : x;
this.renderer
.circle(x, y, 0.65 * r)
.attr('fill', '#F0F')
.add()
}
}
}
现场演示:
API参考:感谢您的快速响应。这对我真的很有用很好