@antv/g2 5.0.0-beta.5 → 5.0.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/g2-lite.min.js +4 -4
- package/dist/g2.min.js +4 -4
- package/esm/api/chart.d.ts +6 -2
- package/esm/api/chart.js +28 -7
- package/esm/api/chart.js.map +1 -1
- package/esm/api/composition/base.d.ts +4 -0
- package/esm/api/composition/base.js +16 -0
- package/esm/api/composition/base.js.map +1 -0
- package/esm/api/composition/facetCircle.d.ts +2 -3
- package/esm/api/composition/facetCircle.js +2 -2
- package/esm/api/composition/facetCircle.js.map +1 -1
- package/esm/api/composition/facetRect.d.ts +2 -3
- package/esm/api/composition/facetRect.js +2 -2
- package/esm/api/composition/facetRect.js.map +1 -1
- package/esm/api/composition/geoPath.d.ts +2 -3
- package/esm/api/composition/geoPath.js +2 -2
- package/esm/api/composition/geoPath.js.map +1 -1
- package/esm/api/composition/geoView.d.ts +2 -3
- package/esm/api/composition/geoView.js +2 -2
- package/esm/api/composition/geoView.js.map +1 -1
- package/esm/api/composition/index.d.ts +2 -1
- package/esm/api/composition/index.js +2 -1
- package/esm/api/composition/index.js.map +1 -1
- package/esm/api/composition/repeatMatrix.d.ts +2 -3
- package/esm/api/composition/repeatMatrix.js +2 -2
- package/esm/api/composition/repeatMatrix.js.map +1 -1
- package/esm/api/composition/spaceFlex.d.ts +2 -3
- package/esm/api/composition/spaceFlex.js +2 -2
- package/esm/api/composition/spaceFlex.js.map +1 -1
- package/esm/api/composition/spaceLayer.d.ts +2 -3
- package/esm/api/composition/spaceLayer.js +2 -2
- package/esm/api/composition/spaceLayer.js.map +1 -1
- package/esm/api/composition/timingKeyframe.d.ts +2 -3
- package/esm/api/composition/timingKeyframe.js +2 -2
- package/esm/api/composition/timingKeyframe.js.map +1 -1
- package/esm/api/composition/view.d.ts +3 -3
- package/esm/api/composition/view.js +4 -4
- package/esm/api/composition/view.js.map +1 -1
- package/esm/api/mark/mark.d.ts +34 -28
- package/esm/api/mark/mark.js +39 -26
- package/esm/api/mark/mark.js.map +1 -1
- package/esm/api/mark/types.d.ts +1 -0
- package/esm/api/node.d.ts +2 -1
- package/esm/api/node.js +8 -9
- package/esm/api/node.js.map +1 -1
- package/esm/component/axis.js +18 -5
- package/esm/component/axis.js.map +1 -1
- package/esm/component/index.d.ts +2 -0
- package/esm/component/index.js +2 -0
- package/esm/component/index.js.map +1 -1
- package/esm/component/scrollbar.d.ts +9 -0
- package/esm/component/scrollbar.js +36 -0
- package/esm/component/scrollbar.js.map +1 -0
- package/esm/component/scrollbarX.d.ts +7 -0
- package/esm/component/scrollbarX.js +9 -0
- package/esm/component/scrollbarX.js.map +1 -0
- package/esm/component/scrollbarY.d.ts +7 -0
- package/esm/component/scrollbarY.js +9 -0
- package/esm/component/scrollbarY.js.map +1 -0
- package/esm/component/slider.js +3 -13
- package/esm/component/slider.js.map +1 -1
- package/esm/component/title.js +46 -22
- package/esm/component/title.js.map +1 -1
- package/esm/data/fold.js +4 -10
- package/esm/data/fold.js.map +1 -1
- package/esm/data/index.d.ts +2 -2
- package/esm/data/index.js +1 -1
- package/esm/data/index.js.map +1 -1
- package/esm/data/pick.js +10 -2
- package/esm/data/pick.js.map +1 -1
- package/esm/data/slice.d.ts +8 -0
- package/esm/data/slice.js +10 -0
- package/esm/data/slice.js.map +1 -0
- package/esm/geo/{d3-projection.d.ts → d3Projection.d.ts} +0 -0
- package/esm/geo/{d3-projection.js → d3Projection.js} +1 -1
- package/esm/geo/d3Projection.js.map +1 -0
- package/esm/geo/geoView.js +1 -1
- package/esm/geo/geoView.js.map +1 -1
- package/esm/interaction/index.d.ts +6 -0
- package/esm/interaction/index.js +5 -30
- package/esm/interaction/index.js.map +1 -1
- package/esm/interaction/native/brushAxisHighlight.d.ts +26 -0
- package/esm/interaction/native/brushAxisHighlight.js +159 -0
- package/esm/interaction/native/brushAxisHighlight.js.map +1 -0
- package/esm/interaction/native/brushFilter.d.ts +14 -0
- package/esm/interaction/native/brushFilter.js +122 -0
- package/esm/interaction/native/brushFilter.js.map +1 -0
- package/esm/interaction/native/brushHighlight.d.ts +30 -5
- package/esm/interaction/native/brushHighlight.js +92 -34
- package/esm/interaction/native/brushHighlight.js.map +1 -1
- package/esm/interaction/native/brushXFilter.d.ts +1 -0
- package/esm/interaction/native/brushXFilter.js +6 -0
- package/esm/interaction/native/brushXFilter.js.map +1 -0
- package/esm/interaction/native/brushXHighlight.d.ts +6 -1
- package/esm/interaction/native/brushXHighlight.js +5 -4
- package/esm/interaction/native/brushXHighlight.js.map +1 -1
- package/esm/interaction/native/brushYFilter.d.ts +1 -0
- package/esm/interaction/native/brushYFilter.js +6 -0
- package/esm/interaction/native/brushYFilter.js.map +1 -0
- package/esm/interaction/native/brushYHighlight.d.ts +6 -1
- package/esm/interaction/native/brushYHighlight.js +5 -4
- package/esm/interaction/native/brushYHighlight.js.map +1 -1
- package/esm/interaction/native/elementHighlight.js +1 -0
- package/esm/interaction/native/elementHighlight.js.map +1 -1
- package/esm/interaction/native/elementSelect.js +1 -0
- package/esm/interaction/native/elementSelect.js.map +1 -1
- package/esm/interaction/native/sliderFilter.d.ts +5 -0
- package/esm/interaction/native/sliderFilter.js +87 -0
- package/esm/interaction/native/sliderFilter.js.map +1 -0
- package/esm/interaction/native/tooltip.js +16 -4
- package/esm/interaction/native/tooltip.js.map +1 -1
- package/esm/interaction/native/utils.d.ts +5 -1
- package/esm/interaction/native/utils.js +11 -3
- package/esm/interaction/native/utils.js.map +1 -1
- package/esm/label-transform/overlapDodgeY.js +8 -0
- package/esm/label-transform/overlapDodgeY.js.map +1 -1
- package/esm/mark/area.js +1 -1
- package/esm/mark/area.js.map +1 -1
- package/esm/mark/boxplot.js +5 -18
- package/esm/mark/boxplot.js.map +1 -1
- package/esm/runtime/component.d.ts +1 -1
- package/esm/runtime/component.js +38 -41
- package/esm/runtime/component.js.map +1 -1
- package/esm/runtime/layout.js +7 -7
- package/esm/runtime/layout.js.map +1 -1
- package/esm/runtime/plot.d.ts +1 -1
- package/esm/runtime/plot.js +70 -27
- package/esm/runtime/plot.js.map +1 -1
- package/esm/runtime/render.d.ts +0 -1
- package/esm/runtime/render.js +4 -34
- package/esm/runtime/render.js.map +1 -1
- package/esm/runtime/scale.d.ts +2 -1
- package/esm/runtime/scale.js +7 -0
- package/esm/runtime/scale.js.map +1 -1
- package/esm/runtime/transform.js +6 -2
- package/esm/runtime/transform.js.map +1 -1
- package/esm/runtime/types/common.d.ts +26 -9
- package/esm/runtime/types/options.d.ts +2 -5
- package/esm/runtime/types/theme.d.ts +2 -5
- package/esm/shape/area/curve.js +15 -8
- package/esm/shape/area/curve.js.map +1 -1
- package/esm/shape/box/box.js +1 -1
- package/esm/shape/box/box.js.map +1 -1
- package/esm/shape/connector/connector.js +2 -2
- package/esm/shape/connector/connector.js.map +1 -1
- package/esm/shape/image/image.js +2 -2
- package/esm/shape/image/image.js.map +1 -1
- package/esm/shape/interval/color.js +3 -1
- package/esm/shape/interval/color.js.map +1 -1
- package/esm/shape/label/position/default.d.ts +5 -7
- package/esm/shape/label/position/default.js +14 -40
- package/esm/shape/label/position/default.js.map +1 -1
- package/esm/shape/label/position/outside.d.ts +18 -1
- package/esm/shape/label/position/outside.js +66 -1
- package/esm/shape/label/position/outside.js.map +1 -1
- package/esm/shape/label/position/spider.d.ts +1 -1
- package/esm/shape/label/position/spider.js +12 -18
- package/esm/shape/label/position/spider.js.map +1 -1
- package/esm/shape/label/position/surround.d.ts +1 -1
- package/esm/shape/label/position/surround.js +12 -14
- package/esm/shape/label/position/surround.js.map +1 -1
- package/esm/shape/line/curve.js +1 -1
- package/esm/shape/line/curve.js.map +1 -1
- package/esm/shape/lineXY/line.js +2 -2
- package/esm/shape/lineXY/line.js.map +1 -1
- package/esm/shape/link/arc.js +2 -2
- package/esm/shape/link/arc.js.map +1 -1
- package/esm/shape/link/link.js +2 -2
- package/esm/shape/link/link.js.map +1 -1
- package/esm/shape/link/smooth.js +2 -2
- package/esm/shape/link/smooth.js.map +1 -1
- package/esm/shape/link/vhv.js +2 -2
- package/esm/shape/link/vhv.js.map +1 -1
- package/esm/shape/point/color.js +1 -1
- package/esm/shape/point/color.js.map +1 -1
- package/esm/shape/polygon/polygon.js +3 -3
- package/esm/shape/polygon/polygon.js.map +1 -1
- package/esm/shape/polygon/ribbon.js +3 -3
- package/esm/shape/polygon/ribbon.js.map +1 -1
- package/esm/shape/text/advance.js +1 -1
- package/esm/shape/text/advance.js.map +1 -1
- package/esm/shape/text/badge.js +3 -3
- package/esm/shape/text/badge.js.map +1 -1
- package/esm/shape/text/text.js +1 -1
- package/esm/shape/text/text.js.map +1 -1
- package/esm/shape/utils.d.ts +4 -0
- package/esm/shape/utils.js +6 -1
- package/esm/shape/utils.js.map +1 -1
- package/esm/shape/vector/vector.js +3 -3
- package/esm/shape/vector/vector.js.map +1 -1
- package/esm/spec/data.d.ts +24 -9
- package/esm/spec/geometry.d.ts +2 -0
- package/esm/spec/interaction.d.ts +28 -3
- package/esm/spec/transform.d.ts +2 -2
- package/esm/stdlib/index.js +5 -5
- package/esm/stdlib/index.js.map +1 -1
- package/esm/theme/academy.js +11 -15
- package/esm/theme/academy.js.map +1 -1
- package/esm/theme/dark.js +11 -18
- package/esm/theme/dark.js.map +1 -1
- package/esm/theme/light.js +25 -19
- package/esm/theme/light.js.map +1 -1
- package/esm/transform/select.js +1 -13
- package/esm/transform/select.js.map +1 -1
- package/esm/transform/selectX.js +1 -1
- package/esm/transform/selectX.js.map +1 -1
- package/esm/transform/selectY.js +1 -1
- package/esm/transform/selectY.js.map +1 -1
- package/esm/utils/scale.d.ts +2 -0
- package/esm/utils/scale.js +30 -0
- package/esm/utils/scale.js.map +1 -0
- package/lib/api/chart.d.ts +6 -2
- package/lib/api/chart.js +27 -6
- package/lib/api/chart.js.map +1 -1
- package/lib/api/composition/base.d.ts +4 -0
- package/lib/api/composition/base.js +19 -0
- package/lib/api/composition/base.js.map +1 -0
- package/lib/api/composition/facetCircle.d.ts +2 -3
- package/lib/api/composition/facetCircle.js +2 -2
- package/lib/api/composition/facetCircle.js.map +1 -1
- package/lib/api/composition/facetRect.d.ts +2 -3
- package/lib/api/composition/facetRect.js +2 -2
- package/lib/api/composition/facetRect.js.map +1 -1
- package/lib/api/composition/geoPath.d.ts +2 -3
- package/lib/api/composition/geoPath.js +2 -2
- package/lib/api/composition/geoPath.js.map +1 -1
- package/lib/api/composition/geoView.d.ts +2 -3
- package/lib/api/composition/geoView.js +2 -2
- package/lib/api/composition/geoView.js.map +1 -1
- package/lib/api/composition/index.d.ts +2 -1
- package/lib/api/composition/index.js +3 -1
- package/lib/api/composition/index.js.map +1 -1
- package/lib/api/composition/repeatMatrix.d.ts +2 -3
- package/lib/api/composition/repeatMatrix.js +2 -2
- package/lib/api/composition/repeatMatrix.js.map +1 -1
- package/lib/api/composition/spaceFlex.d.ts +2 -3
- package/lib/api/composition/spaceFlex.js +2 -2
- package/lib/api/composition/spaceFlex.js.map +1 -1
- package/lib/api/composition/spaceLayer.d.ts +2 -3
- package/lib/api/composition/spaceLayer.js +2 -2
- package/lib/api/composition/spaceLayer.js.map +1 -1
- package/lib/api/composition/timingKeyframe.d.ts +2 -3
- package/lib/api/composition/timingKeyframe.js +2 -2
- package/lib/api/composition/timingKeyframe.js.map +1 -1
- package/lib/api/composition/view.d.ts +3 -3
- package/lib/api/composition/view.js +4 -4
- package/lib/api/composition/view.js.map +1 -1
- package/lib/api/mark/mark.d.ts +34 -28
- package/lib/api/mark/mark.js +41 -27
- package/lib/api/mark/mark.js.map +1 -1
- package/lib/api/mark/types.d.ts +1 -0
- package/lib/api/node.d.ts +2 -1
- package/lib/api/node.js +8 -9
- package/lib/api/node.js.map +1 -1
- package/lib/component/axis.js +18 -5
- package/lib/component/axis.js.map +1 -1
- package/lib/component/index.d.ts +2 -0
- package/lib/component/index.js +5 -1
- package/lib/component/index.js.map +1 -1
- package/lib/component/scrollbar.d.ts +9 -0
- package/lib/component/scrollbar.js +40 -0
- package/lib/component/scrollbar.js.map +1 -0
- package/lib/component/scrollbarX.d.ts +7 -0
- package/lib/component/scrollbarX.js +13 -0
- package/lib/component/scrollbarX.js.map +1 -0
- package/lib/component/scrollbarY.d.ts +7 -0
- package/lib/component/scrollbarY.js +13 -0
- package/lib/component/scrollbarY.js.map +1 -0
- package/lib/component/slider.js +3 -13
- package/lib/component/slider.js.map +1 -1
- package/lib/component/title.js +46 -22
- package/lib/component/title.js.map +1 -1
- package/lib/data/fold.js +4 -10
- package/lib/data/fold.js.map +1 -1
- package/lib/data/index.d.ts +2 -2
- package/lib/data/index.js +3 -3
- package/lib/data/index.js.map +1 -1
- package/lib/data/pick.js +10 -2
- package/lib/data/pick.js.map +1 -1
- package/lib/data/slice.d.ts +8 -0
- package/lib/data/slice.js +14 -0
- package/lib/data/slice.js.map +1 -0
- package/lib/geo/{d3-projection.d.ts → d3Projection.d.ts} +0 -0
- package/lib/geo/{d3-projection.js → d3Projection.js} +1 -1
- package/lib/geo/d3Projection.js.map +1 -0
- package/lib/geo/geoView.js +1 -1
- package/lib/geo/geoView.js.map +1 -1
- package/lib/interaction/index.d.ts +6 -0
- package/lib/interaction/index.js +11 -31
- package/lib/interaction/index.js.map +1 -1
- package/lib/interaction/native/brushAxisHighlight.d.ts +26 -0
- package/lib/interaction/native/brushAxisHighlight.js +164 -0
- package/lib/interaction/native/brushAxisHighlight.js.map +1 -0
- package/lib/interaction/native/brushFilter.d.ts +14 -0
- package/lib/interaction/native/brushFilter.js +127 -0
- package/lib/interaction/native/brushFilter.js.map +1 -0
- package/lib/interaction/native/brushHighlight.d.ts +30 -5
- package/lib/interaction/native/brushHighlight.js +91 -33
- package/lib/interaction/native/brushHighlight.js.map +1 -1
- package/lib/interaction/native/brushXFilter.d.ts +1 -0
- package/lib/interaction/native/brushXFilter.js +10 -0
- package/lib/interaction/native/brushXFilter.js.map +1 -0
- package/lib/interaction/native/brushXHighlight.d.ts +6 -1
- package/lib/interaction/native/brushXHighlight.js +7 -5
- package/lib/interaction/native/brushXHighlight.js.map +1 -1
- package/lib/interaction/native/brushYFilter.d.ts +1 -0
- package/lib/interaction/native/brushYFilter.js +10 -0
- package/lib/interaction/native/brushYFilter.js.map +1 -0
- package/lib/interaction/native/brushYHighlight.d.ts +6 -1
- package/lib/interaction/native/brushYHighlight.js +7 -5
- package/lib/interaction/native/brushYHighlight.js.map +1 -1
- package/lib/interaction/native/elementHighlight.js +1 -0
- package/lib/interaction/native/elementHighlight.js.map +1 -1
- package/lib/interaction/native/elementSelect.js +1 -0
- package/lib/interaction/native/elementSelect.js.map +1 -1
- package/lib/interaction/native/sliderFilter.d.ts +5 -0
- package/lib/interaction/native/sliderFilter.js +91 -0
- package/lib/interaction/native/sliderFilter.js.map +1 -0
- package/lib/interaction/native/tooltip.js +16 -4
- package/lib/interaction/native/tooltip.js.map +1 -1
- package/lib/interaction/native/utils.d.ts +5 -1
- package/lib/interaction/native/utils.js +14 -5
- package/lib/interaction/native/utils.js.map +1 -1
- package/lib/label-transform/overlapDodgeY.js +8 -0
- package/lib/label-transform/overlapDodgeY.js.map +1 -1
- package/lib/mark/area.js +1 -1
- package/lib/mark/area.js.map +1 -1
- package/lib/mark/boxplot.js +5 -18
- package/lib/mark/boxplot.js.map +1 -1
- package/lib/runtime/component.d.ts +1 -1
- package/lib/runtime/component.js +37 -40
- package/lib/runtime/component.js.map +1 -1
- package/lib/runtime/layout.js +7 -7
- package/lib/runtime/layout.js.map +1 -1
- package/lib/runtime/plot.d.ts +1 -1
- package/lib/runtime/plot.js +67 -24
- package/lib/runtime/plot.js.map +1 -1
- package/lib/runtime/render.d.ts +0 -1
- package/lib/runtime/render.js +4 -35
- package/lib/runtime/render.js.map +1 -1
- package/lib/runtime/scale.d.ts +2 -1
- package/lib/runtime/scale.js +9 -1
- package/lib/runtime/scale.js.map +1 -1
- package/lib/runtime/transform.js +6 -2
- package/lib/runtime/transform.js.map +1 -1
- package/lib/runtime/types/common.d.ts +26 -9
- package/lib/runtime/types/options.d.ts +2 -5
- package/lib/runtime/types/theme.d.ts +2 -5
- package/lib/shape/area/curve.js +14 -7
- package/lib/shape/area/curve.js.map +1 -1
- package/lib/shape/box/box.js +1 -1
- package/lib/shape/box/box.js.map +1 -1
- package/lib/shape/connector/connector.js +2 -2
- package/lib/shape/connector/connector.js.map +1 -1
- package/lib/shape/image/image.js +2 -2
- package/lib/shape/image/image.js.map +1 -1
- package/lib/shape/interval/color.js +3 -1
- package/lib/shape/interval/color.js.map +1 -1
- package/lib/shape/label/position/default.d.ts +5 -7
- package/lib/shape/label/position/default.js +16 -40
- package/lib/shape/label/position/default.js.map +1 -1
- package/lib/shape/label/position/outside.d.ts +18 -1
- package/lib/shape/label/position/outside.js +72 -3
- package/lib/shape/label/position/outside.js.map +1 -1
- package/lib/shape/label/position/spider.d.ts +1 -1
- package/lib/shape/label/position/spider.js +12 -18
- package/lib/shape/label/position/spider.js.map +1 -1
- package/lib/shape/label/position/surround.d.ts +1 -1
- package/lib/shape/label/position/surround.js +11 -13
- package/lib/shape/label/position/surround.js.map +1 -1
- package/lib/shape/line/curve.js +1 -1
- package/lib/shape/line/curve.js.map +1 -1
- package/lib/shape/lineXY/line.js +2 -2
- package/lib/shape/lineXY/line.js.map +1 -1
- package/lib/shape/link/arc.js +2 -2
- package/lib/shape/link/arc.js.map +1 -1
- package/lib/shape/link/link.js +2 -2
- package/lib/shape/link/link.js.map +1 -1
- package/lib/shape/link/smooth.js +2 -2
- package/lib/shape/link/smooth.js.map +1 -1
- package/lib/shape/link/vhv.js +2 -2
- package/lib/shape/link/vhv.js.map +1 -1
- package/lib/shape/point/color.js +1 -1
- package/lib/shape/point/color.js.map +1 -1
- package/lib/shape/polygon/polygon.js +3 -3
- package/lib/shape/polygon/polygon.js.map +1 -1
- package/lib/shape/polygon/ribbon.js +3 -3
- package/lib/shape/polygon/ribbon.js.map +1 -1
- package/lib/shape/text/advance.js +1 -1
- package/lib/shape/text/advance.js.map +1 -1
- package/lib/shape/text/badge.js +3 -3
- package/lib/shape/text/badge.js.map +1 -1
- package/lib/shape/text/text.js +1 -1
- package/lib/shape/text/text.js.map +1 -1
- package/lib/shape/utils.d.ts +4 -0
- package/lib/shape/utils.js +6 -1
- package/lib/shape/utils.js.map +1 -1
- package/lib/shape/vector/vector.js +3 -3
- package/lib/shape/vector/vector.js.map +1 -1
- package/lib/spec/data.d.ts +24 -9
- package/lib/spec/geometry.d.ts +2 -0
- package/lib/spec/interaction.d.ts +28 -3
- package/lib/spec/transform.d.ts +2 -2
- package/lib/stdlib/index.js +2 -2
- package/lib/stdlib/index.js.map +1 -1
- package/lib/theme/academy.js +11 -15
- package/lib/theme/academy.js.map +1 -1
- package/lib/theme/dark.js +11 -18
- package/lib/theme/dark.js.map +1 -1
- package/lib/theme/light.js +25 -19
- package/lib/theme/light.js.map +1 -1
- package/lib/transform/select.js +1 -13
- package/lib/transform/select.js.map +1 -1
- package/lib/transform/selectX.js +1 -1
- package/lib/transform/selectX.js.map +1 -1
- package/lib/transform/selectY.js +1 -1
- package/lib/transform/selectY.js.map +1 -1
- package/lib/utils/scale.d.ts +2 -0
- package/lib/utils/scale.js +35 -0
- package/lib/utils/scale.js.map +1 -0
- package/package.json +1 -1
- package/src/api/chart.ts +31 -10
- package/src/api/composition/base.ts +11 -0
- package/src/api/composition/facetCircle.ts +2 -3
- package/src/api/composition/facetRect.ts +2 -3
- package/src/api/composition/geoPath.ts +2 -3
- package/src/api/composition/geoView.ts +2 -3
- package/src/api/composition/index.ts +2 -0
- package/src/api/composition/repeatMatrix.ts +2 -3
- package/src/api/composition/spaceFlex.ts +2 -3
- package/src/api/composition/spaceLayer.ts +2 -3
- package/src/api/composition/timingKeyframe.ts +2 -3
- package/src/api/composition/view.ts +6 -4
- package/src/api/mark/mark.ts +48 -27
- package/src/api/mark/types.ts +1 -0
- package/src/api/node.ts +9 -11
- package/src/component/axis.ts +22 -5
- package/src/component/index.ts +2 -0
- package/src/component/scrollbar.ts +41 -0
- package/src/component/scrollbarX.ts +16 -0
- package/src/component/scrollbarY.ts +16 -0
- package/src/component/slider.ts +3 -12
- package/src/component/title.ts +69 -30
- package/src/data/fold.ts +6 -10
- package/src/data/index.ts +2 -2
- package/src/data/pick.ts +11 -2
- package/src/data/slice.ts +15 -0
- package/src/geo/{d3-projection.ts → d3Projection.ts} +0 -0
- package/src/geo/geoView.ts +1 -1
- package/src/interaction/index.ts +21 -16
- package/src/interaction/native/brushAxisHighlight.ts +194 -0
- package/src/interaction/native/brushFilter.ts +143 -0
- package/src/interaction/native/brushHighlight.ts +104 -31
- package/src/interaction/native/brushXFilter.ts +10 -0
- package/src/interaction/native/brushXHighlight.ts +6 -4
- package/src/interaction/native/brushYFilter.ts +10 -0
- package/src/interaction/native/brushYHighlight.ts +6 -4
- package/src/interaction/native/elementHighlight.ts +1 -0
- package/src/interaction/native/elementSelect.ts +1 -0
- package/src/interaction/native/sliderFilter.ts +112 -0
- package/src/interaction/native/tooltip.ts +18 -4
- package/src/interaction/native/utils.ts +15 -6
- package/src/label-transform/overlapDodgeY.ts +8 -1
- package/src/mark/area.ts +1 -1
- package/src/mark/boxplot.ts +3 -1
- package/src/runtime/component.ts +64 -72
- package/src/runtime/layout.ts +6 -6
- package/src/runtime/plot.ts +126 -73
- package/src/runtime/render.ts +6 -58
- package/src/runtime/scale.ts +14 -0
- package/src/runtime/transform.ts +6 -2
- package/src/runtime/types/common.ts +26 -10
- package/src/runtime/types/options.ts +2 -5
- package/src/runtime/types/theme.ts +2 -5
- package/src/shape/area/curve.ts +15 -8
- package/src/shape/box/box.ts +6 -6
- package/src/shape/connector/connector.ts +2 -3
- package/src/shape/image/image.ts +2 -2
- package/src/shape/interval/color.ts +2 -1
- package/src/shape/label/position/default.ts +15 -55
- package/src/shape/label/position/outside.ts +121 -1
- package/src/shape/label/position/spider.ts +12 -19
- package/src/shape/label/position/surround.ts +13 -15
- package/src/shape/line/curve.ts +1 -1
- package/src/shape/lineXY/line.ts +2 -2
- package/src/shape/link/arc.ts +2 -2
- package/src/shape/link/link.ts +2 -2
- package/src/shape/link/smooth.ts +2 -2
- package/src/shape/link/vhv.ts +2 -2
- package/src/shape/point/color.ts +6 -5
- package/src/shape/polygon/polygon.ts +3 -3
- package/src/shape/polygon/ribbon.ts +3 -3
- package/src/shape/text/advance.ts +4 -1
- package/src/shape/text/badge.ts +8 -3
- package/src/shape/text/text.ts +1 -1
- package/src/shape/utils.ts +6 -5
- package/src/shape/vector/vector.ts +3 -3
- package/src/spec/action.ts +0 -1
- package/src/spec/data.ts +25 -10
- package/src/spec/geometry.ts +2 -0
- package/src/spec/interaction.ts +41 -2
- package/src/spec/transform.ts +3 -1
- package/src/stdlib/index.ts +16 -2
- package/src/theme/academy.ts +11 -15
- package/src/theme/dark.ts +11 -18
- package/src/theme/light.ts +25 -19
- package/src/transform/select.ts +1 -2
- package/src/transform/selectX.ts +1 -1
- package/src/transform/selectY.ts +1 -1
- package/src/utils/scale.ts +31 -0
- package/esm/data/subset.d.ts +0 -7
- package/esm/data/subset.js +0 -26
- package/esm/data/subset.js.map +0 -1
- package/esm/geo/d3-projection.js.map +0 -1
- package/lib/data/subset.d.ts +0 -7
- package/lib/data/subset.js +0 -30
- package/lib/data/subset.js.map +0 -1
- package/lib/geo/d3-projection.js.map +0 -1
- package/src/.DS_Store +0 -0
- package/src/data/.DS_Store +0 -0
- package/src/data/subset.ts +0 -35
- package/src/shape/.DS_Store +0 -0
|
@@ -40,19 +40,28 @@ export function mousePosition(target, event) {
|
|
|
40
40
|
return [offsetX - x, offsetY - y];
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
/**
|
|
44
|
+
* @todo Pass bbox rather than calc it here.
|
|
45
|
+
*/
|
|
46
|
+
export function brushMousePosition(target, event) {
|
|
44
47
|
const { offsetX, offsetY } = event;
|
|
45
|
-
const
|
|
46
|
-
const {
|
|
47
|
-
min: [x, y],
|
|
48
|
-
max: [x1, y1],
|
|
49
|
-
} = bbox;
|
|
48
|
+
const [x, y, x1, y1] = boundsOfBrushArea(target);
|
|
50
49
|
return [
|
|
51
50
|
Math.min(x1, Math.max(x, offsetX)) - x,
|
|
52
51
|
Math.min(y1, Math.max(y, offsetY)) - y,
|
|
53
52
|
];
|
|
54
53
|
}
|
|
55
54
|
|
|
55
|
+
export function boundsOfBrushArea(target) {
|
|
56
|
+
// Calc bbox after clipping.
|
|
57
|
+
const bbox = target.getRenderBounds();
|
|
58
|
+
const {
|
|
59
|
+
min: [x0, y0],
|
|
60
|
+
max: [x1, y1],
|
|
61
|
+
} = bbox;
|
|
62
|
+
return [x0, y0, x1, y1];
|
|
63
|
+
}
|
|
64
|
+
|
|
56
65
|
export function applyDefaultsHighlightedStyle(
|
|
57
66
|
style: Record<string, any>,
|
|
58
67
|
): Record<string, any> {
|
|
@@ -2,6 +2,7 @@ import { DisplayObject } from '@antv/g';
|
|
|
2
2
|
import { ascending } from 'd3-array';
|
|
3
3
|
import { OverlapDodgeYTransform } from '../spec';
|
|
4
4
|
import { LabelTransformComponent as LLC } from '../runtime';
|
|
5
|
+
import { defined } from '../utils/helper';
|
|
5
6
|
|
|
6
7
|
export type OverlapDodgeYOptions = Omit<OverlapDodgeYTransform, 'type'>;
|
|
7
8
|
|
|
@@ -16,13 +17,19 @@ function useMap<K, V>() {
|
|
|
16
17
|
return [get, set] as const;
|
|
17
18
|
}
|
|
18
19
|
|
|
20
|
+
/**
|
|
21
|
+
* @todo fixme
|
|
22
|
+
*/
|
|
19
23
|
function getBoundsWithoutConnector(shape: DisplayObject) {
|
|
24
|
+
// Remove this line when @antv/g fixed
|
|
25
|
+
// https://github.com/antvis/G/pull/1269#pullrequestreview-1251209956
|
|
26
|
+
if (!defined(shape.style.stroke)) shape.style.stroke = '';
|
|
27
|
+
|
|
20
28
|
const node = shape.cloneNode(true);
|
|
21
29
|
const connectorShape = node.getElementById('connector');
|
|
22
30
|
connectorShape && node.removeChild(connectorShape);
|
|
23
31
|
const { min, max } = node.getRenderBounds();
|
|
24
32
|
node.destroy();
|
|
25
|
-
|
|
26
33
|
return { min, max };
|
|
27
34
|
}
|
|
28
35
|
|
package/src/mark/area.ts
CHANGED
package/src/mark/boxplot.ts
CHANGED
|
@@ -56,7 +56,7 @@ function OutlierY() {
|
|
|
56
56
|
|
|
57
57
|
export const Boxplot: CC<BoxPlotOptions> = (options) => {
|
|
58
58
|
return () => {
|
|
59
|
-
const { data, encode, style = {} } = options;
|
|
59
|
+
const { data, encode, style = {}, ...rest } = options;
|
|
60
60
|
const { extend = false, ...restStyle } = style;
|
|
61
61
|
const { y } = encode;
|
|
62
62
|
const encodeY = { y, y1: y, y2: y, y3: y, y4: y };
|
|
@@ -79,6 +79,7 @@ export const Boxplot: CC<BoxPlotOptions> = (options) => {
|
|
|
79
79
|
],
|
|
80
80
|
encode: { ...encode, ...encodeY },
|
|
81
81
|
style: restStyle,
|
|
82
|
+
...rest,
|
|
82
83
|
},
|
|
83
84
|
];
|
|
84
85
|
}
|
|
@@ -99,6 +100,7 @@ export const Boxplot: CC<BoxPlotOptions> = (options) => {
|
|
|
99
100
|
],
|
|
100
101
|
encode: { ...encode, ...encodeY },
|
|
101
102
|
style: boxStyle,
|
|
103
|
+
...rest,
|
|
102
104
|
},
|
|
103
105
|
// Draw outliers.
|
|
104
106
|
{
|
package/src/runtime/component.ts
CHANGED
|
@@ -1,31 +1,25 @@
|
|
|
1
1
|
import { Coordinate } from '@antv/coord';
|
|
2
|
-
import { deepMix } from '@antv/util';
|
|
3
2
|
import {
|
|
4
|
-
|
|
5
|
-
G2CoordinateOptions,
|
|
6
|
-
G2Library,
|
|
7
|
-
G2GuideComponentOptions,
|
|
8
|
-
G2View,
|
|
9
|
-
G2TitleOptions,
|
|
10
|
-
} from './types/options';
|
|
11
|
-
import {
|
|
12
|
-
GuideComponentComponent,
|
|
13
|
-
GuideComponent,
|
|
14
|
-
ScaleComponent,
|
|
15
|
-
Scale,
|
|
16
|
-
} from './types/component';
|
|
17
|
-
import { G2Theme, GuideComponentPosition } from './types/common';
|
|
18
|
-
import {
|
|
19
|
-
isPolar,
|
|
20
|
-
isTranspose,
|
|
3
|
+
isHelix,
|
|
21
4
|
isParallel,
|
|
5
|
+
isPolar,
|
|
6
|
+
isRadial,
|
|
22
7
|
isReflect,
|
|
23
8
|
isReflectY,
|
|
24
9
|
isTheta,
|
|
25
|
-
|
|
26
|
-
isRadial,
|
|
10
|
+
isTranspose,
|
|
27
11
|
} from './coordinate';
|
|
28
12
|
import { useLibrary } from './library';
|
|
13
|
+
import { useRelationScale } from './scale';
|
|
14
|
+
import { G2Theme, GuideComponentPosition } from './types/common';
|
|
15
|
+
import { GuideComponent, GuideComponentComponent } from './types/component';
|
|
16
|
+
import {
|
|
17
|
+
G2CoordinateOptions,
|
|
18
|
+
G2GuideComponentOptions,
|
|
19
|
+
G2Library,
|
|
20
|
+
G2ScaleOptions,
|
|
21
|
+
G2View,
|
|
22
|
+
} from './types/options';
|
|
29
23
|
|
|
30
24
|
export function inferComponent(
|
|
31
25
|
scales: G2ScaleOptions[],
|
|
@@ -48,20 +42,17 @@ export function inferComponent(
|
|
|
48
42
|
if (guide === null) return false;
|
|
49
43
|
return true;
|
|
50
44
|
});
|
|
51
|
-
const sliders =
|
|
45
|
+
const sliders = inferScrollComponents(partialOptions, scales, library);
|
|
52
46
|
const components = [...partialComponents, ...sliders];
|
|
53
47
|
if (title) {
|
|
54
48
|
const { props } = createGuideComponent('title');
|
|
55
49
|
const { defaultPosition, defaultOrder, defaultSize } = props;
|
|
56
|
-
const titleOptions = typeof title === 'string' ? {
|
|
57
|
-
const size = inferTitleComponentSize(
|
|
58
|
-
deepMix({ size: defaultSize }, theme, titleOptions),
|
|
59
|
-
);
|
|
50
|
+
const titleOptions = typeof title === 'string' ? { title } : title;
|
|
60
51
|
components.push({
|
|
61
52
|
type: 'title',
|
|
62
53
|
position: defaultPosition,
|
|
63
54
|
order: defaultOrder,
|
|
64
|
-
size,
|
|
55
|
+
size: defaultSize,
|
|
65
56
|
...titleOptions,
|
|
66
57
|
});
|
|
67
58
|
}
|
|
@@ -107,17 +98,16 @@ export function renderComponent(
|
|
|
107
98
|
theme: G2Theme,
|
|
108
99
|
library: G2Library,
|
|
109
100
|
) {
|
|
110
|
-
const [useScale] = useLibrary<G2ScaleOptions, ScaleComponent, Scale>(
|
|
111
|
-
'scale',
|
|
112
|
-
library,
|
|
113
|
-
);
|
|
114
101
|
const [useGuideComponent] = useLibrary<
|
|
115
102
|
G2GuideComponentOptions,
|
|
116
103
|
GuideComponentComponent,
|
|
117
104
|
GuideComponent
|
|
118
105
|
>('component', library);
|
|
119
106
|
const { scale: scaleDescriptor, bbox, ...options } = component;
|
|
120
|
-
const scale = scaleDescriptor
|
|
107
|
+
const scale = scaleDescriptor
|
|
108
|
+
? useRelationScale(scaleDescriptor, library)
|
|
109
|
+
: null;
|
|
110
|
+
|
|
121
111
|
const { field, domain } = scaleDescriptor || {};
|
|
122
112
|
const value = { field, domain, bbox };
|
|
123
113
|
const render = useGuideComponent(options);
|
|
@@ -168,7 +158,7 @@ function inferComponentPosition(
|
|
|
168
158
|
'right',
|
|
169
159
|
'top',
|
|
170
160
|
'bottom',
|
|
171
|
-
'
|
|
161
|
+
'centerVertical',
|
|
172
162
|
'center',
|
|
173
163
|
];
|
|
174
164
|
const ordinalPosition = !positions.includes(guide.position)
|
|
@@ -182,9 +172,9 @@ function inferComponentPosition(
|
|
|
182
172
|
if (match === null) return ordinalPosition;
|
|
183
173
|
const index = +match[1];
|
|
184
174
|
if (isTranspose(coordinates)) {
|
|
185
|
-
return index === 0 ? 'top' : '
|
|
175
|
+
return index === 0 ? 'top' : 'centerHorizontal';
|
|
186
176
|
} else {
|
|
187
|
-
return index === 0 ? ordinalPosition : '
|
|
177
|
+
return index === 0 ? ordinalPosition : 'centerVertical';
|
|
188
178
|
}
|
|
189
179
|
} else if (
|
|
190
180
|
(type === 'axisX' && isPolar(coordinates) && !isTranspose(coordinates)) ||
|
|
@@ -214,26 +204,19 @@ function inferComponentPosition(
|
|
|
214
204
|
return ordinalPosition;
|
|
215
205
|
}
|
|
216
206
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
// Extra 4px spacing.
|
|
224
|
-
return (text ? titleSize + 4 : 0) + (subtitle ? subtitleSize + spacing : 0);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
function inferSliderType(
|
|
228
|
-
name: string,
|
|
229
|
-
coordinates: G2CoordinateOptions[] = [],
|
|
230
|
-
) {
|
|
231
|
-
if (name === 'x') return isTranspose(coordinates) ? 'sliderY' : 'sliderX';
|
|
232
|
-
if (name === 'y') return isTranspose(coordinates) ? 'sliderX' : 'sliderY';
|
|
207
|
+
/**
|
|
208
|
+
* Infer scroll component type.
|
|
209
|
+
*/
|
|
210
|
+
function inferSCType(name: string, type: string, coordinates = []) {
|
|
211
|
+
if (name === 'x') return isTranspose(coordinates) ? `${type}Y` : `${type}X`;
|
|
212
|
+
if (name === 'y') return isTranspose(coordinates) ? `${type}X` : `${type}Y`;
|
|
233
213
|
return null;
|
|
234
214
|
}
|
|
235
215
|
|
|
236
|
-
|
|
216
|
+
/**
|
|
217
|
+
* Infer scroll components, such as slider and scrollbar.
|
|
218
|
+
*/
|
|
219
|
+
function inferScrollComponents(
|
|
237
220
|
partialOptions: G2View,
|
|
238
221
|
scales: G2ScaleOptions[],
|
|
239
222
|
library,
|
|
@@ -244,29 +227,38 @@ function createSliders(
|
|
|
244
227
|
GuideComponent
|
|
245
228
|
>('component', library);
|
|
246
229
|
|
|
247
|
-
const {
|
|
248
|
-
const nameScale = new Map(scales.map((scale) => [scale.name, scale]));
|
|
230
|
+
const { coordinates } = partialOptions;
|
|
249
231
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
232
|
+
function normalized(
|
|
233
|
+
type: string,
|
|
234
|
+
channelName: string,
|
|
235
|
+
scale: G2ScaleOptions,
|
|
236
|
+
options: Record<string, any>,
|
|
237
|
+
) {
|
|
238
|
+
const componentType = inferSCType(channelName, type, coordinates);
|
|
239
|
+
if (!options || !componentType) return;
|
|
258
240
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
241
|
+
const { props } = createGuideComponent(componentType);
|
|
242
|
+
const { defaultPosition, defaultSize, defaultOrder } = props;
|
|
243
|
+
return {
|
|
244
|
+
position: defaultPosition,
|
|
245
|
+
size: defaultSize,
|
|
246
|
+
order: defaultOrder,
|
|
247
|
+
type: componentType,
|
|
248
|
+
...options,
|
|
249
|
+
scale,
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
return scales
|
|
254
|
+
.filter((d) => d.slider || d.scrollbar)
|
|
255
|
+
.flatMap((scale) => {
|
|
256
|
+
const { slider, scrollbar, name: channelName } = scale;
|
|
257
|
+
|
|
258
|
+
return [
|
|
259
|
+
normalized('slider', channelName, scale, slider),
|
|
260
|
+
normalized('scrollbar', channelName, scale, scrollbar),
|
|
261
|
+
];
|
|
270
262
|
})
|
|
271
263
|
.filter((d) => !!d);
|
|
272
264
|
}
|
package/src/runtime/layout.ts
CHANGED
|
@@ -123,8 +123,8 @@ export function placeComponents(
|
|
|
123
123
|
right: [width - pr, pt, pr, innerHeight, 1, false, ascending],
|
|
124
124
|
bottom: [pl, height - pb, innerWidth, pb, 0, false, ascending],
|
|
125
125
|
left: [0, pt, pl, innerHeight, 1, true, ascending],
|
|
126
|
-
centerHorizontal: [pl, pt, innerWidth, innerHeight, -1, null, null],
|
|
127
126
|
centerVertical: [pl, pt, innerWidth, innerHeight, -1, null, null],
|
|
127
|
+
centerHorizontal: [pl, pt, innerWidth, innerHeight, -1, null, null],
|
|
128
128
|
arc: [pl, pt, innerWidth, innerHeight, -1, null, null],
|
|
129
129
|
arcY: [pl, pt, innerWidth, innerHeight, -1, null, null],
|
|
130
130
|
arcInner: [pl, pt, innerWidth, innerHeight, -1, null, null],
|
|
@@ -134,10 +134,10 @@ export function placeComponents(
|
|
|
134
134
|
|
|
135
135
|
for (const [key, components] of positionComponents.entries()) {
|
|
136
136
|
const area = section[key];
|
|
137
|
-
if (key === '
|
|
138
|
-
placeCenterHorizontal(components, coordinate, area);
|
|
139
|
-
} else if (key === 'centerVertical') {
|
|
137
|
+
if (key === 'centerVertical') {
|
|
140
138
|
placeCenterVertical(components, coordinate, area);
|
|
139
|
+
} else if (key === 'centerHorizontal') {
|
|
140
|
+
placeCenterHorizontal(components, coordinate, area);
|
|
141
141
|
} else if (key === 'arc') {
|
|
142
142
|
placeArc(components, coordinate, area);
|
|
143
143
|
} else if (key === 'arcY') {
|
|
@@ -152,7 +152,7 @@ export function placeComponents(
|
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
function
|
|
155
|
+
function placeCenterVertical(
|
|
156
156
|
components: G2GuideComponentOptions[],
|
|
157
157
|
coordinate: Coordinate,
|
|
158
158
|
area: SectionArea,
|
|
@@ -177,7 +177,7 @@ function placeCenterHorizontal(
|
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
-
function
|
|
180
|
+
function placeCenterHorizontal(
|
|
181
181
|
components: G2GuideComponentOptions[],
|
|
182
182
|
coordinate: Coordinate,
|
|
183
183
|
area: SectionArea,
|
package/src/runtime/plot.ts
CHANGED
|
@@ -1,76 +1,81 @@
|
|
|
1
|
+
import { Vector2 } from '@antv/coord';
|
|
1
2
|
import { DisplayObject, IAnimation as GAnimation, Rect } from '@antv/g';
|
|
2
3
|
import { deepMix, upperFirst } from '@antv/util';
|
|
3
|
-
import { format } from 'd3-format';
|
|
4
|
-
import { Vector2 } from '@antv/coord';
|
|
5
4
|
import { group } from 'd3-array';
|
|
5
|
+
import { format } from 'd3-format';
|
|
6
6
|
import { mapObject } from '../utils/array';
|
|
7
|
+
import { CHART_LIFE_CIRCLE, emitEvent } from '../utils/event';
|
|
7
8
|
import {
|
|
8
|
-
copyAttributes,
|
|
9
|
-
error,
|
|
10
|
-
defined,
|
|
11
|
-
useMemo,
|
|
12
9
|
appendTransform,
|
|
13
10
|
compose,
|
|
11
|
+
copyAttributes,
|
|
12
|
+
defined,
|
|
13
|
+
error,
|
|
14
14
|
maybeSubObject,
|
|
15
15
|
subObject,
|
|
16
|
+
useMemo,
|
|
16
17
|
} from '../utils/helper';
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
18
|
+
import { G2Element, select, Selection } from '../utils/selection';
|
|
19
|
+
import { inferComponent, renderComponent } from './component';
|
|
19
20
|
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
} from './types/options';
|
|
21
|
+
AREA_CLASS_NAME,
|
|
22
|
+
COMPONENT_CLASS_NAME,
|
|
23
|
+
ELEMENT_CLASS_NAME,
|
|
24
|
+
LABEL_CLASS_NAME,
|
|
25
|
+
LABEL_LAYER_CLASS_NAME,
|
|
26
|
+
MAIN_LAYER_CLASS_NAME,
|
|
27
|
+
PLOT_CLASS_NAME,
|
|
28
|
+
VIEW_CLASS_NAME,
|
|
29
|
+
} from './constant';
|
|
30
|
+
import { createCoordinate } from './coordinate';
|
|
31
|
+
import { computeLayout, placeComponents } from './layout';
|
|
32
|
+
import { useLibrary } from './library';
|
|
33
|
+
import { initializeMark } from './mark';
|
|
34
34
|
import {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
AnimationComponent,
|
|
42
|
-
Animation,
|
|
43
|
-
CompositionComponent,
|
|
44
|
-
Composition,
|
|
45
|
-
InteractionComponent,
|
|
46
|
-
Interaction,
|
|
47
|
-
LabelTransformComponent,
|
|
48
|
-
LabelTransform,
|
|
49
|
-
} from './types/component';
|
|
50
|
-
import { MarkComponent, Mark, CompositeMark, SingleMark } from './types/mark';
|
|
35
|
+
applyScale,
|
|
36
|
+
inferScale,
|
|
37
|
+
syncFacetsScales,
|
|
38
|
+
useRelationScale,
|
|
39
|
+
} from './scale';
|
|
40
|
+
import { applyDataTransform } from './transform';
|
|
51
41
|
import {
|
|
52
|
-
G2ViewDescriptor,
|
|
53
42
|
G2MarkState,
|
|
43
|
+
G2ViewDescriptor,
|
|
54
44
|
G2ViewInstance,
|
|
55
45
|
Primitive,
|
|
56
46
|
} from './types/common';
|
|
57
|
-
import { useLibrary } from './library';
|
|
58
|
-
import { initializeMark } from './mark';
|
|
59
|
-
import { inferComponent, renderComponent } from './component';
|
|
60
|
-
import { computeLayout, placeComponents } from './layout';
|
|
61
|
-
import { createCoordinate } from './coordinate';
|
|
62
|
-
import { applyScale, syncFacetsScales, useRelation, inferScale } from './scale';
|
|
63
|
-
import { applyDataTransform } from './transform';
|
|
64
47
|
import {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
48
|
+
Animation,
|
|
49
|
+
AnimationComponent,
|
|
50
|
+
Composition,
|
|
51
|
+
CompositionComponent,
|
|
52
|
+
Interaction,
|
|
53
|
+
InteractionComponent,
|
|
54
|
+
LabelTransform,
|
|
55
|
+
LabelTransformComponent,
|
|
56
|
+
Scale,
|
|
57
|
+
ScaleComponent,
|
|
58
|
+
Shape,
|
|
59
|
+
ShapeComponent,
|
|
60
|
+
Theme,
|
|
61
|
+
ThemeComponent,
|
|
62
|
+
} from './types/component';
|
|
63
|
+
import { CompositeMark, Mark, MarkComponent, SingleMark } from './types/mark';
|
|
64
|
+
import {
|
|
65
|
+
G2AnimationOptions,
|
|
66
|
+
G2CompositionOptions,
|
|
67
|
+
G2Context,
|
|
68
|
+
G2InteractionOptions,
|
|
69
|
+
G2LabelTransformOptions,
|
|
70
|
+
G2Library,
|
|
71
|
+
G2Mark,
|
|
72
|
+
G2MarkOptions,
|
|
73
|
+
G2ScaleOptions,
|
|
74
|
+
G2ShapeOptions,
|
|
75
|
+
G2ThemeOptions,
|
|
76
|
+
G2View,
|
|
77
|
+
G2ViewTree,
|
|
78
|
+
} from './types/options';
|
|
74
79
|
|
|
75
80
|
export async function plot<T extends G2ViewTree>(
|
|
76
81
|
options: T,
|
|
@@ -164,7 +169,8 @@ export async function plot<T extends G2ViewTree>(
|
|
|
164
169
|
emitEvent(on, CHART_LIFE_CIRCLE.BEFORE_PAINT);
|
|
165
170
|
|
|
166
171
|
// Plot chart.
|
|
167
|
-
const
|
|
172
|
+
const enterContainer = new Map<G2ViewDescriptor, DisplayObject>();
|
|
173
|
+
const updateContainer = new Map<G2ViewDescriptor, DisplayObject>();
|
|
168
174
|
const transitions: GAnimation[] = [];
|
|
169
175
|
selection
|
|
170
176
|
.selectAll(className(VIEW_CLASS_NAME))
|
|
@@ -178,29 +184,68 @@ export async function plot<T extends G2ViewTree>(
|
|
|
178
184
|
.call(applyTranslate)
|
|
179
185
|
.each(function (view) {
|
|
180
186
|
plotView(view, select(this), transitions, library);
|
|
181
|
-
|
|
187
|
+
enterContainer.set(view, this);
|
|
182
188
|
}),
|
|
183
189
|
(update) =>
|
|
184
190
|
update.call(applyTranslate).each(function (view) {
|
|
185
191
|
plotView(view, select(this), transitions, library);
|
|
192
|
+
updateContainer.set(view, this);
|
|
186
193
|
}),
|
|
187
|
-
(exit) =>
|
|
194
|
+
(exit) =>
|
|
195
|
+
exit
|
|
196
|
+
.each(function () {
|
|
197
|
+
// Remove existed interactions.
|
|
198
|
+
const interactions = this['nameInteraction'].values();
|
|
199
|
+
for (const interaction of interactions) {
|
|
200
|
+
interaction.destroy();
|
|
201
|
+
}
|
|
202
|
+
})
|
|
203
|
+
.remove(),
|
|
188
204
|
);
|
|
189
205
|
|
|
190
|
-
// Apply
|
|
191
|
-
const
|
|
192
|
-
|
|
206
|
+
// Apply interactions.
|
|
207
|
+
const viewInstanceof = (
|
|
208
|
+
viewContainer: Map<G2ViewDescriptor, DisplayObject>,
|
|
209
|
+
) => {
|
|
210
|
+
return Array.from(viewContainer.entries()).map(([view, container]) => ({
|
|
193
211
|
view,
|
|
194
212
|
container,
|
|
195
213
|
options: viewNode.get(view),
|
|
196
214
|
update: createUpdateView(select(container), library, context),
|
|
197
|
-
})
|
|
198
|
-
|
|
199
|
-
|
|
215
|
+
}));
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
// Interactions for enter views.
|
|
219
|
+
const enterViewInstances = viewInstanceof(enterContainer);
|
|
220
|
+
for (const target of enterViewInstances) {
|
|
200
221
|
const { options } = target;
|
|
222
|
+
|
|
223
|
+
// A Map index interaction by interaction name.
|
|
224
|
+
const nameInteraction = new Map();
|
|
225
|
+
target.container['nameInteraction'] = nameInteraction;
|
|
226
|
+
|
|
227
|
+
// Apply interactions.
|
|
228
|
+
for (const option of inferInteraction(options)) {
|
|
229
|
+
const interaction = useInteraction(option);
|
|
230
|
+
const destroy = interaction(target, enterViewInstances);
|
|
231
|
+
nameInteraction.set(option.type, { destroy });
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// Interactions for update views.
|
|
236
|
+
const updateViewInstances = viewInstanceof(updateContainer);
|
|
237
|
+
for (const target of updateViewInstances) {
|
|
238
|
+
const { options, container } = target;
|
|
239
|
+
const nameInteraction = container['nameInteraction'];
|
|
201
240
|
for (const option of inferInteraction(options)) {
|
|
241
|
+
// Remove interaction for existed views.
|
|
242
|
+
const prevInteraction = nameInteraction.get(option.type);
|
|
243
|
+
if (prevInteraction) prevInteraction.destroy();
|
|
244
|
+
|
|
245
|
+
// Apply new interaction.
|
|
202
246
|
const interaction = useInteraction(option);
|
|
203
|
-
interaction(target,
|
|
247
|
+
const destroy = interaction(target, updateViewInstances);
|
|
248
|
+
nameInteraction.set(options.type, { destroy });
|
|
204
249
|
}
|
|
205
250
|
}
|
|
206
251
|
|
|
@@ -424,13 +469,9 @@ function initializeState(
|
|
|
424
469
|
const scale = Object.fromEntries(
|
|
425
470
|
channels.map(({ name, scale }) => [name, scale]),
|
|
426
471
|
);
|
|
427
|
-
|
|
428
472
|
// Transform abstract value to visual value by scales.
|
|
429
473
|
const markScaleInstance = mapObject(scale, (options) => {
|
|
430
|
-
|
|
431
|
-
const [conditionalize] = useRelation(relations);
|
|
432
|
-
const scale = useScale(options);
|
|
433
|
-
return conditionalize(scale);
|
|
474
|
+
return useRelationScale(options, library);
|
|
434
475
|
});
|
|
435
476
|
Object.assign(scaleInstance, markScaleInstance);
|
|
436
477
|
const value = applyScale(channels, markScaleInstance);
|
|
@@ -564,6 +605,8 @@ async function plotView(
|
|
|
564
605
|
),
|
|
565
606
|
(update) =>
|
|
566
607
|
update.each(function (options) {
|
|
608
|
+
const { preserve = false } = options;
|
|
609
|
+
if (preserve) return;
|
|
567
610
|
const newComponent = renderComponent(
|
|
568
611
|
options,
|
|
569
612
|
coordinate,
|
|
@@ -1204,6 +1247,11 @@ function shapeName(mark: G2Mark, name: string): string {
|
|
|
1204
1247
|
*/
|
|
1205
1248
|
function updateLayers(selection: Selection, marks: G2Mark[]) {
|
|
1206
1249
|
const facet = (d) => (d.class !== undefined ? `${d.class}` : '');
|
|
1250
|
+
|
|
1251
|
+
// Skip for empty selection, it can't append nodes.
|
|
1252
|
+
const nodes = selection.nodes();
|
|
1253
|
+
if (nodes.length === 0) return;
|
|
1254
|
+
|
|
1207
1255
|
selection
|
|
1208
1256
|
.selectAll(className(MAIN_LAYER_CLASS_NAME))
|
|
1209
1257
|
.data(marks, (d) => d.key)
|
|
@@ -1214,8 +1262,13 @@ function updateLayers(selection: Selection, marks: G2Mark[]) {
|
|
|
1214
1262
|
.attr('className', MAIN_LAYER_CLASS_NAME)
|
|
1215
1263
|
.attr('id', (d) => d.key)
|
|
1216
1264
|
.style('facet', facet)
|
|
1217
|
-
.style('fill', 'transparent')
|
|
1218
|
-
|
|
1265
|
+
.style('fill', 'transparent')
|
|
1266
|
+
.style('zIndex', (d) => d.zIndex ?? 0),
|
|
1267
|
+
(update) =>
|
|
1268
|
+
update
|
|
1269
|
+
.style('facet', facet)
|
|
1270
|
+
.style('fill', 'transparent')
|
|
1271
|
+
.style('zIndex', (d) => d.zIndex ?? 0),
|
|
1219
1272
|
(exit) => exit.remove(),
|
|
1220
1273
|
);
|
|
1221
1274
|
|
|
@@ -1231,7 +1284,7 @@ function className(...names: string[]): string {
|
|
|
1231
1284
|
function applyClip(selection, clip?: boolean) {
|
|
1232
1285
|
if (!selection.node()) return;
|
|
1233
1286
|
selection.style('clipPath', (data) => {
|
|
1234
|
-
if (!clip) return;
|
|
1287
|
+
if (!clip) return null;
|
|
1235
1288
|
const {
|
|
1236
1289
|
paddingTop: y,
|
|
1237
1290
|
paddingLeft: x,
|