antvis/G2

[Bug]: treemap 在 NodeJS ssr 下出现报错 #6698

hustcc posted onGitHub

Describe the bug / 问题描述

DEMO 代码:https://g2.antv.antgroup.com/examples/graph/hierarchy/#treemap

使用 @antv/g2-ssr 改成之后,出现报错。

import { createChart } from '@antv/g2-ssr';

createChart({
  type: "treemap",
  width,
  height,
  data,
  layout: {
    path: (d) => d.name.replace(/\\./g, "/"),
    tile: "treemapBinary",
    paddingInner: 1,
  },
  encode: { value: "size" },

  style: {
    labelText: (d) =>
      d.data.name
        .split(".")
        .pop()
        .split(/(?=[A-Z][a-z])/g)[0],
    labelFill: "#000",
    labelPosition: "top-left",
    fillOpacity: 0.7,
  },
});

No response

Steps to Reproduce the Bug or Issue / 重现步骤

No response

Version / 版本

Please select / 请选择

OS / 操作系统

  • macOS
  • Windows
  • Linux
  • Others / 其他

Browser / 浏览器

  • Chrome
  • Edge
  • Firefox
  • Safari (Limited support / 有限支持)
  • IE (Nonsupport / 不支持)
  • Others / 其他

不是 bug。正则表达式的写法错误。

path: (d) => d.name.replace(/\./g, "/"),
posted by hustcc about 1 month ago

Fund this Issue

$0.00
Funded

Pull requests