首页 > 解决方案 > ApexCharts 气泡 - 更改季度背景颜色

问题描述

我正在使用 ng-apexcharts,我只想将背景的四分之一更改为另一种颜色,如下例所示: 在此处输入图像描述

目前使用带有 offestY 的注释,但我们无法理解 offfestY 值是什么以及我们如何使它成为图形大小的 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?
          }
        ],
      },

谢谢!

标签: apexcharts

解决方案


我找到了一个解决方案,也许它会帮助某人:

        events: {
          mounted: (chart, options) => {
            const offsetX = options.globals.gridWidth / 2;
            this.chart.addYaxisAnnotation({
              y: 5,
              y2: 10,
              fillColor: '#f15252',
              opacity: 0.1,
              offsetX,
            });
          },
        }

推荐阅读