javascript - Highcharts 实心仪表未完全着色
问题描述
我正在尝试创建一个实心图表,其中容器对于默认图表大小来说太小了。
有谁知道如何让整个图表着色?
this.chart = Highcharts.chart('container', {
title: null,
chart: {
// marginLeft: 50,
// marginRight: 50,
},
plotOptions: {
solidgauge: {
dataLabels: {
y: 5,
borderWidth: 0,
useHTML: true
}
}
},
pane: {
center: ['50%', '85%'],
size: '140%',
startAngle: -90,
endAngle: 90,
background: {
backgroundColor: '#EEE',
innerRadius: '60%',
outerRadius: '100%',
shape: 'arc'
}
},
yAxis: {
min: 0,
max: 100,
stops: [[0, 'rgba(50,157,255,0.4)']]
},
series: [{
name: 'RPM',
type: 'solidgauge',
dataLabels: {
format: '<div style="text-align:center"><span style="font-size:19px;color:' +
((Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black') + '">{y:.1f} %</span><br/>' +
'<span style="font-size:10px;color:silver">* test</span></div>'
},
tooltip: {
valueSuffix: ' percent of bought power'
}
}]
});
解决方案
您可以通过设置更小来实现它pane.size
。
在附加代码中,窗格大小为 140%,将其更改为小于 100% 的值:
pane: {
center: ['50%', '85%'],
size: '90%',
startAngle: -90,
endAngle: 90,
background: {
backgroundColor: '#EEE',
innerRadius: '60%',
outerRadius: '100%',
shape: 'arc'
}
}
演示:
API参考:
推荐阅读
- python - 在 Pandas 中操作数据
- kubernetes - kube init:为控制平面节点写入 Crisocket 信息时出错:等待条件超时
- vue.js - 未针对从列表中过滤出来的项目触发 Vue js 事件
- python - Julia 中的 3D 网格数据插值
- javascript - Next.js:getStaticProps 不更新生产中的获取值
- algorithm - 在排序的桶列表中查找浮点数的最佳搜索方法
- git - Git:结帐与恢复单个文件
- wordpress - 根据是否存在超过 1 个帖子重写帖子类型存档 slug
- javascript - 选中复选框时如何将选择更改为输入文本?
- python - 如何使用PostergeSQL进行自己的冷却?(discord.py 1.18.2)