@antv/g2 5.0.0-alpha.1 → 5.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/g2-lite.min.js +10 -0
- package/dist/g2.min.js +3 -3
- package/esm/adjust/index.d.ts +2 -1
- package/esm/adjust/index.js.map +1 -1
- package/esm/animation/index.d.ts +14 -7
- package/esm/animation/index.js.map +1 -1
- package/esm/animation/scaleInX.js +3 -0
- package/esm/animation/scaleInX.js.map +1 -1
- package/esm/animation/scaleInY.js +3 -0
- package/esm/animation/scaleInY.js.map +1 -1
- package/esm/api/chart.d.ts +4 -0
- package/esm/api/chart.js +20 -3
- package/esm/api/chart.js.map +1 -1
- package/esm/api/mark/index.d.ts +3 -3
- package/esm/api/mark/index.js +2 -2
- package/esm/api/mark/index.js.map +1 -1
- package/esm/api/mark/mark.d.ts +4 -4
- package/esm/api/mark/mark.js +6 -5
- package/esm/api/mark/mark.js.map +1 -1
- package/esm/api/mark/types.d.ts +1 -0
- package/esm/api/node.d.ts +4 -5
- package/esm/api/node.js +5 -7
- package/esm/api/node.js.map +1 -1
- package/esm/api/props.d.ts +1 -0
- package/esm/api/props.js +10 -10
- package/esm/api/props.js.map +1 -1
- package/esm/component/axis.d.ts +1 -1
- package/esm/component/axis.js +11 -4
- package/esm/component/axis.js.map +1 -1
- package/esm/component/index.d.ts +10 -5
- package/esm/component/index.js.map +1 -1
- package/esm/composition/index.d.ts +16 -8
- package/esm/composition/index.js.map +1 -1
- package/esm/composition/rect.js +1 -1
- package/esm/composition/rect.js.map +1 -1
- package/esm/coordinate/index.d.ts +24 -12
- package/esm/coordinate/index.js.map +1 -1
- package/esm/data/arc.d.ts +7 -0
- package/esm/data/arc.js +10 -18
- package/esm/data/arc.js.map +1 -1
- package/esm/data/cluster.d.ts +8 -0
- package/esm/data/cluster.js +36 -46
- package/esm/data/cluster.js.map +1 -1
- package/esm/data/custom.d.ts +7 -0
- package/esm/data/custom.js +10 -0
- package/esm/data/custom.js.map +1 -0
- package/esm/data/fetch.js +7 -6
- package/esm/data/fetch.js.map +1 -1
- package/esm/data/filterBy.js +6 -2
- package/esm/data/filterBy.js.map +1 -1
- package/esm/data/index.d.ts +28 -9
- package/esm/data/index.js +6 -1
- package/esm/data/index.js.map +1 -1
- package/esm/data/map.d.ts +7 -0
- package/esm/data/map.js +10 -0
- package/esm/data/map.js.map +1 -0
- package/esm/data/sankey.d.ts +8 -0
- package/esm/data/sankey.js +76 -95
- package/esm/data/sankey.js.map +1 -1
- package/esm/data/sortBy.js +14 -4
- package/esm/data/sortBy.js.map +1 -1
- package/esm/data/tree.d.ts +4 -0
- package/esm/data/tree.js +6 -9
- package/esm/data/tree.js.map +1 -1
- package/esm/data/utils/arc/index.d.ts +1 -1
- package/esm/data/utils/fields.d.ts +6 -0
- package/esm/data/utils/fields.js +15 -0
- package/esm/data/utils/fields.js.map +1 -0
- package/esm/data/voronoi.d.ts +1 -0
- package/esm/data/voronoi.js +1 -22
- package/esm/data/voronoi.js.map +1 -1
- package/esm/data/wordCloud.d.ts +1 -0
- package/esm/data/wordCloud.js +1 -93
- package/esm/data/wordCloud.js.map +1 -1
- package/esm/encode/index.d.ts +8 -4
- package/esm/encode/index.js.map +1 -1
- package/esm/interaction/action/index.d.ts +42 -21
- package/esm/interaction/action/index.js +8 -8
- package/esm/interaction/action/index.js.map +1 -1
- package/esm/interaction/index.d.ts +1 -1
- package/esm/interaction/index.js +0 -1
- package/esm/interaction/index.js.map +1 -1
- package/esm/interaction/interactor/index.d.ts +4 -2
- package/esm/interaction/interactor/index.js.map +1 -1
- package/esm/mark/annotation/index.d.ts +14 -7
- package/esm/mark/annotation/index.js +6 -6
- package/esm/mark/annotation/index.js.map +1 -1
- package/esm/mark/geometry/{schema.d.ts → box.d.ts} +4 -4
- package/esm/mark/geometry/{schema.js → box.js} +4 -4
- package/esm/mark/geometry/box.js.map +1 -0
- package/esm/mark/geometry/image.js +5 -4
- package/esm/mark/geometry/image.js.map +1 -1
- package/esm/mark/geometry/index.d.ts +22 -13
- package/esm/mark/geometry/index.js +1 -3
- package/esm/mark/geometry/index.js.map +1 -1
- package/esm/mark/geometry/interval.js +0 -1
- package/esm/mark/geometry/interval.js.map +1 -1
- package/esm/mark/geometry/line.js +5 -1
- package/esm/mark/geometry/line.js.map +1 -1
- package/esm/mark/geometry/link.js +1 -1
- package/esm/mark/geometry/link.js.map +1 -1
- package/esm/mark/geometry/point.js +6 -2
- package/esm/mark/geometry/point.js.map +1 -1
- package/esm/mark/geometry/polygon.js +1 -1
- package/esm/mark/geometry/polygon.js.map +1 -1
- package/esm/palette/index.d.ts +4 -2
- package/esm/palette/index.js.map +1 -1
- package/esm/runtime/component.d.ts +1 -1
- package/esm/runtime/component.js +8 -3
- package/esm/runtime/component.js.map +1 -1
- package/esm/runtime/mark.js +4 -3
- package/esm/runtime/mark.js.map +1 -1
- package/esm/runtime/plot.js +47 -28
- package/esm/runtime/plot.js.map +1 -1
- package/esm/runtime/render.js +15 -6
- package/esm/runtime/render.js.map +1 -1
- package/esm/runtime/scale.js +1 -1
- package/esm/runtime/scale.js.map +1 -1
- package/esm/runtime/types/component.d.ts +4 -6
- package/esm/runtime/types/options.d.ts +1 -0
- package/esm/scale/index.d.ts +22 -11
- package/esm/scale/index.js.map +1 -1
- package/esm/shape/annotation/text.js +16 -4
- package/esm/shape/annotation/text.js.map +1 -1
- package/esm/shape/{schema → box}/box.d.ts +0 -0
- package/esm/shape/{schema → box}/box.js +2 -2
- package/esm/shape/box/box.js.map +1 -0
- package/esm/shape/index.d.ts +86 -48
- package/esm/shape/index.js +9 -12
- package/esm/shape/index.js.map +1 -1
- package/esm/shape/label/label.js +62 -38
- package/esm/shape/label/label.js.map +1 -1
- package/esm/shape/{edge → link}/arc.d.ts +0 -0
- package/esm/shape/{edge → link}/arc.js +0 -0
- package/esm/shape/{edge → link}/arc.js.map +1 -1
- package/esm/shape/{edge → link}/smoothEdge.d.ts +0 -0
- package/esm/shape/{edge → link}/smoothEdge.js +0 -0
- package/esm/shape/{edge → link}/smoothEdge.js.map +1 -1
- package/esm/shape/{edge → link}/vhv.d.ts +0 -0
- package/esm/shape/{edge → link}/vhv.js +0 -0
- package/esm/shape/{edge → link}/vhv.js.map +1 -1
- package/esm/shape/{edge → polygon}/ribbon.d.ts +0 -0
- package/esm/shape/{edge → polygon}/ribbon.js +0 -0
- package/esm/shape/polygon/ribbon.js.map +1 -0
- package/esm/spec/data.d.ts +145 -8
- package/esm/spec/geometry.d.ts +5 -3
- package/esm/spec/transform.d.ts +18 -8
- package/esm/spec/transform.js +0 -133
- package/esm/spec/transform.js.map +1 -1
- package/esm/stdlib/index.js +13 -17
- package/esm/stdlib/index.js.map +1 -1
- package/esm/transform/dodgeX.js +7 -3
- package/esm/transform/dodgeX.js.map +1 -1
- package/esm/transform/flexX.d.ts +7 -0
- package/esm/transform/flexX.js +31 -0
- package/esm/transform/flexX.js.map +1 -0
- package/esm/transform/groupX.js +17 -19
- package/esm/transform/groupX.js.map +1 -1
- package/esm/transform/index.d.ts +46 -21
- package/esm/transform/index.js +3 -1
- package/esm/transform/index.js.map +1 -1
- package/esm/transform/normalizeY.js +1 -2
- package/esm/transform/normalizeY.js.map +1 -1
- package/esm/transform/sortX.d.ts +8 -0
- package/esm/transform/sortX.js +60 -0
- package/esm/transform/sortX.js.map +1 -0
- package/esm/transform/stackY.d.ts +1 -1
- package/esm/transform/stackY.js +26 -9
- package/esm/transform/stackY.js.map +1 -1
- package/esm/utils/coordinate.d.ts +1 -0
- package/esm/utils/coordinate.js +3 -0
- package/esm/utils/coordinate.js.map +1 -1
- package/lib/adjust/index.d.ts +2 -1
- package/lib/adjust/index.js.map +1 -1
- package/lib/animation/index.d.ts +14 -7
- package/lib/animation/index.js.map +1 -1
- package/lib/animation/scaleInX.js +3 -0
- package/lib/animation/scaleInX.js.map +1 -1
- package/lib/animation/scaleInY.js +3 -0
- package/lib/animation/scaleInY.js.map +1 -1
- package/lib/api/chart.d.ts +4 -0
- package/lib/api/chart.js +20 -3
- package/lib/api/chart.js.map +1 -1
- package/lib/api/mark/index.d.ts +3 -3
- package/lib/api/mark/index.js +1 -1
- package/lib/api/mark/index.js.map +1 -1
- package/lib/api/mark/mark.d.ts +4 -4
- package/lib/api/mark/mark.js +7 -6
- package/lib/api/mark/mark.js.map +1 -1
- package/lib/api/mark/types.d.ts +1 -0
- package/lib/api/node.d.ts +4 -5
- package/lib/api/node.js +5 -7
- package/lib/api/node.js.map +1 -1
- package/lib/api/props.d.ts +1 -0
- package/lib/api/props.js +10 -10
- package/lib/api/props.js.map +1 -1
- package/lib/component/axis.d.ts +1 -1
- package/lib/component/axis.js +11 -4
- package/lib/component/axis.js.map +1 -1
- package/lib/component/index.d.ts +10 -5
- package/lib/component/index.js.map +1 -1
- package/lib/composition/index.d.ts +16 -8
- package/lib/composition/index.js.map +1 -1
- package/lib/composition/rect.js +1 -1
- package/lib/composition/rect.js.map +1 -1
- package/lib/coordinate/index.d.ts +24 -12
- package/lib/coordinate/index.js.map +1 -1
- package/lib/data/arc.d.ts +7 -0
- package/lib/data/arc.js +14 -18
- package/lib/data/arc.js.map +1 -1
- package/lib/data/cluster.d.ts +8 -0
- package/lib/data/cluster.js +41 -46
- package/lib/data/cluster.js.map +1 -1
- package/lib/data/custom.d.ts +7 -0
- package/lib/data/custom.js +14 -0
- package/lib/data/custom.js.map +1 -0
- package/lib/data/fetch.js +6 -5
- package/lib/data/fetch.js.map +1 -1
- package/lib/data/filterBy.js +6 -2
- package/lib/data/filterBy.js.map +1 -1
- package/lib/data/index.d.ts +28 -9
- package/lib/data/index.js +13 -3
- package/lib/data/index.js.map +1 -1
- package/lib/data/map.d.ts +7 -0
- package/lib/data/map.js +14 -0
- package/lib/data/map.js.map +1 -0
- package/lib/data/sankey.d.ts +8 -0
- package/lib/data/sankey.js +80 -95
- package/lib/data/sankey.js.map +1 -1
- package/lib/data/sortBy.js +14 -4
- package/lib/data/sortBy.js.map +1 -1
- package/lib/data/tree.d.ts +4 -0
- package/lib/data/tree.js +10 -9
- package/lib/data/tree.js.map +1 -1
- package/lib/data/utils/arc/index.d.ts +1 -1
- package/lib/data/utils/fields.d.ts +6 -0
- package/lib/data/utils/fields.js +19 -0
- package/lib/data/utils/fields.js.map +1 -0
- package/lib/data/voronoi.d.ts +1 -0
- package/lib/data/voronoi.js +2 -22
- package/lib/data/voronoi.js.map +1 -1
- package/lib/data/wordCloud.d.ts +1 -0
- package/lib/data/wordCloud.js +2 -93
- package/lib/data/wordCloud.js.map +1 -1
- package/lib/encode/index.d.ts +8 -4
- package/lib/encode/index.js.map +1 -1
- package/lib/interaction/action/index.d.ts +42 -21
- package/lib/interaction/action/index.js.map +1 -1
- package/lib/interaction/index.d.ts +1 -1
- package/lib/interaction/index.js +0 -15
- package/lib/interaction/index.js.map +1 -1
- package/lib/interaction/interactor/index.d.ts +4 -2
- package/lib/interaction/interactor/index.js.map +1 -1
- package/lib/mark/annotation/index.d.ts +14 -7
- package/lib/mark/annotation/index.js.map +1 -1
- package/lib/mark/geometry/{schema.d.ts → box.d.ts} +4 -4
- package/lib/mark/geometry/{schema.js → box.js} +6 -6
- package/lib/mark/geometry/box.js.map +1 -0
- package/lib/mark/geometry/image.js +5 -4
- package/lib/mark/geometry/image.js.map +1 -1
- package/lib/mark/geometry/index.d.ts +22 -13
- package/lib/mark/geometry/index.js +3 -7
- package/lib/mark/geometry/index.js.map +1 -1
- package/lib/mark/geometry/interval.js +0 -1
- package/lib/mark/geometry/interval.js.map +1 -1
- package/lib/mark/geometry/line.js +5 -1
- package/lib/mark/geometry/line.js.map +1 -1
- package/lib/mark/geometry/link.js +1 -1
- package/lib/mark/geometry/link.js.map +1 -1
- package/lib/mark/geometry/point.js +6 -2
- package/lib/mark/geometry/point.js.map +1 -1
- package/lib/mark/geometry/polygon.js +1 -1
- package/lib/mark/geometry/polygon.js.map +1 -1
- package/lib/palette/index.d.ts +4 -2
- package/lib/palette/index.js.map +1 -1
- package/lib/runtime/component.d.ts +1 -1
- package/lib/runtime/component.js +8 -3
- package/lib/runtime/component.js.map +1 -1
- package/lib/runtime/mark.js +4 -3
- package/lib/runtime/mark.js.map +1 -1
- package/lib/runtime/plot.js +47 -28
- package/lib/runtime/plot.js.map +1 -1
- package/lib/runtime/render.js +15 -6
- package/lib/runtime/render.js.map +1 -1
- package/lib/runtime/scale.js +1 -1
- package/lib/runtime/scale.js.map +1 -1
- package/lib/runtime/types/component.d.ts +4 -6
- package/lib/runtime/types/options.d.ts +1 -0
- package/lib/scale/index.d.ts +22 -11
- package/lib/scale/index.js.map +1 -1
- package/lib/shape/annotation/text.js +16 -4
- package/lib/shape/annotation/text.js.map +1 -1
- package/lib/shape/{schema → box}/box.d.ts +0 -0
- package/lib/shape/{schema → box}/box.js +2 -2
- package/lib/shape/box/box.js.map +1 -0
- package/lib/shape/index.d.ts +86 -48
- package/lib/shape/index.js +10 -16
- package/lib/shape/index.js.map +1 -1
- package/lib/shape/label/label.js +61 -37
- package/lib/shape/label/label.js.map +1 -1
- package/lib/shape/{edge → link}/arc.d.ts +0 -0
- package/lib/shape/{edge → link}/arc.js +0 -0
- package/lib/shape/{edge → link}/arc.js.map +1 -1
- package/lib/shape/{edge → link}/smoothEdge.d.ts +0 -0
- package/lib/shape/{edge → link}/smoothEdge.js +0 -0
- package/lib/shape/{edge → link}/smoothEdge.js.map +1 -1
- package/lib/shape/{edge → link}/vhv.d.ts +0 -0
- package/lib/shape/{edge → link}/vhv.js +0 -0
- package/lib/shape/{edge → link}/vhv.js.map +1 -1
- package/lib/shape/{edge → polygon}/ribbon.d.ts +0 -0
- package/lib/shape/{edge → polygon}/ribbon.js +0 -0
- package/lib/shape/polygon/ribbon.js.map +1 -0
- package/lib/spec/data.d.ts +145 -8
- package/lib/spec/geometry.d.ts +5 -3
- package/lib/spec/transform.d.ts +18 -8
- package/lib/spec/transform.js +0 -133
- package/lib/spec/transform.js.map +1 -1
- package/lib/stdlib/index.js +9 -13
- package/lib/stdlib/index.js.map +1 -1
- package/lib/transform/dodgeX.js +7 -3
- package/lib/transform/dodgeX.js.map +1 -1
- package/lib/transform/flexX.d.ts +7 -0
- package/lib/transform/flexX.js +35 -0
- package/lib/transform/flexX.js.map +1 -0
- package/lib/transform/groupX.js +16 -18
- package/lib/transform/groupX.js.map +1 -1
- package/lib/transform/index.d.ts +46 -21
- package/lib/transform/index.js +5 -1
- package/lib/transform/index.js.map +1 -1
- package/lib/transform/normalizeY.js +0 -1
- package/lib/transform/normalizeY.js.map +1 -1
- package/lib/transform/sortX.d.ts +8 -0
- package/lib/transform/sortX.js +64 -0
- package/lib/transform/sortX.js.map +1 -0
- package/lib/transform/stackY.d.ts +1 -1
- package/lib/transform/stackY.js +26 -9
- package/lib/transform/stackY.js.map +1 -1
- package/lib/utils/coordinate.d.ts +1 -0
- package/lib/utils/coordinate.js +5 -1
- package/lib/utils/coordinate.js.map +1 -1
- package/package.json +19 -4
- package/src/.DS_Store +0 -0
- package/src/adjust/index.ts +2 -1
- package/src/animation/index.ts +15 -7
- package/src/animation/morphing.ts +1 -1
- package/src/animation/scaleInX.ts +3 -0
- package/src/animation/scaleInY.ts +3 -0
- package/src/api/chart.ts +40 -3
- package/src/api/mark/index.ts +3 -3
- package/src/api/mark/mark.ts +6 -5
- package/src/api/mark/types.ts +1 -0
- package/src/api/node.ts +5 -6
- package/src/api/props.ts +14 -10
- package/src/component/axis.ts +13 -5
- package/src/component/index.ts +11 -5
- package/src/composition/index.ts +17 -8
- package/src/composition/rect.ts +1 -1
- package/src/coordinate/index.ts +25 -12
- package/src/data/arc.ts +13 -18
- package/src/data/cluster.ts +53 -56
- package/src/data/custom.ts +15 -0
- package/src/data/fetch.ts +12 -7
- package/src/data/filterBy.ts +11 -2
- package/src/data/index.ts +29 -9
- package/src/data/map.ts +15 -0
- package/src/data/sankey.ts +92 -95
- package/src/data/sortBy.ts +18 -8
- package/src/data/tree.ts +9 -9
- package/src/data/utils/arc/index.ts +1 -1
- package/src/data/utils/fields.ts +17 -0
- package/src/data/voronoi.ts +2 -0
- package/src/data/wordCloud.ts +2 -0
- package/src/encode/index.ts +9 -4
- package/src/interaction/action/index.ts +43 -45
- package/src/interaction/index.ts +17 -1
- package/src/interaction/interactor/index.ts +5 -2
- package/src/interaction/types.ts +1 -1
- package/src/mark/annotation/index.ts +15 -25
- package/src/mark/geometry/{schema.ts → box.ts} +5 -5
- package/src/mark/geometry/image.ts +4 -3
- package/src/mark/geometry/index.ts +23 -13
- package/src/mark/geometry/interval.ts +0 -1
- package/src/mark/geometry/line.ts +6 -1
- package/src/mark/geometry/link.ts +1 -1
- package/src/mark/geometry/point.ts +5 -2
- package/src/mark/geometry/polygon.ts +1 -1
- package/src/palette/index.ts +5 -2
- package/src/runtime/component.ts +10 -3
- package/src/runtime/mark.ts +4 -3
- package/src/runtime/plot.ts +66 -41
- package/src/runtime/render.ts +16 -10
- package/src/runtime/scale.ts +1 -1
- package/src/runtime/types/component.ts +1 -10
- package/src/runtime/types/options.ts +1 -0
- package/src/scale/index.ts +23 -11
- package/src/shape/annotation/text.ts +16 -4
- package/src/shape/{schema → box}/box.ts +2 -2
- package/src/shape/index.ts +92 -60
- package/src/shape/label/label.ts +81 -47
- package/src/shape/{edge → link}/arc.ts +0 -0
- package/src/shape/{edge → link}/smoothEdge.ts +0 -0
- package/src/shape/{edge → link}/vhv.ts +0 -0
- package/src/shape/{edge → polygon}/ribbon.ts +0 -0
- package/src/spec/data.ts +157 -8
- package/src/spec/geometry.ts +5 -3
- package/src/spec/transform.ts +37 -154
- package/src/stdlib/index.ts +18 -20
- package/src/transform/dodgeX.ts +5 -4
- package/src/transform/flexX.ts +38 -0
- package/src/transform/groupX.ts +25 -8
- package/src/transform/index.ts +47 -24
- package/src/transform/normalizeY.ts +0 -1
- package/src/transform/sortX.ts +48 -0
- package/src/transform/stackY.ts +34 -9
- package/src/utils/coordinate.ts +4 -0
- package/esm/data/connector.d.ts +0 -7
- package/esm/data/connector.js +0 -9
- package/esm/data/connector.js.map +0 -1
- package/esm/mark/geometry/edge.d.ts +0 -13
- package/esm/mark/geometry/edge.js +0 -31
- package/esm/mark/geometry/edge.js.map +0 -1
- package/esm/mark/geometry/node.d.ts +0 -8
- package/esm/mark/geometry/node.js +0 -27
- package/esm/mark/geometry/node.js.map +0 -1
- package/esm/mark/geometry/schema.js.map +0 -1
- package/esm/renderer/canvas.d.ts +0 -10
- package/esm/renderer/canvas.js +0 -18
- package/esm/renderer/canvas.js.map +0 -1
- package/esm/renderer/index.d.ts +0 -1
- package/esm/renderer/index.js +0 -2
- package/esm/renderer/index.js.map +0 -1
- package/esm/shape/edge/edge.d.ts +0 -6
- package/esm/shape/edge/edge.js +0 -11
- package/esm/shape/edge/edge.js.map +0 -1
- package/esm/shape/edge/ribbon.js.map +0 -1
- package/esm/shape/node/point.d.ts +0 -6
- package/esm/shape/node/point.js +0 -27
- package/esm/shape/node/point.js.map +0 -1
- package/esm/shape/node/polygon.d.ts +0 -3
- package/esm/shape/node/polygon.js +0 -8
- package/esm/shape/node/polygon.js.map +0 -1
- package/esm/shape/schema/box.js.map +0 -1
- package/lib/data/connector.d.ts +0 -7
- package/lib/data/connector.js +0 -13
- package/lib/data/connector.js.map +0 -1
- package/lib/mark/geometry/edge.d.ts +0 -13
- package/lib/mark/geometry/edge.js +0 -35
- package/lib/mark/geometry/edge.js.map +0 -1
- package/lib/mark/geometry/node.d.ts +0 -8
- package/lib/mark/geometry/node.js +0 -31
- package/lib/mark/geometry/node.js.map +0 -1
- package/lib/mark/geometry/schema.js.map +0 -1
- package/lib/renderer/canvas.d.ts +0 -10
- package/lib/renderer/canvas.js +0 -22
- package/lib/renderer/canvas.js.map +0 -1
- package/lib/renderer/index.d.ts +0 -1
- package/lib/renderer/index.js +0 -6
- package/lib/renderer/index.js.map +0 -1
- package/lib/shape/edge/edge.d.ts +0 -6
- package/lib/shape/edge/edge.js +0 -15
- package/lib/shape/edge/edge.js.map +0 -1
- package/lib/shape/edge/ribbon.js.map +0 -1
- package/lib/shape/node/point.d.ts +0 -6
- package/lib/shape/node/point.js +0 -31
- package/lib/shape/node/point.js.map +0 -1
- package/lib/shape/node/polygon.d.ts +0 -3
- package/lib/shape/node/polygon.js +0 -12
- package/lib/shape/node/polygon.js.map +0 -1
- package/lib/shape/schema/box.js.map +0 -1
- package/src/data/connector.ts +0 -14
- package/src/mark/geometry/edge.ts +0 -40
- package/src/mark/geometry/node.ts +0 -36
- package/src/renderer/canvas.ts +0 -27
- package/src/renderer/index.ts +0 -1
- package/src/shape/edge/edge.ts +0 -15
- package/src/shape/node/point.ts +0 -32
- package/src/shape/node/polygon.ts +0 -12
package/src/stdlib/index.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { G2Library } from '../runtime';
|
|
2
|
-
import { Canvas } from '../renderer';
|
|
3
2
|
import {
|
|
4
3
|
Cartesian,
|
|
5
4
|
Polar,
|
|
@@ -22,13 +21,11 @@ import {
|
|
|
22
21
|
Point as PointGeometry,
|
|
23
22
|
Text as TextGeometry,
|
|
24
23
|
Area as AreaGeometry,
|
|
25
|
-
Edge as EdgeGeometry,
|
|
26
24
|
Image as ImageGeometry,
|
|
27
25
|
Polygon as PolygonGeometry,
|
|
28
|
-
|
|
26
|
+
Box as BoxGeometry,
|
|
29
27
|
Vector as VectorGeometry,
|
|
30
28
|
Link as LinkGeometry,
|
|
31
|
-
Node as NodeGeometry,
|
|
32
29
|
} from '../mark/geometry';
|
|
33
30
|
import {
|
|
34
31
|
AnnotationText,
|
|
@@ -87,7 +84,6 @@ import {
|
|
|
87
84
|
AnnotationConnector as AnnotationConnectorShape,
|
|
88
85
|
Area,
|
|
89
86
|
SmoothArea,
|
|
90
|
-
Edge,
|
|
91
87
|
SmoothEdge,
|
|
92
88
|
VHVEdge,
|
|
93
89
|
Arc,
|
|
@@ -99,8 +95,6 @@ import {
|
|
|
99
95
|
Pyramid,
|
|
100
96
|
Vector,
|
|
101
97
|
Link,
|
|
102
|
-
PointNode,
|
|
103
|
-
PolygonNode,
|
|
104
98
|
Label,
|
|
105
99
|
} from '../shape';
|
|
106
100
|
import { Light } from '../theme';
|
|
@@ -170,17 +164,24 @@ import {
|
|
|
170
164
|
SelectX,
|
|
171
165
|
SelectY,
|
|
172
166
|
GroupX,
|
|
167
|
+
SortX,
|
|
168
|
+
FlexX,
|
|
173
169
|
} from '../transform';
|
|
174
170
|
import {
|
|
175
171
|
Fetch,
|
|
176
172
|
SortBy,
|
|
177
173
|
FilterBy,
|
|
174
|
+
Map,
|
|
178
175
|
Pick,
|
|
179
176
|
Rename,
|
|
180
177
|
Subset,
|
|
181
178
|
Fold,
|
|
182
179
|
Inline,
|
|
183
|
-
|
|
180
|
+
Custom,
|
|
181
|
+
Cluster,
|
|
182
|
+
Tree,
|
|
183
|
+
Sankey,
|
|
184
|
+
Arc as ArcTransform,
|
|
184
185
|
} from '../data';
|
|
185
186
|
import { HideOverlap } from '../labelLayout/hideOverlap';
|
|
186
187
|
|
|
@@ -194,13 +195,14 @@ export function createLibrary(): G2Library {
|
|
|
194
195
|
'data.rename': Rename,
|
|
195
196
|
'data.subset': Subset,
|
|
196
197
|
'data.fold': Fold,
|
|
197
|
-
'data.
|
|
198
|
+
'data.custom': Custom,
|
|
199
|
+
'data.map': Map,
|
|
200
|
+
'data.cluster': Cluster,
|
|
201
|
+
'data.tree': Tree,
|
|
202
|
+
'data.sankey': Sankey,
|
|
203
|
+
'data.arc': ArcTransform,
|
|
198
204
|
// 'transform.wordCloud': WordCloud,
|
|
199
205
|
// 'transform.voronoi': Voronoi,
|
|
200
|
-
// 'transform.sankey': Sankey,
|
|
201
|
-
// 'transform.arc': ArcTransform,
|
|
202
|
-
// 'transform.cluster': ClusterTransform,
|
|
203
|
-
// 'transform.tree': TreeTransform,
|
|
204
206
|
// 'transform.connector': Connector,
|
|
205
207
|
'transform.maybeZeroY1': MaybeZeroY1,
|
|
206
208
|
'transform.maybeZeroX': MaybeZeroX,
|
|
@@ -223,7 +225,8 @@ export function createLibrary(): G2Library {
|
|
|
223
225
|
'transform.maybeSize': MaybeSize,
|
|
224
226
|
'transform.maybeZeroY': MaybeZeroY,
|
|
225
227
|
'transform.maybeKey': MaybeKey,
|
|
226
|
-
'
|
|
228
|
+
'transform.sortX': SortX,
|
|
229
|
+
'transform.flexX': FlexX,
|
|
227
230
|
'coordinate.cartesian': Cartesian,
|
|
228
231
|
'coordinate.polar': Polar,
|
|
229
232
|
'coordinate.helix': Helix,
|
|
@@ -247,11 +250,9 @@ export function createLibrary(): G2Library {
|
|
|
247
250
|
'mark.grid': Grid,
|
|
248
251
|
'mark.area': AreaGeometry,
|
|
249
252
|
'mark.link': LinkGeometry,
|
|
250
|
-
'mark.node': NodeGeometry,
|
|
251
|
-
'mark.edge': EdgeGeometry,
|
|
252
253
|
'mark.image': ImageGeometry,
|
|
253
254
|
'mark.polygon': PolygonGeometry,
|
|
254
|
-
'mark.
|
|
255
|
+
'mark.box': BoxGeometry,
|
|
255
256
|
'mark.vector': VectorGeometry,
|
|
256
257
|
'mark.annotation.text': AnnotationText,
|
|
257
258
|
'mark.annotation.lineX': AnnotationLineX,
|
|
@@ -304,13 +305,10 @@ export function createLibrary(): G2Library {
|
|
|
304
305
|
'shape.text': Text,
|
|
305
306
|
'shape.area': Area,
|
|
306
307
|
'shape.smoothArea': SmoothArea,
|
|
307
|
-
'shape.edge': Edge,
|
|
308
308
|
'shape.smoothEdge': SmoothEdge,
|
|
309
309
|
'shape.vhvEdge': VHVEdge,
|
|
310
310
|
'shape.arc': Arc,
|
|
311
311
|
'shape.link': Link,
|
|
312
|
-
'shape.pointNode': PointNode,
|
|
313
|
-
'shape.polygonNode': PolygonNode,
|
|
314
312
|
'shape.image': Image,
|
|
315
313
|
'shape.polygon': Polygon,
|
|
316
314
|
'shape.ribbon': Ribbon,
|
package/src/transform/dodgeX.ts
CHANGED
|
@@ -17,7 +17,7 @@ export type DodgeXOptions = Omit<DodgeXTransform, 'type'>;
|
|
|
17
17
|
* say to form horizontal "columns" by specified channels.
|
|
18
18
|
*/
|
|
19
19
|
export const DodgeX: TC<DodgeXOptions> = (options = {}) => {
|
|
20
|
-
const { groupBy = 'x', reverse = false, orderBy, ...rest } = options;
|
|
20
|
+
const { groupBy = 'x', reverse = false, orderBy, padding, ...rest } = options;
|
|
21
21
|
return (I, mark) => {
|
|
22
22
|
const { data, encode, scale } = mark;
|
|
23
23
|
const { series: scaleSeries } = scale;
|
|
@@ -39,14 +39,15 @@ export const DodgeX: TC<DodgeXOptions> = (options = {}) => {
|
|
|
39
39
|
newS[G[i]] = domainSeries[i];
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
// console.log(newS, S);
|
|
43
42
|
|
|
44
43
|
return [
|
|
45
44
|
I,
|
|
46
45
|
deepMix({}, mark, {
|
|
47
46
|
scale: {
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
series: {
|
|
48
|
+
domain: domainSeries,
|
|
49
|
+
paddingInner: padding,
|
|
50
|
+
},
|
|
50
51
|
},
|
|
51
52
|
encode: {
|
|
52
53
|
series: column(newS),
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { deepMix } from '@antv/util';
|
|
2
|
+
import { rollups, sum, Primitive } from 'd3-array';
|
|
3
|
+
import { TransformComponent as TC } from '../runtime';
|
|
4
|
+
import { FlexXTransform } from '../spec';
|
|
5
|
+
import { columnOf } from './utils/helper';
|
|
6
|
+
|
|
7
|
+
export type FlexXOptions = Omit<FlexXTransform, 'type'>;
|
|
8
|
+
|
|
9
|
+
function valueOf(data: any, field: FlexXOptions['field']) {
|
|
10
|
+
if (typeof field === 'string') return data.map((d) => d[field]);
|
|
11
|
+
return data.map(field);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function createReducer(
|
|
15
|
+
reducer: FlexXOptions['reducer'],
|
|
16
|
+
V: Primitive[],
|
|
17
|
+
): (I: number[]) => any {
|
|
18
|
+
if (typeof reducer === 'function') return (GI: number[]) => reducer(GI, V);
|
|
19
|
+
if (reducer === 'sum') return (GI: number[]) => sum(GI, (i) => +V[i]);
|
|
20
|
+
throw new Error(`Unknown reducer: ${reducer}`);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Produce flex options from data for x scale.
|
|
25
|
+
*/
|
|
26
|
+
export const FlexX: TC<FlexXOptions> = (options = {}) => {
|
|
27
|
+
const { field, channel = 'y', reducer = 'sum' } = options;
|
|
28
|
+
return (I, mark) => {
|
|
29
|
+
const { data, encode } = mark;
|
|
30
|
+
const [x] = columnOf(encode, 'x');
|
|
31
|
+
const V = field ? valueOf(data, field) : columnOf(encode, channel)[0];
|
|
32
|
+
const reducerFunction = createReducer(reducer, V);
|
|
33
|
+
const flex = rollups(I, reducerFunction, (i) => x[i]).map((d) => d[1]);
|
|
34
|
+
return [I, deepMix({}, mark, { scale: { x: { flex } } })];
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
FlexX.props = {};
|
package/src/transform/groupX.ts
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import { deepMix } from '@antv/util';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
max as d3Max,
|
|
4
|
+
mean as d3Mean,
|
|
5
|
+
sum as d3Sum,
|
|
6
|
+
min as d3Min,
|
|
7
|
+
median as d3Median,
|
|
8
|
+
} from 'd3-array';
|
|
3
9
|
import { TransformComponent as TC, Primitive } from '../runtime';
|
|
4
10
|
import { GroupXTransform, Reducer } from '../spec';
|
|
5
11
|
import { indexOf } from '../utils/array';
|
|
6
12
|
import { columnOf, column } from './utils/helper';
|
|
13
|
+
import { createGroups } from './utils/order';
|
|
7
14
|
|
|
8
15
|
export type GroupXOptions = Omit<GroupXTransform, 'type'>;
|
|
9
16
|
|
|
@@ -13,7 +20,7 @@ type Formatter = (d: Primitive) => string;
|
|
|
13
20
|
|
|
14
21
|
function normalizeReducer(reducer: Reducer): [ReducerFunction, Formatter] {
|
|
15
22
|
if (typeof reducer === 'function') return [reducer, null];
|
|
16
|
-
const registry = { mean, max, count, first, last, sum };
|
|
23
|
+
const registry = { mean, max, count, first, last, sum, min, median };
|
|
17
24
|
const reducerFunction = registry[reducer];
|
|
18
25
|
if (!reducerFunction) throw new Error(`Unknown reducer: ${reducer}.`);
|
|
19
26
|
return reducerFunction();
|
|
@@ -25,15 +32,27 @@ function mean(): [ReducerFunction, Formatter] {
|
|
|
25
32
|
return [reducer, formatter];
|
|
26
33
|
}
|
|
27
34
|
|
|
35
|
+
function median(): [ReducerFunction, Formatter] {
|
|
36
|
+
const reducer: ReducerFunction = (I, V) => d3Median(I, (i) => +V[i]);
|
|
37
|
+
const formatter: Formatter = (d) => `median of ${d}`;
|
|
38
|
+
return [reducer, formatter];
|
|
39
|
+
}
|
|
40
|
+
|
|
28
41
|
function max(): [ReducerFunction, Formatter] {
|
|
29
42
|
const reducer: ReducerFunction = (I, V) => d3Max(I, (i) => +V[i]);
|
|
30
43
|
const formatter: Formatter = (d) => `max of ${d}`;
|
|
31
44
|
return [reducer, formatter];
|
|
32
45
|
}
|
|
33
46
|
|
|
47
|
+
function min(): [ReducerFunction, Formatter] {
|
|
48
|
+
const reducer: ReducerFunction = (I, V) => d3Min(I, (i) => +V[i]);
|
|
49
|
+
const formatter: Formatter = (d) => `min of ${d}`;
|
|
50
|
+
return [reducer, formatter];
|
|
51
|
+
}
|
|
52
|
+
|
|
34
53
|
function count(): [ReducerFunction, Formatter] {
|
|
35
54
|
const reducer: ReducerFunction = (I, V) => I.length;
|
|
36
|
-
const formatter: Formatter = (d) => `count of ${d}
|
|
55
|
+
const formatter: Formatter = (d) => (d === null ? 'count' : `count of ${d}`);
|
|
37
56
|
return [reducer, formatter];
|
|
38
57
|
}
|
|
39
58
|
|
|
@@ -44,7 +63,7 @@ function sum(): [ReducerFunction, Formatter] {
|
|
|
44
63
|
}
|
|
45
64
|
|
|
46
65
|
function first(): [ReducerFunction, Formatter] {
|
|
47
|
-
const reducer: ReducerFunction = (I, V) => V[0];
|
|
66
|
+
const reducer: ReducerFunction = (I, V) => V[I[0]];
|
|
48
67
|
const formatter: Formatter = (d) => `first of ${d}`;
|
|
49
68
|
return [reducer, formatter];
|
|
50
69
|
}
|
|
@@ -61,12 +80,10 @@ function last(): [ReducerFunction, Formatter] {
|
|
|
61
80
|
* @todo Test encode after aggregate.
|
|
62
81
|
*/
|
|
63
82
|
export const GroupX: TC<GroupXOptions> = (options = {}) => {
|
|
64
|
-
const { orderBy, reverse = false, ...rest } = options;
|
|
65
83
|
return (I, mark) => {
|
|
66
84
|
const { data, encode } = mark;
|
|
67
|
-
const
|
|
68
|
-
const
|
|
69
|
-
const outputs = Object.entries(rest).map(([channel, reducer]) => {
|
|
85
|
+
const groups = createGroups(['x', 'color'], I, mark);
|
|
86
|
+
const outputs = Object.entries(options).map(([channel, reducer]) => {
|
|
70
87
|
const [reducerFunction, formatter] = normalizeReducer(reducer);
|
|
71
88
|
const [V, field] = columnOf(encode, channel);
|
|
72
89
|
const RV = groups.map((I) => reducerFunction(I, V ?? data));
|
package/src/transform/index.ts
CHANGED
|
@@ -1,24 +1,47 @@
|
|
|
1
|
-
export { MaybeZeroY1
|
|
2
|
-
export { MaybeStackY
|
|
3
|
-
export { MaybeTitleX
|
|
4
|
-
export {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from './
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
19
|
-
export {
|
|
20
|
-
export {
|
|
21
|
-
export {
|
|
22
|
-
export {
|
|
23
|
-
export {
|
|
24
|
-
|
|
1
|
+
export { MaybeZeroY1 } from './maybeZeroY1';
|
|
2
|
+
export { MaybeStackY } from './maybeStackY';
|
|
3
|
+
export { MaybeTitleX } from './maybeTitleX';
|
|
4
|
+
export { MaybeTooltipPosition } from './maybeTooltipPosition';
|
|
5
|
+
export { MaybeTooltipY } from './maybeTooltipY';
|
|
6
|
+
export { MaybeZeroX } from './maybeZeroX';
|
|
7
|
+
export { MaybeZeroY } from './maybeZeroY';
|
|
8
|
+
export { MaybeSize } from './maybeSize';
|
|
9
|
+
export { MaybeKey } from './maybeKey';
|
|
10
|
+
export { MaybeSeries } from './maybeSeries';
|
|
11
|
+
export { StackY } from './stackY';
|
|
12
|
+
export { DodgeX } from './dodgeX';
|
|
13
|
+
export { StackEnter } from './stackEnter';
|
|
14
|
+
export { NormalizeY } from './normalizeY';
|
|
15
|
+
export { Jitter } from './jitter';
|
|
16
|
+
export { JitterY } from './jitterY';
|
|
17
|
+
export { SymmetryY } from './symmetryY';
|
|
18
|
+
export { Select } from './Select';
|
|
19
|
+
export { SelectX } from './SelectX';
|
|
20
|
+
export { SelectY } from './SelectY';
|
|
21
|
+
export { GroupX } from './groupX';
|
|
22
|
+
export { SortX } from './sortX';
|
|
23
|
+
export { FlexX } from './flexX';
|
|
24
|
+
|
|
25
|
+
export type { MaybeZeroY1Options } from './maybeZeroY1';
|
|
26
|
+
export type { MaybeStackYOptions } from './maybeStackY';
|
|
27
|
+
export type { MaybeTitleXOptions } from './maybeTitleX';
|
|
28
|
+
export type { MaybeTooltipPositionOptions } from './maybeTooltipPosition';
|
|
29
|
+
export type { MaybeTooltipYOptions } from './maybeTooltipY';
|
|
30
|
+
export type { MaybeZeroXOptions } from './maybeZeroX';
|
|
31
|
+
export type { MaybeZeroYOptions } from './maybeZeroY';
|
|
32
|
+
export type { MaybeSizeOptions } from './maybeSize';
|
|
33
|
+
export type { MaybeKeyOptions } from './maybeKey';
|
|
34
|
+
export type { MaybeSeriesOptions } from './maybeSeries';
|
|
35
|
+
export type { StackYOptions } from './stackY';
|
|
36
|
+
export type { DodgeXOptions } from './dodgeX';
|
|
37
|
+
export type { StackEnterOptions } from './stackEnter';
|
|
38
|
+
export type { NormalizeYOptions } from './normalizeY';
|
|
39
|
+
export type { JitterOptions } from './jitter';
|
|
40
|
+
export type { JitterYOptions } from './jitterY';
|
|
41
|
+
export type { SymmetryYOptions } from './symmetryY';
|
|
42
|
+
export type { SelectOptions } from './Select';
|
|
43
|
+
export type { SelectXOptions } from './SelectX';
|
|
44
|
+
export type { SelectYOptions } from './SelectY';
|
|
45
|
+
export type { GroupXOptions } from './groupX';
|
|
46
|
+
export type { SortXOptions } from './sortX';
|
|
47
|
+
export type { FlexXOptions } from './flexX';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { deepMix } from '@antv/util';
|
|
2
|
+
import { groupSort, max, min, sum } from 'd3-array';
|
|
3
|
+
import { TransformComponent as TC } from '../runtime';
|
|
4
|
+
import { SortXTransform } from '../spec';
|
|
5
|
+
import { columnOf } from './utils/helper';
|
|
6
|
+
|
|
7
|
+
function createReducer(options, encode): (I: number[]) => any {
|
|
8
|
+
const { channel = 'y', reducer = 'max' } = options;
|
|
9
|
+
const [V] = columnOf(encode, channel);
|
|
10
|
+
if (typeof reducer === 'function') return (GI: number[]) => reducer(GI, V);
|
|
11
|
+
if (reducer === 'max') return (GI: number[]) => max(GI, (i) => +V[i]);
|
|
12
|
+
if (reducer === 'min') return (GI: number[]) => min(GI, (i) => +V[i]);
|
|
13
|
+
if (reducer === 'sum') return (GI: number[]) => sum(GI, (i) => +V[i]);
|
|
14
|
+
if (reducer === 'first') return (GI: number[]) => V[GI[0]];
|
|
15
|
+
if (reducer === 'last') return (GI: number[]) => V[GI[GI.length - 1]];
|
|
16
|
+
throw new Error(`Unknown reducer: ${reducer}`);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type SortXOptions = Omit<SortXTransform, 'type'>;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Sort marks groups by groups.
|
|
23
|
+
* @todo Add more reducers: first, last, etc,.
|
|
24
|
+
*/
|
|
25
|
+
export const SortX: TC<SortXOptions> = (options = {}) => {
|
|
26
|
+
const { reverse = false, slice, ...rest } = options;
|
|
27
|
+
return (I, mark) => {
|
|
28
|
+
const { encode } = mark;
|
|
29
|
+
const [X] = columnOf(encode, 'x');
|
|
30
|
+
const normalizeReducer = createReducer(rest, encode);
|
|
31
|
+
const sortedDomain = groupSort(I, normalizeReducer, (i) => X[i]);
|
|
32
|
+
if (reverse) sortedDomain.reverse();
|
|
33
|
+
const s = typeof slice === 'number' ? [0, slice] : slice;
|
|
34
|
+
const slicedDomain = slice ? sortedDomain.slice(...s) : sortedDomain;
|
|
35
|
+
return [
|
|
36
|
+
I,
|
|
37
|
+
deepMix(mark, {
|
|
38
|
+
scale: {
|
|
39
|
+
x: {
|
|
40
|
+
domain: slicedDomain,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
}),
|
|
44
|
+
];
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
SortX.props = {};
|
package/src/transform/stackY.ts
CHANGED
|
@@ -7,17 +7,25 @@ import { normalizeComparator, createGroups, applyOrder } from './utils/order';
|
|
|
7
7
|
export type StackYOptions = Omit<StackYTransform, 'type'>;
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
* The stack transform group marks into series by color
|
|
10
|
+
* The stack transform group marks into series by color channel,
|
|
11
11
|
* and then produce new y channel for each series by specified order,
|
|
12
12
|
* say to form vertical "stacks" by specified channels.
|
|
13
13
|
*/
|
|
14
14
|
export const StackY: TC<StackYOptions> = (options = {}) => {
|
|
15
|
-
const {
|
|
16
|
-
|
|
15
|
+
const {
|
|
16
|
+
groupBy = 'x',
|
|
17
|
+
orderBy = null,
|
|
18
|
+
reverse = false,
|
|
19
|
+
y: from = 'y',
|
|
20
|
+
series = true,
|
|
21
|
+
} = options;
|
|
22
|
+
return (I, mark) => {
|
|
17
23
|
const { data, encode } = mark;
|
|
18
24
|
const [Y, fy] = columnOf(encode, 'y');
|
|
19
25
|
const [Y1, fy1] = columnOf(encode, 'y1');
|
|
20
|
-
const [S] =
|
|
26
|
+
const [S] = series
|
|
27
|
+
? maybeColumnOf(encode, 'series', 'color')
|
|
28
|
+
: columnOf(encode, 'color');
|
|
21
29
|
|
|
22
30
|
// Create groups and apply specified order for each group.
|
|
23
31
|
const groups = createGroups(groupBy, I, mark);
|
|
@@ -28,16 +36,33 @@ export const StackY: TC<StackYOptions> = (options = {}) => {
|
|
|
28
36
|
// Stack y channels to produce new y and y1 channel.
|
|
29
37
|
const newY = new Array(I.length);
|
|
30
38
|
const newY1 = new Array(I.length);
|
|
39
|
+
const TY = new Array(I.length);
|
|
31
40
|
for (const G of groups) {
|
|
32
41
|
if (reverse) G.reverse();
|
|
33
42
|
// For range interval with specified y and y1.
|
|
34
43
|
const start = Y1 ? +Y1[G[0]] : 0;
|
|
35
|
-
|
|
36
|
-
|
|
44
|
+
|
|
45
|
+
// Split positive indices of Y and negative Y.
|
|
46
|
+
const PG = [];
|
|
47
|
+
const NG = [];
|
|
37
48
|
for (const i of G) {
|
|
38
|
-
const y = +Y[i] - start;
|
|
39
|
-
if (y < 0)
|
|
40
|
-
else if (y
|
|
49
|
+
const y = (TY[i] = +Y[i] - start);
|
|
50
|
+
if (y < 0) NG.push(i);
|
|
51
|
+
else if (y >= 0) PG.push(i);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Stack negative y in reverse order.
|
|
55
|
+
let ny = start;
|
|
56
|
+
for (const i of NG.reverse()) {
|
|
57
|
+
const y = TY[i];
|
|
58
|
+
ny = newY[i] = (newY1[i] = ny) + y;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Stack positive y in input order.
|
|
62
|
+
let py = start;
|
|
63
|
+
for (const i of PG) {
|
|
64
|
+
const y = TY[i];
|
|
65
|
+
if (y > 0) py = newY[i] = (newY1[i] = py) + y;
|
|
41
66
|
else newY[i] = newY1[i] = py;
|
|
42
67
|
}
|
|
43
68
|
}
|
package/src/utils/coordinate.ts
CHANGED
|
@@ -27,3 +27,7 @@ export function isFisheye(coordinate: Coordinate): boolean {
|
|
|
27
27
|
const { transformations } = coordinate.getOptions();
|
|
28
28
|
return transformations.some(([type]) => type === 'fisheye');
|
|
29
29
|
}
|
|
30
|
+
|
|
31
|
+
export function isCircular(coordinate: Coordinate): boolean {
|
|
32
|
+
return isHelix(coordinate) || isParallel(coordinate);
|
|
33
|
+
}
|
package/esm/data/connector.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { DataComponent as DC } from '../runtime';
|
|
2
|
-
import { ConnectorTransform } from '../spec';
|
|
3
|
-
export declare type ConnectorOptions = Omit<ConnectorTransform, 'type'>;
|
|
4
|
-
/**
|
|
5
|
-
* Connector transfom by function.
|
|
6
|
-
*/
|
|
7
|
-
export declare const Connector: DC<ConnectorOptions>;
|
package/esm/data/connector.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"connector.js","sourceRoot":"src/","sources":["data/connector.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAyB,CAAC,OAAO,EAAE,EAAE;IACzD,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAC7B,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AACtD,CAAC,CAAC;AAEF,SAAS,CAAC,KAAK,GAAG,EAAE,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { MarkComponent as MC } from '../../runtime';
|
|
2
|
-
import { EdgeGeometry } from '../../spec';
|
|
3
|
-
export declare type EdgeOptions = Omit<EdgeGeometry, 'type'>;
|
|
4
|
-
/**
|
|
5
|
-
* Convert value for each channel to edge shapes.
|
|
6
|
-
*
|
|
7
|
-
* input:
|
|
8
|
-
* X: [x0, x1, x2, x3, ...]
|
|
9
|
-
* Y: [y0, y1, y2, y3, ...]
|
|
10
|
-
* output:
|
|
11
|
-
* [P0, P1, P2, P3, ...]
|
|
12
|
-
*/
|
|
13
|
-
export declare const Edge: MC<EdgeOptions>;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { baseGeometryChannels, basePostInference, basePreInference, } from '../utils';
|
|
2
|
-
import { Polygon } from './polygon';
|
|
3
|
-
/**
|
|
4
|
-
* Convert value for each channel to edge shapes.
|
|
5
|
-
*
|
|
6
|
-
* input:
|
|
7
|
-
* X: [x0, x1, x2, x3, ...]
|
|
8
|
-
* Y: [y0, y1, y2, y3, ...]
|
|
9
|
-
* output:
|
|
10
|
-
* [P0, P1, P2, P3, ...]
|
|
11
|
-
*/
|
|
12
|
-
export const Edge = (...args) => {
|
|
13
|
-
return Polygon(...args);
|
|
14
|
-
};
|
|
15
|
-
Edge.props = {
|
|
16
|
-
defaultShape: 'edge',
|
|
17
|
-
defaultLabelShape: 'label',
|
|
18
|
-
channels: [
|
|
19
|
-
...baseGeometryChannels(),
|
|
20
|
-
{ name: 'x', required: true },
|
|
21
|
-
{ name: 'y', required: true },
|
|
22
|
-
],
|
|
23
|
-
preInference: [...basePreInference()],
|
|
24
|
-
postInference: [
|
|
25
|
-
...basePostInference(),
|
|
26
|
-
{ type: 'maybeTitleX' },
|
|
27
|
-
{ type: 'maybeTooltipY' },
|
|
28
|
-
],
|
|
29
|
-
shapes: ['edge', 'arc', 'vhv', 'smoothEdge', 'ribbon'],
|
|
30
|
-
};
|
|
31
|
-
//# sourceMappingURL=edge.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"edge.js","sourceRoot":"src/","sources":["mark/geometry/edge.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,IAAI,GAAoB,CAAC,GAAG,IAAI,EAAE,EAAE;IAC/C,OAAO,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;AAC1B,CAAC,CAAC;AAEF,IAAI,CAAC,KAAK,GAAG;IACX,YAAY,EAAE,MAAM;IACpB,iBAAiB,EAAE,OAAO;IAC1B,QAAQ,EAAE;QACR,GAAG,oBAAoB,EAAE;QACzB,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC7B,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE;KAC9B;IACD,YAAY,EAAE,CAAC,GAAG,gBAAgB,EAAE,CAAC;IACrC,aAAa,EAAE;QACb,GAAG,iBAAiB,EAAE;QACtB,EAAE,IAAI,EAAE,aAAa,EAAE;QACvB,EAAE,IAAI,EAAE,eAAe,EAAE;KAC1B;IACD,MAAM,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,CAAC;CACvD,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { MarkComponent as MC } from '../../runtime';
|
|
2
|
-
import { NodeGeometry } from '../../spec';
|
|
3
|
-
export declare type NodeOptions = Omit<NodeGeometry, 'type'>;
|
|
4
|
-
/**
|
|
5
|
-
* Convert value for each channel to node shapes.
|
|
6
|
-
* Same with polygon.
|
|
7
|
-
*/
|
|
8
|
-
export declare const Node: MC<NodeGeometry>;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { baseGeometryChannels, basePostInference, basePreInference, } from '../utils';
|
|
2
|
-
import { Polygon } from './polygon';
|
|
3
|
-
/**
|
|
4
|
-
* Convert value for each channel to node shapes.
|
|
5
|
-
* Same with polygon.
|
|
6
|
-
*/
|
|
7
|
-
export const Node = (...args) => {
|
|
8
|
-
return Polygon(...args);
|
|
9
|
-
};
|
|
10
|
-
Node.props = {
|
|
11
|
-
defaultShape: 'pointNode',
|
|
12
|
-
defaultLabelShape: 'label',
|
|
13
|
-
channels: [
|
|
14
|
-
...baseGeometryChannels(),
|
|
15
|
-
{ name: 'x', required: true },
|
|
16
|
-
{ name: 'y', required: true },
|
|
17
|
-
{ name: 'size', required: true },
|
|
18
|
-
],
|
|
19
|
-
preInference: [...basePreInference()],
|
|
20
|
-
postInference: [
|
|
21
|
-
...basePostInference(),
|
|
22
|
-
{ type: 'maybeTitleX' },
|
|
23
|
-
{ type: 'maybeTooltipY' },
|
|
24
|
-
],
|
|
25
|
-
shapes: ['pointNode', 'polygonNode'],
|
|
26
|
-
};
|
|
27
|
-
//# sourceMappingURL=node.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"node.js","sourceRoot":"src/","sources":["mark/geometry/node.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC;;;GAGG;AACH,MAAM,CAAC,MAAM,IAAI,GAAqB,CAAC,GAAG,IAAI,EAAE,EAAE;IAChD,OAAO,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;AAC1B,CAAC,CAAC;AAEF,IAAI,CAAC,KAAK,GAAG;IACX,YAAY,EAAE,WAAW;IACzB,iBAAiB,EAAE,OAAO;IAC1B,QAAQ,EAAE;QACR,GAAG,oBAAoB,EAAE;QACzB,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC7B,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC7B,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;KACjC;IACD,YAAY,EAAE,CAAC,GAAG,gBAAgB,EAAE,CAAC;IACrC,aAAa,EAAE;QACb,GAAG,iBAAiB,EAAE;QACtB,EAAE,IAAI,EAAE,aAAa,EAAE;QACvB,EAAE,IAAI,EAAE,eAAe,EAAE;KAC1B;IACD,MAAM,EAAE,CAAC,WAAW,EAAE,aAAa,CAAC;CACrC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"src/","sources":["mark/geometry/schema.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,UAAU,CAAC;AAIlB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,CAAC,MAAM,MAAM,GAAsB,GAAG,EAAE;IAC5C,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE;QACzC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,KAAK,CAAC;QAExE,2BAA2B;QAC3B,2DAA2D;QAC3D,MAAM,MAAM,GAAG,KAAK,CAAC,CAAS,CAAC;QAC/B,MAAM,MAAM,GAAG,KAAK,CAAC,MAAc,CAAC;QAEpC,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE;YAChC,MAAM,UAAU,GAAG,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC7D,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAA,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAG,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACvE,MAAM,KAAK,GAAG,UAAU,GAAG,KAAK,CAAC;YACjC,MAAM,MAAM,GAAG,CAAC,CAAC,CAAA,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAG,CAAC,CAAC,CAAA,IAAI,CAAC,CAAC,GAAG,UAAU,CAAC;YAE3C,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,GAAG,KAAK,GAAG,CAAC,CAAC;YACrC,MAAM,CAAC,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,CAAC,GAAG;gBAClC,CAAC,CAAC,CAAC,CAAC,CAAC;gBACL,CAAC,EAAE,CAAC,CAAC,CAAC;gBACN,CAAC,EAAE,CAAC,CAAC,CAAC;gBACN,CAAC,EAAE,CAAC,CAAC,CAAC;gBACN,CAAC,EAAE,CAAC,CAAC,CAAC;aACP,CAAC;YAEF,MAAM,GAAG,GAAG;gBACV,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,EAAE,IAAI,CAAC;gBACrB,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,EAAE,IAAI,CAAC;gBACrB,CAAC,CAAC,EAAE,IAAI,CAAC;gBACT,CAAC,CAAC,EAAE,EAAE,CAAC;gBACP,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,EAAE,EAAE,CAAC;gBACnB,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,EAAE,EAAE,CAAC;gBACnB,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,EAAE,EAAE,CAAC;gBACnB,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,EAAE,EAAE,CAAC;gBACnB,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,EAAE,MAAM,CAAC;gBACvB,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,EAAE,MAAM,CAAC;gBACvB,CAAC,CAAC,EAAE,EAAE,CAAC;gBACP,CAAC,CAAC,EAAE,GAAG,CAAC;gBACR,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,EAAE,GAAG,CAAC;gBACpB,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,EAAE,GAAG,CAAC;aACrB,CAAC;YAEF,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAc,CAAC;QACxD,CAAC,CAAC,CAAC;QACH,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,KAAK,GAAG;IACb,YAAY,EAAE,KAAK;IACnB,iBAAiB,EAAE,OAAO;IAC1B,QAAQ,EAAE;QACR,GAAG,oBAAoB,EAAE;QACzB,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC5C,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC7B,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE;KAClC;IACD,YAAY,EAAE,CAAC,GAAG,gBAAgB,EAAE,CAAC;IACrC,aAAa,EAAE;QACb,GAAG,iBAAiB,EAAE;QACtB,EAAE,IAAI,EAAE,aAAa,EAAE;QACvB,EAAE,IAAI,EAAE,eAAe,EAAE;KAC1B;IACD,MAAM,EAAE,CAAC,KAAK,CAAC;CAChB,CAAC"}
|
package/esm/renderer/canvas.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { RendererComponent as RC } from '../runtime';
|
|
2
|
-
export declare type CanvasOptions = {
|
|
3
|
-
width?: number;
|
|
4
|
-
height?: number;
|
|
5
|
-
container?: string | HTMLElement;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* Returns a canvas renderer.
|
|
9
|
-
*/
|
|
10
|
-
export declare const Canvas: RC<CanvasOptions>;
|
package/esm/renderer/canvas.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Canvas as GCanvas } from '@antv/g';
|
|
2
|
-
import { Renderer as CanvasRenderer } from '@antv/g-canvas';
|
|
3
|
-
import { Plugin as DragAndDropPlugin } from '@antv/g-plugin-dragndrop';
|
|
4
|
-
/**
|
|
5
|
-
* Returns a canvas renderer.
|
|
6
|
-
*/
|
|
7
|
-
export const Canvas = ({ width, height, container }) => {
|
|
8
|
-
const renderer = new CanvasRenderer();
|
|
9
|
-
renderer.registerPlugin(new DragAndDropPlugin());
|
|
10
|
-
return new GCanvas({
|
|
11
|
-
container,
|
|
12
|
-
width,
|
|
13
|
-
height,
|
|
14
|
-
renderer,
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
Canvas.props = {};
|
|
18
|
-
//# sourceMappingURL=canvas.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"canvas.js","sourceRoot":"src/","sources":["renderer/canvas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,QAAQ,IAAI,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,MAAM,IAAI,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AASvE;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAsB,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE;IACxE,MAAM,QAAQ,GAAG,IAAI,cAAc,EAAE,CAAC;IACtC,QAAQ,CAAC,cAAc,CAAC,IAAI,iBAAiB,EAAE,CAAC,CAAC;IAEjD,OAAO,IAAI,OAAO,CAAC;QACjB,SAAS;QACT,KAAK;QACL,MAAM;QACN,QAAQ;KACT,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,CAAC,KAAK,GAAG,EAAE,CAAC"}
|
package/esm/renderer/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Canvas, CanvasOptions } from './canvas';
|
package/esm/renderer/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["renderer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAiB,MAAM,UAAU,CAAC"}
|