@antv/g2 5.0.0-alpha.0 → 5.0.0-alpha.1
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.min.js +3 -3
- 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/morphing.js +4 -5
- package/esm/animation/morphing.js.map +1 -1
- package/esm/animation/scaleInX.js +4 -5
- package/esm/animation/scaleInX.js.map +1 -1
- package/esm/animation/scaleInY.js +4 -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 +4 -1
- package/esm/api/chart.js +12 -4
- 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/mark.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/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 +7 -0
- 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 +0 -0
- package/esm/data/arc.js +19 -0
- package/esm/data/arc.js.map +1 -0
- package/esm/data/cluster.d.ts +0 -0
- package/esm/data/cluster.js +47 -0
- package/esm/data/cluster.js.map +1 -0
- package/esm/data/connector.d.ts +7 -0
- package/esm/data/connector.js +9 -0
- package/esm/data/connector.js.map +1 -0
- package/esm/data/fetch.d.ts +4 -0
- package/esm/{transform/preprocessor → data}/fetch.js +10 -19
- package/esm/data/fetch.js.map +1 -0
- package/esm/{transform/preprocessor → data}/filterBy.d.ts +3 -3
- package/esm/{transform/preprocessor → data}/filterBy.js +2 -7
- 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 +9 -0
- package/esm/data/index.js +10 -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/pick.d.ts +7 -0
- package/esm/{transform/preprocessor → data}/pick.js +1 -3
- package/esm/data/pick.js.map +1 -0
- package/esm/{transform/preprocessor → data}/rename.d.ts +3 -3
- package/esm/{transform/preprocessor → data}/rename.js +4 -7
- package/esm/data/rename.js.map +1 -0
- package/esm/data/sankey.d.ts +0 -0
- package/esm/data/sankey.js +96 -0
- package/esm/data/sankey.js.map +1 -0
- package/esm/data/sortBy.d.ts +7 -0
- package/esm/{transform/preprocessor → data}/sortBy.js +4 -9
- package/esm/data/sortBy.js.map +1 -0
- package/esm/data/subset.d.ts +7 -0
- package/esm/{transform/preprocessor → data}/subset.js +5 -10
- package/esm/data/subset.js.map +1 -0
- package/esm/data/tree.d.ts +0 -0
- package/esm/data/tree.js +10 -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/{transform → data}/utils/arc/index.d.ts +0 -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/{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 +0 -0
- package/esm/data/voronoi.js +27 -0
- package/esm/data/voronoi.js.map +1 -0
- package/esm/data/wordCloud.d.ts +0 -0
- package/esm/data/wordCloud.js +100 -0
- package/esm/data/wordCloud.js.map +1 -0
- package/esm/index.d.ts +1 -1
- package/esm/index.js +1 -1
- package/esm/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/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/utils.d.ts +1 -3
- package/esm/mark/utils.js +1 -1
- package/esm/mark/utils.js.map +1 -1
- package/esm/runtime/component.js +11 -3
- 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 +34 -90
- package/esm/runtime/mark.js.map +1 -1
- package/esm/runtime/plot.js +19 -13
- package/esm/runtime/plot.js.map +1 -1
- package/esm/runtime/render.js +4 -15
- package/esm/runtime/render.js.map +1 -1
- package/esm/runtime/scale.js +14 -5
- 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 +5 -2
- 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 +6 -3
- package/esm/runtime/types/transform.d.ts +6 -12
- package/esm/shape/interval/colorRect.js +4 -22
- package/esm/shape/interval/colorRect.js.map +1 -1
- package/esm/shape/label/label.js +81 -10
- package/esm/shape/label/label.js.map +1 -1
- 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 +54 -0
- package/esm/spec/data.js +2 -0
- package/esm/spec/data.js.map +1 -0
- package/esm/spec/geometry.d.ts +2 -1
- 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 +58 -166
- package/esm/spec/transform.js +133 -0
- package/esm/spec/transform.js.map +1 -1
- package/esm/stdlib/index.js +28 -17
- 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/{statistic/Select.d.ts → Select.d.ts} +2 -2
- package/esm/transform/{statistic/Select.js → Select.js} +9 -14
- package/esm/transform/Select.js.map +1 -0
- package/esm/transform/{statistic/SelectX.d.ts → SelectX.d.ts} +2 -2
- package/esm/transform/{statistic/SelectX.js → SelectX.js} +1 -3
- package/esm/transform/SelectX.js.map +1 -0
- package/esm/transform/{statistic/SelectY.d.ts → SelectY.d.ts} +2 -2
- package/esm/transform/{statistic/SelectY.js → SelectY.js} +1 -3
- package/esm/transform/SelectY.js.map +1 -0
- package/esm/transform/{statistic/dodgeX.d.ts → dodgeX.d.ts} +2 -2
- package/esm/transform/{statistic/dodgeX.js → dodgeX.js} +19 -19
- package/esm/transform/dodgeX.js.map +1 -0
- package/{lib/transform/statistic → esm/transform}/groupX.d.ts +3 -2
- package/esm/transform/{statistic/groupX.js → groupX.js} +23 -19
- package/esm/transform/groupX.js.map +1 -0
- package/esm/transform/index.d.ts +21 -36
- package/esm/transform/index.js +21 -39
- package/esm/transform/index.js.map +1 -1
- package/esm/transform/{statistic/jitter.d.ts → jitter.d.ts} +3 -3
- package/esm/transform/{statistic/jitter.js → jitter.js} +14 -18
- package/esm/transform/jitter.js.map +1 -0
- package/{lib/transform/statistic → esm/transform}/jitterY.d.ts +2 -2
- 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/{inference/maybeKey.js → maybeKey.js} +11 -12
- 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/{lib/transform/inference → esm/transform}/maybeStackY.d.ts +1 -1
- package/esm/transform/{inference/maybeStackY.js → maybeStackY.js} +11 -13
- 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/{inference/maybeTooltipPosition.d.ts → maybeTooltipPosition.d.ts} +3 -3
- 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/{lib/transform/inference → esm/transform}/maybeZeroX.d.ts +1 -1
- 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/{statistic/normalizeY.d.ts → normalizeY.d.ts} +2 -2
- package/esm/transform/{statistic/normalizeY.js → normalizeY.js} +16 -17
- package/esm/transform/normalizeY.js.map +1 -0
- package/esm/transform/{statistic/stackEnter.d.ts → stackEnter.d.ts} +2 -2
- package/esm/transform/{statistic/stackEnter.js → stackEnter.js} +22 -19
- package/esm/transform/stackEnter.js.map +1 -0
- package/esm/transform/{statistic/stackY.d.ts → stackY.d.ts} +2 -2
- package/esm/transform/{statistic/stackY.js → stackY.js} +20 -19
- package/esm/transform/stackY.js.map +1 -0
- package/esm/transform/{statistic/symmetryY.d.ts → symmetryY.d.ts} +2 -2
- package/esm/transform/{statistic/symmetryY.js → symmetryY.js} +16 -17
- 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/{statistic/utils.d.ts → utils/order.d.ts} +4 -4
- package/esm/transform/{statistic/utils.js → utils/order.js} +7 -5
- package/esm/transform/utils/order.js.map +1 -0
- package/esm/utils/coordinate.d.ts +1 -0
- package/esm/utils/coordinate.js +4 -0
- package/esm/utils/coordinate.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/morphing.js +4 -5
- package/lib/animation/morphing.js.map +1 -1
- package/lib/animation/scaleInX.js +4 -5
- package/lib/animation/scaleInX.js.map +1 -1
- package/lib/animation/scaleInY.js +4 -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 +4 -1
- package/lib/api/chart.js +12 -4
- 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/mark.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/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 +7 -0
- 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 +0 -0
- package/lib/data/arc.js +19 -0
- package/lib/data/arc.js.map +1 -0
- package/lib/data/cluster.d.ts +0 -0
- package/lib/data/cluster.js +47 -0
- package/lib/data/cluster.js.map +1 -0
- package/lib/data/connector.d.ts +7 -0
- package/lib/data/connector.js +13 -0
- package/lib/data/connector.js.map +1 -0
- package/lib/data/fetch.d.ts +4 -0
- package/lib/{transform/preprocessor → data}/fetch.js +10 -19
- package/lib/data/fetch.js.map +1 -0
- package/lib/{transform/preprocessor → data}/filterBy.d.ts +3 -3
- package/lib/{transform/preprocessor → data}/filterBy.js +2 -7
- 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 +9 -0
- package/lib/data/index.js +22 -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/pick.d.ts +7 -0
- package/lib/{transform/preprocessor → data}/pick.js +1 -3
- package/lib/data/pick.js.map +1 -0
- package/lib/{transform/preprocessor → data}/rename.d.ts +3 -3
- package/lib/{transform/preprocessor → data}/rename.js +4 -7
- package/lib/data/rename.js.map +1 -0
- package/lib/data/sankey.d.ts +0 -0
- package/lib/data/sankey.js +96 -0
- package/lib/data/sankey.js.map +1 -0
- package/lib/data/sortBy.d.ts +7 -0
- package/lib/{transform/preprocessor → data}/sortBy.js +4 -9
- package/lib/data/sortBy.js.map +1 -0
- package/lib/data/subset.d.ts +7 -0
- package/lib/{transform/preprocessor → data}/subset.js +5 -10
- package/lib/data/subset.js.map +1 -0
- package/lib/data/tree.d.ts +0 -0
- package/lib/data/tree.js +10 -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/{transform → data}/utils/arc/index.d.ts +0 -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/{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 +0 -0
- package/lib/data/voronoi.js +27 -0
- package/lib/data/voronoi.js.map +1 -0
- package/lib/data/wordCloud.d.ts +0 -0
- package/lib/data/wordCloud.js +100 -0
- package/lib/data/wordCloud.js.map +1 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -1
- package/lib/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/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/utils.d.ts +1 -3
- package/lib/mark/utils.js +1 -1
- package/lib/mark/utils.js.map +1 -1
- package/lib/runtime/component.js +10 -2
- 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 +34 -90
- package/lib/runtime/mark.js.map +1 -1
- package/lib/runtime/plot.js +17 -11
- package/lib/runtime/plot.js.map +1 -1
- package/lib/runtime/render.js +4 -15
- package/lib/runtime/render.js.map +1 -1
- package/lib/runtime/scale.js +13 -4
- 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 +5 -2
- package/lib/runtime/types/data.d.ts +7 -0
- package/lib/{spec/statistic.js → runtime/types/data.js} +1 -1
- 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 +6 -3
- package/lib/runtime/types/transform.d.ts +6 -12
- package/lib/shape/interval/colorRect.js +2 -20
- package/lib/shape/interval/colorRect.js.map +1 -1
- package/lib/shape/label/label.js +80 -9
- package/lib/shape/label/label.js.map +1 -1
- 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 +54 -0
- package/lib/spec/data.js +3 -0
- package/lib/spec/data.js.map +1 -0
- package/lib/spec/geometry.d.ts +2 -1
- 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 +58 -166
- package/lib/spec/transform.js +133 -0
- package/lib/spec/transform.js.map +1 -1
- package/lib/stdlib/index.js +26 -15
- 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/{statistic/Select.d.ts → Select.d.ts} +2 -2
- package/lib/transform/{statistic/Select.js → Select.js} +9 -14
- package/lib/transform/Select.js.map +1 -0
- package/lib/transform/{statistic/SelectX.d.ts → SelectX.d.ts} +2 -2
- package/lib/transform/{statistic/SelectX.js → SelectX.js} +1 -3
- package/lib/transform/SelectX.js.map +1 -0
- package/lib/transform/{statistic/SelectY.d.ts → SelectY.d.ts} +2 -2
- package/lib/transform/{statistic/SelectY.js → SelectY.js} +1 -3
- package/lib/transform/SelectY.js.map +1 -0
- package/lib/transform/{statistic/dodgeX.d.ts → dodgeX.d.ts} +2 -2
- package/lib/transform/{statistic/dodgeX.js → dodgeX.js} +22 -22
- package/lib/transform/dodgeX.js.map +1 -0
- package/{esm/transform/statistic → lib/transform}/groupX.d.ts +3 -2
- package/lib/transform/{statistic/groupX.js → groupX.js} +23 -19
- package/lib/transform/groupX.js.map +1 -0
- package/lib/transform/index.d.ts +21 -36
- package/lib/transform/index.js +22 -55
- package/lib/transform/index.js.map +1 -1
- package/lib/transform/{statistic/jitter.d.ts → jitter.d.ts} +3 -3
- package/lib/transform/{statistic/jitter.js → jitter.js} +16 -20
- package/lib/transform/jitter.js.map +1 -0
- package/{esm/transform/statistic → lib/transform}/jitterY.d.ts +2 -2
- package/lib/transform/{statistic/jitterY.js → jitterY.js} +9 -15
- package/lib/transform/jitterY.js.map +1 -0
- package/lib/transform/maybeKey.d.ts +6 -0
- package/lib/transform/{inference/maybeKey.js → maybeKey.js} +11 -12
- 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/{esm/transform/inference → lib/transform}/maybeStackY.d.ts +1 -1
- package/lib/transform/{inference/maybeStackY.js → maybeStackY.js} +11 -13
- 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/{inference/maybeTooltip.js → maybeTooltip.js} +13 -14
- package/lib/transform/maybeTooltip.js.map +1 -0
- package/lib/transform/{inference/maybeTooltipPosition.d.ts → maybeTooltipPosition.d.ts} +3 -3
- package/lib/transform/{inference/maybeTooltipPosition.js → maybeTooltipPosition.js} +3 -5
- package/lib/transform/maybeTooltipPosition.js.map +1 -0
- package/lib/transform/maybeTooltipY.d.ts +6 -0
- package/lib/transform/{inference/maybeTooltipY.js → maybeTooltipY.js} +2 -5
- package/lib/transform/maybeTooltipY.js.map +1 -0
- package/{esm/transform/inference → lib/transform}/maybeZeroX.d.ts +1 -1
- 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/{statistic/normalizeY.d.ts → normalizeY.d.ts} +2 -2
- package/lib/transform/{statistic/normalizeY.js → normalizeY.js} +16 -17
- package/lib/transform/normalizeY.js.map +1 -0
- package/lib/transform/{statistic/stackEnter.d.ts → stackEnter.d.ts} +2 -2
- package/lib/transform/{statistic/stackEnter.js → stackEnter.js} +22 -19
- package/lib/transform/stackEnter.js.map +1 -0
- package/lib/transform/{statistic/stackY.d.ts → stackY.d.ts} +2 -2
- package/lib/transform/{statistic/stackY.js → stackY.js} +22 -21
- package/lib/transform/stackY.js.map +1 -0
- package/lib/transform/{statistic/symmetryY.d.ts → symmetryY.d.ts} +2 -2
- package/lib/transform/{statistic/symmetryY.js → symmetryY.js} +16 -17
- 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/{statistic/utils.d.ts → utils/order.d.ts} +4 -4
- package/lib/transform/{statistic/utils.js → utils/order.js} +7 -5
- package/lib/transform/utils/order.js.map +1 -0
- package/lib/utils/coordinate.d.ts +1 -0
- package/lib/utils/coordinate.js +6 -1
- package/lib/utils/coordinate.js.map +1 -1
- package/package.json +6 -5
- package/src/animation/fadeIn.ts +4 -6
- package/src/animation/fadeOut.ts +4 -4
- package/src/animation/morphing.ts +4 -5
- package/src/animation/scaleInX.ts +9 -5
- package/src/animation/scaleInY.ts +9 -5
- package/src/animation/scaleOutX.ts +9 -5
- package/src/animation/scaleOutY.ts +9 -5
- package/src/api/chart.ts +19 -8
- package/src/api/index.ts +1 -0
- package/src/api/library.ts +12 -0
- package/src/composition/circle.ts +1 -1
- package/src/composition/flex.ts +4 -2
- 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 +7 -0
- 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 +21 -0
- package/src/data/cluster.ts +56 -0
- package/src/data/connector.ts +14 -0
- package/src/data/fetch.ts +23 -0
- package/src/data/filterBy.ts +19 -0
- package/src/data/fold.ts +29 -0
- package/src/data/index.ts +9 -0
- package/src/data/inline.ts +11 -0
- package/src/{transform/preprocessor → data}/pick.ts +4 -6
- package/src/{transform/preprocessor → data}/rename.ts +7 -10
- package/src/data/sankey.ts +105 -0
- package/src/{transform/preprocessor → data}/sortBy.ts +7 -12
- package/src/{transform/preprocessor → data}/subset.ts +8 -13
- package/src/data/tree.ts +12 -0
- package/src/{transform → data}/utils/arc/arc.ts +0 -0
- package/src/{transform → data}/utils/arc/index.ts +0 -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/{transform → data}/utils/flow.ts +0 -0
- package/src/{transform → data}/utils/memo.ts +1 -0
- package/src/data/voronoi.ts +30 -0
- package/src/data/wordCloud.ts +115 -0
- package/src/index.ts +1 -1
- package/src/interaction/action/service/fisheyeFocus.ts +16 -3
- package/src/interaction/action/transformer/filter.ts +8 -4
- package/src/labelLayout/hideOverlap.ts +47 -0
- package/src/labelLayout/index.ts +1 -0
- package/src/mark/utils.ts +1 -1
- package/src/runtime/component.ts +23 -3
- 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 +56 -135
- package/src/runtime/plot.ts +29 -22
- package/src/runtime/render.ts +4 -5
- package/src/runtime/scale.ts +15 -5
- package/src/runtime/transform.ts +159 -0
- package/src/runtime/types/common.ts +5 -2
- package/src/runtime/types/component.ts +13 -3
- package/src/runtime/types/data.ts +10 -0
- package/src/runtime/types/encode.ts +6 -2
- package/src/runtime/types/options.ts +7 -2
- package/src/runtime/types/transform.ts +8 -13
- package/src/shape/interval/colorRect.ts +4 -23
- package/src/shape/label/label.ts +94 -11
- 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 +81 -0
- package/src/spec/geometry.ts +2 -1
- package/src/spec/index.ts +2 -1
- package/src/spec/labelLayout.ts +5 -0
- package/src/spec/transform.ts +245 -194
- package/src/stdlib/index.ts +50 -31
- package/src/theme/light.ts +1 -0
- package/src/transform/{statistic/dodgeX.ts → dodgeX.ts} +24 -21
- package/src/transform/{statistic/groupX.ts → groupX.ts} +25 -24
- package/src/transform/index.ts +21 -44
- package/src/transform/{statistic/jitter.ts → jitter.ts} +17 -21
- package/src/transform/{statistic/jitterY.ts → jitterY.ts} +11 -17
- package/src/transform/maybeKey.ts +26 -0
- package/src/transform/maybeSeries.ts +20 -0
- package/src/transform/maybeSize.ts +23 -0
- package/src/transform/{inference/maybeStackY.ts → maybeStackY.ts} +12 -13
- package/src/transform/maybeTitleX.ts +20 -0
- package/src/transform/maybeTooltip.ts +34 -0
- package/src/transform/{inference/maybeTooltipPosition.ts → maybeTooltipPosition.ts} +4 -6
- package/src/transform/{inference/maybeTooltipY.ts → maybeTooltipY.ts} +3 -6
- package/src/transform/maybeZeroX.ts +25 -0
- package/src/transform/maybeZeroY.ts +24 -0
- package/src/transform/maybeZeroY1.ts +24 -0
- package/src/transform/{statistic/normalizeY.ts → normalizeY.ts} +20 -19
- package/src/transform/{statistic/select.ts → select.ts} +11 -16
- package/src/transform/{statistic/selectX.ts → selectX.ts} +3 -5
- package/src/transform/{statistic/selectY.ts → selectY.ts} +3 -5
- package/src/transform/{statistic/stackEnter.ts → stackEnter.ts} +29 -21
- package/src/transform/{statistic/stackY.ts → stackY.ts} +22 -21
- package/src/transform/{statistic/symmetryY.ts → symmetryY.ts} +20 -19
- package/src/transform/utils/helper.ts +27 -44
- package/src/transform/{statistic/utils.ts → utils/order.ts} +20 -17
- package/src/utils/coordinate.ts +5 -0
- 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.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.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.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.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.map +0 -1
- 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.map +0 -1
- 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.map +0 -1
- package/esm/transform/preprocessor/subset.d.ts +0 -7
- 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.js.map +0 -1
- package/esm/transform/statistic/SelectX.js.map +0 -1
- package/esm/transform/statistic/SelectY.js.map +0 -1
- package/esm/transform/statistic/dodgeX.js.map +0 -1
- package/esm/transform/statistic/groupX.js.map +0 -1
- package/esm/transform/statistic/jitter.js.map +0 -1
- package/esm/transform/statistic/jitterY.js +0 -27
- package/esm/transform/statistic/jitterY.js.map +0 -1
- package/esm/transform/statistic/normalizeY.js.map +0 -1
- package/esm/transform/statistic/stackEnter.js.map +0 -1
- package/esm/transform/statistic/stackY.js.map +0 -1
- package/esm/transform/statistic/symmetryY.js.map +0 -1
- 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.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/spec/statistic.d.ts +0 -69
- 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.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.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.map +0 -1
- package/lib/transform/inference/maybeTooltipPosition.js.map +0 -1
- package/lib/transform/inference/maybeTooltipY.d.ts +0 -7
- package/lib/transform/inference/maybeTooltipY.js.map +0 -1
- 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.map +0 -1
- 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.map +0 -1
- 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.map +0 -1
- package/lib/transform/preprocessor/subset.d.ts +0 -7
- 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.js.map +0 -1
- package/lib/transform/statistic/SelectX.js.map +0 -1
- package/lib/transform/statistic/SelectY.js.map +0 -1
- package/lib/transform/statistic/dodgeX.js.map +0 -1
- package/lib/transform/statistic/groupX.js.map +0 -1
- package/lib/transform/statistic/jitter.js.map +0 -1
- package/lib/transform/statistic/jitterY.js.map +0 -1
- package/lib/transform/statistic/normalizeY.js.map +0 -1
- package/lib/transform/statistic/stackEnter.js.map +0 -1
- package/lib/transform/statistic/stackY.js.map +0 -1
- package/lib/transform/statistic/symmetryY.js.map +0 -1
- 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.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/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/maybeTitleX.ts +0 -26
- package/src/transform/inference/maybeTooltip.ts +0 -35
- 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/sankey.ts +0 -105
- 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/runtime/mark.ts
CHANGED
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
import { group
|
|
2
|
-
import {
|
|
3
|
-
import { indexOf } from '../utils/array';
|
|
1
|
+
import { group } from 'd3-array';
|
|
2
|
+
import { defined } from '../utils/helper';
|
|
4
3
|
import { useLibrary } from './library';
|
|
5
|
-
import {
|
|
6
|
-
Channel,
|
|
7
|
-
G2MarkState,
|
|
8
|
-
G2Theme,
|
|
9
|
-
TabularData,
|
|
10
|
-
MaybeArray,
|
|
11
|
-
} from './types/common';
|
|
4
|
+
import { Channel, G2MarkState, G2Theme } from './types/common';
|
|
12
5
|
import {
|
|
13
6
|
G2View,
|
|
14
7
|
G2Library,
|
|
@@ -16,15 +9,13 @@ import {
|
|
|
16
9
|
G2ScaleOptions,
|
|
17
10
|
G2TransformOptions,
|
|
18
11
|
G2EncodeOptions,
|
|
19
|
-
G2ViewTree,
|
|
20
12
|
} from './types/options';
|
|
21
13
|
import { MarkProps } from './types/mark';
|
|
22
14
|
import {
|
|
23
|
-
EncodeSpec,
|
|
24
15
|
NormalizedEncodeSpec,
|
|
25
|
-
PrimitiveEncodeSpec,
|
|
26
16
|
EncodeComponent,
|
|
27
17
|
Encode,
|
|
18
|
+
ColumnValue,
|
|
28
19
|
} from './types/encode';
|
|
29
20
|
import {
|
|
30
21
|
ColumnOf,
|
|
@@ -33,6 +24,15 @@ import {
|
|
|
33
24
|
TransformComponent,
|
|
34
25
|
} from './types/transform';
|
|
35
26
|
import { inferScale } from './scale';
|
|
27
|
+
import {
|
|
28
|
+
applyDefaults,
|
|
29
|
+
applyDataTransform,
|
|
30
|
+
extractColumns,
|
|
31
|
+
flatEncode,
|
|
32
|
+
inferChannelsType,
|
|
33
|
+
maybeArrayField,
|
|
34
|
+
maybeVisualChannel,
|
|
35
|
+
} from './transform';
|
|
36
36
|
|
|
37
37
|
export async function initializeMark(
|
|
38
38
|
partialMark: G2Mark,
|
|
@@ -42,14 +42,14 @@ export async function initializeMark(
|
|
|
42
42
|
options: G2View,
|
|
43
43
|
library: G2Library,
|
|
44
44
|
): Promise<[G2Mark, G2MarkState]> {
|
|
45
|
-
// Apply transform to
|
|
46
|
-
const {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
45
|
+
// Apply transform to mark to derive indices, data, encode, etc,.
|
|
46
|
+
const context = { library };
|
|
47
|
+
const [I, transformedMark] = await applyMarkTransform(
|
|
48
|
+
partialMark,
|
|
49
|
+
partialProps,
|
|
50
|
+
context,
|
|
51
|
+
);
|
|
52
|
+
const { data, encode, scale: partialScale = {} } = transformedMark;
|
|
53
53
|
|
|
54
54
|
// Skip mark with non-tabular data. Do not skip empty
|
|
55
55
|
// data, they are useful for facet to display axes.
|
|
@@ -61,10 +61,7 @@ export async function initializeMark(
|
|
|
61
61
|
const { channels: channelDescriptors } = partialProps;
|
|
62
62
|
const nameEncodes = group(
|
|
63
63
|
Object.entries(encode).filter(([, value]) => defined(value)),
|
|
64
|
-
([key]) =>
|
|
65
|
-
const match = /([^\d]+)\d*$/.exec(key);
|
|
66
|
-
return match[1];
|
|
67
|
-
},
|
|
64
|
+
([key]) => /([^\d]+)\d*$/.exec(key)?.[1],
|
|
68
65
|
);
|
|
69
66
|
const channels = channelDescriptors
|
|
70
67
|
.filter((descriptor) => {
|
|
@@ -76,14 +73,13 @@ export async function initializeMark(
|
|
|
76
73
|
.flatMap((descriptor) => {
|
|
77
74
|
const { name } = descriptor;
|
|
78
75
|
const encodes = nameEncodes.get(name);
|
|
79
|
-
return encodes.map((e) => createChannel(descriptor,
|
|
76
|
+
return encodes.map((e) => createChannel(descriptor, e));
|
|
80
77
|
});
|
|
81
78
|
|
|
82
79
|
// Infer scale for each channel.
|
|
83
80
|
const scale = {};
|
|
84
81
|
const { coordinate = [] } = options;
|
|
85
82
|
const scaleChannels = group(channels, (d) => d.scaleName);
|
|
86
|
-
|
|
87
83
|
for (const [scaleName, channels] of scaleChannels.entries()) {
|
|
88
84
|
const { shapes } = partialProps;
|
|
89
85
|
const channel = mergeChannel(channels);
|
|
@@ -99,32 +95,12 @@ export async function initializeMark(
|
|
|
99
95
|
);
|
|
100
96
|
}
|
|
101
97
|
|
|
102
|
-
const mark = {
|
|
103
|
-
...partialMark,
|
|
104
|
-
encode,
|
|
105
|
-
scale,
|
|
106
|
-
data,
|
|
107
|
-
};
|
|
98
|
+
const mark = { ...transformedMark, scale };
|
|
108
99
|
const state = { ...partialProps, channels, index: I };
|
|
109
100
|
return [mark, state];
|
|
110
101
|
}
|
|
111
102
|
|
|
112
|
-
export function
|
|
113
|
-
mark: G2ViewTree,
|
|
114
|
-
library: G2Library,
|
|
115
|
-
): TransformContext {
|
|
116
|
-
const { data, encode = {}, transform = [], scale = {} } = mark;
|
|
117
|
-
return {
|
|
118
|
-
data,
|
|
119
|
-
encode,
|
|
120
|
-
columnOf: createColumnOf(library),
|
|
121
|
-
transform,
|
|
122
|
-
I: Array.isArray(data) ? indexOf(data) : [],
|
|
123
|
-
scale,
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
function createColumnOf(library: G2Library): ColumnOf {
|
|
103
|
+
export function createColumnOf(library: G2Library): ColumnOf {
|
|
128
104
|
const [useEncode] = useLibrary<G2EncodeOptions, EncodeComponent, Encode>(
|
|
129
105
|
'encode',
|
|
130
106
|
library,
|
|
@@ -132,113 +108,59 @@ function createColumnOf(library: G2Library): ColumnOf {
|
|
|
132
108
|
return (data, encode) => {
|
|
133
109
|
if (encode === undefined) return null;
|
|
134
110
|
if (data === undefined) return null;
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
111
|
+
return {
|
|
112
|
+
...encode,
|
|
113
|
+
type: 'column',
|
|
114
|
+
value: useEncode(encode)(data),
|
|
115
|
+
field: fieldOf(encode),
|
|
116
|
+
};
|
|
140
117
|
};
|
|
141
118
|
}
|
|
142
119
|
|
|
143
|
-
function
|
|
144
|
-
encode: Record<string, MaybeArray<EncodeSpec>>,
|
|
145
|
-
): Record<string, EncodeSpec> {
|
|
146
|
-
const flattenEncode = {};
|
|
147
|
-
for (const [key, value] of Object.entries(encode)) {
|
|
148
|
-
if (Array.isArray(value)) {
|
|
149
|
-
for (let i = 0; i < value.length; i++) {
|
|
150
|
-
const name = `${key}${i === 0 ? '' : i}`;
|
|
151
|
-
flattenEncode[name] = value[i];
|
|
152
|
-
}
|
|
153
|
-
} else {
|
|
154
|
-
flattenEncode[key] = value;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
return flattenEncode;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
function inferEncodeType(
|
|
161
|
-
data: TabularData,
|
|
162
|
-
encode: PrimitiveEncodeSpec,
|
|
163
|
-
): string {
|
|
164
|
-
if (typeof encode === 'function') return 'transform';
|
|
165
|
-
if (typeof encode === 'string' && data?.[0]?.[encode] !== undefined) {
|
|
166
|
-
return 'field';
|
|
167
|
-
}
|
|
168
|
-
return 'constant';
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
function normalizeEncode(
|
|
172
|
-
data: TabularData,
|
|
173
|
-
encode: EncodeSpec,
|
|
174
|
-
): NormalizedEncodeSpec {
|
|
175
|
-
if (typeof encode === 'object' && !(encode instanceof Date)) return encode;
|
|
176
|
-
const type = inferEncodeType(data, encode);
|
|
177
|
-
return { type, value: encode };
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
async function applyTransform(
|
|
120
|
+
async function applyMarkTransform(
|
|
181
121
|
mark: G2Mark,
|
|
182
122
|
props: MarkProps,
|
|
183
|
-
|
|
184
|
-
): Promise<
|
|
185
|
-
const
|
|
123
|
+
context: TransformContext,
|
|
124
|
+
): Promise<[number[], G2Mark]> {
|
|
125
|
+
const { library } = context;
|
|
126
|
+
const [useTransform] = useLibrary<
|
|
186
127
|
G2TransformOptions,
|
|
187
128
|
TransformComponent,
|
|
188
129
|
Transform
|
|
189
130
|
>('transform', library);
|
|
190
|
-
|
|
191
|
-
// Create transform Context.
|
|
192
|
-
mark.encode = flatEncode(mark.encode);
|
|
193
|
-
const context = createTransformContext(mark, library);
|
|
194
|
-
|
|
195
|
-
// Group transforms into preprcessors and others.
|
|
196
|
-
const { transform: partialTransform = [] } = mark;
|
|
197
131
|
const { preInference = [], postInference = [] } = props;
|
|
198
|
-
const
|
|
199
|
-
const
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
132
|
+
const { transform = [] } = mark;
|
|
133
|
+
const transforms = [
|
|
134
|
+
applyDefaults,
|
|
135
|
+
applyDataTransform,
|
|
136
|
+
flatEncode,
|
|
137
|
+
inferChannelsType,
|
|
138
|
+
maybeVisualChannel,
|
|
139
|
+
extractColumns,
|
|
140
|
+
maybeArrayField,
|
|
141
|
+
...preInference.map(useTransform),
|
|
142
|
+
...transform.map(useTransform),
|
|
143
|
+
...postInference.map(useTransform),
|
|
144
|
+
];
|
|
145
|
+
let index = [];
|
|
146
|
+
let transformedMark = mark;
|
|
147
|
+
for (const t of transforms) {
|
|
148
|
+
[index, transformedMark] = await t(index, transformedMark, context);
|
|
205
149
|
}
|
|
206
|
-
|
|
207
|
-
// Apply preprocessors to get tabular data.
|
|
208
|
-
const preprocessorFunctions = preprocessors.map(useTransform);
|
|
209
|
-
const preprocessedContext = await composeAsync(preprocessorFunctions)(
|
|
210
|
-
context,
|
|
211
|
-
);
|
|
212
|
-
|
|
213
|
-
// Apply other transforms to get data to be visualized.
|
|
214
|
-
const { data } = preprocessedContext;
|
|
215
|
-
const I = data ? indexOf(data) : [];
|
|
216
|
-
const transform = [...preInference, ...statistics, ...postInference];
|
|
217
|
-
const transformFunctions = transform.map(useTransform);
|
|
218
|
-
return composeAsync(transformFunctions)({
|
|
219
|
-
...context,
|
|
220
|
-
...preprocessedContext,
|
|
221
|
-
I,
|
|
222
|
-
});
|
|
150
|
+
return [index, transformedMark];
|
|
223
151
|
}
|
|
224
152
|
|
|
225
153
|
function createChannel(
|
|
226
154
|
descriptor: Channel,
|
|
227
|
-
|
|
228
|
-
nameEncode: [string, EncodeSpec],
|
|
229
|
-
columnOf: ColumnOf,
|
|
155
|
+
nameEncode: [string, ColumnValue],
|
|
230
156
|
): Channel {
|
|
231
157
|
const { independent = false, name, scaleName, ...rest } = descriptor;
|
|
232
158
|
const [encodeName, encode] = nameEncode;
|
|
233
|
-
const normalizedEncode = normalizeEncode(data, encode);
|
|
234
|
-
const { type } = normalizedEncode;
|
|
235
159
|
return {
|
|
236
160
|
...rest,
|
|
237
|
-
|
|
161
|
+
...encode,
|
|
238
162
|
name: encodeName,
|
|
239
163
|
scaleName: scaleName ?? (independent ? encodeName : name),
|
|
240
|
-
value: columnOf(data, normalizedEncode),
|
|
241
|
-
field: fieldOf(normalizedEncode),
|
|
242
164
|
};
|
|
243
165
|
}
|
|
244
166
|
|
|
@@ -257,6 +179,5 @@ function mergeChannel(channels: Channel[]): Channel {
|
|
|
257
179
|
function fieldOf(encode: NormalizedEncodeSpec): string {
|
|
258
180
|
const { type, value } = encode;
|
|
259
181
|
if (type === 'field' && typeof value === 'string') return value;
|
|
260
|
-
if (value && value.field) return value.field;
|
|
261
182
|
return null;
|
|
262
183
|
}
|
package/src/runtime/plot.ts
CHANGED
|
@@ -5,9 +5,9 @@ import {
|
|
|
5
5
|
copyAttributes,
|
|
6
6
|
error,
|
|
7
7
|
defined,
|
|
8
|
-
composeAsync,
|
|
9
8
|
useMemo,
|
|
10
9
|
appendTransform,
|
|
10
|
+
compose,
|
|
11
11
|
} from '../utils/helper';
|
|
12
12
|
import { Selection, select, G2Element } from '../utils/selection';
|
|
13
13
|
import {
|
|
@@ -22,8 +22,8 @@ import {
|
|
|
22
22
|
G2AnimationOptions,
|
|
23
23
|
G2CompositionOptions,
|
|
24
24
|
G2AdjustOptions,
|
|
25
|
-
G2TransformOptions,
|
|
26
25
|
G2InteractionOptions,
|
|
26
|
+
G2LabelLayoutOptions,
|
|
27
27
|
} from './types/options';
|
|
28
28
|
import {
|
|
29
29
|
ThemeComponent,
|
|
@@ -40,16 +40,19 @@ import {
|
|
|
40
40
|
Adjust,
|
|
41
41
|
InteractionComponent,
|
|
42
42
|
Interaction,
|
|
43
|
+
LabelLayoutComponent,
|
|
44
|
+
LabelLayout,
|
|
43
45
|
} from './types/component';
|
|
44
46
|
import { MarkComponent, Mark, MarkChannel } from './types/mark';
|
|
45
47
|
import { TransformComponent, Transform } from './types/transform';
|
|
46
48
|
import { G2ViewDescriptor, G2MarkState, G2ViewInstance } from './types/common';
|
|
47
49
|
import { useLibrary } from './library';
|
|
48
|
-
import {
|
|
50
|
+
import { initializeMark } from './mark';
|
|
49
51
|
import { inferComponent, renderComponent } from './component';
|
|
50
52
|
import { computeLayout, placeComponents } from './layout';
|
|
51
53
|
import { createCoordinate } from './coordinate';
|
|
52
54
|
import { applyScale, syncFacetsScales } from './scale';
|
|
55
|
+
import { applyDataTransform } from './transform';
|
|
53
56
|
|
|
54
57
|
export async function plot<T extends G2ViewTree>(
|
|
55
58
|
options: T,
|
|
@@ -70,8 +73,8 @@ export async function plot<T extends G2ViewTree>(
|
|
|
70
73
|
// Some helper functions.
|
|
71
74
|
const marks = new Set(
|
|
72
75
|
Object.keys(library)
|
|
73
|
-
.
|
|
74
|
-
.
|
|
76
|
+
.map((d) => /mark\.(.*)/.exec(d)?.[1])
|
|
77
|
+
.filter(defined),
|
|
75
78
|
);
|
|
76
79
|
const typeOf = (node: G2ViewTree) => {
|
|
77
80
|
const { type } = node;
|
|
@@ -294,9 +297,20 @@ function initializeState(
|
|
|
294
297
|
'theme',
|
|
295
298
|
library,
|
|
296
299
|
);
|
|
300
|
+
const [useLabelLayout] = useLibrary<
|
|
301
|
+
G2LabelLayoutOptions,
|
|
302
|
+
LabelLayoutComponent,
|
|
303
|
+
LabelLayout
|
|
304
|
+
>('labelLayout', library);
|
|
297
305
|
|
|
298
|
-
const {
|
|
306
|
+
const {
|
|
307
|
+
key,
|
|
308
|
+
frame,
|
|
309
|
+
theme: partialTheme,
|
|
310
|
+
labelLayout: userLabelLayout = [],
|
|
311
|
+
} = options;
|
|
299
312
|
const theme = useTheme(inferTheme(partialTheme));
|
|
313
|
+
const labelLayout = compose(userLabelLayout.map(useLabelLayout));
|
|
300
314
|
|
|
301
315
|
// Infer components and compute layout.
|
|
302
316
|
const marks = Array.from(markState.keys());
|
|
@@ -378,6 +392,7 @@ function initializeState(
|
|
|
378
392
|
markState,
|
|
379
393
|
key,
|
|
380
394
|
frame,
|
|
395
|
+
labelLayout,
|
|
381
396
|
scale: scaleInstance,
|
|
382
397
|
};
|
|
383
398
|
return [view, children];
|
|
@@ -540,7 +555,7 @@ function plotLabel(
|
|
|
540
555
|
transitions: Promise<void>[],
|
|
541
556
|
library: G2Library,
|
|
542
557
|
) {
|
|
543
|
-
const { markState } = view;
|
|
558
|
+
const { markState, labelLayout } = view;
|
|
544
559
|
const labels = [];
|
|
545
560
|
for (const [mark, state] of markState.entries()) {
|
|
546
561
|
const { key } = mark;
|
|
@@ -561,7 +576,8 @@ function plotLabel(
|
|
|
561
576
|
copyAttributes(label, newLabel);
|
|
562
577
|
});
|
|
563
578
|
}
|
|
564
|
-
// @todo applyLayout
|
|
579
|
+
// @todo applyLayout
|
|
580
|
+
if (labelLayout) labelLayout(labels);
|
|
565
581
|
}
|
|
566
582
|
|
|
567
583
|
function createLabelShapeFunction(
|
|
@@ -769,20 +785,11 @@ async function applyTransform<T extends G2ViewTree>(
|
|
|
769
785
|
node: T,
|
|
770
786
|
library: G2Library,
|
|
771
787
|
): Promise<G2ViewTree> {
|
|
772
|
-
const
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
const { transform = [], data, ...rest } = node;
|
|
778
|
-
const context = createTransformContext(node, library);
|
|
779
|
-
const transformFunctions: TransformComponent[] = transform.map(useTransform);
|
|
780
|
-
const {
|
|
781
|
-
data: newDate,
|
|
782
|
-
encode,
|
|
783
|
-
scale,
|
|
784
|
-
} = await composeAsync(transformFunctions)(context);
|
|
785
|
-
return { ...rest, data: newDate, encode, scale };
|
|
788
|
+
const context = { library };
|
|
789
|
+
const { data, ...rest } = node;
|
|
790
|
+
if (data == undefined) return node;
|
|
791
|
+
const [, { data: newData }] = await applyDataTransform([], { data }, context);
|
|
792
|
+
return { data: newData, ...rest };
|
|
786
793
|
}
|
|
787
794
|
|
|
788
795
|
function applyBBox(selection: Selection) {
|
package/src/runtime/render.ts
CHANGED
|
@@ -63,12 +63,11 @@ export function render<T extends G2ViewTree = G2ViewTree>(
|
|
|
63
63
|
context.library = library;
|
|
64
64
|
|
|
65
65
|
// Plot the chart and mutate context.
|
|
66
|
-
//
|
|
66
|
+
// Make sure that plot chart after container is ready for every time.
|
|
67
67
|
const selection = select(canvas.document.documentElement);
|
|
68
|
-
canvas.
|
|
69
|
-
|
|
70
|
-
callback
|
|
71
|
-
});
|
|
68
|
+
canvas.ready
|
|
69
|
+
.then(() => plot<T>({ ...keyed, width, height }, selection, library))
|
|
70
|
+
.then(callback);
|
|
72
71
|
|
|
73
72
|
// Return the container HTML element wraps the canvas or svg element.
|
|
74
73
|
return normalizeContainer(canvas.getConfig().container);
|
package/src/runtime/scale.ts
CHANGED
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
Palette,
|
|
17
17
|
Scale,
|
|
18
18
|
} from './types/component';
|
|
19
|
-
import { isPolar } from './coordinate';
|
|
19
|
+
import { isPolar, isTheta } from './coordinate';
|
|
20
20
|
import { useLibrary } from './library';
|
|
21
21
|
import { MarkChannel } from './types/mark';
|
|
22
22
|
|
|
@@ -132,13 +132,13 @@ function inferScaleType(
|
|
|
132
132
|
channel: Channel,
|
|
133
133
|
options: G2ScaleOptions,
|
|
134
134
|
): string | ScaleComponent {
|
|
135
|
-
const { scale, name, value,
|
|
135
|
+
const { scale, name, value, visual } = channel;
|
|
136
136
|
const { type, domain, range } = options;
|
|
137
137
|
|
|
138
138
|
if (scale !== undefined) return scale;
|
|
139
139
|
if (type !== undefined) return type;
|
|
140
140
|
|
|
141
|
-
if (
|
|
141
|
+
if (visual) return 'identity';
|
|
142
142
|
if (isObject(value)) return 'identity';
|
|
143
143
|
|
|
144
144
|
if ((domain || range || []).length > 2) return asOrdinalType(name);
|
|
@@ -267,7 +267,8 @@ function inferPadding(
|
|
|
267
267
|
// The scale for enterDelay and enterDuration should has zero padding by default.
|
|
268
268
|
// Because there is no need to add extra delay for the start and the end.
|
|
269
269
|
if (name === 'enterDelay' || name === 'enterDuration') return 0;
|
|
270
|
-
if (type === 'band')
|
|
270
|
+
if (type === 'band')
|
|
271
|
+
return isPolar(coordinate) || isTheta(coordinate) ? 0 : 0.1;
|
|
271
272
|
// Point scale need 0.5 padding to make interval between first and last point
|
|
272
273
|
// equal to other intervals in polar coordinate.
|
|
273
274
|
if (type === 'point') return isPolar(coordinate) ? 0.5 : 0;
|
|
@@ -340,9 +341,18 @@ function isQuantitative(name: string): boolean {
|
|
|
340
341
|
);
|
|
341
342
|
}
|
|
342
343
|
|
|
344
|
+
// Spatial and temporal position.
|
|
343
345
|
export function isPosition(name: string): boolean {
|
|
344
346
|
return (
|
|
345
|
-
name.startsWith('x') ||
|
|
347
|
+
name.startsWith('x') ||
|
|
348
|
+
name.startsWith('y') ||
|
|
349
|
+
name.startsWith('position') ||
|
|
350
|
+
name === 'enterDelay' ||
|
|
351
|
+
name === 'enterDuration' ||
|
|
352
|
+
name === 'updateDelay' ||
|
|
353
|
+
name === 'updateDuration' ||
|
|
354
|
+
name === 'exitDelay' ||
|
|
355
|
+
name === 'exitDuration'
|
|
346
356
|
);
|
|
347
357
|
}
|
|
348
358
|
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { Primitive } from 'd3-array';
|
|
2
|
+
import { indexOf, mapObject } from '../utils/array';
|
|
3
|
+
import { composeAsync, defined } from '../utils/helper';
|
|
4
|
+
import { useLibrary } from './library';
|
|
5
|
+
import { createColumnOf } from './mark';
|
|
6
|
+
import { Data, DataComponent } from './types/data';
|
|
7
|
+
import { G2Mark, G2DataOptions } from './types/options';
|
|
8
|
+
import { TransformContext } from './types/transform';
|
|
9
|
+
import { isPosition } from './scale';
|
|
10
|
+
|
|
11
|
+
// @todo Add more defaults.
|
|
12
|
+
export function applyDefaults(
|
|
13
|
+
I: number[],
|
|
14
|
+
mark: G2Mark,
|
|
15
|
+
context: TransformContext,
|
|
16
|
+
): [number[], G2Mark] {
|
|
17
|
+
const { scale = {}, transform = [], ...rest } = mark;
|
|
18
|
+
return [I, { ...rest, scale, transform }];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export async function applyDataTransform(
|
|
22
|
+
I: number[],
|
|
23
|
+
mark: G2Mark,
|
|
24
|
+
context: TransformContext,
|
|
25
|
+
): Promise<[number[], G2Mark]> {
|
|
26
|
+
const { library } = context;
|
|
27
|
+
const { data } = mark;
|
|
28
|
+
const [useData] = useLibrary<G2DataOptions, DataComponent, Data>(
|
|
29
|
+
'data',
|
|
30
|
+
library,
|
|
31
|
+
);
|
|
32
|
+
const descriptor = normalizedDataSource(data);
|
|
33
|
+
const { transform: T = [], ...connector } = descriptor;
|
|
34
|
+
const transform = [connector, ...T];
|
|
35
|
+
const transformFunctions = transform.map(useData);
|
|
36
|
+
const transformedData = await composeAsync(transformFunctions)(data);
|
|
37
|
+
return [
|
|
38
|
+
Array.isArray(transformedData) ? indexOf(transformedData) : [],
|
|
39
|
+
{ ...mark, data: transformedData },
|
|
40
|
+
];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function flatEncode(
|
|
44
|
+
I: number[],
|
|
45
|
+
mark: G2Mark,
|
|
46
|
+
context: TransformContext,
|
|
47
|
+
): [number[], G2Mark] {
|
|
48
|
+
const { encode } = mark;
|
|
49
|
+
const flattenEncode = {};
|
|
50
|
+
for (const [key, value] of Object.entries(encode)) {
|
|
51
|
+
if (Array.isArray(value)) {
|
|
52
|
+
for (let i = 0; i < value.length; i++) {
|
|
53
|
+
const name = `${key}${i === 0 ? '' : i}`;
|
|
54
|
+
flattenEncode[name] = value[i];
|
|
55
|
+
}
|
|
56
|
+
} else {
|
|
57
|
+
flattenEncode[key] = value;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return [I, { ...mark, encode: flattenEncode }];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function inferChannelsType(
|
|
64
|
+
I: number[],
|
|
65
|
+
mark: G2Mark,
|
|
66
|
+
context: TransformContext,
|
|
67
|
+
): [number[], G2Mark] {
|
|
68
|
+
const { encode, data } = mark;
|
|
69
|
+
const typedEncode = mapObject(encode, (channel) => {
|
|
70
|
+
if (isTypedChannel(channel)) return channel;
|
|
71
|
+
const type = inferChannelType(data, channel);
|
|
72
|
+
return { type, value: channel };
|
|
73
|
+
});
|
|
74
|
+
return [I, { ...mark, encode: typedEncode }];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// @todo Move visual property to style instead of flagging visual.
|
|
78
|
+
export function maybeVisualChannel(
|
|
79
|
+
I: number[],
|
|
80
|
+
mark: G2Mark,
|
|
81
|
+
context: TransformContext,
|
|
82
|
+
): [number[], G2Mark] {
|
|
83
|
+
const { encode } = mark;
|
|
84
|
+
const newEncode = mapObject(encode, (channel, name) => {
|
|
85
|
+
const { type } = channel;
|
|
86
|
+
if (type !== 'constant' || isPosition(name)) return channel;
|
|
87
|
+
return { ...channel, visual: true };
|
|
88
|
+
});
|
|
89
|
+
return [I, { ...mark, encode: newEncode }];
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function extractColumns(
|
|
93
|
+
I: number[],
|
|
94
|
+
mark: G2Mark,
|
|
95
|
+
context: TransformContext,
|
|
96
|
+
): [number[], G2Mark] {
|
|
97
|
+
const { encode, data } = mark;
|
|
98
|
+
const { library } = context;
|
|
99
|
+
const columnOf = createColumnOf(library);
|
|
100
|
+
const valuedEncode = mapObject(encode, (channel) => columnOf(data, channel));
|
|
101
|
+
return [I, { ...mark, encode: valuedEncode }];
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export function maybeArrayField(
|
|
105
|
+
I: number[],
|
|
106
|
+
mark: G2Mark,
|
|
107
|
+
context: TransformContext,
|
|
108
|
+
): [number[], G2Mark] {
|
|
109
|
+
const { encode, ...rest } = mark;
|
|
110
|
+
const columns = Object.entries(encode);
|
|
111
|
+
const arrayColumns = columns
|
|
112
|
+
.filter(([, channel]) => {
|
|
113
|
+
const { value: V } = channel;
|
|
114
|
+
return Array.isArray(V[0]);
|
|
115
|
+
})
|
|
116
|
+
.flatMap(([key, V]) => {
|
|
117
|
+
const columns = [[key, new Array(I.length).fill(undefined)] as const];
|
|
118
|
+
const { value: rows, ...rest } = V;
|
|
119
|
+
for (let i = 0; i < rows.length; i++) {
|
|
120
|
+
const row = rows[i];
|
|
121
|
+
if (Array.isArray(row)) {
|
|
122
|
+
for (let j = 0; j < row.length; j++) {
|
|
123
|
+
const column = columns[j] || [
|
|
124
|
+
`${key}${j}`,
|
|
125
|
+
new Array(I).fill(undefined),
|
|
126
|
+
];
|
|
127
|
+
column[1][i] = row[j];
|
|
128
|
+
columns[j] = column;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return columns.map(([key, value]) => [
|
|
133
|
+
key,
|
|
134
|
+
{ type: 'column', value, ...rest },
|
|
135
|
+
]);
|
|
136
|
+
});
|
|
137
|
+
const newEncode = Object.fromEntries([...columns, ...arrayColumns]);
|
|
138
|
+
return [I, { ...rest, encode: newEncode }];
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function isTypedChannel(channel): boolean {
|
|
142
|
+
if (typeof channel !== 'object' || channel instanceof Date) return false;
|
|
143
|
+
const { type } = channel;
|
|
144
|
+
return defined(type);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function inferChannelType(data: Record<string, Primitive>[], channel): string {
|
|
148
|
+
if (typeof channel === 'function') return 'transform';
|
|
149
|
+
if (typeof channel === 'string' && data?.[0]?.[channel] !== undefined) {
|
|
150
|
+
return 'field';
|
|
151
|
+
}
|
|
152
|
+
return 'constant';
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function normalizedDataSource(data) {
|
|
156
|
+
if (Array.isArray(data)) return { type: 'inline', value: data };
|
|
157
|
+
const { type = 'inline', ...rest } = data;
|
|
158
|
+
return { ...rest, type };
|
|
159
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Coordinate } from '@antv/coord';
|
|
2
2
|
import { DisplayObject } from '@antv/g';
|
|
3
3
|
import { G2GuideComponentOptions, G2Mark, G2ViewTree } from './options';
|
|
4
|
-
import { Scale } from './component';
|
|
4
|
+
import { LabelLayout, Scale } from './component';
|
|
5
5
|
import { MarkProps } from './mark';
|
|
6
6
|
import { ColumnValue } from './encode';
|
|
7
7
|
|
|
@@ -11,6 +11,7 @@ export type G2Theme = {
|
|
|
11
11
|
defaultCategory20?: string;
|
|
12
12
|
defaultSize?: number;
|
|
13
13
|
elementActiveStroke?: string;
|
|
14
|
+
labelFill?: string;
|
|
14
15
|
enter?: {
|
|
15
16
|
duration?: number;
|
|
16
17
|
delay?: number;
|
|
@@ -55,6 +56,7 @@ export type G2ViewDescriptor = {
|
|
|
55
56
|
layout: Layout;
|
|
56
57
|
key: string;
|
|
57
58
|
frame: boolean;
|
|
59
|
+
labelLayout?: LabelLayout;
|
|
58
60
|
};
|
|
59
61
|
|
|
60
62
|
export type G2ViewInstance = {
|
|
@@ -104,10 +106,11 @@ export type Channel = {
|
|
|
104
106
|
scale?: string;
|
|
105
107
|
scaleName?: string;
|
|
106
108
|
required?: boolean;
|
|
107
|
-
value?:
|
|
109
|
+
value?: Primitive[];
|
|
108
110
|
type?: string;
|
|
109
111
|
independent?: boolean;
|
|
110
112
|
field?: string | string[];
|
|
113
|
+
visual?: boolean;
|
|
111
114
|
};
|
|
112
115
|
|
|
113
116
|
export type Vector2 = [number, number];
|