@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/lib/data/arc.js
CHANGED
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
// };
|
|
16
|
-
// Arc.props = {
|
|
17
|
-
// category: 'preprocessor',
|
|
18
|
-
// };
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Arc = void 0;
|
|
4
|
+
const arc_1 = require("../data/utils/arc");
|
|
5
|
+
/**
|
|
6
|
+
* For arc diagram(edge with weight) or chord diagram(with weight)
|
|
7
|
+
*/
|
|
8
|
+
const Arc = (options) => {
|
|
9
|
+
return (data) => {
|
|
10
|
+
return (0, arc_1.Arc)(options)(data);
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
exports.Arc = Arc;
|
|
14
|
+
exports.Arc.props = {};
|
|
19
15
|
//# sourceMappingURL=arc.js.map
|
package/lib/data/arc.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arc.js","sourceRoot":"src/","sources":["data/arc.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"arc.js","sourceRoot":"src/","sources":["data/arc.ts"],"names":[],"mappings":";;;AAEA,2CAAqD;AAIrD;;GAEG;AACI,MAAM,GAAG,GAAmB,CAAC,OAAO,EAAE,EAAE;IAC7C,OAAO,CAAC,IAAI,EAAE,EAAE;QACd,OAAO,IAAA,SAAS,EAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC,CAAC;AACJ,CAAC,CAAC;AAJW,QAAA,GAAG,OAId;AAEF,WAAG,CAAC,KAAK,GAAG,EAAE,CAAC"}
|
package/lib/data/cluster.d.ts
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DataComponent as DC } from '../runtime';
|
|
2
|
+
import { ClusterTransform } from '../spec';
|
|
3
|
+
export declare type ClusterOptions = Omit<ClusterTransform, 'type'>;
|
|
4
|
+
export declare const hierarchyFunction: (layoutFunction: any) => (options: any) => (data: any) => {
|
|
5
|
+
nodes: any[];
|
|
6
|
+
edges: any;
|
|
7
|
+
};
|
|
8
|
+
export declare const Cluster: DC<ClusterOptions>;
|
package/lib/data/cluster.js
CHANGED
|
@@ -1,47 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
//
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
//
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
// };
|
|
43
|
-
// export const Cluster: TC<ClusterOptions> = hierarchyFunction(cluster);
|
|
44
|
-
// Cluster.props = {
|
|
45
|
-
// category: 'preprocessor',
|
|
46
|
-
// };
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Cluster = exports.hierarchyFunction = void 0;
|
|
4
|
+
const d3_hierarchy_1 = require("d3-hierarchy");
|
|
5
|
+
const hierarchyFunction = (layoutFunction) => (options) => {
|
|
6
|
+
return (data) => {
|
|
7
|
+
const { field = 'value', nodeSize, separation, sortBy, as = ['x', 'y'], } = options;
|
|
8
|
+
const [x, y] = as;
|
|
9
|
+
// Process root data.
|
|
10
|
+
const root = (0, d3_hierarchy_1.hierarchy)(data, (d) => d.children)
|
|
11
|
+
.sum((d) => d[field])
|
|
12
|
+
.sort(sortBy);
|
|
13
|
+
// Layout
|
|
14
|
+
const c = layoutFunction();
|
|
15
|
+
c.size([1, 1]);
|
|
16
|
+
if (nodeSize)
|
|
17
|
+
c.nodeSize(nodeSize);
|
|
18
|
+
if (separation)
|
|
19
|
+
c.separation(separation);
|
|
20
|
+
c(root);
|
|
21
|
+
const nodes = [];
|
|
22
|
+
root.each((node) => {
|
|
23
|
+
node[x] = node.x;
|
|
24
|
+
node[y] = node.y;
|
|
25
|
+
node.name = node.data.name;
|
|
26
|
+
nodes.push(node);
|
|
27
|
+
});
|
|
28
|
+
const edges = root.links();
|
|
29
|
+
edges.forEach((edge) => {
|
|
30
|
+
edge[x] = [edge.source[x], edge.target[x]];
|
|
31
|
+
edge[y] = [edge.source[y], edge.target[y]];
|
|
32
|
+
});
|
|
33
|
+
return { nodes, edges };
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
exports.hierarchyFunction = hierarchyFunction;
|
|
37
|
+
const Cluster = (options) => {
|
|
38
|
+
return (0, exports.hierarchyFunction)(d3_hierarchy_1.cluster)(options);
|
|
39
|
+
};
|
|
40
|
+
exports.Cluster = Cluster;
|
|
41
|
+
exports.Cluster.props = {};
|
|
47
42
|
//# sourceMappingURL=cluster.js.map
|
package/lib/data/cluster.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cluster.js","sourceRoot":"src/","sources":["data/cluster.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"cluster.js","sourceRoot":"src/","sources":["data/cluster.ts"],"names":[],"mappings":";;;AAAA,+CAAkD;AAM3C,MAAM,iBAAiB,GAAG,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE;IAC/D,OAAO,CAAC,IAAI,EAAE,EAAE;QACd,MAAM,EACJ,KAAK,GAAG,OAAO,EACf,QAAQ,EACR,UAAU,EACV,MAAM,EACN,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,GAChB,GAAG,OAAO,CAAC;QACZ,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC;QAElB,qBAAqB;QACrB,MAAM,IAAI,GAAG,IAAA,wBAAS,EAAC,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;aAC5C,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAM,CAAC,CAAC;aACrB,IAAI,CAAC,MAAM,CAAC,CAAC;QAEhB,SAAS;QACT,MAAM,CAAC,GAAG,cAAc,EAAE,CAAC;QAC3B,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QACf,IAAI,QAAQ;YAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACnC,IAAI,UAAU;YAAE,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;QACzC,CAAC,CAAC,IAAI,CAAC,CAAC;QAER,MAAM,KAAK,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,IAAI,CAAC,CAAC,IAAS,EAAE,EAAE;YACtB,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;YACjB,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;YACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;YAE3B,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC,CAAC,CAAC;QAEH,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;QAC3B,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YACrB,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;YAC3C,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7C,CAAC,CAAC,CAAC;QAEH,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IAC1B,CAAC,CAAC;AACJ,CAAC,CAAC;AAxCW,QAAA,iBAAiB,qBAwC5B;AAEK,MAAM,OAAO,GAAuB,CAAC,OAAO,EAAE,EAAE;IACrD,OAAO,IAAA,yBAAiB,EAAC,sBAAO,CAAC,CAAC,OAAO,CAAC,CAAC;AAC7C,CAAC,CAAC;AAFW,QAAA,OAAO,WAElB;AAEF,eAAO,CAAC,KAAK,GAAG,EAAE,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DataComponent as DC } from '../runtime';
|
|
2
|
+
import { CustomDataTransform } from '../spec';
|
|
3
|
+
export declare type CustomOptions = Omit<CustomDataTransform, 'type'>;
|
|
4
|
+
/**
|
|
5
|
+
* Connector transfom by function.
|
|
6
|
+
*/
|
|
7
|
+
export declare const Custom: DC<CustomOptions>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Custom = void 0;
|
|
4
|
+
const helper_1 = require("../utils/helper");
|
|
5
|
+
/**
|
|
6
|
+
* Connector transfom by function.
|
|
7
|
+
*/
|
|
8
|
+
const Custom = (options) => {
|
|
9
|
+
const { callback = helper_1.identity } = options;
|
|
10
|
+
return (data) => callback(data);
|
|
11
|
+
};
|
|
12
|
+
exports.Custom = Custom;
|
|
13
|
+
exports.Custom.props = {};
|
|
14
|
+
//# sourceMappingURL=custom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom.js","sourceRoot":"src/","sources":["data/custom.ts"],"names":[],"mappings":";;;AAEA,4CAA2C;AAI3C;;GAEG;AACI,MAAM,MAAM,GAAsB,CAAC,OAAO,EAAE,EAAE;IACnD,MAAM,EAAE,QAAQ,GAAG,iBAAQ,EAAE,GAAG,OAAO,CAAC;IACxC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAClC,CAAC,CAAC;AAHW,QAAA,MAAM,UAGjB;AAEF,cAAM,CAAC,KAAK,GAAG,EAAE,CAAC"}
|
package/lib/data/fetch.js
CHANGED
|
@@ -13,17 +13,18 @@ exports.Fetch = void 0;
|
|
|
13
13
|
const d3_dsv_1 = require("d3-dsv");
|
|
14
14
|
const helper_1 = require("../utils/helper");
|
|
15
15
|
const Fetch = (options) => {
|
|
16
|
-
const { value,
|
|
16
|
+
const { value, format = value.split('.').pop(), delimiter = ',', autoType = true, } = options;
|
|
17
17
|
return () => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
18
|
const response = yield fetch(value);
|
|
19
19
|
if (format === 'csv') {
|
|
20
20
|
// @see: https://github.com/d3/d3-dsv#dsv_parse
|
|
21
21
|
const str = yield response.text();
|
|
22
|
-
return (0, d3_dsv_1.dsvFormat)(delimiter).parse(str,
|
|
22
|
+
return (0, d3_dsv_1.dsvFormat)(delimiter).parse(str, autoType ? d3_dsv_1.autoType : helper_1.identity);
|
|
23
23
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
else if (format === 'json') {
|
|
25
|
+
return yield response.json();
|
|
26
|
+
}
|
|
27
|
+
throw new Error(`Unknown format: ${format}.`);
|
|
27
28
|
});
|
|
28
29
|
};
|
|
29
30
|
exports.Fetch = Fetch;
|
package/lib/data/fetch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.js","sourceRoot":"src/","sources":["data/fetch.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"fetch.js","sourceRoot":"src/","sources":["data/fetch.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAA2D;AAG3D,4CAA2C;AAIpC,MAAM,KAAK,GAAqB,CAAC,OAAO,EAAE,EAAE;IACjD,MAAM,EACJ,KAAK,EACL,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAC/B,SAAS,GAAG,GAAG,EACf,QAAQ,GAAG,IAAI,GAChB,GAAG,OAAO,CAAC;IACZ,OAAO,GAAS,EAAE;QAChB,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,CAAC;QACpC,IAAI,MAAM,KAAK,KAAK,EAAE;YACpB,+CAA+C;YAC/C,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;YAClC,OAAO,IAAA,kBAAS,EAAC,SAAS,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,iBAAU,CAAC,CAAC,CAAC,iBAAQ,CAAC,CAAC;SAC1E;aAAM,IAAI,MAAM,KAAK,MAAM,EAAE;YAC5B,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;SAC9B;QACD,MAAM,IAAI,KAAK,CAAC,mBAAmB,MAAM,GAAG,CAAC,CAAC;IAChD,CAAC,CAAA,CAAC;AACJ,CAAC,CAAC;AAlBW,QAAA,KAAK,SAkBhB;AAEF,aAAK,CAAC,KAAK,GAAG,EAAE,CAAC"}
|
package/lib/data/filterBy.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FilterBy = void 0;
|
|
4
|
+
const fields_1 = require("./utils/fields");
|
|
4
5
|
function defined(d) {
|
|
5
6
|
return d !== undefined && d !== null && !Number.isNaN(d);
|
|
6
7
|
}
|
|
@@ -9,8 +10,11 @@ function defined(d) {
|
|
|
9
10
|
* It saves datum with every fields defined by default.
|
|
10
11
|
*/
|
|
11
12
|
const FilterBy = (options) => {
|
|
12
|
-
const { fields: F = []
|
|
13
|
-
|
|
13
|
+
const { fields: F = [] } = options;
|
|
14
|
+
const normalizedF = (0, fields_1.normalizeFields)(F, defined);
|
|
15
|
+
return (data) => data.filter((d) => {
|
|
16
|
+
return normalizedF.every(([field, callback = defined]) => callback(d[field]));
|
|
17
|
+
});
|
|
14
18
|
};
|
|
15
19
|
exports.FilterBy = FilterBy;
|
|
16
20
|
exports.FilterBy.props = {};
|
package/lib/data/filterBy.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filterBy.js","sourceRoot":"src/","sources":["data/filterBy.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"filterBy.js","sourceRoot":"src/","sources":["data/filterBy.ts"],"names":[],"mappings":";;;AAEA,2CAAiD;AAIjD,SAAS,OAAO,CAAC,CAAM;IACrB,OAAO,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED;;;GAGG;AACI,MAAM,QAAQ,GAAwB,CAAC,OAAO,EAAE,EAAE;IACvD,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC;IAEnC,MAAM,WAAW,GAAG,IAAA,wBAAe,EAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IAEhD,OAAO,CAAC,IAAI,EAAE,EAAE,CACd,IAAI,CAAC,MAAM,CAAC,CAAC,CAAM,EAAE,EAAE;QACrB,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,EAAE,EAAE,CACvD,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CACnB,CAAC;IACJ,CAAC,CAAC,CAAC;AACP,CAAC,CAAC;AAXW,QAAA,QAAQ,YAWnB;AAEF,gBAAQ,CAAC,KAAK,GAAG,EAAE,CAAC"}
|
package/lib/data/index.d.ts
CHANGED
|
@@ -1,9 +1,28 @@
|
|
|
1
|
-
export { Fetch
|
|
2
|
-
export { Fold
|
|
3
|
-
export { FilterBy
|
|
4
|
-
export { Pick
|
|
5
|
-
export { Rename
|
|
6
|
-
export { Subset
|
|
7
|
-
export { SortBy
|
|
8
|
-
export { Inline
|
|
9
|
-
export {
|
|
1
|
+
export { Fetch } from './fetch';
|
|
2
|
+
export { Fold } from './fold';
|
|
3
|
+
export { FilterBy } from './filterBy';
|
|
4
|
+
export { Pick } from './pick';
|
|
5
|
+
export { Rename } from './rename';
|
|
6
|
+
export { Subset } from './subset';
|
|
7
|
+
export { SortBy } from './sortBy';
|
|
8
|
+
export { Inline } from './inline';
|
|
9
|
+
export { Custom } from './custom';
|
|
10
|
+
export { Map } from './map';
|
|
11
|
+
export { Cluster } from './cluster';
|
|
12
|
+
export { Tree } from './tree';
|
|
13
|
+
export { Sankey } from './sankey';
|
|
14
|
+
export { Arc } from './arc';
|
|
15
|
+
export type { FetchOptions } from './fetch';
|
|
16
|
+
export type { FoldOptions } from './fold';
|
|
17
|
+
export type { FilterByOptions } from './filterBy';
|
|
18
|
+
export type { PickOptions } from './pick';
|
|
19
|
+
export type { RenameOptions } from './rename';
|
|
20
|
+
export type { SubsetOptions } from './subset';
|
|
21
|
+
export type { SortByOptions } from './sortBy';
|
|
22
|
+
export type { InlineOptions } from './inline';
|
|
23
|
+
export type { CustomOptions } from './custom';
|
|
24
|
+
export type { MapOptions } from './map';
|
|
25
|
+
export type { ClusterOptions } from './cluster';
|
|
26
|
+
export type { TreeOptions } from './tree';
|
|
27
|
+
export type { SankeyOptions } from './sankey';
|
|
28
|
+
export type { ArcOptions } from './arc';
|
package/lib/data/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.Arc = exports.Sankey = exports.Tree = exports.Cluster = exports.Map = exports.Custom = exports.Inline = exports.SortBy = exports.Subset = exports.Rename = exports.Pick = exports.FilterBy = exports.Fold = exports.Fetch = void 0;
|
|
4
4
|
var fetch_1 = require("./fetch");
|
|
5
5
|
Object.defineProperty(exports, "Fetch", { enumerable: true, get: function () { return fetch_1.Fetch; } });
|
|
6
6
|
var fold_1 = require("./fold");
|
|
@@ -17,6 +17,16 @@ var sortBy_1 = require("./sortBy");
|
|
|
17
17
|
Object.defineProperty(exports, "SortBy", { enumerable: true, get: function () { return sortBy_1.SortBy; } });
|
|
18
18
|
var inline_1 = require("./inline");
|
|
19
19
|
Object.defineProperty(exports, "Inline", { enumerable: true, get: function () { return inline_1.Inline; } });
|
|
20
|
-
var
|
|
21
|
-
Object.defineProperty(exports, "
|
|
20
|
+
var custom_1 = require("./custom");
|
|
21
|
+
Object.defineProperty(exports, "Custom", { enumerable: true, get: function () { return custom_1.Custom; } });
|
|
22
|
+
var map_1 = require("./map");
|
|
23
|
+
Object.defineProperty(exports, "Map", { enumerable: true, get: function () { return map_1.Map; } });
|
|
24
|
+
var cluster_1 = require("./cluster");
|
|
25
|
+
Object.defineProperty(exports, "Cluster", { enumerable: true, get: function () { return cluster_1.Cluster; } });
|
|
26
|
+
var tree_1 = require("./tree");
|
|
27
|
+
Object.defineProperty(exports, "Tree", { enumerable: true, get: function () { return tree_1.Tree; } });
|
|
28
|
+
var sankey_1 = require("./sankey");
|
|
29
|
+
Object.defineProperty(exports, "Sankey", { enumerable: true, get: function () { return sankey_1.Sankey; } });
|
|
30
|
+
var arc_1 = require("./arc");
|
|
31
|
+
Object.defineProperty(exports, "Arc", { enumerable: true, get: function () { return arc_1.Arc; } });
|
|
22
32
|
//# sourceMappingURL=index.js.map
|
package/lib/data/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["data/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["data/index.ts"],"names":[],"mappings":";;;AAAA,iCAAgC;AAAvB,8FAAA,KAAK,OAAA;AACd,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AACb,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AACb,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,6BAA4B;AAAnB,0FAAA,GAAG,OAAA;AACZ,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAChB,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AACb,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,6BAA4B;AAAnB,0FAAA,GAAG,OAAA"}
|
package/lib/data/map.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Map = void 0;
|
|
4
|
+
const helper_1 = require("../utils/helper");
|
|
5
|
+
/**
|
|
6
|
+
* Map transform by function.
|
|
7
|
+
*/
|
|
8
|
+
const Map = (options) => {
|
|
9
|
+
const { callback = helper_1.identity } = options;
|
|
10
|
+
return (data) => (Array.isArray(data) ? data.map(callback) : data);
|
|
11
|
+
};
|
|
12
|
+
exports.Map = Map;
|
|
13
|
+
exports.Map.props = {};
|
|
14
|
+
//# sourceMappingURL=map.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map.js","sourceRoot":"src/","sources":["data/map.ts"],"names":[],"mappings":";;;AACA,4CAA2C;AAK3C;;GAEG;AACI,MAAM,GAAG,GAAmB,CAAC,OAAO,EAAE,EAAE;IAC7C,MAAM,EAAE,QAAQ,GAAG,iBAAQ,EAAE,GAAG,OAAO,CAAC;IACxC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AACrE,CAAC,CAAC;AAHW,QAAA,GAAG,OAGd;AAEF,WAAG,CAAC,KAAK,GAAG,EAAE,CAAC"}
|
package/lib/data/sankey.d.ts
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DataComponent as DC } from '../runtime';
|
|
2
|
+
import { SankeyTransform } from '../spec';
|
|
3
|
+
export declare type SankeyOptions = Omit<SankeyTransform, 'type'>;
|
|
4
|
+
/**
|
|
5
|
+
* Compute the node and edge position, return a graph representing the Sankey layout. All will be normalized to [[0, 0], [1, 1]]
|
|
6
|
+
* Required graph data (nodes, edges)
|
|
7
|
+
*/
|
|
8
|
+
export declare const Sankey: DC<SankeyOptions>;
|
package/lib/data/sankey.js
CHANGED
|
@@ -1,96 +1,81 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
// x: [sx, sx, tx, tx],
|
|
82
|
-
// y: [
|
|
83
|
-
// edge.y0 + offset,
|
|
84
|
-
// edge.y0 - offset,
|
|
85
|
-
// edge.y1 + offset,
|
|
86
|
-
// edge.y1 - offset,
|
|
87
|
-
// ],
|
|
88
|
-
// };
|
|
89
|
-
// });
|
|
90
|
-
// return { data: { nodes, links } };
|
|
91
|
-
// });
|
|
92
|
-
// };
|
|
93
|
-
// Sankey.props = {
|
|
94
|
-
// category: 'preprocessor',
|
|
95
|
-
// };
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Sankey = void 0;
|
|
4
|
+
const d3_sankey_1 = require("./utils/d3-sankey");
|
|
5
|
+
const DEFAULT_OPTIONS = {
|
|
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
|
+
};
|
|
15
|
+
const ALIGN_METHOD = {
|
|
16
|
+
left: d3_sankey_1.left,
|
|
17
|
+
right: d3_sankey_1.right,
|
|
18
|
+
center: d3_sankey_1.center,
|
|
19
|
+
justify: d3_sankey_1.justify,
|
|
20
|
+
};
|
|
21
|
+
function getNodeAlignFunction(nodeAlign) {
|
|
22
|
+
const type = typeof nodeAlign;
|
|
23
|
+
if (type === 'string')
|
|
24
|
+
return ALIGN_METHOD[nodeAlign] || d3_sankey_1.justify;
|
|
25
|
+
if (type === 'function')
|
|
26
|
+
return nodeAlign;
|
|
27
|
+
return d3_sankey_1.justify;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Compute the node and edge position, return a graph representing the Sankey layout. All will be normalized to [[0, 0], [1, 1]]
|
|
31
|
+
* Required graph data (nodes, edges)
|
|
32
|
+
*/
|
|
33
|
+
const Sankey = (options) => {
|
|
34
|
+
return (data) => {
|
|
35
|
+
const { nodeId, nodeSort, nodeAlign, nodeWidth, nodePadding, nodeDepth, nodes: nodeNodes, links: nodeLinks, linkSort, iterations, } = Object.assign({}, DEFAULT_OPTIONS, options);
|
|
36
|
+
const sankeyProcessor = (0, d3_sankey_1.sankey)()
|
|
37
|
+
.nodeSort(nodeSort)
|
|
38
|
+
.linkSort(linkSort)
|
|
39
|
+
.links(nodeLinks)
|
|
40
|
+
.nodes(nodeNodes)
|
|
41
|
+
.nodeWidth(nodeWidth)
|
|
42
|
+
.nodePadding(nodePadding)
|
|
43
|
+
.nodeDepth(nodeDepth)
|
|
44
|
+
.nodeAlign(getNodeAlignFunction(nodeAlign))
|
|
45
|
+
.iterations(iterations)
|
|
46
|
+
.extent([
|
|
47
|
+
[0, 0],
|
|
48
|
+
[1, 1],
|
|
49
|
+
]);
|
|
50
|
+
if (typeof nodeId === 'function') {
|
|
51
|
+
sankeyProcessor.nodeId(nodeId);
|
|
52
|
+
}
|
|
53
|
+
const layoutData = sankeyProcessor(data);
|
|
54
|
+
const { nodes: N, links: L } = layoutData;
|
|
55
|
+
const nodes = N.map((node) => {
|
|
56
|
+
const { x0, x1, y0, y1 } = node;
|
|
57
|
+
/* points
|
|
58
|
+
* 3---2
|
|
59
|
+
* | |
|
|
60
|
+
* 0---1
|
|
61
|
+
*/
|
|
62
|
+
return Object.assign(Object.assign({}, node), { x: [x0, x1, x1, x0], y: [y0, y0, y1, y1] });
|
|
63
|
+
});
|
|
64
|
+
const links = L.map((edge) => {
|
|
65
|
+
const { source, target } = edge;
|
|
66
|
+
const sx = source.x1;
|
|
67
|
+
const tx = target.x0;
|
|
68
|
+
const offset = edge.width / 2;
|
|
69
|
+
return Object.assign(Object.assign({}, edge), { x: [sx, sx, tx, tx], y: [
|
|
70
|
+
edge.y0 + offset,
|
|
71
|
+
edge.y0 - offset,
|
|
72
|
+
edge.y1 + offset,
|
|
73
|
+
edge.y1 - offset,
|
|
74
|
+
] });
|
|
75
|
+
});
|
|
76
|
+
return { nodes, links };
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
exports.Sankey = Sankey;
|
|
80
|
+
exports.Sankey.props = {};
|
|
96
81
|
//# sourceMappingURL=sankey.js.map
|
package/lib/data/sankey.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sankey.js","sourceRoot":"src/","sources":["data/sankey.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sankey.js","sourceRoot":"src/","sources":["data/sankey.ts"],"names":[],"mappings":";;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EAAE,EAAE,CAAC,EACnB,CAAC,EAAE;oBACD,IAAI,CAAC,EAAE,GAAG,MAAM;oBAChB,IAAI,CAAC,EAAE,GAAG,MAAM;oBAChB,IAAI,CAAC,EAAE,GAAG,MAAM;oBAChB,IAAI,CAAC,EAAE,GAAG,MAAM;iBACjB,IACD;QACJ,CAAC,CAAC,CAAC;QACH,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IAC1B,CAAC,CAAC;AACJ,CAAC,CAAC;AAhEW,QAAA,MAAM,UAgEjB;AAEF,cAAM,CAAC,KAAK,GAAG,EAAE,CAAC"}
|
package/lib/data/sortBy.js
CHANGED
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SortBy = void 0;
|
|
4
|
+
const fields_1 = require("./utils/fields");
|
|
4
5
|
/**
|
|
5
6
|
* Immutable data sort by specified fields.
|
|
6
7
|
*/
|
|
7
8
|
const SortBy = (options) => {
|
|
8
|
-
const { fields: F = []
|
|
9
|
+
const { fields: F = [] } = options;
|
|
10
|
+
const normalizedF = (0, fields_1.normalizeFields)(F, true);
|
|
9
11
|
return (data) => {
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
const comparator = (a, b) => normalizedF.reduce((ret, [field, order = true]) => {
|
|
13
|
+
if (ret !== 0) {
|
|
14
|
+
return ret;
|
|
15
|
+
}
|
|
16
|
+
if (order) {
|
|
17
|
+
return a[field] < b[field] ? -1 : +(a[field] !== b[field]);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
return a[field] > b[field] ? -1 : +(a[field] !== b[field]);
|
|
21
|
+
}
|
|
22
|
+
}, 0);
|
|
13
23
|
return [...data].sort(comparator);
|
|
14
24
|
};
|
|
15
25
|
};
|
package/lib/data/sortBy.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sortBy.js","sourceRoot":"src/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