antvis/G2

TypeError chart.interval(...).data is not a function #4658

dragonir posted onGitHub

问题描述

按官网在Vue2项目中使用浏览器提示 “TypeError chart.interval(...).data is not a function”,官网任意一个示例在CodesandBox中打开也是同样的报错。

比如:https://codesandbox.io/s/b4pw8x

image


看看你依赖的 G2 版本是什么?

posted by hustcc about 2 years ago

看看你依赖的 G2 版本是什么?

"@antv/g2": "^5.0.0-beta.10",

posted by yaderick about 2 years ago

image

我看这依赖是 v4 的。

posted by hustcc about 2 years ago

4.2.10 的语法是:

const chart = new Chart({
    container: CONTAINER_ID,
    width: 600, // 指定图表宽度
    height: 300, // 指定图表高度
});

chart.data(data);

chart.interval().position('genre*sold');

chart.render();
posted by hbrls about 2 years ago

Fund this Issue

$0.00
Funded

Pull requests