我正在使用 ng-apexcharts,我只想将背景的四分之一更改为另一种颜色,如下例所示: enter image description here
目前正在使用带有 offestY 的注解,但我们无法理解 offestY 值是什么以及如何使其占图大小的 50%。
代码示例:
chart: {
type: 'bubble',
height: auto,
...
},
annotations: {
xaxis: [
{
x: 50,
x2: 100,
fillColor: '#f15252',
opacity: 0.1,
offsetY: -70, // How to calculate this value to be exactly 50% offest?
}
],
},
谢谢!
答案 0 :(得分:1)
我找到了一个解决方案,也许会对某人有所帮助:
events: {
mounted: (chart, options) => {
const offsetX = options.globals.gridWidth / 2;
this.chart.addYaxisAnnotation({
y: 5,
y2: 10,
fillColor: '#f15252',
opacity: 0.1,
offsetX,
});
},
}