@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
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { DisplayObject, HTML } from '@antv/g';
|
|
2
|
+
import { kebabCase } from '../../utils/string';
|
|
3
|
+
import { subObject } from '../../utils/helper';
|
|
4
|
+
|
|
5
|
+
function dom(tag, children, style) {
|
|
6
|
+
return `<${tag} style="${Object.entries(style)
|
|
7
|
+
.map(([key, value]) => `${kebabCase(key)}:${value}`)
|
|
8
|
+
.join(';')}">${children}</${tag}>`;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const defaultTipStyle = {
|
|
12
|
+
backgroundColor: 'rgba(0,0,0,0.75)',
|
|
13
|
+
color: '#fff',
|
|
14
|
+
width: 'max-content',
|
|
15
|
+
padding: '1px 4px',
|
|
16
|
+
fontSize: '12px',
|
|
17
|
+
borderRadius: '2.5px',
|
|
18
|
+
boxShadow:
|
|
19
|
+
'0 3px 6px -4px rgba(0,0,0,0.12), 0 6px 16px 0 rgba(0,0,0,0.08), 0 9px 28px 8px rgba(0,0,0,0.05)',
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
function isTipText(element) {
|
|
23
|
+
if (element.nodeName !== 'text') return false;
|
|
24
|
+
if (element.isOverflowing()) return true;
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function Poptip({ offsetX = 8, offsetY = 8, ...style }) {
|
|
29
|
+
return (context) => {
|
|
30
|
+
const { container } = context;
|
|
31
|
+
const [x0, y0] = container.getBounds().min;
|
|
32
|
+
const tipStyle = subObject(style, 'tip');
|
|
33
|
+
const tips = new Set();
|
|
34
|
+
|
|
35
|
+
const pointerover = (e) => {
|
|
36
|
+
const { target } = e;
|
|
37
|
+
if (!isTipText(target)) {
|
|
38
|
+
e.stopPropagation();
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const { offsetX: mouseX, offsetY: mouseY } = e;
|
|
42
|
+
const x = mouseX + offsetX - x0;
|
|
43
|
+
const y = mouseY + offsetY - y0;
|
|
44
|
+
if (target.tip) {
|
|
45
|
+
target.tip.style.x = x;
|
|
46
|
+
target.tip.style.y = y;
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const { text } = target.style;
|
|
50
|
+
const tipELement = new HTML({
|
|
51
|
+
className: 'poptip',
|
|
52
|
+
style: {
|
|
53
|
+
innerHTML: dom('div', text, {
|
|
54
|
+
...defaultTipStyle,
|
|
55
|
+
...tipStyle,
|
|
56
|
+
}),
|
|
57
|
+
x,
|
|
58
|
+
y,
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
container.appendChild(tipELement);
|
|
62
|
+
target.tip = tipELement;
|
|
63
|
+
tips.add(tipELement);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const pointerout = (e) => {
|
|
67
|
+
const { target } = e;
|
|
68
|
+
if (!isTipText(target)) {
|
|
69
|
+
e.stopPropagation();
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (!target.tip) return;
|
|
73
|
+
target.tip.remove();
|
|
74
|
+
target.tip = null;
|
|
75
|
+
tips.delete(target.tip);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
container.addEventListener('pointerover', pointerover);
|
|
79
|
+
container.addEventListener('pointerout', pointerout);
|
|
80
|
+
|
|
81
|
+
return () => {
|
|
82
|
+
container.removeEventListener('pointerover', pointerover);
|
|
83
|
+
container.removeEventListener('pointerout', pointerout);
|
|
84
|
+
tips.forEach((tip) => (tip as DisplayObject).remove());
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
}
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import { DisplayObject, Path } from '@antv/g';
|
|
2
2
|
import { path as d3Path } from 'd3-path';
|
|
3
|
+
import { sort } from 'd3-array';
|
|
4
|
+
import { Vector2 } from '@antv/coord';
|
|
3
5
|
import { subObject } from '../../utils/helper';
|
|
4
|
-
import { select } from '../../utils/selection';
|
|
6
|
+
import { G2Element, select } from '../../utils/selection';
|
|
5
7
|
import { mapObject } from '../../utils/array';
|
|
6
8
|
import {
|
|
7
9
|
G2ViewDescriptor,
|
|
8
10
|
ELEMENT_CLASS_NAME,
|
|
9
11
|
PLOT_CLASS_NAME,
|
|
10
12
|
} from '../../runtime';
|
|
13
|
+
import { isOrdinalScale } from '../../utils/scale';
|
|
14
|
+
import { rect } from '../../shape/interval/color';
|
|
15
|
+
import { isPolar, isTranspose } from '../../utils/coordinate';
|
|
16
|
+
import { reorder } from '../../shape/utils';
|
|
17
|
+
import { angle, angleBetween, sub } from '../../utils/vector';
|
|
11
18
|
|
|
12
19
|
/**
|
|
13
20
|
* Given root of chart returns elements to be manipulated
|
|
@@ -180,56 +187,206 @@ export function createValueof(elements, datum) {
|
|
|
180
187
|
};
|
|
181
188
|
}
|
|
182
189
|
|
|
183
|
-
export function renderLink(
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
190
|
+
export function renderLink({
|
|
191
|
+
link = false,
|
|
192
|
+
valueof = (d, element) => d,
|
|
193
|
+
coordinate,
|
|
194
|
+
...style
|
|
195
|
+
}) {
|
|
187
196
|
const LINK_CLASS_NAME = 'element-link';
|
|
188
|
-
|
|
197
|
+
|
|
198
|
+
if (!link) return [() => {}, () => {}];
|
|
199
|
+
|
|
200
|
+
const pointsOf = (element) => element.__data__.points;
|
|
201
|
+
|
|
202
|
+
const pathPointsOf = (P0, P1) => {
|
|
203
|
+
const [, p1, p2] = P0;
|
|
204
|
+
const [p0, , , p3] = P1;
|
|
205
|
+
const P: Vector2[] = [p1, p0, p3, p2];
|
|
206
|
+
return P;
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
const append = (elements) => {
|
|
189
210
|
if (elements.length <= 1) return;
|
|
190
|
-
const elementBBoxs = elements.map((d) => [d, d.getBBox()]);
|
|
191
211
|
|
|
192
|
-
// Sort elements
|
|
193
|
-
|
|
194
|
-
const { x: x0
|
|
195
|
-
const { x: x1
|
|
196
|
-
|
|
212
|
+
// Sort elements by normalized x to avoid cross.
|
|
213
|
+
const sortedElements = sort<G2Element>(elements, (e0, e1) => {
|
|
214
|
+
const { x: x0 } = e0.__data__;
|
|
215
|
+
const { x: x1 } = e1.__data__;
|
|
216
|
+
const dx = x0 - x1;
|
|
217
|
+
return dx;
|
|
197
218
|
});
|
|
198
219
|
|
|
199
|
-
for (let i = 1; i <
|
|
220
|
+
for (let i = 1; i < sortedElements.length; i++) {
|
|
200
221
|
const p = d3Path();
|
|
201
|
-
const
|
|
202
|
-
const
|
|
203
|
-
|
|
204
|
-
p.
|
|
205
|
-
p.lineTo(
|
|
206
|
-
p.lineTo(
|
|
222
|
+
const e0 = sortedElements[i - 1];
|
|
223
|
+
const e1 = sortedElements[i];
|
|
224
|
+
const [p0, p1, p2, p3] = pathPointsOf(pointsOf(e0), pointsOf(e1));
|
|
225
|
+
p.moveTo(...p0);
|
|
226
|
+
p.lineTo(...p1);
|
|
227
|
+
p.lineTo(...p2);
|
|
228
|
+
p.lineTo(...p3);
|
|
207
229
|
p.closePath();
|
|
208
230
|
const { fill = e0.getAttribute('fill'), ...rest } = mapObject(
|
|
209
231
|
style,
|
|
210
232
|
(d) => valueof(d, e0),
|
|
211
233
|
);
|
|
212
|
-
const
|
|
213
|
-
className:
|
|
234
|
+
const link = new Path({
|
|
235
|
+
className: LINK_CLASS_NAME,
|
|
214
236
|
style: {
|
|
215
237
|
d: p.toString(),
|
|
216
238
|
fill,
|
|
239
|
+
zIndex: -2,
|
|
217
240
|
...rest,
|
|
218
241
|
},
|
|
219
242
|
});
|
|
220
|
-
|
|
243
|
+
// @ts-ignore
|
|
244
|
+
e0.link?.remove();
|
|
245
|
+
e0.parentNode.appendChild(link);
|
|
246
|
+
// @ts-ignore
|
|
247
|
+
e0.link = link;
|
|
221
248
|
}
|
|
222
249
|
};
|
|
223
250
|
|
|
224
|
-
const remove = (
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
for (const link of links) link.remove();
|
|
251
|
+
const remove = (element) => {
|
|
252
|
+
element.link?.remove();
|
|
253
|
+
element.link = null;
|
|
228
254
|
};
|
|
229
255
|
|
|
230
256
|
return [append, remove] as const;
|
|
231
257
|
}
|
|
232
258
|
|
|
259
|
+
// Apply translate to mock slice out.
|
|
260
|
+
export function offsetTransform(element, offset, coordinate) {
|
|
261
|
+
const append = (t) => {
|
|
262
|
+
const { transform } = element.style;
|
|
263
|
+
return transform ? `${transform} ${t}` : t;
|
|
264
|
+
};
|
|
265
|
+
if (isPolar(coordinate)) {
|
|
266
|
+
const { points } = element.__data__;
|
|
267
|
+
const [p0, p1] = isTranspose(coordinate) ? reorder(points) : points;
|
|
268
|
+
const center = coordinate.getCenter();
|
|
269
|
+
const v0 = sub(p0, center);
|
|
270
|
+
const v1 = sub(p1, center);
|
|
271
|
+
const a0 = angle(v0);
|
|
272
|
+
const da = angleBetween(v0, v1);
|
|
273
|
+
const amid = a0 + da / 2;
|
|
274
|
+
const dx = offset * Math.cos(amid);
|
|
275
|
+
const dy = offset * Math.sin(amid);
|
|
276
|
+
return append(`translate(${dx}, ${dy})`);
|
|
277
|
+
}
|
|
278
|
+
if (isTranspose(coordinate)) return append(`translate(${offset}, 0)`);
|
|
279
|
+
return append(`translate(0, ${-offset})`);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
export function renderBackground({
|
|
283
|
+
background,
|
|
284
|
+
scale,
|
|
285
|
+
coordinate,
|
|
286
|
+
valueof,
|
|
287
|
+
padding = 0.001,
|
|
288
|
+
...rest
|
|
289
|
+
}) {
|
|
290
|
+
const BACKGROUND_CLASS_NAME = 'element-background';
|
|
291
|
+
|
|
292
|
+
// Don't have background.
|
|
293
|
+
if (!background) return [() => {}, () => {}];
|
|
294
|
+
|
|
295
|
+
const extentOf = (scale, x) => {
|
|
296
|
+
const ax = scale.invert(x);
|
|
297
|
+
const mid = x + scale.getBandWidth(ax) / 2;
|
|
298
|
+
const half = scale.getStep(ax) / 2;
|
|
299
|
+
const offset = half * padding;
|
|
300
|
+
return [mid - half + offset, mid + half - offset];
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
const sizeXOf = (element) => {
|
|
304
|
+
const { x: scaleX } = scale;
|
|
305
|
+
if (!isOrdinalScale(scaleX)) return [0, 1];
|
|
306
|
+
const { __data__: data } = element;
|
|
307
|
+
const { x } = data;
|
|
308
|
+
const [e1, e2] = extentOf(scaleX, x);
|
|
309
|
+
return [e1, e2];
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
const sizeYOf = (element) => {
|
|
313
|
+
const { y: scaleY } = scale;
|
|
314
|
+
if (!isOrdinalScale(scaleY)) return [0, 1];
|
|
315
|
+
const { __data__: data } = element;
|
|
316
|
+
const { y } = data;
|
|
317
|
+
const [e1, e2] = extentOf(scaleY, y);
|
|
318
|
+
return [e1, e2];
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
const bandShapeOf = (element, style) => {
|
|
322
|
+
const [x1, x2] = sizeXOf(element);
|
|
323
|
+
const [y1, y2] = sizeYOf(element);
|
|
324
|
+
const points = [
|
|
325
|
+
[x1, y1],
|
|
326
|
+
[x2, y1],
|
|
327
|
+
[x2, y2],
|
|
328
|
+
[x1, y2],
|
|
329
|
+
].map((d) => coordinate.map(d));
|
|
330
|
+
const { __data__: data } = element;
|
|
331
|
+
const { y: dy, y1: dy1 } = data;
|
|
332
|
+
return rect(points, { y: dy, y1: dy1 }, coordinate, style);
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
// Shape without ordinal style.
|
|
336
|
+
// Clone and scale it.
|
|
337
|
+
const cloneShapeOf = (element, style) => {
|
|
338
|
+
const {
|
|
339
|
+
transform = 'scale(1.2, 1.2)',
|
|
340
|
+
transformOrigin = 'center center',
|
|
341
|
+
stroke = '',
|
|
342
|
+
...rest
|
|
343
|
+
} = style;
|
|
344
|
+
const finalStyle = { transform, transformOrigin, stroke, ...rest };
|
|
345
|
+
const shape = element.cloneNode(true);
|
|
346
|
+
for (const [key, value] of Object.entries(finalStyle)) {
|
|
347
|
+
shape.style[key] = value;
|
|
348
|
+
}
|
|
349
|
+
return shape;
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
const isOrdinalShape = () => {
|
|
353
|
+
const { x, y } = scale;
|
|
354
|
+
return [x, y].some(isOrdinalScale);
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
const append = (element) => {
|
|
358
|
+
if (element.background) element.background.remove();
|
|
359
|
+
const {
|
|
360
|
+
fill = '#CCD6EC',
|
|
361
|
+
fillOpacity = 0.3,
|
|
362
|
+
zIndex = -2,
|
|
363
|
+
...style
|
|
364
|
+
} = mapObject(rest, (d) => valueof(d, element));
|
|
365
|
+
const finalStyle = {
|
|
366
|
+
...style,
|
|
367
|
+
fill,
|
|
368
|
+
fillOpacity,
|
|
369
|
+
zIndex,
|
|
370
|
+
};
|
|
371
|
+
const shapeOf = isOrdinalShape() ? bandShapeOf : cloneShapeOf;
|
|
372
|
+
const shape = shapeOf(element, finalStyle);
|
|
373
|
+
shape.className = BACKGROUND_CLASS_NAME;
|
|
374
|
+
element.parentNode.appendChild(shape);
|
|
375
|
+
element.background = shape;
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
const remove = (element) => {
|
|
379
|
+
element.background?.remove();
|
|
380
|
+
element.background = null;
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
const is = (element) => {
|
|
384
|
+
return element.className === BACKGROUND_CLASS_NAME;
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
return [append, remove, is] as const;
|
|
388
|
+
}
|
|
389
|
+
|
|
233
390
|
export function setCursor(root, cursor) {
|
|
234
391
|
// @ts-ignore
|
|
235
392
|
const canvas = root.getRootNode().defaultView;
|
|
@@ -17,14 +17,7 @@ function useMap<K, V>() {
|
|
|
17
17
|
return [get, set] as const;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
/**
|
|
21
|
-
* @todo fixme
|
|
22
|
-
*/
|
|
23
20
|
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
|
-
|
|
28
21
|
const node = shape.cloneNode(true);
|
|
29
22
|
const connectorShape = node.getElementById('connector');
|
|
30
23
|
connectorShape && node.removeChild(connectorShape);
|
package/src/mark/area.ts
CHANGED
package/src/mark/pack.ts
CHANGED
package/src/mark/treemap.ts
CHANGED