antvis/G2

矩形树图使用scale ,type设置为log无效 #3725

curryz posted onGitHub

矩形树图最大值和最小值差的倍数很大的时候,最小值展示不出来面积。使用scale设置log,无效。有解决办法吗?


可以给个复现demo吗?

posted by rainy-25Ghz over 3 years ago
posted by curryz about 3 years ago

https://bizcharts.net/gist/3duH4AJMpe0

有可能是bizchart的问题 换一个g2写的复现吧

posted by rainy-25Ghz about 3 years ago
posted by curryz about 3 years ago

是因为使用方法不对吗? 看文档理解的这样用应该没有问题

posted by curryz about 3 years ago

矩形树图比较特殊的地方在于,数据是经过布局算法产生的,所以 x y 的范围都在 0 ~ 1 之间,这个区间里面的数据,使用 log 并不能区分出来。

这种情况用 pow 会能区分出来。

chart.scale({
  x: {
    nice: true,
    type: 'pow',
    exponent: 0.1, // 👈🏻 必须设置
  },
  y: {
    nice: true,
    type: 'pow',
    exponent: 0.1,
  },
});
posted by hustcc over 2 years ago

Fund this Issue

$0.00
Funded

Pull requests