G2 3.0 升级指引

    npm

    1. npm install @antv/g2 --save
    • G2 3.0 的图表 只由一层 canvas 组成,不再是之前的三层画布;
    • tooltip 统一使用 html 进行渲染。
    • G2.Frame 废除 Frame ,由 替代。
    • G2.Stat 废除 Stat, 由 DataView 的 transform 替代。
    • G2.Theme 直接使用 G2.Global。
    • G2.Canvas 直接使用 G2.G
    • G2.Coord
    • G2.Base
    • G2.ColorCalculate
    • G2.Layout 由 相应的方法替代。
    • chart.col() 以及 chart.cols() 使用 chart.scale() 替代
    • chart.guide().tag()
    • chart.guide().rect() 使用 chart.guide().region() 替代。
    • chart.setMode()
    • chart.select()
    • chart.getPosition() 使用 chart.getXY() 替代。
    • chart.contour() 通过ploygon 来实现。
    • syncXYScales 度量统一,3.0 中在列定义中进行声明:
    1. chart.scale('x', {
    2. sync: true
    3. })
    • plotCfg
    • chart.on(‘itemselected’)
    • chart.on(‘itemunselected’)
    • chart.on(‘itemselectedchange’)
    • chart.on(‘rangeselectend’)