Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hello, how can I solve the problem of chart.pieLabel is not a function when the pie chart reports an error? 你好,请问饼图报错 chart.pieLabel is not a function 怎么解决呢? #368

Open
coderyqy opened this issue Oct 9, 2021 · 8 comments

Comments

@coderyqy
Copy link

coderyqy commented Oct 9, 2021

唉,我看了好多条Issues,好像都没有解决方案啊。
看文档说明,PieLabel 插件默认没有打包至 @antv/f2 模块包中。
按照文档操作引入:const F2 = require('@antv/f2/lib/index-all');
但是这样引入又说找不到,怎么解决呢?

@coderyqy coderyqy changed the title 饼图报错 chart.pieLabel is not a function 饼图报错 chart.pieLabel is not a function 怎么解决呢? Oct 9, 2021
@coderyqy coderyqy changed the title 饼图报错 chart.pieLabel is not a function 怎么解决呢? Hello, how can I solve the problem of chart.pieLabel is not a function when the pie chart reports an error? 你好,请问饼图报错 chart.pieLabel is not a function 怎么解决呢? Oct 12, 2021
@xiongchenxu
Copy link

要修改源码,将PieLabel注册进去,然后npm重新打包,这样项目才能使用。
image

@GzhiYi
Copy link

GzhiYi commented Dec 23, 2021

试试替换这个js文件 -> 代码

@xiongchenxu
Copy link

xiongchenxu commented Dec 23, 2021 via email

@xiongchenxu
Copy link

xiongchenxu commented Dec 27, 2021 via email

@lh147258
Copy link

我想问一下,替换那个文件的js代码呢

@xiongchenxu
Copy link

xiongchenxu commented Mar 17, 2022 via email

@lh147258
Copy link

@xiongchenxu 可以给我说一下是替换那个文件里的么。或者把文件发给我一份谢谢啦

@xiongchenxu
Copy link

@xiongchenxu 可以给我说一下是替换那个文件里的么。或者把文件发给我一份谢谢啦

自己编译,重新构建就好了。
1.关闭微信小程序,进入 node_modules/@antv/wx-f2/src/index.js 注入代码:
const PieLabel = require('@antv/f2/lib/plugin/pie-label');
F2.Chart.plugins.register(PieLabel);
2.node_modules@antv\wx-f2路径下,执行 npm install、npm run build,完成后删除node_modules@antv\wx-f2\node_modules
3.重新打开微信小程序,开启npm使用功能,构建npm包。
此时PieLabel已经被注册到F2中了,无需引入,直接使用。其实还可以等F2 4.x,新的F2组件更好,不过官方更新的慢了点,主要是ScrollBar在F2 3.x的小程序中引入有BUG,F2 4.x解决了,等待官方更新新版本后,直接用新的吧。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants