@antv/g2 5.0.0-beta.7 → 5.0.0-beta.9
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 +3 -3
- package/dist/g2.min.js +4 -4
- package/esm/animation/morphing.js +22 -2
- package/esm/animation/morphing.js.map +1 -1
- package/esm/api/chart.d.ts +8 -3
- package/esm/api/chart.js +35 -16
- package/esm/api/chart.js.map +1 -1
- package/esm/api/composition/base.d.ts +18 -1
- package/esm/api/composition/base.js +44 -1
- package/esm/api/composition/base.js.map +1 -1
- package/esm/api/mark/base.d.ts +22 -0
- package/esm/api/mark/base.js +54 -0
- package/esm/api/mark/base.js.map +1 -0
- package/esm/api/mark/mark.d.ts +1 -7
- package/esm/api/mark/mark.js +1 -13
- package/esm/api/mark/mark.js.map +1 -1
- package/esm/api/props.js +0 -20
- package/esm/api/props.js.map +1 -1
- package/esm/component/axis.d.ts +5 -7
- package/esm/component/axis.js +126 -94
- package/esm/component/axis.js.map +1 -1
- package/esm/component/axisArc.d.ts +7 -0
- package/esm/component/axisArc.js +9 -0
- package/esm/component/axisArc.js.map +1 -0
- package/esm/component/axisRadar.d.ts +9 -0
- package/esm/component/axisRadar.js +46 -0
- package/esm/component/axisRadar.js.map +1 -0
- package/esm/component/axisX.d.ts +2 -1
- package/esm/component/axisX.js +5 -4
- package/esm/component/axisX.js.map +1 -1
- package/esm/component/axisY.d.ts +1 -1
- package/esm/component/axisY.js +4 -4
- package/esm/component/axisY.js.map +1 -1
- package/esm/component/index.d.ts +8 -0
- package/esm/component/index.js +5 -0
- package/esm/component/index.js.map +1 -1
- package/esm/component/legendCategory.d.ts +5 -3
- package/esm/component/legendCategory.js +80 -36
- package/esm/component/legendCategory.js.map +1 -1
- package/esm/component/legendContinuous.d.ts +4 -2
- package/esm/component/legendContinuous.js +76 -24
- package/esm/component/legendContinuous.js.map +1 -1
- package/esm/component/legendContinuousBlock.d.ts +4 -0
- package/esm/component/legendContinuousBlock.js +6 -0
- package/esm/component/legendContinuousBlock.js.map +1 -0
- package/esm/component/legendContinuousBlockSize.d.ts +4 -0
- package/esm/component/legendContinuousBlockSize.js +6 -0
- package/esm/component/legendContinuousBlockSize.js.map +1 -0
- package/esm/component/legendContinuousSize.d.ts +4 -0
- package/esm/component/legendContinuousSize.js +10 -0
- package/esm/component/legendContinuousSize.js.map +1 -0
- package/esm/component/scrollbar.js +1 -1
- package/esm/component/scrollbar.js.map +1 -1
- package/esm/component/slider.js +1 -1
- package/esm/component/slider.js.map +1 -1
- package/esm/component/title.js +1 -1
- package/esm/component/title.js.map +1 -1
- package/esm/component/utils.d.ts +12 -0
- package/esm/component/utils.js +35 -0
- package/esm/component/utils.js.map +1 -1
- package/esm/composition/facetCircle.js +1 -1
- package/esm/composition/facetCircle.js.map +1 -1
- package/esm/coordinate/index.d.ts +3 -3
- package/esm/coordinate/index.js +3 -3
- package/esm/coordinate/index.js.map +1 -1
- package/esm/coordinate/polar.d.ts +6 -0
- package/esm/coordinate/polar.js +18 -6
- package/esm/coordinate/polar.js.map +1 -1
- package/esm/coordinate/radial.d.ts +6 -0
- package/esm/coordinate/radial.js +17 -5
- package/esm/coordinate/radial.js.map +1 -1
- package/esm/coordinate/theta.d.ts +7 -0
- package/esm/coordinate/theta.js +16 -4
- package/esm/coordinate/theta.js.map +1 -1
- package/esm/interaction/builtin/elementHighlight.d.ts +2 -0
- package/esm/interaction/builtin/elementHighlightByColor.d.ts +2 -0
- package/esm/interaction/builtin/elementHighlightByX.d.ts +2 -0
- package/esm/interaction/index.d.ts +2 -0
- package/esm/interaction/index.js +2 -0
- package/esm/interaction/index.js.map +1 -1
- package/esm/interaction/native/brushAxisHighlight.js +6 -1
- package/esm/interaction/native/brushAxisHighlight.js.map +1 -1
- package/esm/interaction/native/brushFilter.js +1 -1
- package/esm/interaction/native/brushFilter.js.map +1 -1
- package/esm/interaction/native/elementHighlight.d.ts +7 -2
- package/esm/interaction/native/elementHighlight.js +72 -19
- package/esm/interaction/native/elementHighlight.js.map +1 -1
- package/esm/interaction/native/elementHighlightByColor.d.ts +4 -1
- package/esm/interaction/native/elementHighlightByColor.js +19 -3
- package/esm/interaction/native/elementHighlightByColor.js.map +1 -1
- package/esm/interaction/native/elementHighlightByX.d.ts +3 -3
- package/esm/interaction/native/elementHighlightByX.js +19 -3
- package/esm/interaction/native/elementHighlightByX.js.map +1 -1
- package/esm/interaction/native/elementSelect.d.ts +1 -1
- package/esm/interaction/native/elementSelect.js +42 -21
- package/esm/interaction/native/elementSelect.js.map +1 -1
- package/esm/interaction/native/elementSelectByColor.js +3 -2
- package/esm/interaction/native/elementSelectByColor.js.map +1 -1
- package/esm/interaction/native/elementSelectByX.js +3 -2
- package/esm/interaction/native/elementSelectByX.js.map +1 -1
- package/esm/interaction/native/legendFilter.d.ts +6 -0
- package/esm/interaction/native/legendFilter.js +26 -7
- package/esm/interaction/native/legendFilter.js.map +1 -1
- package/esm/interaction/native/legendHighlight.d.ts +4 -0
- package/esm/interaction/native/legendHighlight.js +93 -0
- package/esm/interaction/native/legendHighlight.js.map +1 -0
- package/esm/interaction/native/poptip.d.ts +5 -0
- package/esm/interaction/native/poptip.js +91 -0
- package/esm/interaction/native/poptip.js.map +1 -0
- package/esm/interaction/native/utils.d.ts +13 -2
- package/esm/interaction/native/utils.js +151 -26
- package/esm/interaction/native/utils.js.map +1 -1
- package/esm/label-transform/overlapDodgeY.js +0 -8
- 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/pack.js +0 -1
- package/esm/mark/pack.js.map +1 -1
- package/esm/mark/treemap.js +0 -1
- package/esm/mark/treemap.js.map +1 -1
- package/esm/runtime/component.d.ts +3 -0
- package/esm/runtime/component.js +246 -103
- package/esm/runtime/component.js.map +1 -1
- package/esm/runtime/coordinate.d.ts +11 -0
- package/esm/runtime/coordinate.js +23 -16
- package/esm/runtime/coordinate.js.map +1 -1
- package/esm/runtime/layout.d.ts +1 -1
- package/esm/runtime/layout.js +145 -76
- package/esm/runtime/layout.js.map +1 -1
- package/esm/runtime/plot.js +5 -4
- package/esm/runtime/plot.js.map +1 -1
- package/esm/runtime/render.js +18 -13
- package/esm/runtime/render.js.map +1 -1
- package/esm/runtime/scale.d.ts +2 -1
- package/esm/runtime/scale.js +35 -0
- package/esm/runtime/scale.js.map +1 -1
- package/esm/runtime/transform.js +1 -1
- package/esm/runtime/transform.js.map +1 -1
- package/esm/runtime/types/common.d.ts +11 -2
- package/esm/runtime/types/component.d.ts +9 -7
- package/esm/runtime/types/options.d.ts +8 -6
- package/esm/runtime/types/scale.d.ts +18 -0
- package/esm/runtime/types/scale.js +19 -0
- package/esm/runtime/types/scale.js.map +1 -0
- package/esm/runtime/types/theme.d.ts +2 -1
- package/esm/shape/area/hv.d.ts +3 -0
- package/esm/shape/area/hv.js +9 -0
- package/esm/shape/area/hv.js.map +1 -0
- package/esm/shape/area/hvh.d.ts +3 -0
- package/esm/shape/area/{step.js → hvh.js} +3 -3
- package/esm/shape/area/hvh.js.map +1 -0
- package/esm/shape/area/vh.d.ts +3 -0
- package/esm/shape/area/vh.js +9 -0
- package/esm/shape/area/vh.js.map +1 -0
- package/esm/shape/connector/connector.js +1 -1
- package/esm/shape/index.d.ts +6 -2
- package/esm/shape/index.js +3 -1
- package/esm/shape/index.js.map +1 -1
- package/esm/shape/interval/color.d.ts +1 -0
- package/esm/shape/interval/color.js +65 -53
- package/esm/shape/interval/color.js.map +1 -1
- package/esm/shape/utils.js.map +1 -1
- package/esm/spec/composition.d.ts +0 -3
- package/esm/spec/geometry.d.ts +1 -1
- package/esm/spec/interaction.d.ts +33 -15
- package/esm/spec/transform.d.ts +13 -3
- package/esm/stdlib/index.js +4 -9
- package/esm/stdlib/index.js.map +1 -1
- package/esm/theme/academy.js +10 -4
- package/esm/theme/academy.js.map +1 -1
- package/esm/theme/dark.js +10 -4
- package/esm/theme/dark.js.map +1 -1
- package/esm/theme/light.js +12 -4
- package/esm/theme/light.js.map +1 -1
- package/esm/transform/sample.js +42 -26
- package/esm/transform/sample.js.map +1 -1
- package/esm/transform/utils/lttb.d.ts +5 -0
- package/esm/transform/utils/lttb.js +56 -0
- package/esm/transform/utils/lttb.js.map +1 -0
- package/esm/utils/angle.d.ts +2 -0
- package/esm/utils/angle.js +7 -0
- package/esm/utils/angle.js.map +1 -0
- package/esm/utils/array.d.ts +8 -0
- package/esm/utils/array.js +35 -0
- package/esm/utils/array.js.map +1 -1
- package/esm/utils/coordinate.d.ts +4 -0
- package/esm/utils/coordinate.js +19 -0
- package/esm/utils/coordinate.js.map +1 -1
- package/esm/utils/event.d.ts +0 -2
- package/esm/utils/event.js +0 -18
- package/esm/utils/event.js.map +1 -1
- package/esm/utils/scale.d.ts +1 -0
- package/esm/utils/scale.js +3 -3
- package/esm/utils/scale.js.map +1 -1
- package/esm/utils/vector.d.ts +1 -1
- package/esm/utils/vector.js +1 -1
- package/lib/animation/morphing.js +22 -2
- package/lib/animation/morphing.js.map +1 -1
- package/lib/api/chart.d.ts +8 -3
- package/lib/api/chart.js +37 -15
- package/lib/api/chart.js.map +1 -1
- package/lib/api/composition/base.d.ts +18 -1
- package/lib/api/composition/base.js +44 -1
- package/lib/api/composition/base.js.map +1 -1
- package/lib/api/mark/base.d.ts +22 -0
- package/lib/api/mark/base.js +58 -0
- package/lib/api/mark/base.js.map +1 -0
- package/lib/api/mark/mark.d.ts +1 -7
- package/lib/api/mark/mark.js +28 -41
- package/lib/api/mark/mark.js.map +1 -1
- package/lib/api/props.js +0 -20
- package/lib/api/props.js.map +1 -1
- package/lib/component/axis.d.ts +5 -7
- package/lib/component/axis.js +127 -96
- package/lib/component/axis.js.map +1 -1
- package/lib/component/axisArc.d.ts +7 -0
- package/lib/component/axisArc.js +13 -0
- package/lib/component/axisArc.js.map +1 -0
- package/lib/component/axisRadar.d.ts +9 -0
- package/lib/component/axisRadar.js +50 -0
- package/lib/component/axisRadar.js.map +1 -0
- package/lib/component/axisX.d.ts +2 -1
- package/lib/component/axisX.js +6 -4
- package/lib/component/axisX.js.map +1 -1
- package/lib/component/axisY.d.ts +1 -1
- package/lib/component/axisY.js +3 -3
- package/lib/component/axisY.js.map +1 -1
- package/lib/component/index.d.ts +8 -0
- package/lib/component/index.js +12 -1
- package/lib/component/index.js.map +1 -1
- package/lib/component/legendCategory.d.ts +5 -3
- package/lib/component/legendCategory.js +79 -35
- package/lib/component/legendCategory.js.map +1 -1
- package/lib/component/legendContinuous.d.ts +4 -2
- package/lib/component/legendContinuous.js +75 -23
- package/lib/component/legendContinuous.js.map +1 -1
- package/lib/component/legendContinuousBlock.d.ts +4 -0
- package/lib/component/legendContinuousBlock.js +10 -0
- package/lib/component/legendContinuousBlock.js.map +1 -0
- package/lib/component/legendContinuousBlockSize.d.ts +4 -0
- package/lib/component/legendContinuousBlockSize.js +10 -0
- package/lib/component/legendContinuousBlockSize.js.map +1 -0
- package/lib/component/legendContinuousSize.d.ts +4 -0
- package/lib/component/legendContinuousSize.js +14 -0
- package/lib/component/legendContinuousSize.js.map +1 -0
- package/lib/component/scrollbar.js +1 -1
- package/lib/component/scrollbar.js.map +1 -1
- package/lib/component/slider.js +1 -1
- package/lib/component/slider.js.map +1 -1
- package/lib/component/title.js +1 -1
- package/lib/component/title.js.map +1 -1
- package/lib/component/utils.d.ts +12 -0
- package/lib/component/utils.js +39 -1
- package/lib/component/utils.js.map +1 -1
- package/lib/composition/facetCircle.js +1 -1
- package/lib/composition/facetCircle.js.map +1 -1
- package/lib/coordinate/index.d.ts +3 -3
- package/lib/coordinate/index.js +4 -1
- package/lib/coordinate/index.js.map +1 -1
- package/lib/coordinate/polar.d.ts +6 -0
- package/lib/coordinate/polar.js +20 -7
- package/lib/coordinate/polar.js.map +1 -1
- package/lib/coordinate/radial.d.ts +6 -0
- package/lib/coordinate/radial.js +19 -6
- package/lib/coordinate/radial.js.map +1 -1
- package/lib/coordinate/theta.d.ts +7 -0
- package/lib/coordinate/theta.js +18 -5
- package/lib/coordinate/theta.js.map +1 -1
- package/lib/interaction/builtin/elementHighlight.d.ts +2 -0
- package/lib/interaction/builtin/elementHighlightByColor.d.ts +2 -0
- package/lib/interaction/builtin/elementHighlightByX.d.ts +2 -0
- package/lib/interaction/index.d.ts +2 -0
- package/lib/interaction/index.js +5 -1
- package/lib/interaction/index.js.map +1 -1
- package/lib/interaction/native/brushAxisHighlight.js +6 -1
- package/lib/interaction/native/brushAxisHighlight.js.map +1 -1
- package/lib/interaction/native/brushFilter.js +1 -1
- package/lib/interaction/native/brushFilter.js.map +1 -1
- package/lib/interaction/native/elementHighlight.d.ts +7 -2
- package/lib/interaction/native/elementHighlight.js +71 -18
- package/lib/interaction/native/elementHighlight.js.map +1 -1
- package/lib/interaction/native/elementHighlightByColor.d.ts +4 -1
- package/lib/interaction/native/elementHighlightByColor.js +18 -2
- package/lib/interaction/native/elementHighlightByColor.js.map +1 -1
- package/lib/interaction/native/elementHighlightByX.d.ts +3 -3
- package/lib/interaction/native/elementHighlightByX.js +18 -2
- package/lib/interaction/native/elementHighlightByX.js.map +1 -1
- package/lib/interaction/native/elementSelect.d.ts +1 -1
- package/lib/interaction/native/elementSelect.js +41 -20
- package/lib/interaction/native/elementSelect.js.map +1 -1
- package/lib/interaction/native/elementSelectByColor.js +2 -1
- package/lib/interaction/native/elementSelectByColor.js.map +1 -1
- package/lib/interaction/native/elementSelectByX.js +2 -1
- package/lib/interaction/native/elementSelectByX.js.map +1 -1
- package/lib/interaction/native/legendFilter.d.ts +6 -0
- package/lib/interaction/native/legendFilter.js +31 -6
- package/lib/interaction/native/legendFilter.js.map +1 -1
- package/lib/interaction/native/legendHighlight.d.ts +4 -0
- package/lib/interaction/native/legendHighlight.js +97 -0
- package/lib/interaction/native/legendHighlight.js.map +1 -0
- package/lib/interaction/native/poptip.d.ts +5 -0
- package/lib/interaction/native/poptip.js +95 -0
- package/lib/interaction/native/poptip.js.map +1 -0
- package/lib/interaction/native/utils.d.ts +13 -2
- package/lib/interaction/native/utils.js +154 -27
- package/lib/interaction/native/utils.js.map +1 -1
- package/lib/label-transform/overlapDodgeY.js +0 -8
- 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/pack.js +0 -1
- package/lib/mark/pack.js.map +1 -1
- package/lib/mark/treemap.js +0 -1
- package/lib/mark/treemap.js.map +1 -1
- package/lib/runtime/component.d.ts +3 -0
- package/lib/runtime/component.js +250 -107
- package/lib/runtime/component.js.map +1 -1
- package/lib/runtime/coordinate.d.ts +11 -0
- package/lib/runtime/coordinate.js +26 -17
- package/lib/runtime/coordinate.js.map +1 -1
- package/lib/runtime/layout.d.ts +1 -1
- package/lib/runtime/layout.js +146 -77
- package/lib/runtime/layout.js.map +1 -1
- package/lib/runtime/plot.js +4 -3
- package/lib/runtime/plot.js.map +1 -1
- package/lib/runtime/render.js +20 -12
- package/lib/runtime/render.js.map +1 -1
- package/lib/runtime/scale.d.ts +2 -1
- package/lib/runtime/scale.js +37 -1
- package/lib/runtime/scale.js.map +1 -1
- package/lib/runtime/transform.js +1 -1
- package/lib/runtime/transform.js.map +1 -1
- package/lib/runtime/types/common.d.ts +11 -2
- package/lib/runtime/types/component.d.ts +9 -7
- package/lib/runtime/types/options.d.ts +8 -6
- package/lib/runtime/types/scale.d.ts +18 -0
- package/lib/runtime/types/scale.js +22 -0
- package/lib/runtime/types/scale.js.map +1 -0
- package/lib/runtime/types/theme.d.ts +2 -1
- package/lib/shape/area/hv.d.ts +3 -0
- package/lib/shape/area/hv.js +13 -0
- package/lib/shape/area/hv.js.map +1 -0
- package/lib/shape/area/hvh.d.ts +3 -0
- package/lib/shape/area/{step.js → hvh.js} +5 -5
- package/lib/shape/area/hvh.js.map +1 -0
- package/lib/shape/area/vh.d.ts +3 -0
- package/lib/shape/area/vh.js +13 -0
- package/lib/shape/area/vh.js.map +1 -0
- package/lib/shape/connector/connector.js +1 -1
- package/lib/shape/index.d.ts +6 -2
- package/lib/shape/index.js +7 -3
- package/lib/shape/index.js.map +1 -1
- package/lib/shape/interval/color.d.ts +1 -0
- package/lib/shape/interval/color.js +67 -54
- package/lib/shape/interval/color.js.map +1 -1
- package/lib/shape/utils.js.map +1 -1
- package/lib/spec/composition.d.ts +0 -3
- package/lib/spec/geometry.d.ts +1 -1
- package/lib/spec/interaction.d.ts +33 -15
- package/lib/spec/transform.d.ts +13 -3
- package/lib/stdlib/index.js +1 -1
- package/lib/stdlib/index.js.map +1 -1
- package/lib/theme/academy.js +10 -4
- package/lib/theme/academy.js.map +1 -1
- package/lib/theme/dark.js +10 -4
- package/lib/theme/dark.js.map +1 -1
- package/lib/theme/light.js +12 -4
- package/lib/theme/light.js.map +1 -1
- package/lib/transform/sample.js +42 -26
- package/lib/transform/sample.js.map +1 -1
- package/lib/transform/utils/lttb.d.ts +5 -0
- package/lib/transform/utils/lttb.js +60 -0
- package/lib/transform/utils/lttb.js.map +1 -0
- package/lib/utils/angle.d.ts +2 -0
- package/lib/utils/angle.js +12 -0
- package/lib/utils/angle.js.map +1 -0
- package/lib/utils/array.d.ts +8 -0
- package/lib/utils/array.js +38 -1
- package/lib/utils/array.js.map +1 -1
- package/lib/utils/coordinate.d.ts +4 -0
- package/lib/utils/coordinate.js +24 -1
- package/lib/utils/coordinate.js.map +1 -1
- package/lib/utils/event.d.ts +0 -2
- package/lib/utils/event.js +1 -21
- package/lib/utils/event.js.map +1 -1
- package/lib/utils/scale.d.ts +1 -0
- package/lib/utils/scale.js +5 -4
- package/lib/utils/scale.js.map +1 -1
- package/lib/utils/vector.d.ts +1 -1
- package/lib/utils/vector.js +1 -1
- package/package.json +7 -7
- package/src/animation/morphing.ts +23 -2
- package/src/api/chart.ts +43 -20
- package/src/api/composition/base.ts +46 -1
- package/src/api/mark/base.ts +58 -0
- package/src/api/mark/mark.ts +1 -20
- package/src/api/props.ts +0 -23
- package/src/component/axis.ts +199 -118
- package/src/component/axisArc.ts +16 -0
- package/src/component/axisRadar.ts +73 -0
- package/src/component/axisX.ts +7 -4
- package/src/component/axisY.ts +4 -4
- package/src/component/index.ts +8 -0
- package/src/component/legendCategory.ts +156 -35
- package/src/component/legendContinuous.ts +133 -32
- package/src/component/legendContinuousBlock.ts +17 -0
- package/src/component/legendContinuousBlockSize.ts +22 -0
- package/src/component/legendContinuousSize.ts +27 -0
- package/src/component/scrollbar.ts +1 -1
- package/src/component/slider.ts +1 -1
- package/src/component/title.ts +1 -1
- package/src/component/utils.ts +46 -0
- package/src/composition/facetCircle.ts +1 -1
- package/src/coordinate/index.ts +3 -3
- package/src/coordinate/polar.ts +19 -11
- package/src/coordinate/radial.ts +19 -10
- package/src/coordinate/theta.ts +18 -9
- package/src/interaction/index.ts +2 -0
- package/src/interaction/native/brushAxisHighlight.ts +9 -1
- package/src/interaction/native/brushFilter.ts +1 -1
- package/src/interaction/native/elementHighlight.ts +78 -12
- package/src/interaction/native/elementHighlightByColor.ts +9 -4
- package/src/interaction/native/elementHighlightByX.ts +9 -5
- package/src/interaction/native/elementSelect.ts +58 -15
- package/src/interaction/native/elementSelectByColor.ts +4 -1
- package/src/interaction/native/elementSelectByX.ts +4 -1
- package/src/interaction/native/legendFilter.ts +29 -7
- package/src/interaction/native/legendHighlight.ts +86 -0
- package/src/interaction/native/poptip.ts +87 -0
- package/src/interaction/native/utils.ts +183 -26
- package/src/label-transform/overlapDodgeY.ts +0 -7
- package/src/mark/area.ts +1 -1
- package/src/mark/pack.ts +0 -1
- package/src/mark/treemap.ts +0 -1
- package/src/runtime/component.ts +335 -124
- package/src/runtime/coordinate.ts +29 -16
- package/src/runtime/layout.ts +206 -97
- package/src/runtime/plot.ts +5 -4
- package/src/runtime/render.ts +26 -13
- package/src/runtime/scale.ts +41 -0
- package/src/runtime/transform.ts +3 -0
- package/src/runtime/types/common.ts +23 -10
- package/src/runtime/types/component.ts +19 -10
- package/src/runtime/types/options.ts +24 -16
- package/src/runtime/types/scale.ts +20 -0
- package/src/runtime/types/theme.ts +2 -1
- package/src/shape/area/hv.ts +20 -0
- package/src/shape/area/{step.ts → hvh.ts} +3 -3
- package/src/shape/area/vh.ts +20 -0
- package/src/shape/connector/connector.ts +1 -1
- package/src/shape/index.ts +7 -2
- package/src/shape/interval/color.ts +86 -54
- package/src/shape/utils.ts +2 -0
- package/src/spec/composition.ts +0 -1
- package/src/spec/geometry.ts +3 -1
- package/src/spec/interaction.ts +51 -19
- package/src/spec/transform.ts +27 -2
- package/src/stdlib/index.ts +22 -6
- package/src/theme/academy.ts +10 -4
- package/src/theme/dark.ts +10 -4
- package/src/theme/light.ts +12 -4
- package/src/transform/sample.ts +54 -18
- package/src/transform/utils/lttb.ts +73 -0
- package/src/utils/angle.ts +7 -0
- package/src/utils/array.ts +39 -0
- package/src/utils/coordinate.ts +29 -0
- package/src/utils/event.ts +0 -26
- package/src/utils/scale.ts +4 -4
- package/src/utils/vector.ts +1 -1
- package/esm/shape/area/step.d.ts +0 -3
- package/esm/shape/area/step.js.map +0 -1
- package/lib/shape/area/step.d.ts +0 -3
- package/lib/shape/area/step.js.map +0 -1
|
@@ -122,6 +122,27 @@ function maybePath(node: DisplayObject, d: string): DisplayObject {
|
|
|
122
122
|
return path;
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
+
function hasUniqueString(search: string, pattern: string): boolean {
|
|
126
|
+
const first = search.indexOf(pattern);
|
|
127
|
+
const last = search.lastIndexOf(pattern);
|
|
128
|
+
return first === last;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Path definition with multiple m and M command has sub path.
|
|
132
|
+
// eg. 'M10,10...M20,20', 'm10,10...m20,20'
|
|
133
|
+
function hasSubPath(path: string): boolean {
|
|
134
|
+
return !hasUniqueString(path, 'm') || !hasUniqueString(path, 'M');
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function shape2path(shape: DisplayObject): string {
|
|
138
|
+
const path = convertToPath(shape);
|
|
139
|
+
if (!path) return;
|
|
140
|
+
// Path definition with sub path can't do path morphing animation,
|
|
141
|
+
// so skip this kind of path.
|
|
142
|
+
if (hasSubPath(path)) return;
|
|
143
|
+
return path;
|
|
144
|
+
}
|
|
145
|
+
|
|
125
146
|
function oneToOne(
|
|
126
147
|
shape: DisplayObject,
|
|
127
148
|
from: DisplayObject,
|
|
@@ -133,8 +154,8 @@ function oneToOne(
|
|
|
133
154
|
// the apply shape to shape animation.
|
|
134
155
|
const { nodeName: fromName } = from;
|
|
135
156
|
const { nodeName: toName } = to;
|
|
136
|
-
const fromPath =
|
|
137
|
-
const toPath =
|
|
157
|
+
const fromPath = shape2path(from);
|
|
158
|
+
const toPath = shape2path(to);
|
|
138
159
|
const isSameNodes = fromName === toName && fromName !== 'path';
|
|
139
160
|
const hasNonPathNode = fromPath === undefined || toPath === undefined;
|
|
140
161
|
if (isSameNodes || hasNonPathNode) return shapeToShape(from, to, timeEffect);
|
package/src/api/chart.ts
CHANGED
|
@@ -2,10 +2,11 @@ import { RendererPlugin, Canvas as GCanvas } from '@antv/g';
|
|
|
2
2
|
import { Renderer as CanvasRenderer } from '@antv/g-canvas';
|
|
3
3
|
import { Plugin as DragAndDropPlugin } from '@antv/g-plugin-dragndrop';
|
|
4
4
|
import { debounce } from '@antv/util';
|
|
5
|
+
import EventEmitter from '@antv/event-emitter';
|
|
5
6
|
import { G2Context, render, destroy } from '../runtime';
|
|
6
7
|
import { ViewComposition } from '../spec';
|
|
7
8
|
import { getChartSize } from '../utils/size';
|
|
8
|
-
import { CHART_LIFE_CIRCLE
|
|
9
|
+
import { CHART_LIFE_CIRCLE } from '../utils/event';
|
|
9
10
|
import { Node } from './node';
|
|
10
11
|
import {
|
|
11
12
|
defineProps,
|
|
@@ -112,6 +113,7 @@ export function optionsOf(node: Node): Record<string, any> {
|
|
|
112
113
|
|
|
113
114
|
export type ChartOptions = ViewComposition & {
|
|
114
115
|
container?: string | HTMLElement;
|
|
116
|
+
canvas?: GCanvas;
|
|
115
117
|
width?: number;
|
|
116
118
|
height?: number;
|
|
117
119
|
autoFit?: boolean;
|
|
@@ -133,7 +135,6 @@ export interface Chart extends Composition, Mark {
|
|
|
133
135
|
transform: ArrayAttribute<ChartProps['transform'], Chart>;
|
|
134
136
|
theme: ObjectAttribute<ChartProps['theme'], Chart>;
|
|
135
137
|
title: ObjectAttribute<ChartProps['title'], Chart>;
|
|
136
|
-
on: ObjectAttribute<ChartProps['on'], Chart>;
|
|
137
138
|
scale: ObjectAttribute<ChartOptions['scale'], Chart>;
|
|
138
139
|
axis: ObjectAttribute<ChartOptions['axis'], Chart>;
|
|
139
140
|
legend: ObjectAttribute<ChartOptions['legend'], Chart>;
|
|
@@ -151,7 +152,6 @@ export const props: NodePropertyDescriptor[] = [
|
|
|
151
152
|
{ name: 'key', type: 'value' },
|
|
152
153
|
{ name: 'transform', type: 'array' },
|
|
153
154
|
{ name: 'theme', type: 'object' },
|
|
154
|
-
{ name: 'on', type: 'event' },
|
|
155
155
|
{ name: 'scale', type: 'object' },
|
|
156
156
|
{ name: 'axis', type: 'object' },
|
|
157
157
|
{ name: 'legend', type: 'object' },
|
|
@@ -164,16 +164,18 @@ export const props: NodePropertyDescriptor[] = [
|
|
|
164
164
|
export class Chart extends View<ChartOptions> {
|
|
165
165
|
private _container: HTMLElement;
|
|
166
166
|
private _context: G2Context;
|
|
167
|
+
private _emitter: EventEmitter;
|
|
167
168
|
|
|
168
169
|
constructor(options: ChartOptions = {}) {
|
|
169
|
-
const { container, ...rest } = options;
|
|
170
|
+
const { container, canvas, ...rest } = options;
|
|
170
171
|
super(rest, 'view');
|
|
171
172
|
this._container = normalizeContainer(container);
|
|
172
|
-
this.
|
|
173
|
+
this._emitter = new EventEmitter();
|
|
174
|
+
this._context = { library, emitter: this._emitter, canvas };
|
|
173
175
|
this.bindAutoFit();
|
|
174
176
|
}
|
|
175
177
|
|
|
176
|
-
render(): Chart {
|
|
178
|
+
render(): Promise<Chart> {
|
|
177
179
|
if (!this._context.canvas) {
|
|
178
180
|
// Init width and height.
|
|
179
181
|
const {
|
|
@@ -201,9 +203,10 @@ export class Chart extends View<ChartOptions> {
|
|
|
201
203
|
plugins,
|
|
202
204
|
);
|
|
203
205
|
}
|
|
204
|
-
render(this.options(), this._context);
|
|
205
206
|
|
|
206
|
-
return
|
|
207
|
+
return new Promise((resolve) => {
|
|
208
|
+
render(this.options(), this._context, () => resolve(this));
|
|
209
|
+
});
|
|
207
210
|
}
|
|
208
211
|
|
|
209
212
|
options() {
|
|
@@ -218,23 +221,41 @@ export class Chart extends View<ChartOptions> {
|
|
|
218
221
|
return this._context;
|
|
219
222
|
}
|
|
220
223
|
|
|
224
|
+
on(event: string, callback: (...args: any[]) => any, once?: boolean): this {
|
|
225
|
+
this._emitter.on(event, callback, once);
|
|
226
|
+
return this;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
once(event: string, callback: (...args: any[]) => any): this {
|
|
230
|
+
this._emitter.once(event, callback);
|
|
231
|
+
return this;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
emit(event: string, ...args: any[]): this {
|
|
235
|
+
this._emitter.emit(event, ...args);
|
|
236
|
+
return this;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
off(event?: string, callback?: (...args: any[]) => any) {
|
|
240
|
+
this._emitter.off(event, callback);
|
|
241
|
+
return this;
|
|
242
|
+
}
|
|
243
|
+
|
|
221
244
|
destroy() {
|
|
222
245
|
const options = this.options();
|
|
223
|
-
|
|
224
|
-
emitEvent(on, CHART_LIFE_CIRCLE.BEFORE_DESTROY);
|
|
246
|
+
this.emit(CHART_LIFE_CIRCLE.BEFORE_DESTROY);
|
|
225
247
|
this.unbindAutoFit();
|
|
226
248
|
destroy(options, this._context);
|
|
227
249
|
// Remove the container.
|
|
228
250
|
removeContainer(this._container);
|
|
229
|
-
|
|
251
|
+
this.emit(CHART_LIFE_CIRCLE.AFTER_DESTROY);
|
|
230
252
|
}
|
|
231
253
|
|
|
232
254
|
clear() {
|
|
233
255
|
const options = this.options();
|
|
234
|
-
|
|
235
|
-
emitEvent(on, CHART_LIFE_CIRCLE.BEFORE_CLEAR);
|
|
256
|
+
this.emit(CHART_LIFE_CIRCLE.BEFORE_CLEAR);
|
|
236
257
|
destroy(options, this._context);
|
|
237
|
-
|
|
258
|
+
this.emit(CHART_LIFE_CIRCLE.AFTER_CLEAR);
|
|
238
259
|
}
|
|
239
260
|
|
|
240
261
|
forceFit() {
|
|
@@ -250,17 +271,19 @@ export class Chart extends View<ChartOptions> {
|
|
|
250
271
|
}
|
|
251
272
|
}
|
|
252
273
|
|
|
253
|
-
changeSize(adjustedWidth: number, adjustedHeight: number) {
|
|
274
|
+
changeSize(adjustedWidth: number, adjustedHeight: number): Promise<Chart> {
|
|
254
275
|
const { width, height, on } = this.options();
|
|
255
276
|
if (width === adjustedWidth && height === adjustedHeight) {
|
|
256
|
-
return this;
|
|
277
|
+
return Promise.resolve(this);
|
|
257
278
|
}
|
|
258
|
-
|
|
259
|
-
emitEvent(on, CHART_LIFE_CIRCLE.BEFORE_CHANGE_SIZE);
|
|
279
|
+
this.emit(CHART_LIFE_CIRCLE.BEFORE_CHANGE_SIZE);
|
|
260
280
|
this.width(adjustedWidth);
|
|
261
281
|
this.height(adjustedHeight);
|
|
262
|
-
this.render();
|
|
263
|
-
|
|
282
|
+
const finished = this.render();
|
|
283
|
+
finished.then(() => {
|
|
284
|
+
this.emit(CHART_LIFE_CIRCLE.AFTER_CHANGE_SIZE);
|
|
285
|
+
});
|
|
286
|
+
return finished;
|
|
264
287
|
}
|
|
265
288
|
|
|
266
289
|
private onResize = debounce(() => {
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { DisplayObject } from '@antv/g';
|
|
2
|
+
import { Coordinate } from '@antv/coord';
|
|
1
3
|
import { defineProps } from '../props';
|
|
2
4
|
import { Node } from '../node';
|
|
5
|
+
import { G2Theme, G2ViewDescriptor } from '../../runtime';
|
|
3
6
|
|
|
4
7
|
@defineProps([{ name: 'on', type: 'event' }])
|
|
5
8
|
export class Base<
|
|
@@ -7,5 +10,47 @@ export class Base<
|
|
|
7
10
|
ParentValue extends Record<string, any> = Record<string, any>,
|
|
8
11
|
ChildValue extends Record<string, any> = Record<string, any>,
|
|
9
12
|
> extends Node<Value, ParentValue, ChildValue> {
|
|
10
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Get view instance by key.
|
|
15
|
+
*/
|
|
16
|
+
getView(): G2ViewDescriptor {
|
|
17
|
+
const chart = this.root();
|
|
18
|
+
const { views } = chart.context();
|
|
19
|
+
if (!views?.length) return undefined;
|
|
20
|
+
return views.find((view) => view.key === this.attr('key'));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
getCoordinate(): Coordinate {
|
|
24
|
+
return this.getView()?.coordinate;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
getTheme(): G2Theme {
|
|
28
|
+
return this.getView()?.theme;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
getGroup(): DisplayObject {
|
|
32
|
+
const key = this.attr('key');
|
|
33
|
+
if (!key) return undefined;
|
|
34
|
+
const chart = this.root();
|
|
35
|
+
const chartGroup = chart.context().canvas.getRoot();
|
|
36
|
+
return chartGroup.getElementById(key);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Show the view.
|
|
41
|
+
*/
|
|
42
|
+
show() {
|
|
43
|
+
const group = this.getGroup();
|
|
44
|
+
if (!group) return;
|
|
45
|
+
!group.isVisible() && group.setAttribute('visibility', 'visible');
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Hide the view.
|
|
50
|
+
*/
|
|
51
|
+
hide() {
|
|
52
|
+
const group = this.getGroup();
|
|
53
|
+
if (!group) return;
|
|
54
|
+
group.isVisible() && group.setAttribute('visibility', 'hidden');
|
|
55
|
+
}
|
|
11
56
|
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { DisplayObject } from '@antv/g';
|
|
2
|
+
import { Node } from '../node';
|
|
3
|
+
import { G2MarkState, Scale } from '../../runtime';
|
|
4
|
+
|
|
5
|
+
export class MarkBase<
|
|
6
|
+
Value extends Record<string, any> = Record<string, any>,
|
|
7
|
+
ParentValue extends Record<string, any> = Record<string, any>,
|
|
8
|
+
ChildValue extends Record<string, any> = Record<string, any>,
|
|
9
|
+
> extends Node<Value, ParentValue, ChildValue> {
|
|
10
|
+
changeData(data: any) {
|
|
11
|
+
const chart = this.root();
|
|
12
|
+
if (!chart) return;
|
|
13
|
+
this.attr('data', data);
|
|
14
|
+
return chart?.render();
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Get mark from chart views.
|
|
19
|
+
*/
|
|
20
|
+
getMark(): G2MarkState {
|
|
21
|
+
const chartView = this.root()?.getView();
|
|
22
|
+
if (!chartView) return undefined;
|
|
23
|
+
const { markState } = chartView;
|
|
24
|
+
const markKey = Array.from(markState.keys()).find(
|
|
25
|
+
(item) => item.key === this.attr('key'),
|
|
26
|
+
);
|
|
27
|
+
return markState.get(markKey);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Get all scales instance.
|
|
32
|
+
*/
|
|
33
|
+
getScale(): Record<string, Scale> {
|
|
34
|
+
const chartView = this.root()?.getView();
|
|
35
|
+
if (!chartView) return undefined;
|
|
36
|
+
return chartView?.scale;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Get the scale instance by channel.
|
|
41
|
+
*/
|
|
42
|
+
getScaleByChannel(channel: string): Scale {
|
|
43
|
+
const chartView = this.root()?.getView();
|
|
44
|
+
if (!chartView) return undefined;
|
|
45
|
+
return chartView?.scale?.[channel];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Get canvas group.
|
|
50
|
+
*/
|
|
51
|
+
getGroup(): DisplayObject {
|
|
52
|
+
const key = this.attr('key');
|
|
53
|
+
if (!key) return undefined;
|
|
54
|
+
const chart = this.root();
|
|
55
|
+
const chartGroup = chart.context().canvas.getRoot();
|
|
56
|
+
return chartGroup.getElementById(key);
|
|
57
|
+
}
|
|
58
|
+
}
|
package/src/api/mark/mark.ts
CHANGED
|
@@ -27,8 +27,8 @@ import {
|
|
|
27
27
|
WordCloudMark,
|
|
28
28
|
} from '../../spec';
|
|
29
29
|
import { NodePropertyDescriptor, defineProps } from '../props';
|
|
30
|
-
import { Node } from '../node';
|
|
31
30
|
import { Concrete } from '../types';
|
|
31
|
+
import { MarkBase } from './base';
|
|
32
32
|
import { API } from './types';
|
|
33
33
|
|
|
34
34
|
export interface Interval extends API<Concrete<IntervalGeometry>, Interval> {
|
|
@@ -148,25 +148,6 @@ export const props: NodePropertyDescriptor[] = [
|
|
|
148
148
|
{ name: 'scrollbar', type: 'object' },
|
|
149
149
|
];
|
|
150
150
|
|
|
151
|
-
export class MarkBase<
|
|
152
|
-
Value extends Record<string, any> = Record<string, any>,
|
|
153
|
-
ParentValue extends Record<string, any> = Record<string, any>,
|
|
154
|
-
ChildValue extends Record<string, any> = Record<string, any>,
|
|
155
|
-
> extends Node<Value, ParentValue, ChildValue> {
|
|
156
|
-
changeData(data) {
|
|
157
|
-
const chart = this.root();
|
|
158
|
-
if (!chart) return;
|
|
159
|
-
this.attr('data', data);
|
|
160
|
-
chart?.render();
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
getMark() {}
|
|
164
|
-
|
|
165
|
-
getScale() {}
|
|
166
|
-
|
|
167
|
-
getGroup() {}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
151
|
@defineProps(props)
|
|
171
152
|
export class Interval extends MarkBase<IntervalGeometry> {
|
|
172
153
|
constructor() {
|
package/src/api/props.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import { isObject, deepMix, get, isString, isArray } from '@antv/util';
|
|
2
|
-
|
|
3
|
-
type EventListener = (...args: any[]) => void;
|
|
4
|
-
|
|
5
1
|
export type NodePropertyDescriptor = {
|
|
6
2
|
type: 'object' | 'value' | 'array' | 'node' | 'container' | 'event';
|
|
7
3
|
name: string;
|
|
@@ -51,24 +47,6 @@ function defineContainerProp(Node, { name, ctor }: NodePropertyDescriptor) {
|
|
|
51
47
|
};
|
|
52
48
|
}
|
|
53
49
|
|
|
54
|
-
function defineEventProp(Node, { name, key = name }: NodePropertyDescriptor) {
|
|
55
|
-
Node.prototype[name] = function (
|
|
56
|
-
eventName: string,
|
|
57
|
-
listener: EventListener | EventListener[],
|
|
58
|
-
) {
|
|
59
|
-
const events = this.attr(key) || {};
|
|
60
|
-
if (arguments.length === 0) return events;
|
|
61
|
-
if (arguments.length === 1) return events[eventName];
|
|
62
|
-
const listeners = events[eventName];
|
|
63
|
-
if (listeners) {
|
|
64
|
-
isArray(listener) ? listeners.concat(listener) : listeners.push(listener);
|
|
65
|
-
} else {
|
|
66
|
-
events[eventName] = isArray(listener) ? listener : [listener];
|
|
67
|
-
}
|
|
68
|
-
return this.attr(key, events);
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
|
|
72
50
|
/**
|
|
73
51
|
* A decorator to define different type of attribute setter or
|
|
74
52
|
* getter for current node.
|
|
@@ -82,7 +60,6 @@ export function defineProps(descriptors: NodePropertyDescriptor[]) {
|
|
|
82
60
|
else if (type === 'object') defineObjectProp(Node, descriptor);
|
|
83
61
|
else if (type === 'node') defineNodeProp(Node, descriptor);
|
|
84
62
|
else if (type === 'container') defineContainerProp(Node, descriptor);
|
|
85
|
-
else if (type === 'event') defineEventProp(Node, descriptor);
|
|
86
63
|
}
|
|
87
64
|
return Node;
|
|
88
65
|
};
|