@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/shape/label/label.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import { Coordinate } from '@antv/coord';
|
|
1
|
+
import { Coordinate, Vector } from '@antv/coord';
|
|
2
2
|
import { DisplayObject, Text } from '@antv/g';
|
|
3
3
|
import { select } from '../../utils/selection';
|
|
4
4
|
import { ShapeComponent as SC, Vector2 } from '../../runtime';
|
|
5
5
|
import { applyStyle, getArcObject } from '../../shape/utils';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
isHelix,
|
|
8
|
+
isPolar,
|
|
9
|
+
isTranspose,
|
|
10
|
+
isCircular,
|
|
11
|
+
} from '../../utils/coordinate';
|
|
7
12
|
|
|
8
13
|
type LabelPosition = 'top' | 'left' | 'right' | 'bottom' | 'inside' | 'outside';
|
|
9
14
|
|
|
@@ -11,7 +16,9 @@ export type LabelOptions = Record<string, any>;
|
|
|
11
16
|
|
|
12
17
|
/**
|
|
13
18
|
* Avoid getting error bounds caused by element animations.
|
|
14
|
-
* @todo Remove this temporary handle method, if runtime supports
|
|
19
|
+
* @todo Remove this temporary handle method, if runtime supports
|
|
20
|
+
* correct process: drawElement, do label layout and then do
|
|
21
|
+
* transitions together.
|
|
15
22
|
*/
|
|
16
23
|
function getLocalBounds(element: DisplayObject) {
|
|
17
24
|
const cloneElement = element.cloneNode();
|
|
@@ -24,31 +31,70 @@ function getLocalBounds(element: DisplayObject) {
|
|
|
24
31
|
element.parentNode.appendChild(cloneElement);
|
|
25
32
|
const bounds = cloneElement.getLocalBounds();
|
|
26
33
|
cloneElement.destroy();
|
|
27
|
-
|
|
28
34
|
return bounds;
|
|
29
35
|
}
|
|
30
36
|
|
|
31
|
-
function inferPosition(
|
|
37
|
+
function inferPosition(position: LabelPosition, coordinate: Coordinate) {
|
|
38
|
+
if (position !== undefined) return position;
|
|
39
|
+
if (isTranspose(coordinate)) return 'right';
|
|
40
|
+
if (isPolar(coordinate) || isHelix(coordinate)) return 'inside';
|
|
41
|
+
return 'top';
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function maybePercentage(x: number | string, size: number) {
|
|
45
|
+
if (x === undefined) return null;
|
|
46
|
+
if (typeof x === 'number') return x;
|
|
47
|
+
const px = +x.replace('%', '');
|
|
48
|
+
return Number.isNaN(px) ? null : (px / 100) * size;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function inferNonCircularStyle(
|
|
52
|
+
position: LabelPosition,
|
|
32
53
|
points: Vector2[],
|
|
33
|
-
value,
|
|
54
|
+
value: Record<string, any>,
|
|
34
55
|
coordinate: Coordinate,
|
|
56
|
+
) {
|
|
57
|
+
const element: DisplayObject = value.element;
|
|
58
|
+
const { halfExtents } = getLocalBounds(element);
|
|
59
|
+
const w = halfExtents[0] * 2;
|
|
60
|
+
const h = halfExtents[1] * 2;
|
|
61
|
+
const xy = (options) => {
|
|
62
|
+
const { x, y } = value;
|
|
63
|
+
const px = maybePercentage(x, w);
|
|
64
|
+
const py = maybePercentage(y, h);
|
|
65
|
+
return {
|
|
66
|
+
...options,
|
|
67
|
+
...(px !== null && { x }),
|
|
68
|
+
...(py !== null && { y }),
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
if (position === 'left')
|
|
72
|
+
return xy({ x: 0, y: h / 2, textAnchor: 'start', textBaseline: 'middle' });
|
|
73
|
+
if (position === 'right')
|
|
74
|
+
return xy({ x: w, y: h / 2, textAnchor: 'end', textBaseline: 'middle' });
|
|
75
|
+
if (position === 'bottom')
|
|
76
|
+
return xy({ x: w / 2, y: h, textAnchor: 'center', textBaseline: 'bottom' });
|
|
77
|
+
if (position === 'inside')
|
|
78
|
+
return xy({
|
|
79
|
+
x: w / 2,
|
|
80
|
+
y: h / 2,
|
|
81
|
+
textAnchor: 'center',
|
|
82
|
+
textBaseline: 'middle',
|
|
83
|
+
});
|
|
84
|
+
if (position === 'top')
|
|
85
|
+
return xy({ x: w / 2, y: 0, textAnchor: 'center', textBaseline: 'bottom' });
|
|
86
|
+
return xy({});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function inferCircularStyle(
|
|
35
90
|
position: LabelPosition,
|
|
91
|
+
points: Vector2[],
|
|
92
|
+
value: Record<string, any>,
|
|
93
|
+
coordinate: Coordinate,
|
|
36
94
|
) {
|
|
37
95
|
const element: DisplayObject = value.element;
|
|
38
|
-
const { min
|
|
96
|
+
const { min } = getLocalBounds(element);
|
|
39
97
|
const [x0, y0] = min;
|
|
40
|
-
// Infer the label position in non-polar coordinate.
|
|
41
|
-
if (!isPolar(coordinate) && !isHelix(coordinate)) {
|
|
42
|
-
const w = halfExtents[0] * 2;
|
|
43
|
-
const h = halfExtents[1] * 2;
|
|
44
|
-
|
|
45
|
-
if (position === 'left') return { x: 0, y: h / 2 };
|
|
46
|
-
if (position === 'right') return { x: w, y: h / 2 };
|
|
47
|
-
if (position === 'bottom') return { x: w / 2, y: h };
|
|
48
|
-
if (position === 'inside') return { x: w / 2, y: h / 2 };
|
|
49
|
-
|
|
50
|
-
return { x: w / 2, y: 0 };
|
|
51
|
-
}
|
|
52
98
|
|
|
53
99
|
// Infer the label position in polar coordinate.
|
|
54
100
|
const { y, y1 } = value;
|
|
@@ -68,47 +114,35 @@ function inferPosition(
|
|
|
68
114
|
return {
|
|
69
115
|
x: center[0] + Math.sin(midAngle) * radius - x0,
|
|
70
116
|
y: center[1] - Math.cos(midAngle) * radius - y0,
|
|
117
|
+
textAlign: 'center',
|
|
118
|
+
textBaseline: 'middle',
|
|
71
119
|
};
|
|
72
120
|
}
|
|
73
121
|
|
|
74
|
-
function inferDefaultStyle(position: LabelPosition): {
|
|
75
|
-
dy?: string;
|
|
76
|
-
textBaseline?: string;
|
|
77
|
-
} {
|
|
78
|
-
if (
|
|
79
|
-
position === 'left' ||
|
|
80
|
-
position === 'right' ||
|
|
81
|
-
position === 'inside' ||
|
|
82
|
-
position === 'outside'
|
|
83
|
-
) {
|
|
84
|
-
return { textBaseline: 'middle' };
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return { dy: '-2px' };
|
|
88
|
-
}
|
|
89
|
-
|
|
90
122
|
/**
|
|
91
123
|
* Render normal label for each mark.
|
|
92
124
|
* @todo Support position option: middle...
|
|
93
125
|
*/
|
|
94
126
|
export const Label: SC<LabelOptions> = (options) => {
|
|
95
|
-
const { label: style = {} } = options;
|
|
96
127
|
return (points, value, coordinate, theme) => {
|
|
97
|
-
const { position, ...
|
|
128
|
+
const { position, text, ...overrideStyle } = value;
|
|
98
129
|
const { labelFill: fill } = theme;
|
|
99
|
-
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
130
|
+
const definedPosition = inferPosition(position, coordinate);
|
|
131
|
+
const inferDefaultStyle = isCircular(coordinate)
|
|
132
|
+
? inferCircularStyle
|
|
133
|
+
: inferNonCircularStyle;
|
|
134
|
+
const defaultStyle = inferDefaultStyle(
|
|
135
|
+
definedPosition,
|
|
136
|
+
points,
|
|
137
|
+
value,
|
|
138
|
+
coordinate,
|
|
139
|
+
);
|
|
103
140
|
return select(new Text())
|
|
104
|
-
.
|
|
105
|
-
.style('
|
|
106
|
-
.style('text', `${label}`)
|
|
141
|
+
.call(applyStyle, defaultStyle)
|
|
142
|
+
.style('text', `${text}`)
|
|
107
143
|
.style('fontSize', 12)
|
|
108
|
-
.style('textAlign', 'center')
|
|
109
144
|
.style('fill', fill)
|
|
110
|
-
.call(applyStyle,
|
|
111
|
-
.call(applyStyle, restStyle)
|
|
145
|
+
.call(applyStyle, overrideStyle)
|
|
112
146
|
.node();
|
|
113
147
|
};
|
|
114
148
|
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/src/spec/data.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { DataComponent } from '../runtime';
|
|
1
|
+
import { DataComponent, Vector2 } from '../runtime';
|
|
2
2
|
export type Data = FetchConnector | InlineConnector | any;
|
|
3
3
|
|
|
4
4
|
export type FetchConnector = {
|
|
5
5
|
type?: 'fetch';
|
|
6
6
|
value?: string;
|
|
7
7
|
format?: 'json' | 'csv';
|
|
8
|
-
callback?: (d: any) => any;
|
|
9
8
|
// Useful when format is 'csv'.
|
|
10
9
|
delimiter?: string;
|
|
10
|
+
/** Automatically infer the data to Javascript type */
|
|
11
|
+
autoType?: boolean;
|
|
11
12
|
transform?: DataTransform[];
|
|
12
13
|
};
|
|
13
14
|
|
|
@@ -37,8 +38,8 @@ export type DataTransformTypes =
|
|
|
37
38
|
|
|
38
39
|
export type SortByTransform = {
|
|
39
40
|
type?: 'sortBy';
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
/** type: [field, order]; order: true => ascend, false => descend */
|
|
42
|
+
fields?: (string | [string, boolean?])[];
|
|
42
43
|
};
|
|
43
44
|
|
|
44
45
|
export type PickTransform = {
|
|
@@ -60,8 +61,11 @@ export type SubsetTransform = {
|
|
|
60
61
|
|
|
61
62
|
export type FilterByTransform = {
|
|
62
63
|
type?: 'filterBy';
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
/**
|
|
65
|
+
* way1: [[field1, callback1], [field2, callback2], ...]
|
|
66
|
+
* way2: [field1, field2, field3, callback] All field filtered by the last callback.
|
|
67
|
+
*/
|
|
68
|
+
fields?: ([string, ((d: any) => boolean)?] | string)[];
|
|
65
69
|
};
|
|
66
70
|
|
|
67
71
|
export type FoldTransform = {
|
|
@@ -70,8 +74,8 @@ export type FoldTransform = {
|
|
|
70
74
|
as?: string[];
|
|
71
75
|
};
|
|
72
76
|
|
|
73
|
-
export type
|
|
74
|
-
type?: '
|
|
77
|
+
export type CustomDataTransform = {
|
|
78
|
+
type?: 'custom';
|
|
75
79
|
callback?: (d: any) => any;
|
|
76
80
|
};
|
|
77
81
|
|
|
@@ -79,3 +83,148 @@ export type CustomTransform = {
|
|
|
79
83
|
type?: DataComponent;
|
|
80
84
|
[key: string]: any;
|
|
81
85
|
};
|
|
86
|
+
|
|
87
|
+
// Transforms for graph.
|
|
88
|
+
export type SankeyTransform = {
|
|
89
|
+
type?: 'sankey';
|
|
90
|
+
nodeId?: (node: any) => string;
|
|
91
|
+
nodes?: (graph: any) => any;
|
|
92
|
+
links?: (graph: any) => any;
|
|
93
|
+
/**
|
|
94
|
+
* sankey.nodeSort(undefined) is the default and resorts by ascending breadth during each iteration.
|
|
95
|
+
* sankey.nodeSort(null) specifies the input order of nodes and never sorts.
|
|
96
|
+
* sankey.nodeSort(function) specifies the given order as a comparator function and sorts once on initialization.
|
|
97
|
+
*/
|
|
98
|
+
nodeSort?: null | undefined | ((a: any, b: any) => number);
|
|
99
|
+
/**
|
|
100
|
+
* sankey.linkSort(undefined) is the default, indicating that vertical order of links within each node will be determined automatically by the layout. If
|
|
101
|
+
* sankey.linkSort(null) will resort by the input.
|
|
102
|
+
* sankey.linkSort(function) specifies the given order as a comparator function and sorts once on initialization.
|
|
103
|
+
*/
|
|
104
|
+
linkSort?: null | undefined | ((a: any, b: any) => number);
|
|
105
|
+
nodeAlign?:
|
|
106
|
+
| 'left'
|
|
107
|
+
| 'center'
|
|
108
|
+
| 'right'
|
|
109
|
+
| 'justify'
|
|
110
|
+
| ((node: any, n: number) => number);
|
|
111
|
+
nodeWidth?: number;
|
|
112
|
+
nodePadding?: number;
|
|
113
|
+
iterations?: number;
|
|
114
|
+
// support config the depth of node
|
|
115
|
+
nodeDepth?: (datum: any, maxDepth: number) => number;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export type WordCloudTransform = {
|
|
119
|
+
type?: 'wordCloud';
|
|
120
|
+
/**
|
|
121
|
+
* @description If specified, sets the rectangular [width, height] of the layout
|
|
122
|
+
* @default [1, 1]
|
|
123
|
+
*/
|
|
124
|
+
size?: [number, number];
|
|
125
|
+
font?: string | ((word: any) => string);
|
|
126
|
+
fontStyle?: string | ((word: any) => string);
|
|
127
|
+
fontWeight?: any | ((word: any) => any);
|
|
128
|
+
fontSize?: number | [number, number] | ((word: any) => number);
|
|
129
|
+
padding?: number | ((word: any) => number);
|
|
130
|
+
/**
|
|
131
|
+
* @description sets the text accessor function, which indicates the text for each word
|
|
132
|
+
* @default (d) => d.text
|
|
133
|
+
*/
|
|
134
|
+
text?: (word: any) => number;
|
|
135
|
+
rotate?: number | ((word: any) => number);
|
|
136
|
+
timeInterval?: number;
|
|
137
|
+
random?: number | (() => number);
|
|
138
|
+
/**
|
|
139
|
+
* @description sets the current type of spiral used for positioning words. This can either be one of the two built-in spirals, "archimedean" and "rectangular"
|
|
140
|
+
* @default "archimedean"
|
|
141
|
+
*/
|
|
142
|
+
spiral?:
|
|
143
|
+
| 'archimedean'
|
|
144
|
+
| 'rectangular'
|
|
145
|
+
| ((size: [number, number]) => (t: number) => number[]);
|
|
146
|
+
imageMask?: HTMLImageElement | string;
|
|
147
|
+
on?:
|
|
148
|
+
| ((type: 'end', details?: { cloud; words; bounds }) => void)
|
|
149
|
+
| ((type: 'word', details?: { cloud; word }) => void);
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
export type VoronoiTransform = {
|
|
153
|
+
type?: 'voronoi';
|
|
154
|
+
/**
|
|
155
|
+
* @description Sets the input fields from the data.
|
|
156
|
+
*/
|
|
157
|
+
fields: [string, string];
|
|
158
|
+
/**
|
|
159
|
+
* @description Sets the output fields into data.
|
|
160
|
+
*/
|
|
161
|
+
as: [string, string];
|
|
162
|
+
/**
|
|
163
|
+
* @description Sets region of canvas.
|
|
164
|
+
*/
|
|
165
|
+
extend: Vector2[];
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* For arc diagram(edge with weight) or chord diagram(with weight)
|
|
170
|
+
*/
|
|
171
|
+
export type ArcTransform = {
|
|
172
|
+
type?: 'arc';
|
|
173
|
+
/** Layout y position, default: 0 */
|
|
174
|
+
y?: number;
|
|
175
|
+
/** margin between nodes, [0, 1), default: 0.1 */
|
|
176
|
+
marginRatio?: number;
|
|
177
|
+
/** Thickness of node, default: 0.05 */
|
|
178
|
+
thickness?: number;
|
|
179
|
+
/** Whether calculate weight, default: false */
|
|
180
|
+
weight?: boolean;
|
|
181
|
+
/** Key of node, default: node.id */
|
|
182
|
+
id?: (node: any) => any;
|
|
183
|
+
/** Source key of edge, default: edge.source */
|
|
184
|
+
source?: (edge: any) => any;
|
|
185
|
+
/** Target key of edge, default: edge.target */
|
|
186
|
+
target?: (edge: any) => any;
|
|
187
|
+
/** Weight of source, default: edge.value || 1 */
|
|
188
|
+
sourceWeight?: (edge: any) => number;
|
|
189
|
+
/** Weight of target, default: edge.value || 1 */
|
|
190
|
+
targetWeight?: (edge: any) => number;
|
|
191
|
+
/** Sort method, default: null */
|
|
192
|
+
sortBy?: 'id' | 'weight' | 'frequency' | null | ((a: any, b: any) => number);
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Cluster layout options.
|
|
197
|
+
*/
|
|
198
|
+
export type ClusterTransform = {
|
|
199
|
+
type?: 'cluster';
|
|
200
|
+
/**
|
|
201
|
+
* Layout field. Default: 'value'.
|
|
202
|
+
*/
|
|
203
|
+
field?: string;
|
|
204
|
+
/**
|
|
205
|
+
* Sets this cluster layout’s node size to the specified two-element array of numbers [width, height] and returns this cluster layout.
|
|
206
|
+
* Default: null.
|
|
207
|
+
*/
|
|
208
|
+
nodeSize?: any;
|
|
209
|
+
/**
|
|
210
|
+
* The separation accessor is used to separate neighboring leaves. Default: (a, b) => a.parent == b.parent ? 1 : 2;
|
|
211
|
+
*/
|
|
212
|
+
separation?: (a, b) => number;
|
|
213
|
+
/**
|
|
214
|
+
* Sort function by compare 2 nodes.
|
|
215
|
+
*/
|
|
216
|
+
sortBy?: (a, b) => number;
|
|
217
|
+
/**
|
|
218
|
+
* Layout infomation saved into fields. Default: ['x', 'y'].
|
|
219
|
+
*/
|
|
220
|
+
as?: [string, string];
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
export type TreeTransform = Omit<ClusterTransform, 'type'> & {
|
|
224
|
+
type?: 'tree';
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
export type MapTransform = {
|
|
228
|
+
type?: 'map';
|
|
229
|
+
callback?: (d: any) => any;
|
|
230
|
+
};
|
package/src/spec/geometry.ts
CHANGED
|
@@ -19,7 +19,7 @@ export type Geometry =
|
|
|
19
19
|
| EdgeGeometry
|
|
20
20
|
| ImageGeometry
|
|
21
21
|
| PolygonGeometry
|
|
22
|
-
|
|
|
22
|
+
| BoxGeometry
|
|
23
23
|
| VectorGeometry
|
|
24
24
|
| AnnotationText
|
|
25
25
|
| CustomComponent;
|
|
@@ -36,7 +36,7 @@ export type GeometryTypes =
|
|
|
36
36
|
| 'link'
|
|
37
37
|
| 'image'
|
|
38
38
|
| 'polygon'
|
|
39
|
-
| '
|
|
39
|
+
| 'box'
|
|
40
40
|
| 'vector'
|
|
41
41
|
| 'annotation.text'
|
|
42
42
|
| 'annotation.lineX'
|
|
@@ -86,6 +86,8 @@ export type BaseGeometry<
|
|
|
86
86
|
adjust?: Adjust;
|
|
87
87
|
facet?: boolean;
|
|
88
88
|
frame?: boolean;
|
|
89
|
+
labels?: Record<string, any>[];
|
|
90
|
+
stack?: boolean;
|
|
89
91
|
animate?: {
|
|
90
92
|
enter?: Animation;
|
|
91
93
|
exit?: Animation;
|
|
@@ -158,7 +160,7 @@ export type ImageGeometry = BaseGeometry<'image', ChannelTypes | 'src'>;
|
|
|
158
160
|
|
|
159
161
|
export type PolygonGeometry = BaseGeometry<'polygon'>;
|
|
160
162
|
|
|
161
|
-
export type
|
|
163
|
+
export type BoxGeometry = BaseGeometry<'box'>;
|
|
162
164
|
|
|
163
165
|
export type VectorGeometry = BaseGeometry<
|
|
164
166
|
'vector',
|
package/src/spec/transform.ts
CHANGED
|
@@ -12,15 +12,9 @@ export type Transform =
|
|
|
12
12
|
| SelectTransform
|
|
13
13
|
| SelectXTransform
|
|
14
14
|
| SelectYTransform
|
|
15
|
-
| GroupXTransform
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
| 'value'
|
|
19
|
-
| 'sum'
|
|
20
|
-
| 'series'
|
|
21
|
-
| 'maxIndex'
|
|
22
|
-
| string[]
|
|
23
|
-
| ((data: Record<string, Primitive>) => Primitive);
|
|
15
|
+
| GroupXTransform
|
|
16
|
+
| SortXTransform
|
|
17
|
+
| FlexXTransform;
|
|
24
18
|
|
|
25
19
|
export type TransformTypes =
|
|
26
20
|
| 'dodgeX'
|
|
@@ -34,15 +28,24 @@ export type TransformTypes =
|
|
|
34
28
|
| 'selectY'
|
|
35
29
|
| 'selectX'
|
|
36
30
|
| 'groupX'
|
|
31
|
+
| 'sortX'
|
|
32
|
+
| 'flexX'
|
|
37
33
|
| TransformComponent;
|
|
38
34
|
|
|
35
|
+
export type TransformOrder =
|
|
36
|
+
| 'value'
|
|
37
|
+
| 'sum'
|
|
38
|
+
| 'series'
|
|
39
|
+
| 'maxIndex'
|
|
40
|
+
| string[]
|
|
41
|
+
| null
|
|
42
|
+
| ((data: Record<string, Primitive>) => Primitive);
|
|
43
|
+
|
|
39
44
|
export type DodgeXTransform = {
|
|
40
45
|
type?: 'dodgeX';
|
|
41
46
|
groupBy?: string | string[];
|
|
42
47
|
reverse?: boolean;
|
|
43
48
|
orderBy?: TransformOrder;
|
|
44
|
-
paddingInner?: number;
|
|
45
|
-
paddingOuter?: number;
|
|
46
49
|
padding?: number;
|
|
47
50
|
};
|
|
48
51
|
|
|
@@ -52,6 +55,7 @@ export type StackYTransform = {
|
|
|
52
55
|
reverse?: boolean;
|
|
53
56
|
orderBy?: TransformOrder;
|
|
54
57
|
y?: 'y' | 'y1';
|
|
58
|
+
series?: boolean;
|
|
55
59
|
};
|
|
56
60
|
|
|
57
61
|
export type NormalizeYTransform = {
|
|
@@ -66,8 +70,7 @@ export type NormalizeYTransform = {
|
|
|
66
70
|
| 'mean'
|
|
67
71
|
| 'median'
|
|
68
72
|
| 'min'
|
|
69
|
-
| 'sum'
|
|
70
|
-
| 'extent';
|
|
73
|
+
| 'sum';
|
|
71
74
|
};
|
|
72
75
|
|
|
73
76
|
export type JitterTransform = {
|
|
@@ -117,6 +120,27 @@ export type SelectYTransform = {
|
|
|
117
120
|
selector?: Selector;
|
|
118
121
|
};
|
|
119
122
|
|
|
123
|
+
export type SortXTransform = {
|
|
124
|
+
type?: 'sortX';
|
|
125
|
+
reverse?: boolean;
|
|
126
|
+
channel?: string;
|
|
127
|
+
slice?: number | [number, number];
|
|
128
|
+
reducer?:
|
|
129
|
+
| 'max'
|
|
130
|
+
| 'min'
|
|
131
|
+
| 'sum'
|
|
132
|
+
| 'first'
|
|
133
|
+
| 'last'
|
|
134
|
+
| ((I: number[], V: Primitive[]) => Primitive);
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
export type FlexXTransform = {
|
|
138
|
+
type?: 'flexX';
|
|
139
|
+
field?: string | ((d: any) => Primitive[]);
|
|
140
|
+
channel?: string;
|
|
141
|
+
reducer?: 'sum' | ((I: number[], V: Primitive[]) => Primitive);
|
|
142
|
+
};
|
|
143
|
+
|
|
120
144
|
export type Reducer =
|
|
121
145
|
| 'mean'
|
|
122
146
|
| 'max'
|
|
@@ -130,145 +154,4 @@ export type Reducer =
|
|
|
130
154
|
|
|
131
155
|
export type GroupXTransform = {
|
|
132
156
|
type?: 'groupX';
|
|
133
|
-
orderBy?: ChannelTypes;
|
|
134
|
-
reverse?: boolean;
|
|
135
157
|
} & { [key in ChannelTypes]?: Reducer };
|
|
136
|
-
|
|
137
|
-
// export type SankeyTransform = {
|
|
138
|
-
// type?: 'sankey';
|
|
139
|
-
// nodeId?: (node: any) => string;
|
|
140
|
-
// nodes?: (graph: any) => any;
|
|
141
|
-
// links?: (graph: any) => any;
|
|
142
|
-
// /**
|
|
143
|
-
// * sankey.nodeSort(undefined) is the default and resorts by ascending breadth during each iteration.
|
|
144
|
-
// * sankey.nodeSort(null) specifies the input order of nodes and never sorts.
|
|
145
|
-
// * sankey.nodeSort(function) specifies the given order as a comparator function and sorts once on initialization.
|
|
146
|
-
// */
|
|
147
|
-
// nodeSort?: null | undefined | ((a: any, b: any) => number);
|
|
148
|
-
// /**
|
|
149
|
-
// * sankey.linkSort(undefined) is the default, indicating that vertical order of links within each node will be determined automatically by the layout. If
|
|
150
|
-
// * sankey.linkSort(null) will resort by the input.
|
|
151
|
-
// * sankey.linkSort(function) specifies the given order as a comparator function and sorts once on initialization.
|
|
152
|
-
// */
|
|
153
|
-
// linkSort?: null | undefined | ((a: any, b: any) => number);
|
|
154
|
-
// nodeAlign?:
|
|
155
|
-
// | 'left'
|
|
156
|
-
// | 'center'
|
|
157
|
-
// | 'right'
|
|
158
|
-
// | 'justify'
|
|
159
|
-
// | ((node: any, n: number) => number);
|
|
160
|
-
// nodeWidth?: number;
|
|
161
|
-
// nodePadding?: number;
|
|
162
|
-
// iterations?: number;
|
|
163
|
-
// // support config the depth of node
|
|
164
|
-
// nodeDepth?: (datum: any, maxDepth: number) => number;
|
|
165
|
-
// };
|
|
166
|
-
|
|
167
|
-
// export type WordCloudTransform = {
|
|
168
|
-
// type?: 'wordCloud';
|
|
169
|
-
// /**
|
|
170
|
-
// * @description If specified, sets the rectangular [width, height] of the layout
|
|
171
|
-
// * @default [1, 1]
|
|
172
|
-
// */
|
|
173
|
-
// size?: [number, number];
|
|
174
|
-
// font?: string | ((word: any) => string);
|
|
175
|
-
// fontStyle?: string | ((word: any) => string);
|
|
176
|
-
// fontWeight?: any | ((word: any) => any);
|
|
177
|
-
// fontSize?: number | [number, number] | ((word: any) => number);
|
|
178
|
-
// padding?: number | ((word: any) => number);
|
|
179
|
-
// /**
|
|
180
|
-
// * @description sets the text accessor function, which indicates the text for each word
|
|
181
|
-
// * @default (d) => d.text
|
|
182
|
-
// */
|
|
183
|
-
// text?: (word: any) => number;
|
|
184
|
-
// rotate?: number | ((word: any) => number);
|
|
185
|
-
// timeInterval?: number;
|
|
186
|
-
// random?: number | (() => number);
|
|
187
|
-
// /**
|
|
188
|
-
// * @description sets the current type of spiral used for positioning words. This can either be one of the two built-in spirals, "archimedean" and "rectangular"
|
|
189
|
-
// * @default "archimedean"
|
|
190
|
-
// */
|
|
191
|
-
// spiral?:
|
|
192
|
-
// | 'archimedean'
|
|
193
|
-
// | 'rectangular'
|
|
194
|
-
// | ((size: [number, number]) => (t: number) => number[]);
|
|
195
|
-
// imageMask?: HTMLImageElement | string;
|
|
196
|
-
// on?:
|
|
197
|
-
// | ((type: 'end', details?: { cloud; words; bounds }) => void)
|
|
198
|
-
// | ((type: 'word', details?: { cloud; word }) => void);
|
|
199
|
-
// };
|
|
200
|
-
|
|
201
|
-
// export type VoronoiTransform = {
|
|
202
|
-
// type?: 'voronoi';
|
|
203
|
-
// /**
|
|
204
|
-
// * @description Sets the input fields from the data.
|
|
205
|
-
// */
|
|
206
|
-
// fields: [string, string];
|
|
207
|
-
// /**
|
|
208
|
-
// * @description Sets the output fields into data.
|
|
209
|
-
// */
|
|
210
|
-
// as: [string, string];
|
|
211
|
-
// /**
|
|
212
|
-
// * @description Sets region of canvas.
|
|
213
|
-
// */
|
|
214
|
-
// extend: Vector2[];
|
|
215
|
-
// };
|
|
216
|
-
|
|
217
|
-
// /**
|
|
218
|
-
// * For arc diagram(edge with weight) or chord diagram(with weight)
|
|
219
|
-
// */
|
|
220
|
-
// export type ArcTransform = {
|
|
221
|
-
// type?: 'arc';
|
|
222
|
-
// /** Layout y position, default: 0 */
|
|
223
|
-
// y?: number;
|
|
224
|
-
// /** margin between nodes, [0, 1), default: 0.1 */
|
|
225
|
-
// marginRatio?: number;
|
|
226
|
-
// /** Thickness of node, default: 0.05 */
|
|
227
|
-
// thickness?: number;
|
|
228
|
-
// /** Whether calculate weight, default: false */
|
|
229
|
-
// weight?: boolean;
|
|
230
|
-
// /** Key of node, default: node.id */
|
|
231
|
-
// id?: (node: any) => any;
|
|
232
|
-
// /** Source key of edge, default: edge.source */
|
|
233
|
-
// source?: (edge: any) => any;
|
|
234
|
-
// /** Target key of edge, default: edge.target */
|
|
235
|
-
// target?: (edge: any) => any;
|
|
236
|
-
// /** Weight of source, default: edge.value || 1 */
|
|
237
|
-
// sourceWeight?: (edge: any) => number;
|
|
238
|
-
// /** Weight of target, default: edge.value || 1 */
|
|
239
|
-
// targetWeight?: (edge: any) => number;
|
|
240
|
-
// /** Sort method, default: null */
|
|
241
|
-
// sortBy?: 'id' | 'weight' | 'frequency' | null | ((a: any, b: any) => number);
|
|
242
|
-
// };
|
|
243
|
-
|
|
244
|
-
// /**
|
|
245
|
-
// * Cluster layout options.
|
|
246
|
-
// */
|
|
247
|
-
// export type ClusterTransform = {
|
|
248
|
-
// type?: 'cluster';
|
|
249
|
-
// /**
|
|
250
|
-
// * Layout field. Default: 'value'.
|
|
251
|
-
// */
|
|
252
|
-
// field?: string;
|
|
253
|
-
// /**
|
|
254
|
-
// * Sets this cluster layout’s node size to the specified two-element array of numbers [width, height] and returns this cluster layout.
|
|
255
|
-
// * Default: null.
|
|
256
|
-
// */
|
|
257
|
-
// nodeSize?: any;
|
|
258
|
-
// /**
|
|
259
|
-
// * The separation accessor is used to separate neighboring leaves. Default: (a, b) => a.parent == b.parent ? 1 : 2;
|
|
260
|
-
// */
|
|
261
|
-
// separation?: (a, b) => number;
|
|
262
|
-
// /**
|
|
263
|
-
// * Sort function by compare 2 nodes.
|
|
264
|
-
// */
|
|
265
|
-
// sortBy?: (a, b) => number;
|
|
266
|
-
// /**
|
|
267
|
-
// * Layout infomation saved into fields. Default: ['x', 'y'].
|
|
268
|
-
// */
|
|
269
|
-
// as?: [string, string];
|
|
270
|
-
// };
|
|
271
|
-
|
|
272
|
-
// export type TreeTransform = Omit<ClusterTransform, 'type'> & {
|
|
273
|
-
// type?: 'tree';
|
|
274
|
-
// };
|