@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/data/map.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DataComponent as DC } from '../runtime';
|
|
2
|
+
import { identity } from '../utils/helper';
|
|
3
|
+
import { MapTransform } from '../spec';
|
|
4
|
+
|
|
5
|
+
export type MapOptions = Omit<MapTransform, 'type'>;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Map transform by function.
|
|
9
|
+
*/
|
|
10
|
+
export const Map: DC<MapOptions> = (options) => {
|
|
11
|
+
const { callback = identity } = options;
|
|
12
|
+
return (data) => (Array.isArray(data) ? data.map(callback) : data);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
Map.props = {};
|
package/src/data/sankey.ts
CHANGED
|
@@ -1,105 +1,102 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
// import { merge } from '../transform/utils/helper';
|
|
1
|
+
import { DataComponent as DC } from '../runtime';
|
|
2
|
+
import { SankeyTransform } from '../spec';
|
|
3
|
+
import { sankey, left, right, center, justify } from './utils/d3-sankey';
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
5
|
+
const DEFAULT_OPTIONS: Partial<SankeyOptions> = {
|
|
6
|
+
nodeAlign: 'justify',
|
|
7
|
+
nodeWidth: 0.008,
|
|
8
|
+
nodePadding: 0.03,
|
|
9
|
+
nodes: (graph) => graph.nodes,
|
|
10
|
+
links: (graph) => graph.links,
|
|
11
|
+
nodeSort: undefined,
|
|
12
|
+
linkSort: undefined,
|
|
13
|
+
iterations: 6,
|
|
14
|
+
};
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
const ALIGN_METHOD = {
|
|
17
|
+
left,
|
|
18
|
+
right,
|
|
19
|
+
center,
|
|
20
|
+
justify,
|
|
21
|
+
};
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
function getNodeAlignFunction(nodeAlign: SankeyOptions['nodeAlign']) {
|
|
24
|
+
const type = typeof nodeAlign;
|
|
25
|
+
if (type === 'string') return ALIGN_METHOD[nodeAlign as string] || justify;
|
|
26
|
+
if (type === 'function') return nodeAlign;
|
|
27
|
+
return justify;
|
|
28
|
+
}
|
|
30
29
|
|
|
31
|
-
|
|
30
|
+
export type SankeyOptions = Omit<SankeyTransform, 'type'>;
|
|
32
31
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Compute the node and edge position, return a graph representing the Sankey layout. All will be normalized to [[0, 0], [1, 1]]
|
|
34
|
+
* Required graph data (nodes, edges)
|
|
35
|
+
*/
|
|
36
|
+
export const Sankey: DC<SankeyOptions> = (options) => {
|
|
37
|
+
return (data) => {
|
|
38
|
+
const {
|
|
39
|
+
nodeId,
|
|
40
|
+
nodeSort,
|
|
41
|
+
nodeAlign,
|
|
42
|
+
nodeWidth,
|
|
43
|
+
nodePadding,
|
|
44
|
+
nodeDepth,
|
|
45
|
+
nodes: nodeNodes,
|
|
46
|
+
links: nodeLinks,
|
|
47
|
+
linkSort,
|
|
48
|
+
iterations,
|
|
49
|
+
} = Object.assign({}, DEFAULT_OPTIONS, options);
|
|
51
50
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
51
|
+
const sankeyProcessor = sankey()
|
|
52
|
+
.nodeSort(nodeSort)
|
|
53
|
+
.linkSort(linkSort)
|
|
54
|
+
.links(nodeLinks)
|
|
55
|
+
.nodes(nodeNodes)
|
|
56
|
+
.nodeWidth(nodeWidth)
|
|
57
|
+
.nodePadding(nodePadding)
|
|
58
|
+
.nodeDepth(nodeDepth)
|
|
59
|
+
.nodeAlign(getNodeAlignFunction(nodeAlign))
|
|
60
|
+
.iterations(iterations)
|
|
61
|
+
.extent([
|
|
62
|
+
[0, 0],
|
|
63
|
+
[1, 1],
|
|
64
|
+
]);
|
|
66
65
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
if (typeof nodeId === 'function') {
|
|
67
|
+
sankeyProcessor.nodeId(nodeId);
|
|
68
|
+
}
|
|
70
69
|
|
|
71
|
-
|
|
70
|
+
const layoutData = sankeyProcessor(data);
|
|
72
71
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
72
|
+
const { nodes: N, links: L } = layoutData;
|
|
73
|
+
const nodes = N.map((node) => {
|
|
74
|
+
const { x0, x1, y0, y1 } = node;
|
|
75
|
+
/* points
|
|
76
|
+
* 3---2
|
|
77
|
+
* | |
|
|
78
|
+
* 0---1
|
|
79
|
+
*/
|
|
80
|
+
return { ...node, x: [x0, x1, x1, x0], y: [y0, y0, y1, y1] };
|
|
81
|
+
});
|
|
82
|
+
const links = L.map((edge) => {
|
|
83
|
+
const { source, target } = edge;
|
|
84
|
+
const sx = source.x1;
|
|
85
|
+
const tx = target.x0;
|
|
86
|
+
const offset = edge.width / 2;
|
|
87
|
+
return {
|
|
88
|
+
...edge,
|
|
89
|
+
x: [sx, sx, tx, tx],
|
|
90
|
+
y: [
|
|
91
|
+
edge.y0 + offset,
|
|
92
|
+
edge.y0 - offset,
|
|
93
|
+
edge.y1 + offset,
|
|
94
|
+
edge.y1 - offset,
|
|
95
|
+
],
|
|
96
|
+
};
|
|
97
|
+
});
|
|
98
|
+
return { nodes, links };
|
|
99
|
+
};
|
|
100
|
+
};
|
|
102
101
|
|
|
103
|
-
|
|
104
|
-
// category: 'preprocessor',
|
|
105
|
-
// };
|
|
102
|
+
Sankey.props = {};
|
package/src/data/sortBy.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DataComponent as DC } from '../runtime';
|
|
2
2
|
import { SortByTransform } from '../spec';
|
|
3
|
+
import { normalizeFields } from './utils/fields';
|
|
3
4
|
|
|
4
5
|
export type SortByOptions = Omit<SortByTransform, 'type'>;
|
|
5
6
|
|
|
@@ -7,15 +8,24 @@ export type SortByOptions = Omit<SortByTransform, 'type'>;
|
|
|
7
8
|
* Immutable data sort by specified fields.
|
|
8
9
|
*/
|
|
9
10
|
export const SortBy: DC<SortByOptions> = (options) => {
|
|
10
|
-
const { fields: F = []
|
|
11
|
+
const { fields: F = [] } = options;
|
|
12
|
+
|
|
13
|
+
const normalizedF = normalizeFields(F, true);
|
|
14
|
+
|
|
11
15
|
return (data) => {
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
const comparator = (a: any, b: any) =>
|
|
17
|
+
normalizedF.reduce((ret: number, [field, order = true]) => {
|
|
18
|
+
if (ret !== 0) {
|
|
19
|
+
return ret;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (order) {
|
|
23
|
+
return a[field] < b[field] ? -1 : +(a[field] !== b[field]);
|
|
24
|
+
} else {
|
|
25
|
+
return a[field] > b[field] ? -1 : +(a[field] !== b[field]);
|
|
26
|
+
}
|
|
27
|
+
}, 0);
|
|
28
|
+
|
|
19
29
|
return [...data].sort(comparator);
|
|
20
30
|
};
|
|
21
31
|
};
|
package/src/data/tree.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { tree } from 'd3-hierarchy';
|
|
2
|
+
import { DataComponent as DC } from '../runtime';
|
|
3
|
+
import { TreeTransform } from '../spec';
|
|
4
|
+
import { hierarchyFunction } from './cluster';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
export type TreeOptions = Omit<TreeTransform, 'type'>;
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
export const Tree: DC<TreeOptions> = (options) => {
|
|
9
|
+
return hierarchyFunction(tree)(options);
|
|
10
|
+
};
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
// category: 'preprocessor',
|
|
12
|
-
// };
|
|
12
|
+
Tree.props = {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { Arc } from './arc';
|
|
2
|
-
export { ArcOptions } from './types';
|
|
2
|
+
export type { ArcOptions } from './types';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @description Converts a random format array into a regular two-dimensional array
|
|
4
|
+
* @example ['a', 'b', ['c', value]] => [['a', defaultValue], ['b', defaultValue], ['c', value]]
|
|
5
|
+
*/
|
|
6
|
+
export function normalizeFields(
|
|
7
|
+
fields: any[],
|
|
8
|
+
defaultValue: boolean | ((d: any) => boolean),
|
|
9
|
+
) {
|
|
10
|
+
return fields.map((d) => {
|
|
11
|
+
if (Array.isArray(d)) {
|
|
12
|
+
const [field, value = defaultValue] = d;
|
|
13
|
+
return [field, value];
|
|
14
|
+
}
|
|
15
|
+
return [d, defaultValue];
|
|
16
|
+
});
|
|
17
|
+
}
|
package/src/data/voronoi.ts
CHANGED
package/src/data/wordCloud.ts
CHANGED
package/src/encode/index.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
export { Constant
|
|
2
|
-
export { Transform
|
|
3
|
-
export { Field
|
|
4
|
-
export { Column
|
|
1
|
+
export { Constant } from './constant';
|
|
2
|
+
export { Transform } from './transform';
|
|
3
|
+
export { Field } from './field';
|
|
4
|
+
export { Column } from './column';
|
|
5
|
+
|
|
6
|
+
export type { ConstantOptions } from './constant';
|
|
7
|
+
export type { TransformOptions } from './transform';
|
|
8
|
+
export type { FieldOptions } from './field';
|
|
9
|
+
export type { ColumnOptions } from './column';
|
|
@@ -1,47 +1,45 @@
|
|
|
1
|
-
export {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} from './service/
|
|
5
|
-
export {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from './service/
|
|
9
|
-
export {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
} from './
|
|
13
|
-
export {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
} from './service/
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
19
|
-
export {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
} from './service/recordCurrentPoint';
|
|
23
|
-
export { RecordRegion, RecordRegionOptions } from './service/recordRegion';
|
|
24
|
-
export {
|
|
25
|
-
ActiveElement,
|
|
26
|
-
ActiveElementOptions,
|
|
27
|
-
} from './transformer/activeElement';
|
|
28
|
-
export {
|
|
29
|
-
HighlightElement,
|
|
30
|
-
HighlightOptions,
|
|
31
|
-
} from './transformer/highlightElement';
|
|
32
|
-
export { Tooltip, TooltipOptions } from './transformer/tooltip';
|
|
33
|
-
export { Plot, PlotOptions } from './transformer/plot';
|
|
34
|
-
export { Filter, FilterOptions } from './transformer/filter';
|
|
35
|
-
export {
|
|
36
|
-
FilterElement,
|
|
37
|
-
FilterElementOptions,
|
|
38
|
-
} from './transformer/filterElement';
|
|
39
|
-
export { SetItemState, SetItemStateOptions } from './transformer/setItemState';
|
|
40
|
-
export { FisheyeFocus, FisheyeFocusOptions } from './service/fisheyeFocus';
|
|
41
|
-
export { Cursor, CursorOptions } from './transformer/cursor';
|
|
42
|
-
export { Mask, MaskOptions } from './transformer/mask';
|
|
43
|
-
export { Button, ButtonOptions } from './transformer/button';
|
|
44
|
-
export { Move, MoveOptions } from './transformer/move';
|
|
45
|
-
export { ActiveRegion, ActiveRegionOptions } from './transformer/activeRegion';
|
|
1
|
+
export { SurfacePointSelection } from './service/surfacePointSelection';
|
|
2
|
+
export { TriggerInfoSelection } from './service/triggerInfoSelection';
|
|
3
|
+
export { ElementSelection } from './service/elementSelection';
|
|
4
|
+
export { LegendItemSelection } from './service/legendItemSelection';
|
|
5
|
+
export { RecordState } from './service/recordState';
|
|
6
|
+
export { RecordPoint } from './service/recordPoint';
|
|
7
|
+
export { RecordCurrentPoint } from './service/recordCurrentPoint';
|
|
8
|
+
export { RecordRegion } from './service/recordRegion';
|
|
9
|
+
export { ActiveElement } from './transformer/activeElement';
|
|
10
|
+
export { HighlightElement } from './transformer/highlightElement';
|
|
11
|
+
export { Tooltip } from './transformer/tooltip';
|
|
12
|
+
export { Plot } from './transformer/plot';
|
|
13
|
+
export { Filter } from './transformer/filter';
|
|
14
|
+
export { FilterElement } from './transformer/filterElement';
|
|
15
|
+
export { SetItemState } from './transformer/setItemState';
|
|
16
|
+
export { FisheyeFocus } from './service/fisheyeFocus';
|
|
17
|
+
export { Cursor } from './transformer/cursor';
|
|
18
|
+
export { Mask } from './transformer/mask';
|
|
19
|
+
export { Button } from './transformer/button';
|
|
20
|
+
export { Move } from './transformer/move';
|
|
21
|
+
export { ActiveRegion } from './transformer/activeRegion';
|
|
46
22
|
export { RecordTip } from './service/recordTip';
|
|
47
23
|
export { Poptip } from './transformer/poptip';
|
|
24
|
+
|
|
25
|
+
export type { SurfacePointSelectionOptions } from './service/surfacePointSelection';
|
|
26
|
+
export type { TriggerInfoSelectionOptions } from './service/triggerInfoSelection';
|
|
27
|
+
export type { ElementSelectionOptions } from './service/elementSelection';
|
|
28
|
+
export type { LegendItemSelectionOptions } from './service/legendItemSelection';
|
|
29
|
+
export type { RecordStateOptions } from './service/recordState';
|
|
30
|
+
export type { RecordPointOptions } from './service/recordPoint';
|
|
31
|
+
export type { RecordCurrentPointOptions } from './service/recordCurrentPoint';
|
|
32
|
+
export type { RecordRegionOptions } from './service/recordRegion';
|
|
33
|
+
export type { ActiveElementOptions } from './transformer/activeElement';
|
|
34
|
+
export type { HighlightOptions } from './transformer/highlightElement';
|
|
35
|
+
export type { TooltipOptions } from './transformer/tooltip';
|
|
36
|
+
export type { PlotOptions } from './transformer/plot';
|
|
37
|
+
export type { FilterOptions } from './transformer/filter';
|
|
38
|
+
export type { FilterElementOptions } from './transformer/filterElement';
|
|
39
|
+
export type { SetItemStateOptions } from './transformer/setItemState';
|
|
40
|
+
export type { FisheyeFocusOptions } from './service/fisheyeFocus';
|
|
41
|
+
export type { CursorOptions } from './transformer/cursor';
|
|
42
|
+
export type { MaskOptions } from './transformer/mask';
|
|
43
|
+
export type { ButtonOptions } from './transformer/button';
|
|
44
|
+
export type { MoveOptions } from './transformer/move';
|
|
45
|
+
export type { ActiveRegionOptions } from './transformer/activeRegion';
|
package/src/interaction/index.ts
CHANGED
|
@@ -16,4 +16,20 @@ export { BrushHighlight } from './builtin/brushHighlight';
|
|
|
16
16
|
export { BrushVisible } from './builtin/brushVisible';
|
|
17
17
|
export { ActiveRegion } from './builtin/activeRegion';
|
|
18
18
|
export { EllipsisText } from './builtin/ellipsisText';
|
|
19
|
-
|
|
19
|
+
|
|
20
|
+
export type {
|
|
21
|
+
InteractionContext,
|
|
22
|
+
ActionComponent,
|
|
23
|
+
InteractionDescriptor,
|
|
24
|
+
InteractionStep,
|
|
25
|
+
InteractorOptions,
|
|
26
|
+
ActionOptions,
|
|
27
|
+
Action,
|
|
28
|
+
InteractorAction,
|
|
29
|
+
Interactor,
|
|
30
|
+
G2Event,
|
|
31
|
+
InteractionNamespaces,
|
|
32
|
+
InteractorComponent,
|
|
33
|
+
InteractionOptions,
|
|
34
|
+
InteractionValue,
|
|
35
|
+
} from './types';
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
export { MousePosition
|
|
2
|
-
export { TouchPosition
|
|
1
|
+
export { MousePosition } from './mousePosition';
|
|
2
|
+
export { TouchPosition } from './touchPosition';
|
|
3
|
+
|
|
4
|
+
export type { MousePositionPotions } from './mousePosition';
|
|
5
|
+
export type { TouchPositionPotions } from './touchPosition';
|
package/src/interaction/types.ts
CHANGED
|
@@ -1,25 +1,15 @@
|
|
|
1
|
-
export { AnnotationText
|
|
2
|
-
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} from './
|
|
6
|
-
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
} from './
|
|
10
|
-
export {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} from './
|
|
14
|
-
export {
|
|
15
|
-
|
|
16
|
-
RangeOptions as AnnotationRangeOptions,
|
|
17
|
-
} from './range';
|
|
18
|
-
export {
|
|
19
|
-
RangeX as AnnotationRangeX,
|
|
20
|
-
RangeXOptions as AnnotationRangeXOptions,
|
|
21
|
-
} from './rangeX';
|
|
22
|
-
export {
|
|
23
|
-
RangeY as AnnotationRangeY,
|
|
24
|
-
RangeYOptions as AnnotationRangeYOptions,
|
|
25
|
-
} from './rangeY';
|
|
1
|
+
export { AnnotationText } from './text';
|
|
2
|
+
export { LineY as AnnotationLineY } from './lineY';
|
|
3
|
+
export { LineX as AnnotationLineX } from './lineX';
|
|
4
|
+
export { Connector as AnnotationConnector } from './connector';
|
|
5
|
+
export { Range as AnnotationRange } from './range';
|
|
6
|
+
export { RangeX as AnnotationRangeX } from './rangeX';
|
|
7
|
+
export { RangeY as AnnotationRangeY } from './rangeY';
|
|
8
|
+
|
|
9
|
+
export type { AnnotationTextOptions } from './text';
|
|
10
|
+
export type { LineYOptions as AnnotationLineYOptions } from './lineY';
|
|
11
|
+
export type { LineXOptions as AnnotationLineXOptions } from './lineX';
|
|
12
|
+
export type { ConnectorOptions as AnnotationConnectorOptions } from './connector';
|
|
13
|
+
export type { RangeOptions as AnnotationRangeOptions } from './range';
|
|
14
|
+
export type { RangeXOptions as AnnotationRangeXOptions } from './rangeX';
|
|
15
|
+
export type { RangeYOptions as AnnotationRangeYOptions } from './rangeY';
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { Band } from '@antv/scale';
|
|
2
2
|
import { Vector2, MarkComponent as MC } from '../../runtime';
|
|
3
|
-
import {
|
|
3
|
+
import { BoxGeometry } from '../../spec';
|
|
4
4
|
import {
|
|
5
5
|
baseGeometryChannels,
|
|
6
6
|
basePostInference,
|
|
7
7
|
basePreInference,
|
|
8
8
|
} from '../utils';
|
|
9
9
|
|
|
10
|
-
export type
|
|
10
|
+
export type BoxOptions = Omit<BoxGeometry, 'type'>;
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* Convert value for each channel to
|
|
13
|
+
* Convert value for each channel to box shapes.
|
|
14
14
|
*
|
|
15
15
|
* p0 p2 p1
|
|
16
16
|
* ──────────┬──────────
|
|
@@ -39,7 +39,7 @@ export type SchemaOptions = Omit<SchemaGeometry, 'type'>;
|
|
|
39
39
|
* ───────────┴───────────
|
|
40
40
|
* p12 p11 p13
|
|
41
41
|
*/
|
|
42
|
-
export const
|
|
42
|
+
export const Box: MC<BoxOptions> = () => {
|
|
43
43
|
return (index, scale, value, coordinate) => {
|
|
44
44
|
const { x: X, y: Y, y1: Y1, y2: Y2, y3: Y3, y4: Y4, series: S } = value;
|
|
45
45
|
|
|
@@ -86,7 +86,7 @@ export const Schema: MC<SchemaOptions> = () => {
|
|
|
86
86
|
};
|
|
87
87
|
};
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
Box.props = {
|
|
90
90
|
defaultShape: 'box',
|
|
91
91
|
defaultLabelShape: 'label',
|
|
92
92
|
channels: [
|
|
@@ -10,12 +10,13 @@ export type ImageOptions = Omit<ImageGeometry, 'type'>;
|
|
|
10
10
|
export const Image: MC<ImageOptions> = () => {
|
|
11
11
|
return (index, scale, value, coordinate) => {
|
|
12
12
|
const { x: X, y: Y } = value;
|
|
13
|
-
const { x } = scale;
|
|
13
|
+
const { x, y } = scale;
|
|
14
|
+
const xoffset = (x?.getBandWidth?.() || 0) / 2;
|
|
15
|
+
const yoffset = (y?.getBandWidth?.() || 0) / 2;
|
|
14
16
|
const P = Array.from(index, (i) => {
|
|
15
17
|
const px = +X[i];
|
|
16
18
|
const py = +Y[i];
|
|
17
|
-
|
|
18
|
-
return [coordinate.map([px + xoffset / 2, py])] as Vector2[];
|
|
19
|
+
return [coordinate.map([px + xoffset, py + yoffset])] as Vector2[];
|
|
19
20
|
});
|
|
20
21
|
return [index, P];
|
|
21
22
|
};
|
|
@@ -1,13 +1,23 @@
|
|
|
1
|
-
export { Interval
|
|
2
|
-
export { Line
|
|
3
|
-
export { Point
|
|
4
|
-
export { Text
|
|
5
|
-
export { Grid
|
|
6
|
-
export { Area
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
|
|
13
|
-
export {
|
|
1
|
+
export { Interval } from './interval';
|
|
2
|
+
export { Line } from './line';
|
|
3
|
+
export { Point } from './point';
|
|
4
|
+
export { Text } from './text';
|
|
5
|
+
export { Grid } from './grid';
|
|
6
|
+
export { Area } from './area';
|
|
7
|
+
export { Link } from './link';
|
|
8
|
+
export { Image } from './image';
|
|
9
|
+
export { Polygon } from './polygon';
|
|
10
|
+
export { Box } from './box';
|
|
11
|
+
export { Vector } from './vector';
|
|
12
|
+
|
|
13
|
+
export type { IntervalOptions } from './interval';
|
|
14
|
+
export type { LineOptions } from './line';
|
|
15
|
+
export type { PointOptions } from './point';
|
|
16
|
+
export type { TextOptions } from './text';
|
|
17
|
+
export type { GridOptions } from './grid';
|
|
18
|
+
export type { AreaOptions } from './area';
|
|
19
|
+
export type { LinkOptions } from './link';
|
|
20
|
+
export type { ImageOptions } from './image';
|
|
21
|
+
export type { PolygonOptions } from './polygon';
|
|
22
|
+
export type { BoxOptions } from './box';
|
|
23
|
+
export type { VectorOptions } from './vector';
|
|
@@ -13,6 +13,7 @@ export type LineOptions = Omit<LineGeometry, 'type'>;
|
|
|
13
13
|
|
|
14
14
|
const line: Mark = (index, scale, value, coordinate) => {
|
|
15
15
|
const { series: S, x: X, y: Y } = value;
|
|
16
|
+
const { x, y } = scale;
|
|
16
17
|
|
|
17
18
|
// Because x and y channel is not strictly required in Line.props,
|
|
18
19
|
// it should throw error with empty x or y channels.
|
|
@@ -26,8 +27,12 @@ const line: Mark = (index, scale, value, coordinate) => {
|
|
|
26
27
|
const I = series.map((group) => group[0]);
|
|
27
28
|
|
|
28
29
|
// A group of data corresponds to one line.
|
|
30
|
+
const xoffset = (x?.getBandWidth?.() || 0) / 2;
|
|
31
|
+
const yoffset = (y?.getBandWidth?.() || 0) / 2;
|
|
29
32
|
const P = Array.from(series, (I) => {
|
|
30
|
-
return I.map((i) =>
|
|
33
|
+
return I.map((i) =>
|
|
34
|
+
coordinate.map([+X[i] + xoffset, +Y[i] + yoffset]),
|
|
35
|
+
) as Vector2[];
|
|
31
36
|
});
|
|
32
37
|
return [I, P, series];
|
|
33
38
|
};
|