@antv/g2 5.0.0-alpha.0 → 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/README.en-US.md +47 -75
- package/README.md +47 -83
- 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/fadeIn.js +4 -6
- package/esm/animation/fadeIn.js.map +1 -1
- package/esm/animation/fadeOut.js +4 -4
- package/esm/animation/fadeOut.js.map +1 -1
- package/esm/animation/index.d.ts +14 -7
- package/esm/animation/index.js.map +1 -1
- package/esm/animation/morphing.js +4 -5
- package/esm/animation/morphing.js.map +1 -1
- package/esm/animation/scaleInX.js +7 -5
- package/esm/animation/scaleInX.js.map +1 -1
- package/esm/animation/scaleInY.js +7 -5
- package/esm/animation/scaleInY.js.map +1 -1
- package/esm/animation/scaleOutX.js +4 -5
- package/esm/animation/scaleOutX.js.map +1 -1
- package/esm/animation/scaleOutY.js +4 -5
- package/esm/animation/scaleOutY.js.map +1 -1
- package/esm/api/chart.d.ts +8 -1
- package/esm/api/chart.js +32 -7
- package/esm/api/chart.js.map +1 -1
- package/esm/api/composition/circle.js.map +1 -1
- package/esm/api/composition/flex.js.map +1 -1
- package/esm/api/composition/keyframe.js.map +1 -1
- package/esm/api/composition/layer.js.map +1 -1
- package/esm/api/composition/matrix.js.map +1 -1
- package/esm/api/composition/rect.js.map +1 -1
- package/esm/api/composition/view.js.map +1 -1
- package/esm/api/index.d.ts +1 -0
- package/esm/api/index.js +1 -0
- package/esm/api/index.js.map +1 -1
- package/esm/api/library.d.ts +3 -0
- package/esm/api/library.js +7 -0
- package/esm/api/library.js.map +1 -0
- 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/circle.js +1 -1
- package/esm/composition/circle.js.map +1 -1
- package/esm/composition/flex.js +4 -2
- package/esm/composition/flex.js.map +1 -1
- package/esm/composition/index.d.ts +16 -8
- package/esm/composition/index.js.map +1 -1
- package/esm/composition/layer.js +3 -3
- package/esm/composition/layer.js.map +1 -1
- package/esm/composition/mark.js +2 -1
- package/esm/composition/mark.js.map +1 -1
- package/esm/composition/rect.js +29 -30
- package/esm/composition/rect.js.map +1 -1
- package/esm/composition/utils.d.ts +6 -0
- package/esm/composition/utils.js +19 -0
- package/esm/composition/utils.js.map +1 -1
- package/esm/composition/view.js +3 -2
- package/esm/composition/view.js.map +1 -1
- package/esm/coordinate/fisheye.d.ts +1 -1
- package/esm/coordinate/fisheye.js +1 -1
- package/esm/coordinate/fisheye.js.map +1 -1
- package/esm/coordinate/fisheyeX.d.ts +7 -0
- package/esm/coordinate/fisheyeX.js +6 -0
- package/esm/coordinate/fisheyeX.js.map +1 -0
- package/esm/coordinate/fisheyeY.d.ts +7 -0
- package/esm/coordinate/fisheyeY.js +6 -0
- package/esm/coordinate/fisheyeY.js.map +1 -0
- package/esm/coordinate/helix.d.ts +7 -0
- package/esm/coordinate/helix.js +11 -0
- package/esm/coordinate/helix.js.map +1 -0
- package/esm/coordinate/index.d.ts +24 -5
- package/esm/coordinate/index.js +7 -0
- package/esm/coordinate/index.js.map +1 -1
- package/esm/coordinate/reflect.d.ts +7 -0
- package/esm/coordinate/reflect.js +10 -0
- package/esm/coordinate/reflect.js.map +1 -0
- package/esm/coordinate/reflectX.d.ts +7 -0
- package/esm/coordinate/reflectX.js +10 -0
- package/esm/coordinate/reflectX.js.map +1 -0
- package/esm/coordinate/reflectY.d.ts +7 -0
- package/esm/coordinate/reflectY.js +10 -0
- package/esm/coordinate/reflectY.js.map +1 -0
- package/esm/coordinate/theta.d.ts +7 -0
- package/esm/coordinate/theta.js +11 -0
- package/esm/coordinate/theta.js.map +1 -0
- package/esm/data/arc.d.ts +7 -0
- package/esm/data/arc.js +11 -0
- package/esm/data/arc.js.map +1 -0
- package/esm/data/cluster.d.ts +8 -0
- package/esm/data/cluster.js +37 -0
- package/esm/data/cluster.js.map +1 -0
- 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.d.ts +4 -0
- package/esm/data/fetch.js +28 -0
- package/esm/data/fetch.js.map +1 -0
- package/esm/data/filterBy.d.ts +8 -0
- package/esm/data/filterBy.js +17 -0
- package/esm/data/filterBy.js.map +1 -0
- package/esm/data/fold.d.ts +10 -0
- package/esm/data/fold.js +24 -0
- package/esm/data/fold.js.map +1 -0
- package/esm/data/index.d.ts +28 -0
- package/esm/data/index.js +15 -0
- package/esm/data/index.js.map +1 -0
- package/esm/data/inline.d.ts +4 -0
- package/esm/data/inline.js +6 -0
- package/esm/data/inline.js.map +1 -0
- 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/pick.d.ts +7 -0
- package/esm/data/pick.js +10 -0
- package/esm/data/pick.js.map +1 -0
- package/esm/data/rename.d.ts +8 -0
- package/esm/data/rename.js +17 -0
- package/esm/data/rename.js.map +1 -0
- package/esm/data/sankey.d.ts +8 -0
- package/esm/data/sankey.js +77 -0
- package/esm/data/sankey.js.map +1 -0
- package/esm/data/sortBy.d.ts +7 -0
- package/esm/data/sortBy.js +24 -0
- package/esm/data/sortBy.js.map +1 -0
- package/esm/data/subset.d.ts +7 -0
- package/esm/data/subset.js +26 -0
- package/esm/data/subset.js.map +1 -0
- package/esm/data/tree.d.ts +4 -0
- package/esm/data/tree.js +7 -0
- package/esm/data/tree.js.map +1 -0
- package/esm/{transform → data}/utils/arc/arc.d.ts +0 -0
- package/esm/{transform → data}/utils/arc/arc.js +0 -0
- package/esm/data/utils/arc/arc.js.map +1 -0
- package/esm/data/utils/arc/index.d.ts +2 -0
- package/esm/{transform → data}/utils/arc/index.js +0 -0
- package/esm/data/utils/arc/index.js.map +1 -0
- package/esm/{transform → data}/utils/arc/sort.d.ts +0 -0
- package/esm/{transform → data}/utils/arc/sort.js +0 -0
- package/esm/data/utils/arc/sort.js.map +1 -0
- package/esm/{transform → data}/utils/arc/types.d.ts +0 -0
- package/esm/{transform → data}/utils/arc/types.js +0 -0
- package/esm/data/utils/arc/types.js.map +1 -0
- package/esm/{transform → data}/utils/d3-cloud/index.d.ts +0 -0
- package/esm/{transform → data}/utils/d3-cloud/index.js +0 -0
- package/esm/data/utils/d3-cloud/index.js.map +1 -0
- package/esm/{transform → data}/utils/d3-sankey/align.d.ts +0 -0
- package/esm/{transform → data}/utils/d3-sankey/align.js +0 -0
- package/esm/data/utils/d3-sankey/align.js.map +1 -0
- package/esm/{transform → data}/utils/d3-sankey/constant.d.ts +0 -0
- package/esm/{transform → data}/utils/d3-sankey/constant.js +0 -0
- package/esm/data/utils/d3-sankey/constant.js.map +1 -0
- package/esm/{transform → data}/utils/d3-sankey/index.d.ts +0 -0
- package/esm/{transform → data}/utils/d3-sankey/index.js +0 -0
- package/esm/data/utils/d3-sankey/index.js.map +1 -0
- package/esm/{transform → data}/utils/d3-sankey/sankey.d.ts +0 -0
- package/esm/{transform → data}/utils/d3-sankey/sankey.js +0 -0
- package/esm/data/utils/d3-sankey/sankey.js.map +1 -0
- 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/{transform → data}/utils/flow.d.ts +0 -0
- package/esm/{transform → data}/utils/flow.js +0 -0
- package/esm/data/utils/flow.js.map +1 -0
- package/esm/{transform → data}/utils/memo.d.ts +0 -0
- package/esm/{transform → data}/utils/memo.js +0 -0
- package/esm/data/utils/memo.js.map +1 -0
- package/esm/data/voronoi.d.ts +1 -0
- package/esm/data/voronoi.js +6 -0
- package/esm/data/voronoi.js.map +1 -0
- package/esm/data/wordCloud.d.ts +1 -0
- package/esm/data/wordCloud.js +8 -0
- package/esm/data/wordCloud.js.map +1 -0
- package/esm/encode/index.d.ts +8 -4
- package/esm/encode/index.js.map +1 -1
- package/esm/index.d.ts +1 -1
- package/esm/index.js +1 -1
- package/esm/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/action/service/fisheyeFocus.js +7 -3
- package/esm/interaction/action/service/fisheyeFocus.js.map +1 -1
- package/esm/interaction/action/transformer/filter.js +9 -3
- package/esm/interaction/action/transformer/filter.js.map +1 -1
- package/esm/interaction/builtin/fisheye.d.ts +2 -0
- 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/labelLayout/hideOverlap.d.ts +2 -0
- package/esm/labelLayout/hideOverlap.js +38 -0
- package/esm/labelLayout/hideOverlap.js.map +1 -0
- package/esm/labelLayout/index.d.ts +1 -0
- package/esm/labelLayout/index.js +2 -0
- package/esm/labelLayout/index.js.map +1 -0
- 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/box.d.ts +34 -0
- package/esm/mark/geometry/box.js +90 -0
- 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/mark/utils.d.ts +1 -3
- package/esm/mark/utils.js +1 -1
- package/esm/mark/utils.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 +19 -6
- package/esm/runtime/component.js.map +1 -1
- package/esm/runtime/coordinate.d.ts +4 -0
- package/esm/runtime/coordinate.js +16 -0
- package/esm/runtime/coordinate.js.map +1 -1
- package/esm/runtime/index.d.ts +1 -0
- package/esm/runtime/index.js +1 -0
- package/esm/runtime/index.js.map +1 -1
- package/esm/runtime/layout.js.map +1 -1
- package/esm/runtime/mark.d.ts +3 -3
- package/esm/runtime/mark.js +38 -93
- package/esm/runtime/mark.js.map +1 -1
- package/esm/runtime/plot.js +64 -39
- package/esm/runtime/plot.js.map +1 -1
- package/esm/runtime/render.js +19 -21
- package/esm/runtime/render.js.map +1 -1
- package/esm/runtime/scale.js +15 -6
- package/esm/runtime/scale.js.map +1 -1
- package/esm/runtime/transform.d.ts +9 -0
- package/esm/runtime/transform.js +144 -0
- package/esm/runtime/transform.js.map +1 -0
- package/esm/runtime/types/common.d.ts +5 -3
- package/esm/runtime/types/component.d.ts +7 -6
- package/esm/runtime/types/data.d.ts +7 -0
- package/esm/runtime/types/data.js +2 -0
- package/esm/runtime/types/data.js.map +1 -0
- package/esm/runtime/types/encode.d.ts +4 -2
- package/esm/runtime/types/options.d.ts +7 -3
- package/esm/runtime/types/transform.d.ts +6 -12
- 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/box/box.js +87 -0
- 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/interval/colorRect.js +4 -22
- package/esm/shape/interval/colorRect.js.map +1 -1
- package/esm/shape/label/label.js +109 -14
- 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/link/arc.js.map +1 -0
- package/esm/shape/{edge → link}/smoothEdge.d.ts +0 -0
- package/esm/shape/{edge → link}/smoothEdge.js +0 -0
- package/esm/shape/link/smoothEdge.js.map +1 -0
- package/esm/shape/{edge → link}/vhv.d.ts +0 -0
- package/esm/shape/{edge → link}/vhv.js +0 -0
- package/esm/shape/link/vhv.js.map +1 -0
- 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/shape/utils.d.ts +7 -0
- package/esm/shape/utils.js +23 -0
- package/esm/shape/utils.js.map +1 -1
- package/esm/spec/composition.d.ts +8 -5
- package/esm/spec/coordinate.d.ts +46 -2
- package/esm/spec/data.d.ts +191 -0
- package/esm/spec/data.js +2 -0
- package/esm/spec/data.js.map +1 -0
- package/esm/spec/geometry.d.ts +7 -4
- package/esm/spec/index.d.ts +2 -1
- package/esm/spec/index.js +2 -1
- package/esm/spec/index.js.map +1 -1
- package/esm/spec/labelLayout.d.ts +4 -0
- package/esm/spec/labelLayout.js +2 -0
- package/esm/spec/labelLayout.js.map +1 -0
- package/esm/spec/transform.d.ts +66 -164
- package/esm/stdlib/index.js +34 -27
- package/esm/stdlib/index.js.map +1 -1
- package/esm/theme/light.js +1 -0
- package/esm/theme/light.js.map +1 -1
- package/esm/transform/Select.d.ts +9 -0
- package/esm/transform/Select.js +53 -0
- package/esm/transform/Select.js.map +1 -0
- package/esm/transform/SelectX.d.ts +7 -0
- package/esm/transform/SelectX.js +21 -0
- package/esm/transform/SelectX.js.map +1 -0
- package/esm/transform/SelectY.d.ts +7 -0
- package/esm/transform/SelectY.js +21 -0
- package/esm/transform/SelectY.js.map +1 -0
- package/esm/transform/dodgeX.d.ts +9 -0
- package/esm/transform/dodgeX.js +60 -0
- package/esm/transform/dodgeX.js.map +1 -0
- 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.d.ts +9 -0
- package/esm/transform/groupX.js +87 -0
- package/esm/transform/groupX.js.map +1 -0
- package/esm/transform/index.d.ts +46 -36
- package/esm/transform/index.js +23 -39
- package/esm/transform/index.js.map +1 -1
- package/esm/transform/jitter.d.ts +9 -0
- package/esm/transform/jitter.js +36 -0
- package/esm/transform/jitter.js.map +1 -0
- package/esm/transform/jitterY.d.ts +8 -0
- package/esm/transform/jitterY.js +21 -0
- package/esm/transform/jitterY.js.map +1 -0
- package/esm/transform/maybeKey.d.ts +6 -0
- package/esm/transform/maybeKey.js +32 -0
- package/esm/transform/maybeKey.js.map +1 -0
- package/esm/transform/maybeSeries.d.ts +6 -0
- package/esm/transform/maybeSeries.js +17 -0
- package/esm/transform/maybeSeries.js.map +1 -0
- package/esm/transform/maybeSize.d.ts +7 -0
- package/esm/transform/maybeSize.js +20 -0
- package/esm/transform/maybeSize.js.map +1 -0
- package/esm/transform/maybeStackY.d.ts +9 -0
- package/esm/transform/maybeStackY.js +30 -0
- package/esm/transform/maybeStackY.js.map +1 -0
- package/esm/transform/maybeTitleX.d.ts +6 -0
- package/esm/transform/maybeTitleX.js +17 -0
- package/esm/transform/maybeTitleX.js.map +1 -0
- package/esm/transform/maybeTooltip.d.ts +8 -0
- package/esm/transform/maybeTooltip.js +29 -0
- package/esm/transform/maybeTooltip.js.map +1 -0
- package/esm/transform/maybeTooltipPosition.d.ts +7 -0
- package/esm/transform/maybeTooltipPosition.js +10 -0
- package/esm/transform/maybeTooltipPosition.js.map +1 -0
- package/esm/transform/maybeTooltipY.d.ts +6 -0
- package/esm/transform/maybeTooltipY.js +9 -0
- package/esm/transform/maybeTooltipY.js.map +1 -0
- package/esm/transform/maybeZeroX.d.ts +7 -0
- package/esm/transform/maybeZeroX.js +22 -0
- package/esm/transform/maybeZeroX.js.map +1 -0
- package/esm/transform/maybeZeroY.d.ts +6 -0
- package/esm/transform/maybeZeroY.js +21 -0
- package/esm/transform/maybeZeroY.js.map +1 -0
- package/esm/transform/maybeZeroY1.d.ts +6 -0
- package/esm/transform/maybeZeroY1.js +21 -0
- package/esm/transform/maybeZeroY1.js.map +1 -0
- package/esm/transform/normalizeY.d.ts +9 -0
- package/esm/transform/normalizeY.js +68 -0
- package/esm/transform/normalizeY.js.map +1 -0
- 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/stackEnter.d.ts +13 -0
- package/esm/transform/stackEnter.js +62 -0
- package/esm/transform/stackEnter.js.map +1 -0
- package/esm/transform/stackY.d.ts +9 -0
- package/esm/transform/stackY.js +73 -0
- package/esm/transform/stackY.js.map +1 -0
- package/esm/transform/symmetryY.d.ts +8 -0
- package/esm/transform/symmetryY.js +60 -0
- package/esm/transform/symmetryY.js.map +1 -0
- package/esm/transform/utils/helper.d.ts +11 -10
- package/esm/transform/utils/helper.js +27 -33
- package/esm/transform/utils/helper.js.map +1 -1
- package/esm/transform/utils/order.d.ts +9 -0
- package/esm/transform/utils/order.js +72 -0
- package/esm/transform/utils/order.js.map +1 -0
- package/esm/utils/coordinate.d.ts +2 -0
- package/esm/utils/coordinate.js +7 -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/fadeIn.js +4 -6
- package/lib/animation/fadeIn.js.map +1 -1
- package/lib/animation/fadeOut.js +4 -4
- package/lib/animation/fadeOut.js.map +1 -1
- package/lib/animation/index.d.ts +14 -7
- package/lib/animation/index.js.map +1 -1
- package/lib/animation/morphing.js +4 -5
- package/lib/animation/morphing.js.map +1 -1
- package/lib/animation/scaleInX.js +7 -5
- package/lib/animation/scaleInX.js.map +1 -1
- package/lib/animation/scaleInY.js +7 -5
- package/lib/animation/scaleInY.js.map +1 -1
- package/lib/animation/scaleOutX.js +4 -5
- package/lib/animation/scaleOutX.js.map +1 -1
- package/lib/animation/scaleOutY.js +4 -5
- package/lib/animation/scaleOutY.js.map +1 -1
- package/lib/api/chart.d.ts +8 -1
- package/lib/api/chart.js +32 -7
- package/lib/api/chart.js.map +1 -1
- package/lib/api/composition/circle.js.map +1 -1
- package/lib/api/composition/flex.js.map +1 -1
- package/lib/api/composition/keyframe.js.map +1 -1
- package/lib/api/composition/layer.js.map +1 -1
- package/lib/api/composition/matrix.js.map +1 -1
- package/lib/api/composition/rect.js.map +1 -1
- package/lib/api/composition/view.js.map +1 -1
- package/lib/api/index.d.ts +1 -0
- package/lib/api/index.js +3 -1
- package/lib/api/index.js.map +1 -1
- package/lib/api/library.d.ts +3 -0
- package/lib/api/library.js +11 -0
- package/lib/api/library.js.map +1 -0
- 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/circle.js +1 -1
- package/lib/composition/circle.js.map +1 -1
- package/lib/composition/flex.js +4 -2
- package/lib/composition/flex.js.map +1 -1
- package/lib/composition/index.d.ts +16 -8
- package/lib/composition/index.js.map +1 -1
- package/lib/composition/layer.js +3 -3
- package/lib/composition/layer.js.map +1 -1
- package/lib/composition/mark.js +2 -1
- package/lib/composition/mark.js.map +1 -1
- package/lib/composition/rect.js +29 -30
- package/lib/composition/rect.js.map +1 -1
- package/lib/composition/utils.d.ts +6 -0
- package/lib/composition/utils.js +21 -1
- package/lib/composition/utils.js.map +1 -1
- package/lib/composition/view.js +3 -2
- package/lib/composition/view.js.map +1 -1
- package/lib/coordinate/fisheye.d.ts +1 -1
- package/lib/coordinate/fisheye.js +1 -1
- package/lib/coordinate/fisheye.js.map +1 -1
- package/lib/coordinate/fisheyeX.d.ts +7 -0
- package/lib/coordinate/fisheyeX.js +10 -0
- package/lib/coordinate/fisheyeX.js.map +1 -0
- package/lib/coordinate/fisheyeY.d.ts +7 -0
- package/lib/coordinate/fisheyeY.js +10 -0
- package/lib/coordinate/fisheyeY.js.map +1 -0
- package/lib/coordinate/helix.d.ts +7 -0
- package/lib/coordinate/helix.js +15 -0
- package/lib/coordinate/helix.js.map +1 -0
- package/lib/coordinate/index.d.ts +24 -5
- package/lib/coordinate/index.js +15 -1
- package/lib/coordinate/index.js.map +1 -1
- package/lib/coordinate/reflect.d.ts +7 -0
- package/lib/coordinate/reflect.js +14 -0
- package/lib/coordinate/reflect.js.map +1 -0
- package/lib/coordinate/reflectX.d.ts +7 -0
- package/lib/coordinate/reflectX.js +14 -0
- package/lib/coordinate/reflectX.js.map +1 -0
- package/lib/coordinate/reflectY.d.ts +7 -0
- package/lib/coordinate/reflectY.js +14 -0
- package/lib/coordinate/reflectY.js.map +1 -0
- package/lib/coordinate/theta.d.ts +7 -0
- package/lib/coordinate/theta.js +15 -0
- package/lib/coordinate/theta.js.map +1 -0
- package/lib/data/arc.d.ts +7 -0
- package/lib/data/arc.js +15 -0
- package/lib/data/arc.js.map +1 -0
- package/lib/data/cluster.d.ts +8 -0
- package/lib/data/cluster.js +42 -0
- package/lib/data/cluster.js.map +1 -0
- 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.d.ts +4 -0
- package/lib/data/fetch.js +32 -0
- package/lib/data/fetch.js.map +1 -0
- package/lib/data/filterBy.d.ts +8 -0
- package/lib/data/filterBy.js +21 -0
- package/lib/data/filterBy.js.map +1 -0
- package/lib/data/fold.d.ts +10 -0
- package/lib/data/fold.js +29 -0
- package/lib/data/fold.js.map +1 -0
- package/lib/data/index.d.ts +28 -0
- package/lib/data/index.js +32 -0
- package/lib/data/index.js.map +1 -0
- package/lib/data/inline.d.ts +4 -0
- package/lib/data/inline.js +10 -0
- package/lib/data/inline.js.map +1 -0
- 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/pick.d.ts +7 -0
- package/lib/data/pick.js +14 -0
- package/lib/data/pick.js.map +1 -0
- package/lib/data/rename.d.ts +8 -0
- package/lib/data/rename.js +22 -0
- package/lib/data/rename.js.map +1 -0
- package/lib/data/sankey.d.ts +8 -0
- package/lib/data/sankey.js +81 -0
- package/lib/data/sankey.js.map +1 -0
- package/lib/data/sortBy.d.ts +7 -0
- package/lib/data/sortBy.js +28 -0
- package/lib/data/sortBy.js.map +1 -0
- package/lib/data/subset.d.ts +7 -0
- package/lib/data/subset.js +30 -0
- package/lib/data/subset.js.map +1 -0
- package/lib/data/tree.d.ts +4 -0
- package/lib/data/tree.js +11 -0
- package/lib/data/tree.js.map +1 -0
- package/lib/{transform → data}/utils/arc/arc.d.ts +0 -0
- package/lib/{transform → data}/utils/arc/arc.js +0 -0
- package/lib/data/utils/arc/arc.js.map +1 -0
- package/lib/data/utils/arc/index.d.ts +2 -0
- package/lib/{transform → data}/utils/arc/index.js +0 -0
- package/lib/data/utils/arc/index.js.map +1 -0
- package/lib/{transform → data}/utils/arc/sort.d.ts +0 -0
- package/lib/{transform → data}/utils/arc/sort.js +0 -0
- package/lib/data/utils/arc/sort.js.map +1 -0
- package/lib/{transform → data}/utils/arc/types.d.ts +0 -0
- package/lib/{transform → data}/utils/arc/types.js +0 -0
- package/lib/data/utils/arc/types.js.map +1 -0
- package/lib/{transform → data}/utils/d3-cloud/index.d.ts +0 -0
- package/lib/{transform → data}/utils/d3-cloud/index.js +0 -0
- package/lib/data/utils/d3-cloud/index.js.map +1 -0
- package/lib/{transform → data}/utils/d3-sankey/align.d.ts +0 -0
- package/lib/{transform → data}/utils/d3-sankey/align.js +0 -0
- package/lib/data/utils/d3-sankey/align.js.map +1 -0
- package/lib/{transform → data}/utils/d3-sankey/constant.d.ts +0 -0
- package/lib/{transform → data}/utils/d3-sankey/constant.js +0 -0
- package/lib/data/utils/d3-sankey/constant.js.map +1 -0
- package/lib/{transform → data}/utils/d3-sankey/index.d.ts +0 -0
- package/lib/{transform → data}/utils/d3-sankey/index.js +0 -0
- package/lib/data/utils/d3-sankey/index.js.map +1 -0
- package/lib/{transform → data}/utils/d3-sankey/sankey.d.ts +0 -0
- package/lib/{transform → data}/utils/d3-sankey/sankey.js +0 -0
- package/lib/data/utils/d3-sankey/sankey.js.map +1 -0
- 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/{transform → data}/utils/flow.d.ts +0 -0
- package/lib/{transform → data}/utils/flow.js +0 -0
- package/lib/data/utils/flow.js.map +1 -0
- package/lib/{transform → data}/utils/memo.d.ts +0 -0
- package/lib/{transform → data}/utils/memo.js +0 -0
- package/lib/data/utils/memo.js.map +1 -0
- package/lib/data/voronoi.d.ts +1 -0
- package/lib/data/voronoi.js +7 -0
- package/lib/data/voronoi.js.map +1 -0
- package/lib/data/wordCloud.d.ts +1 -0
- package/lib/data/wordCloud.js +9 -0
- package/lib/data/wordCloud.js.map +1 -0
- package/lib/encode/index.d.ts +8 -4
- package/lib/encode/index.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -1
- package/lib/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/action/service/fisheyeFocus.js +7 -3
- package/lib/interaction/action/service/fisheyeFocus.js.map +1 -1
- package/lib/interaction/action/transformer/filter.js +9 -3
- package/lib/interaction/action/transformer/filter.js.map +1 -1
- package/lib/interaction/builtin/fisheye.d.ts +2 -0
- 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/labelLayout/hideOverlap.d.ts +2 -0
- package/lib/labelLayout/hideOverlap.js +42 -0
- package/lib/labelLayout/hideOverlap.js.map +1 -0
- package/lib/labelLayout/index.d.ts +1 -0
- package/lib/labelLayout/index.js +6 -0
- package/lib/labelLayout/index.js.map +1 -0
- package/lib/mark/annotation/index.d.ts +14 -7
- package/lib/mark/annotation/index.js.map +1 -1
- package/lib/mark/geometry/box.d.ts +34 -0
- package/lib/mark/geometry/box.js +94 -0
- 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/mark/utils.d.ts +1 -3
- package/lib/mark/utils.js +1 -1
- package/lib/mark/utils.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 +18 -5
- package/lib/runtime/component.js.map +1 -1
- package/lib/runtime/coordinate.d.ts +4 -0
- package/lib/runtime/coordinate.js +21 -1
- package/lib/runtime/coordinate.js.map +1 -1
- package/lib/runtime/index.d.ts +1 -0
- package/lib/runtime/index.js +1 -0
- package/lib/runtime/index.js.map +1 -1
- package/lib/runtime/layout.js.map +1 -1
- package/lib/runtime/mark.d.ts +3 -3
- package/lib/runtime/mark.js +37 -92
- package/lib/runtime/mark.js.map +1 -1
- package/lib/runtime/plot.js +62 -37
- package/lib/runtime/plot.js.map +1 -1
- package/lib/runtime/render.js +18 -20
- package/lib/runtime/render.js.map +1 -1
- package/lib/runtime/scale.js +14 -5
- package/lib/runtime/scale.js.map +1 -1
- package/lib/runtime/transform.d.ts +9 -0
- package/lib/runtime/transform.js +154 -0
- package/lib/runtime/transform.js.map +1 -0
- package/lib/runtime/types/common.d.ts +5 -3
- package/lib/runtime/types/component.d.ts +7 -6
- package/lib/runtime/types/data.d.ts +7 -0
- package/lib/runtime/types/data.js +3 -0
- package/lib/runtime/types/data.js.map +1 -0
- package/lib/runtime/types/encode.d.ts +4 -2
- package/lib/runtime/types/options.d.ts +7 -3
- package/lib/runtime/types/transform.d.ts +6 -12
- 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/box/box.js +91 -0
- 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/interval/colorRect.js +2 -20
- package/lib/shape/interval/colorRect.js.map +1 -1
- package/lib/shape/label/label.js +108 -13
- 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/link/arc.js.map +1 -0
- package/lib/shape/{edge → link}/smoothEdge.d.ts +0 -0
- package/lib/shape/{edge → link}/smoothEdge.js +0 -0
- package/lib/shape/link/smoothEdge.js.map +1 -0
- package/lib/shape/{edge → link}/vhv.d.ts +0 -0
- package/lib/shape/{edge → link}/vhv.js +0 -0
- package/lib/shape/link/vhv.js.map +1 -0
- 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/shape/utils.d.ts +7 -0
- package/lib/shape/utils.js +25 -1
- package/lib/shape/utils.js.map +1 -1
- package/lib/spec/composition.d.ts +8 -5
- package/lib/spec/coordinate.d.ts +46 -2
- package/lib/spec/data.d.ts +191 -0
- package/lib/spec/data.js +3 -0
- package/lib/spec/data.js.map +1 -0
- package/lib/spec/geometry.d.ts +7 -4
- package/lib/spec/index.d.ts +2 -1
- package/lib/spec/index.js +2 -1
- package/lib/spec/index.js.map +1 -1
- package/lib/spec/labelLayout.d.ts +4 -0
- package/lib/spec/labelLayout.js +3 -0
- package/lib/spec/labelLayout.js.map +1 -0
- package/lib/spec/transform.d.ts +66 -164
- package/lib/stdlib/index.js +30 -23
- package/lib/stdlib/index.js.map +1 -1
- package/lib/theme/light.js +1 -0
- package/lib/theme/light.js.map +1 -1
- package/lib/transform/Select.d.ts +9 -0
- package/lib/transform/Select.js +57 -0
- package/lib/transform/Select.js.map +1 -0
- package/lib/transform/SelectX.d.ts +7 -0
- package/lib/transform/SelectX.js +25 -0
- package/lib/transform/SelectX.js.map +1 -0
- package/lib/transform/SelectY.d.ts +7 -0
- package/lib/transform/SelectY.js +25 -0
- package/lib/transform/SelectY.js.map +1 -0
- package/lib/transform/dodgeX.d.ts +9 -0
- package/lib/transform/dodgeX.js +64 -0
- package/lib/transform/dodgeX.js.map +1 -0
- 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.d.ts +9 -0
- package/lib/transform/groupX.js +91 -0
- package/lib/transform/groupX.js.map +1 -0
- package/lib/transform/index.d.ts +46 -36
- package/lib/transform/index.js +26 -55
- package/lib/transform/index.js.map +1 -1
- package/lib/transform/jitter.d.ts +9 -0
- package/lib/transform/jitter.js +41 -0
- package/lib/transform/jitter.js.map +1 -0
- package/lib/transform/jitterY.d.ts +8 -0
- package/lib/transform/jitterY.js +25 -0
- package/lib/transform/jitterY.js.map +1 -0
- package/lib/transform/maybeKey.d.ts +6 -0
- package/lib/transform/maybeKey.js +36 -0
- package/lib/transform/maybeKey.js.map +1 -0
- package/lib/transform/maybeSeries.d.ts +6 -0
- package/lib/transform/maybeSeries.js +21 -0
- package/lib/transform/maybeSeries.js.map +1 -0
- package/lib/transform/maybeSize.d.ts +7 -0
- package/lib/transform/maybeSize.js +24 -0
- package/lib/transform/maybeSize.js.map +1 -0
- package/lib/transform/maybeStackY.d.ts +9 -0
- package/lib/transform/maybeStackY.js +34 -0
- package/lib/transform/maybeStackY.js.map +1 -0
- package/lib/transform/maybeTitleX.d.ts +6 -0
- package/lib/transform/maybeTitleX.js +21 -0
- package/lib/transform/maybeTitleX.js.map +1 -0
- package/lib/transform/maybeTooltip.d.ts +8 -0
- package/lib/transform/maybeTooltip.js +33 -0
- package/lib/transform/maybeTooltip.js.map +1 -0
- package/lib/transform/maybeTooltipPosition.d.ts +7 -0
- package/lib/transform/maybeTooltipPosition.js +14 -0
- package/lib/transform/maybeTooltipPosition.js.map +1 -0
- package/lib/transform/maybeTooltipY.d.ts +6 -0
- package/lib/transform/maybeTooltipY.js +13 -0
- package/lib/transform/maybeTooltipY.js.map +1 -0
- package/lib/transform/maybeZeroX.d.ts +7 -0
- package/lib/transform/maybeZeroX.js +26 -0
- package/lib/transform/maybeZeroX.js.map +1 -0
- package/lib/transform/maybeZeroY.d.ts +6 -0
- package/lib/transform/maybeZeroY.js +25 -0
- package/lib/transform/maybeZeroY.js.map +1 -0
- package/lib/transform/maybeZeroY1.d.ts +6 -0
- package/lib/transform/maybeZeroY1.js +25 -0
- package/lib/transform/maybeZeroY1.js.map +1 -0
- package/lib/transform/normalizeY.d.ts +9 -0
- package/lib/transform/normalizeY.js +72 -0
- package/lib/transform/normalizeY.js.map +1 -0
- 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/stackEnter.d.ts +13 -0
- package/lib/transform/stackEnter.js +66 -0
- package/lib/transform/stackEnter.js.map +1 -0
- package/lib/transform/stackY.d.ts +9 -0
- package/lib/transform/stackY.js +77 -0
- package/lib/transform/stackY.js.map +1 -0
- package/lib/transform/symmetryY.d.ts +8 -0
- package/lib/transform/symmetryY.js +64 -0
- package/lib/transform/symmetryY.js.map +1 -0
- package/lib/transform/utils/helper.d.ts +11 -10
- package/lib/transform/utils/helper.js +32 -38
- package/lib/transform/utils/helper.js.map +1 -1
- package/lib/transform/utils/order.d.ts +9 -0
- package/lib/transform/utils/order.js +79 -0
- package/lib/transform/utils/order.js.map +1 -0
- package/lib/utils/coordinate.d.ts +2 -0
- package/lib/utils/coordinate.js +10 -1
- package/lib/utils/coordinate.js.map +1 -1
- package/package.json +24 -8
- package/src/.DS_Store +0 -0
- package/src/adjust/index.ts +2 -1
- package/src/animation/fadeIn.ts +4 -6
- package/src/animation/fadeOut.ts +4 -4
- package/src/animation/index.ts +15 -7
- package/src/animation/morphing.ts +5 -6
- package/src/animation/scaleInX.ts +12 -5
- package/src/animation/scaleInY.ts +12 -5
- package/src/animation/scaleOutX.ts +9 -5
- package/src/animation/scaleOutY.ts +9 -5
- package/src/api/chart.ts +59 -11
- package/src/api/index.ts +1 -0
- package/src/api/library.ts +12 -0
- 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/circle.ts +1 -1
- package/src/composition/flex.ts +4 -2
- package/src/composition/index.ts +17 -8
- package/src/composition/layer.ts +3 -2
- package/src/composition/mark.ts +3 -0
- package/src/composition/rect.ts +27 -28
- package/src/composition/utils.ts +10 -0
- package/src/composition/view.ts +3 -2
- package/src/coordinate/fisheye.ts +3 -2
- package/src/coordinate/fisheyeX.ts +15 -0
- package/src/coordinate/fisheyeY.ts +15 -0
- package/src/coordinate/helix.ts +21 -0
- package/src/coordinate/index.ts +25 -5
- package/src/coordinate/reflect.ts +15 -0
- package/src/coordinate/reflectX.ts +15 -0
- package/src/coordinate/reflectY.ts +15 -0
- package/src/coordinate/theta.ts +21 -0
- package/src/data/arc.ts +16 -0
- package/src/data/cluster.ts +53 -0
- package/src/data/custom.ts +15 -0
- package/src/data/fetch.ts +28 -0
- package/src/data/filterBy.ts +28 -0
- package/src/data/fold.ts +29 -0
- package/src/data/index.ts +29 -0
- package/src/data/inline.ts +11 -0
- package/src/data/map.ts +15 -0
- package/src/data/pick.ts +15 -0
- package/src/data/rename.ts +26 -0
- package/src/data/sankey.ts +102 -0
- package/src/data/sortBy.ts +33 -0
- package/src/data/subset.ts +35 -0
- package/src/data/tree.ts +12 -0
- package/src/{transform → data}/utils/arc/arc.ts +0 -0
- package/src/data/utils/arc/index.ts +2 -0
- package/src/{transform → data}/utils/arc/sort.ts +0 -0
- package/src/{transform → data}/utils/arc/types.ts +0 -0
- package/src/{transform → data}/utils/d3-cloud/index.ts +0 -0
- package/src/{transform → data}/utils/d3-sankey/align.ts +0 -0
- package/src/{transform → data}/utils/d3-sankey/constant.ts +0 -0
- package/src/{transform → data}/utils/d3-sankey/index.ts +0 -0
- package/src/{transform → data}/utils/d3-sankey/sankey.ts +0 -0
- package/src/data/utils/fields.ts +17 -0
- package/src/{transform → data}/utils/flow.ts +0 -0
- package/src/data/utils/memo.ts +80 -0
- package/src/data/voronoi.ts +32 -0
- package/src/data/wordCloud.ts +117 -0
- package/src/encode/index.ts +9 -4
- package/src/index.ts +1 -1
- package/src/interaction/action/index.ts +43 -45
- package/src/interaction/action/service/fisheyeFocus.ts +16 -3
- package/src/interaction/action/transformer/filter.ts +8 -4
- package/src/interaction/index.ts +17 -1
- package/src/interaction/interactor/index.ts +5 -2
- package/src/interaction/types.ts +1 -1
- package/src/labelLayout/hideOverlap.ts +47 -0
- package/src/labelLayout/index.ts +1 -0
- package/src/mark/annotation/index.ts +15 -25
- package/src/mark/geometry/box.ts +105 -0
- 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/mark/utils.ts +1 -1
- package/src/palette/index.ts +5 -2
- package/src/runtime/component.ts +33 -6
- package/src/runtime/coordinate.ts +20 -0
- package/src/runtime/index.ts +1 -0
- package/src/runtime/layout.ts +1 -1
- package/src/runtime/mark.ts +60 -138
- package/src/runtime/plot.ts +93 -61
- package/src/runtime/render.ts +20 -15
- package/src/runtime/scale.ts +16 -6
- package/src/runtime/transform.ts +159 -0
- package/src/runtime/types/common.ts +5 -2
- package/src/runtime/types/component.ts +14 -13
- package/src/runtime/types/data.ts +10 -0
- package/src/runtime/types/encode.ts +6 -2
- package/src/runtime/types/options.ts +8 -2
- package/src/runtime/types/transform.ts +8 -13
- package/src/scale/index.ts +23 -11
- package/src/shape/annotation/text.ts +16 -4
- package/src/shape/box/box.ts +96 -0
- package/src/shape/index.ts +92 -60
- package/src/shape/interval/colorRect.ts +4 -23
- package/src/shape/label/label.ts +132 -15
- 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/shape/utils.ts +31 -0
- package/src/spec/composition.ts +8 -5
- package/src/spec/coordinate.ts +67 -3
- package/src/spec/data.ts +230 -0
- package/src/spec/geometry.ts +7 -4
- package/src/spec/index.ts +2 -1
- package/src/spec/labelLayout.ts +5 -0
- package/src/spec/transform.ts +129 -195
- package/src/stdlib/index.ts +62 -45
- package/src/theme/light.ts +1 -0
- package/src/transform/dodgeX.ts +60 -0
- package/src/transform/flexX.ts +38 -0
- package/src/transform/groupX.ts +109 -0
- package/src/transform/index.ts +46 -46
- package/src/transform/jitter.ts +45 -0
- package/src/transform/jitterY.ts +26 -0
- package/src/transform/maybeKey.ts +26 -0
- package/src/transform/maybeSeries.ts +20 -0
- package/src/transform/maybeSize.ts +23 -0
- package/src/transform/maybeStackY.ts +37 -0
- package/src/transform/maybeTitleX.ts +20 -0
- package/src/transform/maybeTooltip.ts +34 -0
- package/src/transform/maybeTooltipPosition.ts +14 -0
- package/src/transform/maybeTooltipY.ts +13 -0
- package/src/transform/maybeZeroX.ts +25 -0
- package/src/transform/maybeZeroY.ts +24 -0
- package/src/transform/maybeZeroY1.ts +24 -0
- package/src/transform/normalizeY.ts +69 -0
- package/src/transform/select.ts +53 -0
- package/src/transform/selectX.ts +15 -0
- package/src/transform/selectY.ts +15 -0
- package/src/transform/sortX.ts +48 -0
- package/src/transform/stackEnter.ts +73 -0
- package/src/transform/stackY.ts +84 -0
- package/src/transform/symmetryY.ts +60 -0
- package/src/transform/utils/helper.ts +27 -44
- package/src/transform/utils/order.ts +123 -0
- package/src/utils/coordinate.ts +9 -0
- 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.d.ts +0 -34
- package/esm/mark/geometry/schema.js +0 -90
- 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/arc.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/edge/smoothEdge.js.map +0 -1
- package/esm/shape/edge/vhv.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 +0 -87
- package/esm/shape/schema/box.js.map +0 -1
- package/esm/spec/statistic.d.ts +0 -69
- package/esm/spec/statistic.js +0 -2
- package/esm/spec/statistic.js.map +0 -1
- package/esm/transform/inference/maybeArrayField.d.ts +0 -8
- package/esm/transform/inference/maybeArrayField.js +0 -47
- package/esm/transform/inference/maybeArrayField.js.map +0 -1
- package/esm/transform/inference/maybeKey.d.ts +0 -9
- package/esm/transform/inference/maybeKey.js +0 -33
- package/esm/transform/inference/maybeKey.js.map +0 -1
- package/esm/transform/inference/maybeSeries.d.ts +0 -7
- package/esm/transform/inference/maybeSeries.js +0 -23
- package/esm/transform/inference/maybeSeries.js.map +0 -1
- package/esm/transform/inference/maybeSize.d.ts +0 -7
- package/esm/transform/inference/maybeSize.js +0 -14
- package/esm/transform/inference/maybeSize.js.map +0 -1
- package/esm/transform/inference/maybeStackY.d.ts +0 -9
- package/esm/transform/inference/maybeStackY.js +0 -32
- package/esm/transform/inference/maybeStackY.js.map +0 -1
- package/esm/transform/inference/maybeTitleX.d.ts +0 -7
- package/esm/transform/inference/maybeTitleX.js +0 -23
- package/esm/transform/inference/maybeTitleX.js.map +0 -1
- package/esm/transform/inference/maybeTooltip.d.ts +0 -9
- package/esm/transform/inference/maybeTooltip.js +0 -30
- package/esm/transform/inference/maybeTooltip.js.map +0 -1
- package/esm/transform/inference/maybeTooltipPosition.d.ts +0 -7
- package/esm/transform/inference/maybeTooltipPosition.js +0 -12
- package/esm/transform/inference/maybeTooltipPosition.js.map +0 -1
- package/esm/transform/inference/maybeTooltipY.d.ts +0 -7
- package/esm/transform/inference/maybeTooltipY.js +0 -12
- package/esm/transform/inference/maybeTooltipY.js.map +0 -1
- package/esm/transform/inference/maybeZeroX.d.ts +0 -7
- package/esm/transform/inference/maybeZeroX.js +0 -14
- package/esm/transform/inference/maybeZeroX.js.map +0 -1
- package/esm/transform/inference/maybeZeroY.d.ts +0 -7
- package/esm/transform/inference/maybeZeroY.js +0 -14
- package/esm/transform/inference/maybeZeroY.js.map +0 -1
- package/esm/transform/inference/maybeZeroY1.d.ts +0 -7
- package/esm/transform/inference/maybeZeroY1.js +0 -14
- package/esm/transform/inference/maybeZeroY1.js.map +0 -1
- package/esm/transform/preprocessor/arc.d.ts +0 -7
- package/esm/transform/preprocessor/arc.js +0 -16
- package/esm/transform/preprocessor/arc.js.map +0 -1
- package/esm/transform/preprocessor/cluster.d.ts +0 -5
- package/esm/transform/preprocessor/cluster.js +0 -40
- package/esm/transform/preprocessor/cluster.js.map +0 -1
- package/esm/transform/preprocessor/connector.d.ts +0 -7
- package/esm/transform/preprocessor/connector.js +0 -16
- package/esm/transform/preprocessor/connector.js.map +0 -1
- package/esm/transform/preprocessor/fetch.d.ts +0 -8
- package/esm/transform/preprocessor/fetch.js +0 -36
- package/esm/transform/preprocessor/fetch.js.map +0 -1
- package/esm/transform/preprocessor/filterBy.d.ts +0 -8
- package/esm/transform/preprocessor/filterBy.js +0 -18
- package/esm/transform/preprocessor/filterBy.js.map +0 -1
- package/esm/transform/preprocessor/fold.d.ts +0 -8
- package/esm/transform/preprocessor/fold.js +0 -27
- package/esm/transform/preprocessor/fold.js.map +0 -1
- package/esm/transform/preprocessor/pick.d.ts +0 -7
- package/esm/transform/preprocessor/pick.js +0 -12
- package/esm/transform/preprocessor/pick.js.map +0 -1
- package/esm/transform/preprocessor/rename.d.ts +0 -8
- package/esm/transform/preprocessor/rename.js +0 -20
- package/esm/transform/preprocessor/rename.js.map +0 -1
- package/esm/transform/preprocessor/sankey.d.ts +0 -8
- package/esm/transform/preprocessor/sankey.js +0 -80
- package/esm/transform/preprocessor/sankey.js.map +0 -1
- package/esm/transform/preprocessor/sortBy.d.ts +0 -7
- package/esm/transform/preprocessor/sortBy.js +0 -19
- package/esm/transform/preprocessor/sortBy.js.map +0 -1
- package/esm/transform/preprocessor/subset.d.ts +0 -7
- package/esm/transform/preprocessor/subset.js +0 -31
- package/esm/transform/preprocessor/subset.js.map +0 -1
- package/esm/transform/preprocessor/tree.d.ts +0 -4
- package/esm/transform/preprocessor/tree.js +0 -7
- package/esm/transform/preprocessor/tree.js.map +0 -1
- package/esm/transform/preprocessor/voronoi.d.ts +0 -4
- package/esm/transform/preprocessor/voronoi.js +0 -20
- package/esm/transform/preprocessor/voronoi.js.map +0 -1
- package/esm/transform/preprocessor/wordCloud.d.ts +0 -6
- package/esm/transform/preprocessor/wordCloud.js +0 -106
- package/esm/transform/preprocessor/wordCloud.js.map +0 -1
- package/esm/transform/statistic/Select.d.ts +0 -9
- package/esm/transform/statistic/Select.js +0 -58
- package/esm/transform/statistic/Select.js.map +0 -1
- package/esm/transform/statistic/SelectX.d.ts +0 -7
- package/esm/transform/statistic/SelectX.js +0 -23
- package/esm/transform/statistic/SelectX.js.map +0 -1
- package/esm/transform/statistic/SelectY.d.ts +0 -7
- package/esm/transform/statistic/SelectY.js +0 -23
- package/esm/transform/statistic/SelectY.js.map +0 -1
- package/esm/transform/statistic/dodgeX.d.ts +0 -9
- package/esm/transform/statistic/dodgeX.js +0 -56
- package/esm/transform/statistic/dodgeX.js.map +0 -1
- package/esm/transform/statistic/groupX.d.ts +0 -8
- package/esm/transform/statistic/groupX.js +0 -85
- package/esm/transform/statistic/groupX.js.map +0 -1
- package/esm/transform/statistic/jitter.d.ts +0 -9
- package/esm/transform/statistic/jitter.js +0 -40
- package/esm/transform/statistic/jitter.js.map +0 -1
- package/esm/transform/statistic/jitterY.d.ts +0 -8
- package/esm/transform/statistic/jitterY.js +0 -27
- package/esm/transform/statistic/jitterY.js.map +0 -1
- package/esm/transform/statistic/normalizeY.d.ts +0 -9
- package/esm/transform/statistic/normalizeY.js +0 -70
- package/esm/transform/statistic/normalizeY.js.map +0 -1
- package/esm/transform/statistic/stackEnter.d.ts +0 -13
- package/esm/transform/statistic/stackEnter.js +0 -59
- package/esm/transform/statistic/stackEnter.js.map +0 -1
- package/esm/transform/statistic/stackY.d.ts +0 -9
- package/esm/transform/statistic/stackY.js +0 -55
- package/esm/transform/statistic/stackY.js.map +0 -1
- package/esm/transform/statistic/symmetryY.d.ts +0 -8
- package/esm/transform/statistic/symmetryY.js +0 -61
- package/esm/transform/statistic/symmetryY.js.map +0 -1
- package/esm/transform/statistic/utils.d.ts +0 -9
- package/esm/transform/statistic/utils.js +0 -70
- package/esm/transform/statistic/utils.js.map +0 -1
- package/esm/transform/utils/arc/arc.js.map +0 -1
- package/esm/transform/utils/arc/index.d.ts +0 -2
- package/esm/transform/utils/arc/index.js.map +0 -1
- package/esm/transform/utils/arc/sort.js.map +0 -1
- package/esm/transform/utils/arc/types.js.map +0 -1
- package/esm/transform/utils/d3-cloud/index.js.map +0 -1
- package/esm/transform/utils/d3-sankey/align.js.map +0 -1
- package/esm/transform/utils/d3-sankey/constant.js.map +0 -1
- package/esm/transform/utils/d3-sankey/index.js.map +0 -1
- package/esm/transform/utils/d3-sankey/sankey.js.map +0 -1
- package/esm/transform/utils/flow.js.map +0 -1
- package/esm/transform/utils/memo.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.d.ts +0 -34
- package/lib/mark/geometry/schema.js +0 -94
- 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/arc.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/edge/smoothEdge.js.map +0 -1
- package/lib/shape/edge/vhv.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 +0 -91
- package/lib/shape/schema/box.js.map +0 -1
- package/lib/spec/statistic.d.ts +0 -69
- package/lib/spec/statistic.js +0 -3
- package/lib/spec/statistic.js.map +0 -1
- package/lib/transform/inference/maybeArrayField.d.ts +0 -8
- package/lib/transform/inference/maybeArrayField.js +0 -51
- package/lib/transform/inference/maybeArrayField.js.map +0 -1
- package/lib/transform/inference/maybeKey.d.ts +0 -9
- package/lib/transform/inference/maybeKey.js +0 -37
- package/lib/transform/inference/maybeKey.js.map +0 -1
- package/lib/transform/inference/maybeSeries.d.ts +0 -7
- package/lib/transform/inference/maybeSeries.js +0 -27
- package/lib/transform/inference/maybeSeries.js.map +0 -1
- package/lib/transform/inference/maybeSize.d.ts +0 -7
- package/lib/transform/inference/maybeSize.js +0 -18
- package/lib/transform/inference/maybeSize.js.map +0 -1
- package/lib/transform/inference/maybeStackY.d.ts +0 -9
- package/lib/transform/inference/maybeStackY.js +0 -36
- package/lib/transform/inference/maybeStackY.js.map +0 -1
- package/lib/transform/inference/maybeTitleX.d.ts +0 -7
- package/lib/transform/inference/maybeTitleX.js +0 -27
- package/lib/transform/inference/maybeTitleX.js.map +0 -1
- package/lib/transform/inference/maybeTooltip.d.ts +0 -9
- package/lib/transform/inference/maybeTooltip.js +0 -34
- package/lib/transform/inference/maybeTooltip.js.map +0 -1
- package/lib/transform/inference/maybeTooltipPosition.d.ts +0 -7
- package/lib/transform/inference/maybeTooltipPosition.js +0 -16
- package/lib/transform/inference/maybeTooltipPosition.js.map +0 -1
- package/lib/transform/inference/maybeTooltipY.d.ts +0 -7
- package/lib/transform/inference/maybeTooltipY.js +0 -16
- package/lib/transform/inference/maybeTooltipY.js.map +0 -1
- package/lib/transform/inference/maybeZeroX.d.ts +0 -7
- package/lib/transform/inference/maybeZeroX.js +0 -18
- package/lib/transform/inference/maybeZeroX.js.map +0 -1
- package/lib/transform/inference/maybeZeroY.d.ts +0 -7
- package/lib/transform/inference/maybeZeroY.js +0 -18
- package/lib/transform/inference/maybeZeroY.js.map +0 -1
- package/lib/transform/inference/maybeZeroY1.d.ts +0 -7
- package/lib/transform/inference/maybeZeroY1.js +0 -18
- package/lib/transform/inference/maybeZeroY1.js.map +0 -1
- package/lib/transform/preprocessor/arc.d.ts +0 -7
- package/lib/transform/preprocessor/arc.js +0 -20
- package/lib/transform/preprocessor/arc.js.map +0 -1
- package/lib/transform/preprocessor/cluster.d.ts +0 -5
- package/lib/transform/preprocessor/cluster.js +0 -44
- package/lib/transform/preprocessor/cluster.js.map +0 -1
- package/lib/transform/preprocessor/connector.d.ts +0 -7
- package/lib/transform/preprocessor/connector.js +0 -20
- package/lib/transform/preprocessor/connector.js.map +0 -1
- package/lib/transform/preprocessor/fetch.d.ts +0 -8
- package/lib/transform/preprocessor/fetch.js +0 -40
- package/lib/transform/preprocessor/fetch.js.map +0 -1
- package/lib/transform/preprocessor/filterBy.d.ts +0 -8
- package/lib/transform/preprocessor/filterBy.js +0 -22
- package/lib/transform/preprocessor/filterBy.js.map +0 -1
- package/lib/transform/preprocessor/fold.d.ts +0 -8
- package/lib/transform/preprocessor/fold.js +0 -32
- package/lib/transform/preprocessor/fold.js.map +0 -1
- package/lib/transform/preprocessor/pick.d.ts +0 -7
- package/lib/transform/preprocessor/pick.js +0 -16
- package/lib/transform/preprocessor/pick.js.map +0 -1
- package/lib/transform/preprocessor/rename.d.ts +0 -8
- package/lib/transform/preprocessor/rename.js +0 -25
- package/lib/transform/preprocessor/rename.js.map +0 -1
- package/lib/transform/preprocessor/sankey.d.ts +0 -8
- package/lib/transform/preprocessor/sankey.js +0 -84
- package/lib/transform/preprocessor/sankey.js.map +0 -1
- package/lib/transform/preprocessor/sortBy.d.ts +0 -7
- package/lib/transform/preprocessor/sortBy.js +0 -23
- package/lib/transform/preprocessor/sortBy.js.map +0 -1
- package/lib/transform/preprocessor/subset.d.ts +0 -7
- package/lib/transform/preprocessor/subset.js +0 -35
- package/lib/transform/preprocessor/subset.js.map +0 -1
- package/lib/transform/preprocessor/tree.d.ts +0 -4
- package/lib/transform/preprocessor/tree.js +0 -10
- package/lib/transform/preprocessor/tree.js.map +0 -1
- package/lib/transform/preprocessor/voronoi.d.ts +0 -4
- package/lib/transform/preprocessor/voronoi.js +0 -24
- package/lib/transform/preprocessor/voronoi.js.map +0 -1
- package/lib/transform/preprocessor/wordCloud.d.ts +0 -6
- package/lib/transform/preprocessor/wordCloud.js +0 -112
- package/lib/transform/preprocessor/wordCloud.js.map +0 -1
- package/lib/transform/statistic/Select.d.ts +0 -9
- package/lib/transform/statistic/Select.js +0 -62
- package/lib/transform/statistic/Select.js.map +0 -1
- package/lib/transform/statistic/SelectX.d.ts +0 -7
- package/lib/transform/statistic/SelectX.js +0 -27
- package/lib/transform/statistic/SelectX.js.map +0 -1
- package/lib/transform/statistic/SelectY.d.ts +0 -7
- package/lib/transform/statistic/SelectY.js +0 -27
- package/lib/transform/statistic/SelectY.js.map +0 -1
- package/lib/transform/statistic/dodgeX.d.ts +0 -9
- package/lib/transform/statistic/dodgeX.js +0 -60
- package/lib/transform/statistic/dodgeX.js.map +0 -1
- package/lib/transform/statistic/groupX.d.ts +0 -8
- package/lib/transform/statistic/groupX.js +0 -89
- package/lib/transform/statistic/groupX.js.map +0 -1
- package/lib/transform/statistic/jitter.d.ts +0 -9
- package/lib/transform/statistic/jitter.js +0 -45
- package/lib/transform/statistic/jitter.js.map +0 -1
- package/lib/transform/statistic/jitterY.d.ts +0 -8
- package/lib/transform/statistic/jitterY.js +0 -31
- package/lib/transform/statistic/jitterY.js.map +0 -1
- package/lib/transform/statistic/normalizeY.d.ts +0 -9
- package/lib/transform/statistic/normalizeY.js +0 -74
- package/lib/transform/statistic/normalizeY.js.map +0 -1
- package/lib/transform/statistic/stackEnter.d.ts +0 -13
- package/lib/transform/statistic/stackEnter.js +0 -63
- package/lib/transform/statistic/stackEnter.js.map +0 -1
- package/lib/transform/statistic/stackY.d.ts +0 -9
- package/lib/transform/statistic/stackY.js +0 -59
- package/lib/transform/statistic/stackY.js.map +0 -1
- package/lib/transform/statistic/symmetryY.d.ts +0 -8
- package/lib/transform/statistic/symmetryY.js +0 -65
- package/lib/transform/statistic/symmetryY.js.map +0 -1
- package/lib/transform/statistic/utils.d.ts +0 -9
- package/lib/transform/statistic/utils.js +0 -77
- package/lib/transform/statistic/utils.js.map +0 -1
- package/lib/transform/utils/arc/arc.js.map +0 -1
- package/lib/transform/utils/arc/index.d.ts +0 -2
- package/lib/transform/utils/arc/index.js.map +0 -1
- package/lib/transform/utils/arc/sort.js.map +0 -1
- package/lib/transform/utils/arc/types.js.map +0 -1
- package/lib/transform/utils/d3-cloud/index.js.map +0 -1
- package/lib/transform/utils/d3-sankey/align.js.map +0 -1
- package/lib/transform/utils/d3-sankey/constant.js.map +0 -1
- package/lib/transform/utils/d3-sankey/index.js.map +0 -1
- package/lib/transform/utils/d3-sankey/sankey.js.map +0 -1
- package/lib/transform/utils/flow.js.map +0 -1
- package/lib/transform/utils/memo.js.map +0 -1
- package/src/mark/geometry/edge.ts +0 -40
- package/src/mark/geometry/node.ts +0 -36
- package/src/mark/geometry/schema.ts +0 -105
- 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/schema/box.ts +0 -96
- package/src/spec/statistic.ts +0 -135
- package/src/transform/inference/maybeArrayField.ts +0 -55
- package/src/transform/inference/maybeKey.ts +0 -29
- package/src/transform/inference/maybeSeries.ts +0 -26
- package/src/transform/inference/maybeSize.ts +0 -18
- package/src/transform/inference/maybeStackY.ts +0 -38
- package/src/transform/inference/maybeTitleX.ts +0 -26
- package/src/transform/inference/maybeTooltip.ts +0 -35
- package/src/transform/inference/maybeTooltipPosition.ts +0 -16
- package/src/transform/inference/maybeTooltipY.ts +0 -16
- package/src/transform/inference/maybeZeroX.ts +0 -18
- package/src/transform/inference/maybeZeroY.ts +0 -18
- package/src/transform/inference/maybeZeroY1.ts +0 -18
- package/src/transform/preprocessor/arc.ts +0 -21
- package/src/transform/preprocessor/cluster.ts +0 -56
- package/src/transform/preprocessor/connector.ts +0 -22
- package/src/transform/preprocessor/fetch.ts +0 -32
- package/src/transform/preprocessor/filterBy.ts +0 -24
- package/src/transform/preprocessor/fold.ts +0 -32
- package/src/transform/preprocessor/pick.ts +0 -17
- package/src/transform/preprocessor/rename.ts +0 -29
- package/src/transform/preprocessor/sankey.ts +0 -105
- package/src/transform/preprocessor/sortBy.ts +0 -28
- package/src/transform/preprocessor/subset.ts +0 -40
- package/src/transform/preprocessor/tree.ts +0 -12
- package/src/transform/preprocessor/voronoi.ts +0 -30
- package/src/transform/preprocessor/wordCloud.ts +0 -115
- package/src/transform/statistic/dodgeX.ts +0 -56
- package/src/transform/statistic/groupX.ts +0 -91
- package/src/transform/statistic/jitter.ts +0 -49
- package/src/transform/statistic/jitterY.ts +0 -32
- package/src/transform/statistic/normalizeY.ts +0 -69
- package/src/transform/statistic/select.ts +0 -58
- package/src/transform/statistic/selectX.ts +0 -17
- package/src/transform/statistic/selectY.ts +0 -17
- package/src/transform/statistic/stackEnter.ts +0 -65
- package/src/transform/statistic/stackY.ts +0 -58
- package/src/transform/statistic/symmetryY.ts +0 -59
- package/src/transform/statistic/utils.ts +0 -120
- package/src/transform/utils/arc/index.ts +0 -2
- package/src/transform/utils/memo.ts +0 -79
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { TransformComponent as TC } from '../../runtime';
|
|
2
|
-
import { SortByTransform } from '../../spec';
|
|
3
|
-
import { merge } from '../utils/helper';
|
|
4
|
-
|
|
5
|
-
export type SortByOptions = Omit<SortByTransform, 'type'>;
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Immutable data sort by specified fields.
|
|
9
|
-
*/
|
|
10
|
-
export const SortBy: TC<SortByOptions> = (options) => {
|
|
11
|
-
const { fields: F = [], order = 'ASC' } = options;
|
|
12
|
-
return merge(({ data }) => {
|
|
13
|
-
const asc = (a: any, b: any) =>
|
|
14
|
-
F.reduce(
|
|
15
|
-
(eq, f) => (eq !== 0 ? eq : a[f] < b[f] ? -1 : +(a[f] !== b[f])),
|
|
16
|
-
0,
|
|
17
|
-
);
|
|
18
|
-
const desc = (a: any, b: any) => asc(b, a);
|
|
19
|
-
const comparator = order === 'ASC' ? asc : desc;
|
|
20
|
-
return {
|
|
21
|
-
data: [...data].sort(comparator),
|
|
22
|
-
};
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
SortBy.props = {
|
|
27
|
-
category: 'preprocessor',
|
|
28
|
-
};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { TransformComponent as TC } from '../../runtime';
|
|
2
|
-
import { SubsetTransform } from '../../spec';
|
|
3
|
-
import { merge } from '../utils/helper';
|
|
4
|
-
|
|
5
|
-
function constrain(v: number, min: number, max: number) {
|
|
6
|
-
return Math.min(max, Math.max(min, v));
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export type SubsetOptions = Omit<SubsetTransform, 'type'>;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Immutable data sort by specified fields.
|
|
13
|
-
*/
|
|
14
|
-
export const Subset: TC<SubsetOptions> = (options) => {
|
|
15
|
-
return merge(({ data }) => {
|
|
16
|
-
const { fields = [] } = options;
|
|
17
|
-
|
|
18
|
-
let { start = 0, end = data.length } = options;
|
|
19
|
-
start = constrain(start, 0, data.length - 1);
|
|
20
|
-
end = constrain(end, 1, data.length);
|
|
21
|
-
if (start > end) [start, end] = [end, start];
|
|
22
|
-
|
|
23
|
-
const pick = (v: any) =>
|
|
24
|
-
fields.reduce((datum, field) => {
|
|
25
|
-
// pick the data deeply.
|
|
26
|
-
if (field in v) {
|
|
27
|
-
datum[field] = v[field];
|
|
28
|
-
}
|
|
29
|
-
return datum;
|
|
30
|
-
}, {});
|
|
31
|
-
|
|
32
|
-
return {
|
|
33
|
-
data: data.filter((_, i) => i >= start && i < end).map(pick),
|
|
34
|
-
};
|
|
35
|
-
});
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
Subset.props = {
|
|
39
|
-
category: 'preprocessor',
|
|
40
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { tree } from 'd3-hierarchy';
|
|
2
|
-
import { TransformComponent as TC } from '../../runtime';
|
|
3
|
-
import { TreeTransform } from '../../spec';
|
|
4
|
-
import { hierarchyFunction } from './cluster';
|
|
5
|
-
|
|
6
|
-
export type TreeOptions = Omit<TreeTransform, 'type'>;
|
|
7
|
-
|
|
8
|
-
export const Tree: TC<TreeOptions> = hierarchyFunction(tree);
|
|
9
|
-
|
|
10
|
-
Tree.props = {
|
|
11
|
-
category: 'preprocessor',
|
|
12
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { voronoi } from 'd3-voronoi';
|
|
2
|
-
import { TransformComponent as TC } from '../../runtime';
|
|
3
|
-
import { VoronoiTransform } from '../../spec';
|
|
4
|
-
import { merge } from '../utils/helper';
|
|
5
|
-
|
|
6
|
-
export type VoronoiOptions = Omit<VoronoiTransform, 'type'>;
|
|
7
|
-
|
|
8
|
-
export const Voronoi: TC<VoronoiOptions> = (options) => {
|
|
9
|
-
const { fields: F, as: A, extend } = options;
|
|
10
|
-
const [x, y] = F;
|
|
11
|
-
const [ax, ay] = A;
|
|
12
|
-
|
|
13
|
-
return merge(({ data }) => {
|
|
14
|
-
const polygons = voronoi()
|
|
15
|
-
.x((d) => d[x])
|
|
16
|
-
.y((d) => d[y])
|
|
17
|
-
.extent(extend)
|
|
18
|
-
.polygons(data)
|
|
19
|
-
.map((p) => ({
|
|
20
|
-
...p.data,
|
|
21
|
-
[ax]: p.map((pi) => pi[0]),
|
|
22
|
-
[ay]: p.map((pi) => pi[1]),
|
|
23
|
-
}));
|
|
24
|
-
return { data: polygons };
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
Voronoi.props = {
|
|
29
|
-
category: 'preprocessor',
|
|
30
|
-
};
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { min, max } from 'd3-array';
|
|
2
|
-
import { TransformComponent as TC } from '../../runtime';
|
|
3
|
-
import { WordCloudTransform } from '../../spec';
|
|
4
|
-
import { tagCloud } from '../utils/d3-cloud';
|
|
5
|
-
import { flow } from '../utils/flow';
|
|
6
|
-
import { merge } from '../utils/helper';
|
|
7
|
-
|
|
8
|
-
export type WordCloudOptions = Omit<WordCloudTransform, 'type'>;
|
|
9
|
-
|
|
10
|
-
const DEFAULT_OPTIONS: Partial<WordCloudOptions> = {
|
|
11
|
-
size: [500, 500],
|
|
12
|
-
fontSize: [14, 28],
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export function processImageMask(
|
|
16
|
-
img: HTMLImageElement | string,
|
|
17
|
-
): Promise<HTMLImageElement> {
|
|
18
|
-
return new Promise((res, rej) => {
|
|
19
|
-
if (img instanceof HTMLImageElement) {
|
|
20
|
-
res(img);
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
if (typeof img === 'string') {
|
|
24
|
-
const image = new Image();
|
|
25
|
-
image.crossOrigin = 'anonymous';
|
|
26
|
-
image.src = img;
|
|
27
|
-
image.onload = () => res(image);
|
|
28
|
-
image.onerror = () => {
|
|
29
|
-
console.error(`'image ${img} load failed !!!'`);
|
|
30
|
-
rej();
|
|
31
|
-
};
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
rej();
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export function normalizeFontSize(fontSize: any, range?: [number, number]) {
|
|
39
|
-
if (typeof fontSize === 'function') return fontSize;
|
|
40
|
-
|
|
41
|
-
if (Array.isArray(fontSize)) {
|
|
42
|
-
const [fMin, fMax] = fontSize;
|
|
43
|
-
if (!range) return () => (fMax + fMin) / 2;
|
|
44
|
-
|
|
45
|
-
const [min, max] = range;
|
|
46
|
-
if (max === min) return () => (fMax + fMin) / 2;
|
|
47
|
-
|
|
48
|
-
return ({ value }) => ((fMax - fMin) / (max - min)) * (value - min) + fMin;
|
|
49
|
-
}
|
|
50
|
-
return () => fontSize;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export const WordCloud: TC<WordCloudOptions> = (options) => {
|
|
54
|
-
return merge(async ({ data }) => {
|
|
55
|
-
const cloudOptions = Object.assign({}, DEFAULT_OPTIONS, options);
|
|
56
|
-
const layout = tagCloud();
|
|
57
|
-
|
|
58
|
-
await flow(layout, cloudOptions)
|
|
59
|
-
.set('fontSize', (v) => {
|
|
60
|
-
const arr = data.map((d) => d.value);
|
|
61
|
-
return normalizeFontSize(v, [min(arr) as any, max(arr) as any]);
|
|
62
|
-
})
|
|
63
|
-
.set('font')
|
|
64
|
-
.set('fontStyle')
|
|
65
|
-
.set('fontWeight')
|
|
66
|
-
.set('padding')
|
|
67
|
-
.set('rotate')
|
|
68
|
-
.set('size')
|
|
69
|
-
.set('spiral')
|
|
70
|
-
.set('timeInterval')
|
|
71
|
-
.set('random')
|
|
72
|
-
.set('text')
|
|
73
|
-
.set('on')
|
|
74
|
-
.setAsync('imageMask', processImageMask, layout.createMask);
|
|
75
|
-
|
|
76
|
-
layout.words([...data]);
|
|
77
|
-
|
|
78
|
-
const result = layout.start();
|
|
79
|
-
|
|
80
|
-
const [cw, ch] = cloudOptions.size;
|
|
81
|
-
const defaultBounds = [
|
|
82
|
-
{ x: 0, y: 0 },
|
|
83
|
-
{ x: cw, y: ch },
|
|
84
|
-
];
|
|
85
|
-
const { _bounds: bounds = defaultBounds, _tags, hasImage } = result;
|
|
86
|
-
|
|
87
|
-
const tags = _tags.map(({ x, y, ...rest }) => ({
|
|
88
|
-
...rest,
|
|
89
|
-
x: x + cw / 2,
|
|
90
|
-
y: y + ch / 2,
|
|
91
|
-
}));
|
|
92
|
-
|
|
93
|
-
// Append two data to replace the corner of top-left and bottom-right, avoid calculate the actual bounds will occur some error.
|
|
94
|
-
const [{ x: tlx, y: tly }, { x: brx, y: bry }] = bounds;
|
|
95
|
-
const invisibleText = { text: '', value: 0, opacity: 0, fontSize: 0 };
|
|
96
|
-
tags.push(
|
|
97
|
-
{
|
|
98
|
-
...invisibleText,
|
|
99
|
-
x: hasImage ? 0 : tlx,
|
|
100
|
-
y: hasImage ? 0 : tly,
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
...invisibleText,
|
|
104
|
-
x: hasImage ? cw : brx,
|
|
105
|
-
y: hasImage ? ch : bry,
|
|
106
|
-
},
|
|
107
|
-
);
|
|
108
|
-
|
|
109
|
-
return { data: tags };
|
|
110
|
-
});
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
WordCloud.props = {
|
|
114
|
-
category: 'preprocessor',
|
|
115
|
-
};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { deepMix } from '@antv/util';
|
|
2
|
-
import { TransformComponent as TC } from '../../runtime';
|
|
3
|
-
import { DodgeXTransform } from '../../spec';
|
|
4
|
-
import { column, merge } from '../utils/helper';
|
|
5
|
-
import {
|
|
6
|
-
createGroups,
|
|
7
|
-
normalizeComparator,
|
|
8
|
-
applyOrder,
|
|
9
|
-
domainOf,
|
|
10
|
-
} from './utils';
|
|
11
|
-
|
|
12
|
-
export type DodgeXOptions = Omit<DodgeXTransform, 'type'>;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* The dodge group marks into series by color or series channel,
|
|
16
|
-
* and then produce new series channel for each series by specified order,
|
|
17
|
-
* say to form horizontal "columns" by specified channels.
|
|
18
|
-
*/
|
|
19
|
-
export const DodgeX: TC<DodgeXOptions> = (options = {}) => {
|
|
20
|
-
const { groupBy = 'x', reverse = false, orderBy, ...rest } = options;
|
|
21
|
-
return merge((context) => {
|
|
22
|
-
const { data, encode, columnOf, I, scale } = context;
|
|
23
|
-
const { series, color, y } = encode;
|
|
24
|
-
const { series: scaleSeries } = scale;
|
|
25
|
-
const Y = columnOf(data, y);
|
|
26
|
-
const S = columnOf(data, series || color);
|
|
27
|
-
const domainSeries = domainOf(S, scaleSeries);
|
|
28
|
-
|
|
29
|
-
// Create groups and apply specified order for each group.
|
|
30
|
-
const groups = createGroups(groupBy, context);
|
|
31
|
-
const createComparator = normalizeComparator(orderBy);
|
|
32
|
-
const comparator = createComparator(data, Y, S);
|
|
33
|
-
if (comparator) applyOrder(groups, comparator);
|
|
34
|
-
|
|
35
|
-
// Update series for each mark related to series domain.
|
|
36
|
-
const newS = new Array(I.length);
|
|
37
|
-
for (const G of groups) {
|
|
38
|
-
if (reverse) G.reverse();
|
|
39
|
-
for (let i = 0; i < G.length; i++) {
|
|
40
|
-
newS[G[i]] = domainSeries[i];
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return {
|
|
45
|
-
// Update the domain of series as well.
|
|
46
|
-
scale: deepMix({}, scale, { series: { domain: domainSeries, ...rest } }),
|
|
47
|
-
encode: {
|
|
48
|
-
series: column(newS),
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
});
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
DodgeX.props = {
|
|
55
|
-
category: 'statistic',
|
|
56
|
-
};
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { group, max as d3Max, mean as d3Mean, sum as d3Sum } from 'd3-array';
|
|
2
|
-
import { TransformComponent as TC, Primitive } from '../../runtime';
|
|
3
|
-
import { GroupXTransform, Reducer } from '../../spec';
|
|
4
|
-
import { merge, column, field } from '../utils/helper';
|
|
5
|
-
import { indexOf } from '../../utils/array';
|
|
6
|
-
|
|
7
|
-
export type GroupXOptions = Omit<GroupXTransform, 'type'>;
|
|
8
|
-
|
|
9
|
-
type ReducerFunction = (I: number[], V: Primitive[]) => Primitive;
|
|
10
|
-
|
|
11
|
-
type Formatter = (d: Primitive) => string;
|
|
12
|
-
|
|
13
|
-
function normalizeReducer(reducer: Reducer): [ReducerFunction, Formatter] {
|
|
14
|
-
if (typeof reducer === 'function') return [reducer, null];
|
|
15
|
-
const registry = { mean, max, count, first, last, sum };
|
|
16
|
-
const reducerFunction = registry[reducer];
|
|
17
|
-
if (!reducerFunction) throw new Error(`Unknown reducer: ${reducer}.`);
|
|
18
|
-
return reducerFunction();
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function mean(): [ReducerFunction, Formatter] {
|
|
22
|
-
const reducer: ReducerFunction = (I, V) => d3Mean(I, (i) => +V[i]);
|
|
23
|
-
const formatter: Formatter = (d) => `mean of ${d}`;
|
|
24
|
-
return [reducer, formatter];
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function max(): [ReducerFunction, Formatter] {
|
|
28
|
-
const reducer: ReducerFunction = (I, V) => d3Max(I, (i) => +V[i]);
|
|
29
|
-
const formatter: Formatter = (d) => `max of ${d}`;
|
|
30
|
-
return [reducer, formatter];
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function count(): [ReducerFunction, Formatter] {
|
|
34
|
-
const reducer: ReducerFunction = (I, V) => I.length;
|
|
35
|
-
const formatter: Formatter = (d) => `count of ${d}`;
|
|
36
|
-
return [reducer, formatter];
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function sum(): [ReducerFunction, Formatter] {
|
|
40
|
-
const reducer: ReducerFunction = (I, V) => d3Sum(I, (i) => +V[i]);
|
|
41
|
-
const formatter: Formatter = (d) => `sum of ${d}`;
|
|
42
|
-
return [reducer, formatter];
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function first(): [ReducerFunction, Formatter] {
|
|
46
|
-
const reducer: ReducerFunction = (I, V) => V[0];
|
|
47
|
-
const formatter: Formatter = (d) => `first of ${d}`;
|
|
48
|
-
return [reducer, formatter];
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function last(): [ReducerFunction, Formatter] {
|
|
52
|
-
const reducer: ReducerFunction = (I, V) => V[I[I.length - 1]];
|
|
53
|
-
const formatter: Formatter = (d) => `last of ${d}`;
|
|
54
|
-
return [reducer, formatter];
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* The GroupX transform group data by x channel, and aggregate.
|
|
59
|
-
* @todo Sort among groups and apply reverse options.
|
|
60
|
-
*/
|
|
61
|
-
export const GroupX: TC<GroupXOptions> = (options = {}) => {
|
|
62
|
-
const { orderBy, reverse = false, ...rest } = options;
|
|
63
|
-
return merge((context) => {
|
|
64
|
-
const { data, encode, columnOf, I } = context;
|
|
65
|
-
const { x } = encode;
|
|
66
|
-
const X = columnOf(data, x);
|
|
67
|
-
const groups = X ? Array.from(group(I, (i) => X[i]).values()) : [I];
|
|
68
|
-
const outputs = Object.entries(rest).map(([channel, reducer]) => {
|
|
69
|
-
const { [channel]: e } = encode;
|
|
70
|
-
const V = columnOf(data, e);
|
|
71
|
-
const [reducerFunction, formatter] = normalizeReducer(reducer);
|
|
72
|
-
const RV = groups.map((I) => reducerFunction(I, V ?? data));
|
|
73
|
-
return [channel, column(field(RV, V, formatter))];
|
|
74
|
-
});
|
|
75
|
-
const GD = groups.map((I) => data[I[0]]);
|
|
76
|
-
const GX = groups.map((I) => X[I[0]]);
|
|
77
|
-
const GI = indexOf(groups);
|
|
78
|
-
return {
|
|
79
|
-
I: GI,
|
|
80
|
-
data: GD,
|
|
81
|
-
encode: {
|
|
82
|
-
x: column(field(GX, X)),
|
|
83
|
-
...Object.fromEntries(outputs),
|
|
84
|
-
},
|
|
85
|
-
};
|
|
86
|
-
});
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
GroupX.props = {
|
|
90
|
-
category: 'statistic',
|
|
91
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { Band } from '@antv/scale';
|
|
2
|
-
import { ColumnValue, TransformComponent as TC } from '../../runtime';
|
|
3
|
-
import { JitterTransform } from '../../spec';
|
|
4
|
-
import { merge, column } from '../utils/helper';
|
|
5
|
-
import { random } from '../../utils/helper';
|
|
6
|
-
import { domainOf } from './utils';
|
|
7
|
-
|
|
8
|
-
export type JitterOptions = Omit<JitterTransform, 'type'>;
|
|
9
|
-
|
|
10
|
-
export function rangeOf(
|
|
11
|
-
value: ColumnValue,
|
|
12
|
-
scaleOptions: Record<string, any>,
|
|
13
|
-
padding: number,
|
|
14
|
-
): [number, number] {
|
|
15
|
-
if (value === null) return [-0.5, 0.5];
|
|
16
|
-
const domain = domainOf(value, scaleOptions);
|
|
17
|
-
const scale = new Band({ domain, range: [0, 1], padding });
|
|
18
|
-
const step = scale.getBandWidth();
|
|
19
|
-
return [-step / 2, step / 2];
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* The jitter transform produce dx and dy channels for marks (especially for point)
|
|
24
|
-
* with ordinal x and y dimension, say to make them jitter in their own space.
|
|
25
|
-
*/
|
|
26
|
-
export const Jitter: TC<JitterOptions> = (options = {}) => {
|
|
27
|
-
const { paddingX = 0, paddingY = 0 } = options;
|
|
28
|
-
return merge((context) => {
|
|
29
|
-
const { data, I, columnOf, encode, scale } = context;
|
|
30
|
-
const { x, y } = encode;
|
|
31
|
-
const { x: scaleX, y: scaleY } = scale;
|
|
32
|
-
const X = columnOf(data, x);
|
|
33
|
-
const Y = columnOf(data, y);
|
|
34
|
-
const rangeX = rangeOf(X, scaleX, paddingX);
|
|
35
|
-
const rangeY = rangeOf(Y, scaleY, paddingY);
|
|
36
|
-
const DY = I.map(() => random(...rangeY));
|
|
37
|
-
const DX = I.map(() => random(...rangeX));
|
|
38
|
-
return {
|
|
39
|
-
encode: {
|
|
40
|
-
dy: column(DY),
|
|
41
|
-
dx: column(DX),
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
});
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
Jitter.props = {
|
|
48
|
-
category: 'statistic',
|
|
49
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { TransformComponent as TC } from '../../runtime';
|
|
2
|
-
import { JitterYTransform } from '../../spec';
|
|
3
|
-
import { merge, column } from '../utils/helper';
|
|
4
|
-
import { random } from '../../utils/helper';
|
|
5
|
-
import { rangeOf } from './jitter';
|
|
6
|
-
|
|
7
|
-
export type JitterYOptions = Omit<JitterYTransform, 'type'>;
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* The jitterY transform produce dy channels for marks (especially for point)
|
|
11
|
-
* with ordinal x and y dimension, say to make them jitter in their own space.
|
|
12
|
-
*/
|
|
13
|
-
export const JitterY: TC<JitterYOptions> = (options = {}) => {
|
|
14
|
-
const { padding = 0 } = options;
|
|
15
|
-
return merge((context) => {
|
|
16
|
-
const { data, I, columnOf, encode, scale } = context;
|
|
17
|
-
const { y } = encode;
|
|
18
|
-
const { y: scaleY } = scale;
|
|
19
|
-
const Y = columnOf(data, y);
|
|
20
|
-
const rangeY = rangeOf(Y, scaleY, padding);
|
|
21
|
-
const DY = I.map(() => random(...rangeY));
|
|
22
|
-
return {
|
|
23
|
-
encode: {
|
|
24
|
-
dy: column(DY),
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
JitterY.props = {
|
|
31
|
-
category: 'statistic',
|
|
32
|
-
};
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { mean, extent, deviation, median, sum, max, min } from 'd3-array';
|
|
2
|
-
import { TransformComponent as TC } from '../../runtime';
|
|
3
|
-
import { NormalizeYTransform } from '../../spec';
|
|
4
|
-
import { merge, column, field } from '../utils/helper';
|
|
5
|
-
import { createGroups } from './utils';
|
|
6
|
-
|
|
7
|
-
export type NormalizeYOptions = Omit<NormalizeYTransform, 'type'>;
|
|
8
|
-
|
|
9
|
-
function normalizeBasis(basis: NormalizeYOptions['basis']) {
|
|
10
|
-
const registry = {
|
|
11
|
-
min,
|
|
12
|
-
max,
|
|
13
|
-
first: (d) => d[0],
|
|
14
|
-
last: (d) => d[d.length - 1],
|
|
15
|
-
mean,
|
|
16
|
-
extent,
|
|
17
|
-
median,
|
|
18
|
-
sum,
|
|
19
|
-
deviation,
|
|
20
|
-
};
|
|
21
|
-
return registry[basis] || max;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Group marks into series by specified channels, and then transform
|
|
26
|
-
* each series's value, say to transform them relative to some basis
|
|
27
|
-
* to apply a moving average.
|
|
28
|
-
*/
|
|
29
|
-
export const NormalizeY: TC<NormalizeYOptions> = (options = {}) => {
|
|
30
|
-
const { groupBy = 'x', basis = 'max' } = options;
|
|
31
|
-
return merge((context) => {
|
|
32
|
-
const { data, encode, columnOf, I } = context;
|
|
33
|
-
const { x, ...rest } = encode;
|
|
34
|
-
|
|
35
|
-
// Extract and create new channels starts with y, such as y, y1.
|
|
36
|
-
const Yn = Object.entries(rest)
|
|
37
|
-
.filter(([k]) => k.startsWith('y'))
|
|
38
|
-
.map(([k, encode]) => [k, columnOf(data, encode)] as const);
|
|
39
|
-
const newYn = Yn.map(([k, V]) => {
|
|
40
|
-
const newV = new Array(I.length);
|
|
41
|
-
return [k, field(newV, V)] as const;
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
// Group marks into series by specified keys.
|
|
45
|
-
const groups = createGroups(groupBy, context);
|
|
46
|
-
|
|
47
|
-
// Transform y channels for each group based on basis.
|
|
48
|
-
const basisFunction = normalizeBasis(basis);
|
|
49
|
-
for (const I of groups) {
|
|
50
|
-
const Y = I.flatMap((i) => Yn.map(([, V]) => +V[i]));
|
|
51
|
-
const basisValue = basisFunction(Y);
|
|
52
|
-
for (const i of I) {
|
|
53
|
-
for (let j = 0; j < Yn.length; j++) {
|
|
54
|
-
const [, V] = Yn[j];
|
|
55
|
-
const [, newV] = newYn[j];
|
|
56
|
-
newV[i] = +V[i] / basisValue;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return {
|
|
62
|
-
encode: Object.fromEntries(newYn.map(([k, v]) => [k, column(v)])),
|
|
63
|
-
};
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
NormalizeY.props = {
|
|
68
|
-
category: 'statistic',
|
|
69
|
-
};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { maxIndex, minIndex } from 'd3-array';
|
|
2
|
-
import { TransformComponent as TC } from '../../runtime';
|
|
3
|
-
import { SelectTransform, Selector } from '../../spec';
|
|
4
|
-
import { merge, column } from '../utils/helper';
|
|
5
|
-
import { createGroups } from './utils';
|
|
6
|
-
|
|
7
|
-
export type SelectOptions = Omit<SelectTransform, 'type'>;
|
|
8
|
-
|
|
9
|
-
type SelectorFunction = (I: number[], V: number[]) => number[];
|
|
10
|
-
|
|
11
|
-
function first(I: number[], V: number[]): number[] {
|
|
12
|
-
return [I[0]];
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function last(I: number[], V: number[]): number[] {
|
|
16
|
-
const i = I.length - 1;
|
|
17
|
-
return [I[i]];
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function max(I: number[], V: number[]): number[] {
|
|
21
|
-
const i = maxIndex(I, (i) => V[i]);
|
|
22
|
-
return [I[i]];
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function min(I: number[], V: number[]): number[] {
|
|
26
|
-
const i = minIndex(I, (i) => V[i]);
|
|
27
|
-
return [I[i]];
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function normalizeSelector(selector: Selector): SelectorFunction {
|
|
31
|
-
if (typeof selector === 'function') return selector;
|
|
32
|
-
const registry = { first, last, max, min };
|
|
33
|
-
return registry[selector] || first;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* The select transform groups marks with specified channels, and
|
|
38
|
-
* filter index by specified selector for each series, say to
|
|
39
|
-
* pull a single or multiple values out of each series.
|
|
40
|
-
*/
|
|
41
|
-
export const Select: TC<SelectOptions> = (options = {}) => {
|
|
42
|
-
const { groupBy = 'series', ...rest } = options;
|
|
43
|
-
return merge((context) => {
|
|
44
|
-
const { data, columnOf, encode } = context;
|
|
45
|
-
const groups = createGroups(groupBy, context);
|
|
46
|
-
const [channel, selector] = Object.entries(rest)[0];
|
|
47
|
-
const { [channel]: e } = encode;
|
|
48
|
-
const V = columnOf(data, e);
|
|
49
|
-
const selectFunction = normalizeSelector(selector);
|
|
50
|
-
return {
|
|
51
|
-
I: groups.flatMap((GI) => selectFunction(GI, V as number[])),
|
|
52
|
-
};
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
Select.props = {
|
|
57
|
-
category: 'statistic',
|
|
58
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { TransformComponent as TC } from '../../runtime';
|
|
2
|
-
import { SelectXTransform } from '../../spec';
|
|
3
|
-
import { Select } from './Select';
|
|
4
|
-
|
|
5
|
-
export type SelectXOptions = Omit<SelectXTransform, 'type'>;
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* The selectX transform filter index by y channel.
|
|
9
|
-
*/
|
|
10
|
-
export const SelectX: TC<SelectXOptions> = (options = {}) => {
|
|
11
|
-
const { selector, ...rest } = options;
|
|
12
|
-
return Select({ x: selector, ...rest });
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
SelectX.props = {
|
|
16
|
-
category: 'statistic',
|
|
17
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { TransformComponent as TC } from '../../runtime';
|
|
2
|
-
import { SelectYTransform } from '../../spec';
|
|
3
|
-
import { Select } from './Select';
|
|
4
|
-
|
|
5
|
-
export type SelectYOptions = Omit<SelectYTransform, 'type'>;
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* The selectY transform filter index by y channel.
|
|
9
|
-
*/
|
|
10
|
-
export const SelectY: TC<SelectYOptions> = (options = {}) => {
|
|
11
|
-
const { selector, ...rest } = options;
|
|
12
|
-
return Select({ y: selector, ...rest });
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
SelectY.props = {
|
|
16
|
-
category: 'statistic',
|
|
17
|
-
};
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { group, max } from 'd3-array';
|
|
2
|
-
import { TransformComponent as TC } from '../../runtime';
|
|
3
|
-
import { StackEnterTransform } from '../../spec';
|
|
4
|
-
import { merge, column } from '../utils/helper';
|
|
5
|
-
|
|
6
|
-
export type StackEnterOptions = Omit<StackEnterTransform, 'type'>;
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Group marks by channels into groups and stacking their enterDelay
|
|
10
|
-
* to make marks show up groups by groups.
|
|
11
|
-
* It will update enterDelay channel for each mark by its enterDuration and group.
|
|
12
|
-
* @todo Sort among groups(e.g. reverse).
|
|
13
|
-
* @todo Stack enter in groups rather than between groups?
|
|
14
|
-
* @todo Auto inter this statistic for scaleInY animation in stacked interval?
|
|
15
|
-
* @todo All the groups shared the enterDuration?
|
|
16
|
-
*/
|
|
17
|
-
export const StackEnter: TC<StackEnterOptions> = (options) => {
|
|
18
|
-
const { by = ['x'] } = options;
|
|
19
|
-
return merge(({ encode, I, data, columnOf }) => {
|
|
20
|
-
const { enterDuration, enterDelay } = encode;
|
|
21
|
-
if (enterDuration === undefined) return {};
|
|
22
|
-
|
|
23
|
-
// Extract group information by each specified channel,
|
|
24
|
-
// and skip if all values of channels are empty.
|
|
25
|
-
const groupEntries = by.map((k) => [k, columnOf(data, encode[k])]);
|
|
26
|
-
if (groupEntries.length === 0) return {};
|
|
27
|
-
|
|
28
|
-
// Nest group index and flatten them in right order among timeline.
|
|
29
|
-
// [[1, 2, 3, 4, 5, 6]] ->
|
|
30
|
-
// [[1, 2, 3], [4, 5, 6]] ->
|
|
31
|
-
// [[1], [2], [3], [4], [5], [6]]
|
|
32
|
-
let groups = [I];
|
|
33
|
-
for (const [, V] of groupEntries) {
|
|
34
|
-
const newGroups = [];
|
|
35
|
-
for (const I of groups) {
|
|
36
|
-
const G = Array.from(group(I, (i) => V[i]).values());
|
|
37
|
-
// @todo sort by x.
|
|
38
|
-
newGroups.push(...G);
|
|
39
|
-
}
|
|
40
|
-
groups = newGroups;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Stack delay for each group.
|
|
44
|
-
const ED = columnOf(data, enterDuration);
|
|
45
|
-
const EDL = columnOf(data, enterDelay) || new Array(I.length).fill(0);
|
|
46
|
-
const newEnterDelay = new Array(I.length);
|
|
47
|
-
for (let i = 0, pd = 0; i < groups.length; i++) {
|
|
48
|
-
const I = groups[i];
|
|
49
|
-
const maxDuration = max(I, (i) => +ED[i]);
|
|
50
|
-
for (const j of I) newEnterDelay[j] = EDL[j] + pd;
|
|
51
|
-
pd += maxDuration;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return {
|
|
55
|
-
encode: {
|
|
56
|
-
enterDuration: column(ED),
|
|
57
|
-
enterDelay: column(newEnterDelay),
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
StackEnter.props = {
|
|
64
|
-
category: 'statistic',
|
|
65
|
-
};
|