@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
|
@@ -2,7 +2,6 @@ import { Canvas, DisplayObject, Animation as GAnimation } from '@antv/g';
|
|
|
2
2
|
import { Transformation, Coordinate } from '@antv/coord';
|
|
3
3
|
import {
|
|
4
4
|
IndexedValue,
|
|
5
|
-
Primitive,
|
|
6
5
|
G2Theme,
|
|
7
6
|
Vector2,
|
|
8
7
|
GuideComponentPosition,
|
|
@@ -13,6 +12,7 @@ import { G2ViewTree } from './options';
|
|
|
13
12
|
import { EncodeComponent, Encode } from './encode';
|
|
14
13
|
import { MarkComponent, Mark } from './mark';
|
|
15
14
|
import { TransformComponent, Transform } from './transform';
|
|
15
|
+
import { Data, DataComponent } from './data';
|
|
16
16
|
|
|
17
17
|
export type G2ComponentNamespaces =
|
|
18
18
|
| 'renderer'
|
|
@@ -32,7 +32,9 @@ export type G2ComponentNamespaces =
|
|
|
32
32
|
| 'interaction'
|
|
33
33
|
| 'interactor'
|
|
34
34
|
| 'composition'
|
|
35
|
-
| 'adjust'
|
|
35
|
+
| 'adjust'
|
|
36
|
+
| 'data'
|
|
37
|
+
| 'labelLayout';
|
|
36
38
|
|
|
37
39
|
export type G2Component =
|
|
38
40
|
| RendererComponent
|
|
@@ -50,7 +52,9 @@ export type G2Component =
|
|
|
50
52
|
| InteractionComponent
|
|
51
53
|
| CompositionComponent
|
|
52
54
|
| AdjustComponent
|
|
53
|
-
| TransformComponent
|
|
55
|
+
| TransformComponent
|
|
56
|
+
| DataComponent
|
|
57
|
+
| LabelLayoutComponent;
|
|
54
58
|
|
|
55
59
|
export type G2ComponentValue =
|
|
56
60
|
| Renderer
|
|
@@ -211,3 +215,9 @@ export type AdjustComponent<O = Record<string, unknown>> = G2BaseComponent<
|
|
|
211
215
|
Adjust,
|
|
212
216
|
O
|
|
213
217
|
>;
|
|
218
|
+
|
|
219
|
+
export type LabelLayout = (labels: DisplayObject[]) => DisplayObject[];
|
|
220
|
+
export type LabelLayoutComponent<O = Record<string, unknown>> = G2BaseComponent<
|
|
221
|
+
LabelLayout,
|
|
222
|
+
O
|
|
223
|
+
>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type DataOptions = Record<string, any>;
|
|
2
|
+
|
|
3
|
+
export type DataProps = Record<string, never>;
|
|
4
|
+
|
|
5
|
+
export type DataComponent<O extends DataOptions = DataOptions> = {
|
|
6
|
+
(options?: O): Data;
|
|
7
|
+
props: DataProps;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type Data = (data: any) => any | Promise<any>;
|
|
@@ -11,7 +11,7 @@ export type EncodeComponent<O extends EncodeOptions = EncodeOptions> = {
|
|
|
11
11
|
props: EncodeProps;
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
export type Encode = (data: TabularData) =>
|
|
14
|
+
export type Encode = (data: TabularData) => Primitive[];
|
|
15
15
|
|
|
16
16
|
export type EncodeSpec = NormalizedEncodeSpec | PrimitiveEncodeSpec;
|
|
17
17
|
|
|
@@ -29,4 +29,8 @@ export type FunctionEncodeSpec = (
|
|
|
29
29
|
|
|
30
30
|
export type PrimitiveEncodeSpec = Primitive | FunctionEncodeSpec;
|
|
31
31
|
|
|
32
|
-
export type ColumnValue =
|
|
32
|
+
export type ColumnValue = {
|
|
33
|
+
type: 'column';
|
|
34
|
+
value: Primitive[];
|
|
35
|
+
field?: string;
|
|
36
|
+
};
|
|
@@ -16,11 +16,13 @@ import {
|
|
|
16
16
|
CompositionComponent,
|
|
17
17
|
AdjustComponent,
|
|
18
18
|
Scale,
|
|
19
|
+
LabelLayoutComponent,
|
|
19
20
|
} from './component';
|
|
20
21
|
|
|
21
22
|
import { TransformComponent } from './transform';
|
|
22
23
|
import { EncodeComponent } from './encode';
|
|
23
24
|
import { MarkComponent } from './mark';
|
|
25
|
+
import { DataComponent } from './data';
|
|
24
26
|
|
|
25
27
|
export type G2ViewTree = {
|
|
26
28
|
width?: number;
|
|
@@ -62,6 +64,7 @@ export type G2View = {
|
|
|
62
64
|
marks?: G2Mark[];
|
|
63
65
|
frame?: boolean;
|
|
64
66
|
adjust?: { type?: string; [key: string]: any };
|
|
67
|
+
labelLayout?: G2LabelLayoutOptions[];
|
|
65
68
|
};
|
|
66
69
|
|
|
67
70
|
export type G2Mark = {
|
|
@@ -73,7 +76,6 @@ export type G2Mark = {
|
|
|
73
76
|
paddingBottom?: number;
|
|
74
77
|
data?: any;
|
|
75
78
|
transform?: G2TransformOptions[];
|
|
76
|
-
statistic?: G2StatisticOptions[];
|
|
77
79
|
scale?: Record<string, G2ScaleOptions>;
|
|
78
80
|
encode?: Record<string, any | G2EncodeOptions>;
|
|
79
81
|
type?: string | MarkComponent;
|
|
@@ -114,7 +116,8 @@ export type G2ComponentOptions =
|
|
|
114
116
|
| G2AnimationOptions
|
|
115
117
|
| G2InteractionOptions
|
|
116
118
|
| G2CompositionOptions
|
|
117
|
-
| G2AdjustOptions
|
|
119
|
+
| G2AdjustOptions
|
|
120
|
+
| G2LabelLayoutOptions;
|
|
118
121
|
|
|
119
122
|
export type G2TransformOptions = G2BaseComponentOptions<TransformComponent>;
|
|
120
123
|
export type G2StatisticOptions = G2BaseComponentOptions<StatisticComponent>;
|
|
@@ -152,8 +155,10 @@ export type G2AnimationOptions = G2BaseComponentOptions<AnimationComponent>;
|
|
|
152
155
|
export type G2InteractionOptions = G2BaseComponentOptions<InteractionComponent>;
|
|
153
156
|
export type G2CompositionOptions = G2BaseComponentOptions<CompositionComponent>;
|
|
154
157
|
export type G2AdjustOptions = G2BaseComponentOptions<AdjustComponent>;
|
|
158
|
+
export type G2LabelLayoutOptions = G2BaseComponentOptions<LabelLayoutComponent>;
|
|
155
159
|
export type G2TitleOptions = G2Title & {
|
|
156
160
|
position?: GuideComponentPosition;
|
|
157
161
|
size?: number;
|
|
158
162
|
zIndex?: number;
|
|
159
163
|
};
|
|
164
|
+
export type G2DataOptions = G2BaseComponent<DataComponent>;
|
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
import { ColumnValue,
|
|
1
|
+
import { ColumnValue, NormalizedEncodeSpec } from './encode';
|
|
2
|
+
import { G2Library, G2Mark } from './options';
|
|
2
3
|
|
|
3
4
|
export type TransformContext = {
|
|
4
|
-
|
|
5
|
-
I?: number[];
|
|
6
|
-
encode?: Record<string, EncodeSpec>;
|
|
7
|
-
columnOf?: ColumnOf;
|
|
8
|
-
transform?: TransformSpec[];
|
|
9
|
-
// @todo Replace with ScaleSpec
|
|
10
|
-
scale?: Record<string, any>;
|
|
5
|
+
library: G2Library;
|
|
11
6
|
};
|
|
12
7
|
|
|
13
8
|
export type TransformOptions = Record<string, any>;
|
|
14
9
|
|
|
15
|
-
export type TransformProps =
|
|
16
|
-
category: 'inference' | 'preprocessor' | 'statistic';
|
|
17
|
-
};
|
|
10
|
+
export type TransformProps = Record<string, never>;
|
|
18
11
|
|
|
19
12
|
export type TransformComponent<O extends TransformOptions = TransformOptions> =
|
|
20
13
|
{
|
|
@@ -23,12 +16,14 @@ export type TransformComponent<O extends TransformOptions = TransformOptions> =
|
|
|
23
16
|
};
|
|
24
17
|
|
|
25
18
|
export type Transform = (
|
|
19
|
+
I: number[],
|
|
20
|
+
mark: G2Mark,
|
|
26
21
|
context: TransformContext,
|
|
27
|
-
) =>
|
|
22
|
+
) => [number[], G2Mark] | Promise<[number[], G2Mark]>;
|
|
28
23
|
|
|
29
24
|
export type TransformSpec = {
|
|
30
25
|
type?: string | TransformComponent;
|
|
31
26
|
[key: string]: any;
|
|
32
27
|
};
|
|
33
28
|
|
|
34
|
-
export type ColumnOf = (data: any, encode:
|
|
29
|
+
export type ColumnOf = (data: any, encode: NormalizedEncodeSpec) => ColumnValue;
|
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
import { Path } from '@antv/g';
|
|
2
2
|
import { arc } from 'd3-shape';
|
|
3
3
|
import { path as d3path } from 'd3-path';
|
|
4
|
-
import { angle, sub, dist } from '../../utils/vector';
|
|
5
4
|
import { Vector2, ShapeComponent as SC } from '../../runtime';
|
|
6
|
-
import {
|
|
5
|
+
import { isPolar, isHelix } from '../../utils/coordinate';
|
|
7
6
|
import { select } from '../../utils/selection';
|
|
8
|
-
import { applyStyle, appendPolygon } from '../utils';
|
|
9
|
-
|
|
10
|
-
function reorder(points: Vector2[]): Vector2[] {
|
|
11
|
-
const [p0, p1, p2, p3] = points;
|
|
12
|
-
return [p3, p0, p1, p2];
|
|
13
|
-
}
|
|
7
|
+
import { applyStyle, appendPolygon, getArcObject } from '../utils';
|
|
14
8
|
|
|
15
9
|
export type ColorRectOptions = {
|
|
16
10
|
colorAttribute: 'fill' | 'stroke';
|
|
@@ -34,10 +28,9 @@ export const ColorRect: SC<ColorRectOptions> = (options) => {
|
|
|
34
28
|
const { radius = 0 } = style;
|
|
35
29
|
const { defaultColor } = theme;
|
|
36
30
|
const { color = defaultColor } = value;
|
|
37
|
-
const [p0, p1, p2, p3] = isTranspose(coordinate) ? reorder(points) : points;
|
|
38
31
|
|
|
39
32
|
// Render rect in non-polar coordinate.
|
|
40
|
-
if (!isPolar(coordinate)) {
|
|
33
|
+
if (!isPolar(coordinate) && !isHelix(coordinate)) {
|
|
41
34
|
return select(new Path())
|
|
42
35
|
.style('lineWidth', lineWidth)
|
|
43
36
|
.style('d', appendPolygon(d3path(), points).toString())
|
|
@@ -50,19 +43,7 @@ export const ColorRect: SC<ColorRectOptions> = (options) => {
|
|
|
50
43
|
// Render path in polar coordinate.
|
|
51
44
|
const { y, y1 } = value;
|
|
52
45
|
const center = coordinate.getCenter() as Vector2;
|
|
53
|
-
const
|
|
54
|
-
const a2 = angle(sub(p1, center));
|
|
55
|
-
// There are two situations that a2 === a1:
|
|
56
|
-
// 1. a1 - a2 = 0
|
|
57
|
-
// 2. |a1 - a2| = Math.PI * 2
|
|
58
|
-
// Distinguish them by y and y1:
|
|
59
|
-
const a3 = a2 === a1 && y !== y1 ? a2 + Math.PI * 2 : a2;
|
|
60
|
-
const arcObject = {
|
|
61
|
-
startAngle: a1,
|
|
62
|
-
endAngle: a3 - a1 >= 0 ? a3 : Math.PI * 2 + a3,
|
|
63
|
-
innerRadius: dist(p3, center),
|
|
64
|
-
outerRadius: dist(p0, center),
|
|
65
|
-
};
|
|
46
|
+
const arcObject = getArcObject(coordinate, points, [y, y1]);
|
|
66
47
|
const path = arc().cornerRadius(radius as number);
|
|
67
48
|
|
|
68
49
|
return select(new Path({}))
|
package/src/shape/label/label.ts
CHANGED
|
@@ -1,10 +1,92 @@
|
|
|
1
|
+
import { Coordinate } from '@antv/coord';
|
|
1
2
|
import { DisplayObject, Text } from '@antv/g';
|
|
2
3
|
import { select } from '../../utils/selection';
|
|
3
|
-
import { ShapeComponent as SC } from '../../runtime';
|
|
4
|
-
import { applyStyle } from '../../shape/utils';
|
|
4
|
+
import { ShapeComponent as SC, Vector2 } from '../../runtime';
|
|
5
|
+
import { applyStyle, getArcObject } from '../../shape/utils';
|
|
6
|
+
import { isHelix, isPolar } from '../../utils/coordinate';
|
|
7
|
+
|
|
8
|
+
type LabelPosition = 'top' | 'left' | 'right' | 'bottom' | 'inside' | 'outside';
|
|
5
9
|
|
|
6
10
|
export type LabelOptions = Record<string, any>;
|
|
7
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Avoid getting error bounds caused by element animations.
|
|
14
|
+
* @todo Remove this temporary handle method, if runtime supports correct process: drawElement, do label layout and then do transitions together.
|
|
15
|
+
*/
|
|
16
|
+
function getLocalBounds(element: DisplayObject) {
|
|
17
|
+
const cloneElement = element.cloneNode();
|
|
18
|
+
const animations = element.getAnimations();
|
|
19
|
+
cloneElement.style.visibility = 'hidden';
|
|
20
|
+
animations.forEach((animation) => {
|
|
21
|
+
const keyframes = animation.effect.getKeyframes();
|
|
22
|
+
cloneElement.attr(keyframes[keyframes.length - 1]);
|
|
23
|
+
});
|
|
24
|
+
element.parentNode.appendChild(cloneElement);
|
|
25
|
+
const bounds = cloneElement.getLocalBounds();
|
|
26
|
+
cloneElement.destroy();
|
|
27
|
+
|
|
28
|
+
return bounds;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function inferPosition(
|
|
32
|
+
points: Vector2[],
|
|
33
|
+
value,
|
|
34
|
+
coordinate: Coordinate,
|
|
35
|
+
position: LabelPosition,
|
|
36
|
+
) {
|
|
37
|
+
const element: DisplayObject = value.element;
|
|
38
|
+
const { min, halfExtents } = getLocalBounds(element);
|
|
39
|
+
const [x0, y0] = min;
|
|
40
|
+
// Infer the label position in non-polar coordinate.
|
|
41
|
+
if (!isPolar(coordinate) && !isHelix(coordinate)) {
|
|
42
|
+
const w = halfExtents[0] * 2;
|
|
43
|
+
const h = halfExtents[1] * 2;
|
|
44
|
+
|
|
45
|
+
if (position === 'left') return { x: 0, y: h / 2 };
|
|
46
|
+
if (position === 'right') return { x: w, y: h / 2 };
|
|
47
|
+
if (position === 'bottom') return { x: w / 2, y: h };
|
|
48
|
+
if (position === 'inside') return { x: w / 2, y: h / 2 };
|
|
49
|
+
|
|
50
|
+
return { x: w / 2, y: 0 };
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Infer the label position in polar coordinate.
|
|
54
|
+
const { y, y1 } = value;
|
|
55
|
+
const arcObject = getArcObject(coordinate, points, [y, y1]);
|
|
56
|
+
|
|
57
|
+
const { startAngle, endAngle, innerRadius, outerRadius } = arcObject;
|
|
58
|
+
const midAngle = (startAngle + endAngle) / 2;
|
|
59
|
+
|
|
60
|
+
const center = coordinate.getCenter() as Vector2;
|
|
61
|
+
|
|
62
|
+
// @todo Support config by label.offset
|
|
63
|
+
const offset = position === 'inside' ? 0 : 12;
|
|
64
|
+
const radius =
|
|
65
|
+
(position === 'inside' ? (innerRadius + outerRadius) / 2 : outerRadius) +
|
|
66
|
+
offset;
|
|
67
|
+
|
|
68
|
+
return {
|
|
69
|
+
x: center[0] + Math.sin(midAngle) * radius - x0,
|
|
70
|
+
y: center[1] - Math.cos(midAngle) * radius - y0,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function inferDefaultStyle(position: LabelPosition): {
|
|
75
|
+
dy?: string;
|
|
76
|
+
textBaseline?: string;
|
|
77
|
+
} {
|
|
78
|
+
if (
|
|
79
|
+
position === 'left' ||
|
|
80
|
+
position === 'right' ||
|
|
81
|
+
position === 'inside' ||
|
|
82
|
+
position === 'outside'
|
|
83
|
+
) {
|
|
84
|
+
return { textBaseline: 'middle' };
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return { dy: '-2px' };
|
|
88
|
+
}
|
|
89
|
+
|
|
8
90
|
/**
|
|
9
91
|
* Render normal label for each mark.
|
|
10
92
|
* @todo Support position option: middle...
|
|
@@ -12,20 +94,21 @@ export type LabelOptions = Record<string, any>;
|
|
|
12
94
|
export const Label: SC<LabelOptions> = (options) => {
|
|
13
95
|
const { label: style = {} } = options;
|
|
14
96
|
return (points, value, coordinate, theme) => {
|
|
15
|
-
const
|
|
16
|
-
const {
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
const w = x1 - x0;
|
|
97
|
+
const { position, ...restStyle } = style;
|
|
98
|
+
const { labelFill: fill } = theme;
|
|
99
|
+
|
|
100
|
+
const { x, y } = inferPosition(points, value, coordinate, position);
|
|
20
101
|
const { label } = value;
|
|
102
|
+
const defaultStyle = inferDefaultStyle(position);
|
|
21
103
|
return select(new Text())
|
|
22
|
-
.style('x',
|
|
23
|
-
.style('y',
|
|
104
|
+
.style('x', x)
|
|
105
|
+
.style('y', y)
|
|
24
106
|
.style('text', `${label}`)
|
|
25
107
|
.style('fontSize', 12)
|
|
26
|
-
.style('dy', '-2px')
|
|
27
108
|
.style('textAlign', 'center')
|
|
28
|
-
.
|
|
109
|
+
.style('fill', fill)
|
|
110
|
+
.call(applyStyle, defaultStyle)
|
|
111
|
+
.call(applyStyle, restStyle)
|
|
29
112
|
.node();
|
|
30
113
|
};
|
|
31
114
|
};
|
package/src/shape/utils.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Path as D3Path } from 'd3-path';
|
|
2
|
+
import { Coordinate } from '@antv/coord';
|
|
2
3
|
import { Linear } from '@antv/scale';
|
|
3
4
|
import { Primitive, Vector2 } from '../runtime';
|
|
5
|
+
import { isTranspose } from '../utils/coordinate';
|
|
4
6
|
import { angle, dist, sub } from '../utils/vector';
|
|
5
7
|
import { Selection } from '../utils/selection';
|
|
6
8
|
|
|
@@ -127,3 +129,32 @@ export function computeGradient(C: string[], X: number[]): string {
|
|
|
127
129
|
const gradient = C.map((c, i) => `${c} ${color.map(X[i])}%`).join(',');
|
|
128
130
|
return `linear-gradient(${gradient})`;
|
|
129
131
|
}
|
|
132
|
+
|
|
133
|
+
function reorder(points: Vector2[]): Vector2[] {
|
|
134
|
+
const [p0, p1, p2, p3] = points;
|
|
135
|
+
return [p3, p0, p1, p2];
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export function getArcObject(
|
|
139
|
+
coordinate: Coordinate,
|
|
140
|
+
points: Vector2[],
|
|
141
|
+
Y: [number, number],
|
|
142
|
+
) {
|
|
143
|
+
const [p0, p1, , p3] = isTranspose(coordinate) ? reorder(points) : points;
|
|
144
|
+
|
|
145
|
+
const [y, y1] = Y;
|
|
146
|
+
const center = coordinate.getCenter() as Vector2;
|
|
147
|
+
const a1 = angle(sub(p0, center));
|
|
148
|
+
const a2 = angle(sub(p1, center));
|
|
149
|
+
// There are two situations that a2 === a1:
|
|
150
|
+
// 1. a1 - a2 = 0
|
|
151
|
+
// 2. |a1 - a2| = Math.PI * 2
|
|
152
|
+
// Distinguish them by y and y1:
|
|
153
|
+
const a3 = a2 === a1 && y !== y1 ? a2 + Math.PI * 2 : a2;
|
|
154
|
+
return {
|
|
155
|
+
startAngle: a1,
|
|
156
|
+
endAngle: a3 - a1 >= 0 ? a3 : Math.PI * 2 + a3,
|
|
157
|
+
innerRadius: dist(p3, center),
|
|
158
|
+
outerRadius: dist(p0, center),
|
|
159
|
+
};
|
|
160
|
+
}
|
package/src/spec/composition.ts
CHANGED
|
@@ -5,6 +5,8 @@ import { Interaction } from './interaction';
|
|
|
5
5
|
import { Transform } from './transform';
|
|
6
6
|
import { Scale } from './scale';
|
|
7
7
|
import { Title } from './title';
|
|
8
|
+
import { Data } from './data';
|
|
9
|
+
import { LabelLayout } from './labelLayout';
|
|
8
10
|
|
|
9
11
|
export type Node =
|
|
10
12
|
| MarkComposition
|
|
@@ -22,7 +24,7 @@ export type MarkComposition = Geometry & {
|
|
|
22
24
|
|
|
23
25
|
export type ViewComposition = {
|
|
24
26
|
type?: 'view';
|
|
25
|
-
data?:
|
|
27
|
+
data?: Data;
|
|
26
28
|
key?: string;
|
|
27
29
|
class?: string;
|
|
28
30
|
paddingLeft?: number;
|
|
@@ -36,6 +38,7 @@ export type ViewComposition = {
|
|
|
36
38
|
theme?: Theme;
|
|
37
39
|
children?: MarkComposition[];
|
|
38
40
|
adjust?: Adjust;
|
|
41
|
+
labelLayout?: LabelLayout[];
|
|
39
42
|
};
|
|
40
43
|
|
|
41
44
|
export type LayerComposition = {
|
|
@@ -48,7 +51,7 @@ export type LayerComposition = {
|
|
|
48
51
|
export type FlexComposition = {
|
|
49
52
|
type?: 'flex';
|
|
50
53
|
key?: string;
|
|
51
|
-
data?:
|
|
54
|
+
data?: Data;
|
|
52
55
|
direction?: 'col' | 'row';
|
|
53
56
|
ratio?: number[];
|
|
54
57
|
padding?: number;
|
|
@@ -68,7 +71,7 @@ export type FacetContext = {
|
|
|
68
71
|
|
|
69
72
|
export type RectComposition = {
|
|
70
73
|
transform?: Transform;
|
|
71
|
-
data?:
|
|
74
|
+
data?: Data;
|
|
72
75
|
paddingLeft?: number;
|
|
73
76
|
paddingRight?: number;
|
|
74
77
|
paddingTop?: number;
|
|
@@ -97,7 +100,7 @@ export type MatrixComposition = {
|
|
|
97
100
|
paddingBottom?: number;
|
|
98
101
|
transform?: Transform;
|
|
99
102
|
title?: Title;
|
|
100
|
-
data?:
|
|
103
|
+
data?: Data;
|
|
101
104
|
key?: string;
|
|
102
105
|
encode?: {
|
|
103
106
|
x?: string[];
|
|
@@ -119,7 +122,7 @@ export type CircleComposition = {
|
|
|
119
122
|
paddingBottom?: number;
|
|
120
123
|
transform?: Transform;
|
|
121
124
|
title?: Title;
|
|
122
|
-
data?:
|
|
125
|
+
data?: Data;
|
|
123
126
|
key?: string;
|
|
124
127
|
encode?: {
|
|
125
128
|
position?: string;
|
package/src/spec/coordinate.ts
CHANGED
|
@@ -2,18 +2,34 @@ import { CoordinateComponent } from '../runtime';
|
|
|
2
2
|
|
|
3
3
|
export type Coordinate =
|
|
4
4
|
| PolarCoordinate
|
|
5
|
+
| HelixCoordinate
|
|
5
6
|
| TransposeCoordinate
|
|
7
|
+
| ThetaCoordinate
|
|
8
|
+
| ReflectCoordinate
|
|
9
|
+
| ReflectXCoordinate
|
|
10
|
+
| ReflectYCoordinate
|
|
6
11
|
| CustomCoordinate
|
|
7
12
|
| CartesianCoordinate
|
|
8
13
|
| ParallelCoordinate
|
|
9
|
-
| FisheyeCoordinate
|
|
14
|
+
| FisheyeCoordinate
|
|
15
|
+
| FisheyeXCoordinate
|
|
16
|
+
| FisheyeYCoordinate
|
|
17
|
+
| FisheyeCircularCoordinate;
|
|
10
18
|
|
|
11
19
|
export type CoordinateTypes =
|
|
12
20
|
| 'polar'
|
|
21
|
+
| 'helix'
|
|
13
22
|
| 'transpose'
|
|
23
|
+
| 'theta'
|
|
24
|
+
| 'reflect'
|
|
25
|
+
| 'reflectX'
|
|
26
|
+
| 'reflectY'
|
|
14
27
|
| 'cartesian'
|
|
15
28
|
| 'parallel'
|
|
16
|
-
| 'fisheye'
|
|
29
|
+
| 'fisheye'
|
|
30
|
+
| 'fisheyeX'
|
|
31
|
+
| 'fisheyeY'
|
|
32
|
+
| 'fisheyeCircular';
|
|
17
33
|
|
|
18
34
|
export type PolarCoordinate = {
|
|
19
35
|
type?: 'polar';
|
|
@@ -23,10 +39,38 @@ export type PolarCoordinate = {
|
|
|
23
39
|
outerRadius?: number;
|
|
24
40
|
};
|
|
25
41
|
|
|
42
|
+
export type HelixCoordinate = {
|
|
43
|
+
type?: 'helix';
|
|
44
|
+
startAngle?: number;
|
|
45
|
+
endAngle?: number;
|
|
46
|
+
innerRadius?: number;
|
|
47
|
+
outerRadius?: number;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export type ReflectCoordinate = {
|
|
51
|
+
type?: 'reflect';
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export type ReflectXCoordinate = {
|
|
55
|
+
type?: 'reflect.x';
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export type ReflectYCoordinate = {
|
|
59
|
+
type?: 'reflect.y';
|
|
60
|
+
};
|
|
61
|
+
|
|
26
62
|
export type TransposeCoordinate = {
|
|
27
63
|
type?: 'transpose';
|
|
28
64
|
};
|
|
29
65
|
|
|
66
|
+
export type ThetaCoordinate = {
|
|
67
|
+
type?: 'theta';
|
|
68
|
+
startAngle?: number;
|
|
69
|
+
endAngle?: number;
|
|
70
|
+
innerRadius?: number;
|
|
71
|
+
outerRadius?: number;
|
|
72
|
+
};
|
|
73
|
+
|
|
30
74
|
export type CartesianCoordinate = {
|
|
31
75
|
type?: 'cartesian';
|
|
32
76
|
};
|
|
@@ -41,8 +85,28 @@ export type FisheyeCoordinate = {
|
|
|
41
85
|
focusY?: number;
|
|
42
86
|
distortionX?: number;
|
|
43
87
|
distortionY?: number;
|
|
88
|
+
isVisual?: boolean;
|
|
89
|
+
};
|
|
90
|
+
export type FisheyeXCoordinate = {
|
|
91
|
+
type?: 'fisheye.x';
|
|
92
|
+
focusX?: number;
|
|
93
|
+
distortionX?: number;
|
|
94
|
+
isVisual?: boolean;
|
|
95
|
+
};
|
|
96
|
+
export type FisheyeYCoordinate = {
|
|
97
|
+
type?: 'fisheye.y';
|
|
98
|
+
focusY?: number;
|
|
99
|
+
distortionY?: number;
|
|
100
|
+
isVisual?: boolean;
|
|
101
|
+
};
|
|
102
|
+
export type FisheyeCircularCoordinate = {
|
|
103
|
+
type?: 'fisheye.circular';
|
|
104
|
+
focusX?: number;
|
|
105
|
+
focusY?: number;
|
|
106
|
+
radius?: number;
|
|
107
|
+
distortion?: number;
|
|
108
|
+
isVisual?: boolean;
|
|
44
109
|
};
|
|
45
|
-
|
|
46
110
|
export type CustomCoordinate = {
|
|
47
111
|
type: CoordinateComponent;
|
|
48
112
|
[key: string]: any;
|
package/src/spec/data.ts
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { DataComponent } from '../runtime';
|
|
2
|
+
export type Data = FetchConnector | InlineConnector | any;
|
|
3
|
+
|
|
4
|
+
export type FetchConnector = {
|
|
5
|
+
type?: 'fetch';
|
|
6
|
+
value?: string;
|
|
7
|
+
format?: 'json' | 'csv';
|
|
8
|
+
callback?: (d: any) => any;
|
|
9
|
+
// Useful when format is 'csv'.
|
|
10
|
+
delimiter?: string;
|
|
11
|
+
transform?: DataTransform[];
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type InlineConnector = {
|
|
15
|
+
type?: 'inline';
|
|
16
|
+
value?: any;
|
|
17
|
+
transform?: DataTransform[];
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export type DataTransform =
|
|
21
|
+
| SortByTransform
|
|
22
|
+
| PickTransform
|
|
23
|
+
| RenameTransform
|
|
24
|
+
| SubsetTransform
|
|
25
|
+
| FoldTransform
|
|
26
|
+
| FilterByTransform
|
|
27
|
+
| CustomTransform;
|
|
28
|
+
|
|
29
|
+
export type DataTransformTypes =
|
|
30
|
+
| 'sortBy'
|
|
31
|
+
| 'fetch'
|
|
32
|
+
| 'filterBy'
|
|
33
|
+
| 'pick'
|
|
34
|
+
| 'fold'
|
|
35
|
+
| 'connector'
|
|
36
|
+
| DataComponent;
|
|
37
|
+
|
|
38
|
+
export type SortByTransform = {
|
|
39
|
+
type?: 'sortBy';
|
|
40
|
+
fields?: string[];
|
|
41
|
+
order?: 'DESC' | 'ASC';
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export type PickTransform = {
|
|
45
|
+
type?: 'pick';
|
|
46
|
+
fields?: string[];
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export type RenameTransform = {
|
|
50
|
+
type?: 'rename';
|
|
51
|
+
map?: Record<string, string>;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export type SubsetTransform = {
|
|
55
|
+
type?: 'subset';
|
|
56
|
+
start?: number;
|
|
57
|
+
end?: number;
|
|
58
|
+
fields?: string[];
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export type FilterByTransform = {
|
|
62
|
+
type?: 'filterBy';
|
|
63
|
+
fields?: string[];
|
|
64
|
+
callback?: (d: any) => boolean;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export type FoldTransform = {
|
|
68
|
+
type?: 'fold';
|
|
69
|
+
fields?: string[];
|
|
70
|
+
as?: string[];
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export type ConnectorTransform = {
|
|
74
|
+
type?: 'connector';
|
|
75
|
+
callback?: (d: any) => any;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export type CustomTransform = {
|
|
79
|
+
type?: DataComponent;
|
|
80
|
+
[key: string]: any;
|
|
81
|
+
};
|
package/src/spec/geometry.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { Coordinate } from './coordinate';
|
|
|
6
6
|
import { Animation } from './animate';
|
|
7
7
|
import { Interaction } from './interaction';
|
|
8
8
|
import { Theme } from './theme';
|
|
9
|
+
import { Data } from './data';
|
|
9
10
|
|
|
10
11
|
export type Geometry =
|
|
11
12
|
| IntervalGeometry
|
|
@@ -74,7 +75,7 @@ export type BaseGeometry<
|
|
|
74
75
|
paddingRight?: number;
|
|
75
76
|
paddingBottom?: number;
|
|
76
77
|
paddingTop?: number;
|
|
77
|
-
data?:
|
|
78
|
+
data?: Data;
|
|
78
79
|
transform?: Transform[];
|
|
79
80
|
encode?: Partial<Record<C, Encode | Encode[]>>;
|
|
80
81
|
scale?: Partial<Record<C, Scale>>;
|
package/src/spec/index.ts
CHANGED
|
@@ -7,7 +7,7 @@ export type G2Spec = Node & {
|
|
|
7
7
|
|
|
8
8
|
export * from './transform';
|
|
9
9
|
export * from './encode';
|
|
10
|
-
export * from './
|
|
10
|
+
export * from './data';
|
|
11
11
|
export * from './scale';
|
|
12
12
|
export * from './palette';
|
|
13
13
|
export * from './coordinate';
|
|
@@ -16,3 +16,4 @@ export * from './animate';
|
|
|
16
16
|
export * from './interaction';
|
|
17
17
|
export * from './action';
|
|
18
18
|
export * from './composition';
|
|
19
|
+
export * from './labelLayout';
|