klinecharts/KLineChart

[Bug] 添加覆盖物 同时创建 createXAxisFigures和createPointFigures 只会会渲染一个覆盖物

Closed this issue · 0 comments

版本

v9.7.1

复现步骤

// 注册 覆盖物
registerOverlay({
  name: 'test1',
  totalStep: 1,
  createPointFigures: ({ coordinates, overlay }) => {
    const startX = coordinates[0].x;
    return [
      {
        type: 'text',
        attrs: {
          x: startX,
          y: 20,
          text: overlay.extendData,
          align: 'center',
          baseline: 'bottom',
        },
      },
    ];
  },
  createXAxisFigures: ({ coordinates, overlay }) => {
    const startX = coordinates[0].x;
    return [
      {
        type: 'text',
        attrs: {
          x: startX,
          y: 20,
          text: overlay.extendData,
          align: 'center',
          baseline: 'bottom',
        },
      },
    ];
  },
});
// 创建
 chart?.createOverlay(
    {
      name: 'test1',
      extendData: `123456789-1704499800000`,
      points: [{ timestamp: data[data.length - 10].timestamp, value: 0 }],
    }
    //  "x_axis_pane"
  );

当前效果

只在主图中渲染覆盖物,x轴没有渲染,需要重新渲染一下才会出现

预期效果

同时出现主图和 x 轴

环境

- 系统:window
- 浏览器:chrome 119
- 框架:React@18

补充说明

在线地址