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

希望G2能够支持按需加载 #364

Closed
andyforever opened this issue Jan 8, 2018 · 7 comments
Closed

希望G2能够支持按需加载 #364

andyforever opened this issue Jan 8, 2018 · 7 comments
Assignees
Labels

Comments

@andyforever
Copy link

  • G2 Version: 3.0.3
  • Platform: Mac OS
  • Mini Showcase(like screenshots):
  • CodePen Link:

在应用中可能只用到了G2的几种图表类型,比如折线、柱状图等,但是需要把data-set.js(1.14M)和g2.js(1.38M)都引入进来,在应用bundle中占比很大,希望能够支持按需加载。

@dxq613
Copy link
Member

dxq613 commented Jan 11, 2018

正在讨论这件事情。

@leungwensen
Copy link
Member

antvis/F2#41

@trexguo
Copy link

trexguo commented Apr 3, 2018

请问进展如何?

@leungwensen
Copy link
Member

3.1 正式版中会包含按需加载方案,beta 版本估计四月下旬能用 @trexguo

@lchunxiu
Copy link

lchunxiu commented Apr 8, 2018

希望早些支持!!

@leungwensen
Copy link
Member

leungwensen commented Apr 20, 2018

最新的 @antv/g2@3.0.7@antv/data-set@0.8.7 已经支持按需加载。两种方法:

  1. 直接 require 源码,const G2 = require('@antv/g2/lib/core');,具体写法参考 lib/index.js 文件
  2. 使用源码仓库提供的 bundler(一个 electron 小程序)手动选择需要的模块进行按需构建,具体 clone 两个代码库后,npm install && npm run bundler

@trampboy
Copy link

trampboy commented Jan 6, 2023

@leungwensen
你好,antv/data-set 有按需加载的方案吗?目前看是整包加载的。
我现在使用后大小是1.72MB(压缩后是464.67KB)

使用版本:
@antv/data-set@0.10.2

使用方法:

import DataSet from "@antv/data-set";

const ds = new DataSet();
    const dv = ds.createView().source(data);
    dv.source(data).transform({
      type: "sort-by",
      fields: ["rawData"],
      order: "ASC",
    });

谢谢。

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

No branches or pull requests

6 participants