feat: support custom renderer and plugins#4113
Conversation
UMD 打包方式修改打包 UMD 时将 此种情况下使用方式会变成: <script src="unpkg/@antv/g" type="application/javascript"></script>
<script src="unpkg/@antv/g-canvas" type="application/javascript"></script>
<script src="unpkg/@antv/g-plugin-xxx" type="application/javascript"></script>
<script src="unpkg/@antv/g2" type="application/javascript"></script>
<script src="unpkg/@antv/g6" type="application/javascript"></script>在 // UMD 使用方式
const chart = new G2.Chart({
renderer: new G.Canvas2D.Renderer(),
plugins: [new G.RoughCanvasRenderer.Plugin()],
});展示效果问题发现以下展示问题。由于 Rough.js 提供的 Canvas / SVG 展示效果也有不一致情况,需要进一步验证。 下图为 下图为 去掉手绘插件, 手绘风格字体另外手绘风格下,字体是很影响观感的。如果需要加载相应字体,可以使用第三方加载器,例如:https://github.com/typekit/webfontloader 加载完成后,G2 可能需要提供坐标轴、图例字体的配置方式。 |
a197f4f to
bf49d69
Compare
|
讨论结果:g2 会打两种 umd,一种是包含 g 的,叫 g2.min.js;一种是不包含 g 的,叫 g2-lite.min.js。开箱即用的情况使用前者,在需要插件的情况下使用后者。 |
我会用俩 rollup 配置生成 UMD,一个就是之前的 但有一个小小的问题。 // .genjirc
// 理想的写法,这样能始终引用最新的依赖
"scripts": [
"node_modules/@antv/g/dist/index.umd.min.js",
"node_modules/@antv/g-canvas/dist/index.umd.min.js",
"dist/g2-lite.min.js"
]
// 目前的临时写法
"scripts": [
"docs/assets/g.umd.min.js",
"docs/assets/g-canvas.umd.min.js",
"dist/g2-lite.min.js"
] |
e3de11d to
b148173
Compare
|
c769a14 to
62d8062
Compare
|
还需要处理一下冲突 |
62d8062 to
ede4257
Compare
|
案例后续再加,等 genji-notebook 升级 |
* feat: support custom renderer and plugins * chore: add an independent rollup config for g-lite UMD output * feat: add renderer docs (close: #4104) Co-authored-by: yuqi.pyq <[email protected]>
* feat: support custom renderer and plugins * chore: add an independent rollup config for g-lite UMD output * feat: add renderer docs (close: #4104) Co-authored-by: yuqi.pyq <[email protected]>




Usage
List