@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
package/src/stdlib/index.ts
CHANGED
|
@@ -114,7 +114,9 @@ import {
|
|
|
114
114
|
Connector as ConnectorShape,
|
|
115
115
|
Area,
|
|
116
116
|
SmoothArea,
|
|
117
|
-
|
|
117
|
+
HVHArea,
|
|
118
|
+
VHArea,
|
|
119
|
+
HVArea,
|
|
118
120
|
SmoothEdge,
|
|
119
121
|
VHVEdge,
|
|
120
122
|
Arc,
|
|
@@ -133,10 +135,16 @@ import {
|
|
|
133
135
|
} from '../shape';
|
|
134
136
|
import { Light, Dark, Academy } from '../theme';
|
|
135
137
|
import {
|
|
138
|
+
AxisLinear,
|
|
139
|
+
AxisArc,
|
|
136
140
|
AxisX,
|
|
137
141
|
AxisY,
|
|
142
|
+
AxisRadar,
|
|
138
143
|
LegendCategory,
|
|
139
144
|
LegendContinuous,
|
|
145
|
+
LegendContinuousBlock,
|
|
146
|
+
LegendContinuousBlockSize,
|
|
147
|
+
LegendContinuousSize,
|
|
140
148
|
TitleComponent,
|
|
141
149
|
SliderX,
|
|
142
150
|
SliderY,
|
|
@@ -159,10 +167,6 @@ import {
|
|
|
159
167
|
GrowInY,
|
|
160
168
|
} from '../animation';
|
|
161
169
|
import {
|
|
162
|
-
// ElementHighlight,
|
|
163
|
-
// ElementSelected,
|
|
164
|
-
// Tooltip,
|
|
165
|
-
// Fisheye as FisheyeInteraction,
|
|
166
170
|
ElementHighlight,
|
|
167
171
|
ElementHighlightByX,
|
|
168
172
|
ElementHighlightByColor,
|
|
@@ -173,6 +177,7 @@ import {
|
|
|
173
177
|
Fisheye as ChartFisheye,
|
|
174
178
|
Tooltip,
|
|
175
179
|
LegendFilter,
|
|
180
|
+
LegendHighlight,
|
|
176
181
|
BrushHighlight,
|
|
177
182
|
BrushXHighlight,
|
|
178
183
|
BrushYHighlight,
|
|
@@ -181,6 +186,7 @@ import {
|
|
|
181
186
|
BrushXFilter,
|
|
182
187
|
BrushYFilter,
|
|
183
188
|
SliderFilter,
|
|
189
|
+
Poptip,
|
|
184
190
|
// ElementHighlightByX,
|
|
185
191
|
// ElementHighlightByColor,
|
|
186
192
|
// ElementListHighlight,
|
|
@@ -447,7 +453,9 @@ export function createLibrary(): G2Library {
|
|
|
447
453
|
'shape.text.text': Text,
|
|
448
454
|
'shape.area.area': Area,
|
|
449
455
|
'shape.area.smooth': SmoothArea,
|
|
450
|
-
'shape.area.
|
|
456
|
+
'shape.area.hvh': HVHArea,
|
|
457
|
+
'shape.area.vh': VHArea,
|
|
458
|
+
'shape.area.hv': HVArea,
|
|
451
459
|
'shape.link.smooth': SmoothEdge,
|
|
452
460
|
'shape.link.vhv': VHVEdge,
|
|
453
461
|
'shape.link.arc': Arc,
|
|
@@ -473,8 +481,14 @@ export function createLibrary(): G2Library {
|
|
|
473
481
|
'theme.academy': Academy,
|
|
474
482
|
'component.axisX': AxisX,
|
|
475
483
|
'component.axisY': AxisY,
|
|
484
|
+
'component.axisRadar': AxisRadar,
|
|
485
|
+
'component.axisLinear': AxisLinear,
|
|
486
|
+
'component.axisArc': AxisArc,
|
|
476
487
|
'component.legendCategory': LegendCategory,
|
|
477
488
|
'component.legendContinuous': LegendContinuous,
|
|
489
|
+
'component.legendContinuousBlock': LegendContinuousBlock,
|
|
490
|
+
'component.legendContinuousBlockSize': LegendContinuousBlockSize,
|
|
491
|
+
'component.legendContinuousSize': LegendContinuousSize,
|
|
478
492
|
'component.title': TitleComponent,
|
|
479
493
|
'component.sliderX': SliderX,
|
|
480
494
|
'component.sliderY': SliderY,
|
|
@@ -503,6 +517,7 @@ export function createLibrary(): G2Library {
|
|
|
503
517
|
'interaction.chartIndex': ChartIndex,
|
|
504
518
|
'interaction.tooltip': Tooltip,
|
|
505
519
|
'interaction.legendFilter': LegendFilter,
|
|
520
|
+
'interaction.legendHighlight': LegendHighlight,
|
|
506
521
|
'interaction.brushHighlight': BrushHighlight,
|
|
507
522
|
'interaction.brushXHighlight': BrushXHighlight,
|
|
508
523
|
'interaction.brushYHighlight': BrushYHighlight,
|
|
@@ -511,6 +526,7 @@ export function createLibrary(): G2Library {
|
|
|
511
526
|
'interaction.brushXFilter': BrushXFilter,
|
|
512
527
|
'interaction.brushYFilter': BrushYFilter,
|
|
513
528
|
'interaction.sliderFilter': SliderFilter,
|
|
529
|
+
'interaction.poptip': Poptip,
|
|
514
530
|
// 'interaction.elementSelected': ElementSelected,
|
|
515
531
|
// 'interaction.elementHighlight': ElementHighlight,
|
|
516
532
|
// 'interaction.elementHighlightByX': ElementHighlightByX,
|
package/src/theme/academy.ts
CHANGED
|
@@ -284,16 +284,22 @@ export const Academy: TC<AcademyOptions> = (options) => {
|
|
|
284
284
|
tickDirection: 'negative',
|
|
285
285
|
gridDirection: 'positive',
|
|
286
286
|
},
|
|
287
|
-
|
|
287
|
+
axisLinear: {
|
|
288
288
|
titlePosition: 'top',
|
|
289
|
-
titleSpacing: 0,
|
|
290
289
|
titleTextBaseline: 'bottom',
|
|
291
290
|
gridDirection: 'negative',
|
|
292
291
|
gridConnect: 'arc',
|
|
293
|
-
gridControlAngles: [90, 180, 360],
|
|
294
292
|
gridType: 'surround',
|
|
295
293
|
girdClosed: true,
|
|
296
294
|
},
|
|
295
|
+
axisRadar: {
|
|
296
|
+
titlePosition: 'start',
|
|
297
|
+
showTick: false,
|
|
298
|
+
showLabel: false,
|
|
299
|
+
gridType: 'surround',
|
|
300
|
+
girdClosed: true,
|
|
301
|
+
gridStrokeOpacity: 0.3,
|
|
302
|
+
},
|
|
297
303
|
legend: {
|
|
298
304
|
padding: 8,
|
|
299
305
|
showTitle: false,
|
|
@@ -303,7 +309,7 @@ export const Academy: TC<AcademyOptions> = (options) => {
|
|
|
303
309
|
titleFontWeight: 'bold',
|
|
304
310
|
titleSpacing: 4,
|
|
305
311
|
// legend marker
|
|
306
|
-
itemMarkerFill: DEFAULT_COLOR,
|
|
312
|
+
// itemMarkerFill: DEFAULT_COLOR,
|
|
307
313
|
itemMarkerFillOpacity: 1,
|
|
308
314
|
itemMarkerSize: 8,
|
|
309
315
|
itemSpacing: [5, 4],
|
package/src/theme/dark.ts
CHANGED
|
@@ -290,16 +290,22 @@ export const Dark: TC<DarkOptions> = (options) => {
|
|
|
290
290
|
tickDirection: 'negative',
|
|
291
291
|
gridDirection: 'positive',
|
|
292
292
|
},
|
|
293
|
-
|
|
293
|
+
axisLinear: {
|
|
294
294
|
titlePosition: 'top',
|
|
295
|
-
titleSpacing: 0,
|
|
296
295
|
titleTextBaseline: 'bottom',
|
|
297
296
|
gridDirection: 'negative',
|
|
298
297
|
gridConnect: 'arc',
|
|
299
|
-
gridControlAngles: [90, 180, 360],
|
|
300
298
|
gridType: 'surround',
|
|
301
299
|
girdClosed: true,
|
|
302
300
|
},
|
|
301
|
+
axisRadar: {
|
|
302
|
+
titlePosition: 'start',
|
|
303
|
+
showTick: false,
|
|
304
|
+
showLabel: false,
|
|
305
|
+
gridType: 'surround',
|
|
306
|
+
girdClosed: true,
|
|
307
|
+
gridStrokeOpacity: 0.3,
|
|
308
|
+
},
|
|
303
309
|
legend: {
|
|
304
310
|
padding: 8,
|
|
305
311
|
showTitle: false,
|
|
@@ -309,7 +315,7 @@ export const Dark: TC<DarkOptions> = (options) => {
|
|
|
309
315
|
titleFontWeight: 'normal',
|
|
310
316
|
titleSpacing: 4,
|
|
311
317
|
// legend marker
|
|
312
|
-
itemMarkerFill: DEFAULT_COLOR,
|
|
318
|
+
// itemMarkerFill: DEFAULT_COLOR,
|
|
313
319
|
itemMarkerFillOpacity: 1,
|
|
314
320
|
itemMarkerSize: 8,
|
|
315
321
|
itemSpacing: [5, 8],
|
package/src/theme/light.ts
CHANGED
|
@@ -290,16 +290,22 @@ export const Light: TC<LightOptions> = (options) => {
|
|
|
290
290
|
tickDirection: 'negative',
|
|
291
291
|
gridDirection: 'positive',
|
|
292
292
|
},
|
|
293
|
-
|
|
293
|
+
axisLinear: {
|
|
294
294
|
titlePosition: 'top',
|
|
295
295
|
titleSpacing: 0,
|
|
296
|
-
titleTextBaseline: 'bottom',
|
|
297
296
|
gridDirection: 'negative',
|
|
298
297
|
gridConnect: 'arc',
|
|
299
|
-
gridControlAngles: [90, 180, 360],
|
|
300
298
|
gridType: 'surround',
|
|
301
299
|
girdClosed: true,
|
|
302
300
|
},
|
|
301
|
+
axisRadar: {
|
|
302
|
+
titlePosition: 'start',
|
|
303
|
+
showTick: false,
|
|
304
|
+
showLabel: false,
|
|
305
|
+
gridType: 'surround',
|
|
306
|
+
girdClosed: true,
|
|
307
|
+
gridStrokeOpacity: 0.3,
|
|
308
|
+
},
|
|
303
309
|
legend: {
|
|
304
310
|
padding: 8,
|
|
305
311
|
showTitle: false,
|
|
@@ -309,7 +315,7 @@ export const Light: TC<LightOptions> = (options) => {
|
|
|
309
315
|
titleFontWeight: 'normal',
|
|
310
316
|
titleSpacing: 4,
|
|
311
317
|
// legend marker
|
|
312
|
-
itemMarkerFill: DEFAULT_COLOR,
|
|
318
|
+
// itemMarkerFill: DEFAULT_COLOR,
|
|
313
319
|
itemMarkerFillOpacity: 1,
|
|
314
320
|
itemMarkerSize: 8,
|
|
315
321
|
itemSpacing: [5, 8],
|
|
@@ -347,6 +353,8 @@ export const Light: TC<LightOptions> = (options) => {
|
|
|
347
353
|
handleLabelFillOpacity: 0.45,
|
|
348
354
|
handleLabelFontSize: 12,
|
|
349
355
|
handleLabelFontWeight: 'normal',
|
|
356
|
+
labelShowTick: true,
|
|
357
|
+
labelSpacing: 8,
|
|
350
358
|
// [todo] legend rail
|
|
351
359
|
},
|
|
352
360
|
label: {
|
package/src/transform/sample.ts
CHANGED
|
@@ -1,14 +1,46 @@
|
|
|
1
|
+
// @ts-ignore medianIndex exist in d3-array@3.2.0, but @types/d3-array Expired.
|
|
2
|
+
import { maxIndex, minIndex, medianIndex } from 'd3-array';
|
|
1
3
|
import { TransformComponent as TC, Primitive } from '../runtime';
|
|
2
|
-
import { SampleTransform } from '../spec';
|
|
4
|
+
import { SampleTransform, SampleFunction } from '../spec';
|
|
3
5
|
import { createGroups } from './utils/order';
|
|
4
|
-
import {
|
|
6
|
+
import { columnOf } from './utils/helper';
|
|
7
|
+
import { lttb } from './utils/lttb';
|
|
5
8
|
|
|
6
9
|
export type SampleOptions = Omit<SampleTransform, 'type'>;
|
|
7
10
|
|
|
11
|
+
function normalizeSample(
|
|
12
|
+
strategy: SampleTransform['strategy'],
|
|
13
|
+
): SampleFunction {
|
|
14
|
+
if (typeof strategy === 'function') return strategy;
|
|
15
|
+
if (strategy === 'lttb') return lttb;
|
|
16
|
+
|
|
17
|
+
const strategies = {
|
|
18
|
+
first: (f: number[]) => [f[0]],
|
|
19
|
+
last: (f: number[]) => [f[f.length - 1]],
|
|
20
|
+
min: (f: number[], X: number[], Y: number[]) => [
|
|
21
|
+
f[minIndex(f, (i) => Y[i])],
|
|
22
|
+
],
|
|
23
|
+
max: (f: number[], X: number[], Y: number[]) => [
|
|
24
|
+
f[maxIndex(f, (i) => Y[i])],
|
|
25
|
+
],
|
|
26
|
+
median: (f: number[], X: number[], Y: number[]) => [
|
|
27
|
+
f[medianIndex(f, (i) => Y[i])],
|
|
28
|
+
],
|
|
29
|
+
};
|
|
30
|
+
const sampleFunction = strategies[strategy] || strategies.median;
|
|
31
|
+
return (I: number[], X: number[], Y: number[], thresholds: number) => {
|
|
32
|
+
// Sepreate group to frames, then sample each frame.
|
|
33
|
+
// Keep more data as possible.
|
|
34
|
+
const frameSize = Math.max(1, Math.floor(I.length / thresholds));
|
|
35
|
+
const frames = getFrames(I, frameSize);
|
|
36
|
+
return frames.flatMap((frame) => sampleFunction(frame, X, Y));
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
8
40
|
/**
|
|
9
41
|
* Split the array into frame with each frameSize.
|
|
10
42
|
*/
|
|
11
|
-
function getFrames(I: Primitive[], frameSize: number) {
|
|
43
|
+
function getFrames(I: Primitive[], frameSize: number): number[][] {
|
|
12
44
|
const size = I.length;
|
|
13
45
|
const frames = [];
|
|
14
46
|
let i = 0;
|
|
@@ -23,22 +55,26 @@ function getFrames(I: Primitive[], frameSize: number) {
|
|
|
23
55
|
* sample data for each group when data.length >= threshold(default = 2000).
|
|
24
56
|
*/
|
|
25
57
|
export const Sample: TC<SampleOptions> = (options = {}) => {
|
|
26
|
-
const {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
58
|
+
const {
|
|
59
|
+
strategy = 'median',
|
|
60
|
+
thresholds = 2000,
|
|
61
|
+
groupBy = 'series',
|
|
62
|
+
} = options;
|
|
63
|
+
const sampleFunction = normalizeSample(strategy);
|
|
64
|
+
|
|
65
|
+
return (I, mark) => {
|
|
66
|
+
const { encode } = mark;
|
|
67
|
+
const groups = createGroups(groupBy, I, mark);
|
|
68
|
+
const [X] = columnOf(encode, 'x');
|
|
69
|
+
const [Y] = columnOf(encode, 'y');
|
|
70
|
+
|
|
71
|
+
return [
|
|
72
|
+
groups.flatMap((g) =>
|
|
73
|
+
sampleFunction(g, X as number[], Y as number[], thresholds),
|
|
74
|
+
),
|
|
75
|
+
mark,
|
|
76
|
+
];
|
|
40
77
|
};
|
|
41
|
-
return GroupN({ ...rest, groupBy });
|
|
42
78
|
};
|
|
43
79
|
|
|
44
80
|
Sample.props = {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sample data with lttb(Largest-Triangle-Three-Buckets) algo (https://github.com/pingec/downsample-lttb).
|
|
3
|
+
* Return the sampled index array.
|
|
4
|
+
*/
|
|
5
|
+
export function lttb(
|
|
6
|
+
I: number[],
|
|
7
|
+
X: number[],
|
|
8
|
+
Y: number[],
|
|
9
|
+
thresholds: number,
|
|
10
|
+
): number[] {
|
|
11
|
+
const length = I.length;
|
|
12
|
+
if (thresholds >= length || thresholds === 0) {
|
|
13
|
+
return I;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const x = (i: number) => X[I[i]] * 1;
|
|
17
|
+
const y = (i: number) => Y[I[i]] * 1;
|
|
18
|
+
const sampled = [];
|
|
19
|
+
|
|
20
|
+
// Bucket size. Leave room for start and end data points.
|
|
21
|
+
const every = (length - 2) / (thresholds - 2);
|
|
22
|
+
|
|
23
|
+
let a = 0; // Initially a is the first point in the triangle.
|
|
24
|
+
let maxArea;
|
|
25
|
+
let area;
|
|
26
|
+
let nextA;
|
|
27
|
+
|
|
28
|
+
sampled.push(a); // Always add the first point.
|
|
29
|
+
|
|
30
|
+
for (let i = 0; i < thresholds - 2; i++) {
|
|
31
|
+
// Calculate point average for next bucket (containing c).
|
|
32
|
+
let avgX = 0;
|
|
33
|
+
let avgY = 0;
|
|
34
|
+
let start = Math.floor((i + 1) * every) + 1;
|
|
35
|
+
let end = Math.floor((i + 2) * every) + 1;
|
|
36
|
+
end = Math.min(end, length);
|
|
37
|
+
const size = end - start;
|
|
38
|
+
|
|
39
|
+
for (; start < end; start++) {
|
|
40
|
+
avgX += x(start);
|
|
41
|
+
avgY += y(start);
|
|
42
|
+
}
|
|
43
|
+
avgX /= size;
|
|
44
|
+
avgY /= size;
|
|
45
|
+
|
|
46
|
+
// Get the range for this bucket.
|
|
47
|
+
let frameStart = Math.floor((i + 0) * every) + 1;
|
|
48
|
+
const frameEnd = Math.floor((i + 1) * every) + 1;
|
|
49
|
+
|
|
50
|
+
// Point a.
|
|
51
|
+
const pointA = [x(a), y(a)];
|
|
52
|
+
maxArea = area = -1;
|
|
53
|
+
for (; frameStart < frameEnd; frameStart++) {
|
|
54
|
+
// Calculate triangle area over three buckets.
|
|
55
|
+
area =
|
|
56
|
+
Math.abs(
|
|
57
|
+
(pointA[0] - avgX) * (x(frameStart) - pointA[1]) -
|
|
58
|
+
(pointA[0] - y(frameStart)) * (avgY - pointA[0]),
|
|
59
|
+
) * 0.5;
|
|
60
|
+
if (area > maxArea) {
|
|
61
|
+
maxArea = area;
|
|
62
|
+
nextA = frameStart; // Next a is this b.
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
sampled.push(nextA); // Pick this point from the bucket.
|
|
67
|
+
a = nextA; // This a is the next a (chosen b).
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
sampled.push(length - 1); // Always add last.
|
|
71
|
+
|
|
72
|
+
return sampled.map((a) => I[a]);
|
|
73
|
+
}
|
package/src/utils/array.ts
CHANGED
|
@@ -48,3 +48,42 @@ export function isFlatArray<T>(array: (T | T[])[]): array is T[] {
|
|
|
48
48
|
export function unique<T>(array: T[]): T[] {
|
|
49
49
|
return Array.from(new Set(array));
|
|
50
50
|
}
|
|
51
|
+
|
|
52
|
+
export function divide<T>(
|
|
53
|
+
array: T[],
|
|
54
|
+
callbackfn: (item: T) => boolean,
|
|
55
|
+
): [T[], T[]] {
|
|
56
|
+
const result: [T[], T[]] = [[], []];
|
|
57
|
+
array.forEach((item) => {
|
|
58
|
+
result[callbackfn(item) ? 0 : 1].push(item);
|
|
59
|
+
});
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function comb<T>(array: T[], len = array.length): T[][] {
|
|
64
|
+
if (len === 1) return array.map((item) => [item]);
|
|
65
|
+
const result: T[][] = [];
|
|
66
|
+
for (let i = 0; i < array.length; i++) {
|
|
67
|
+
const rest = array.slice(i + 1);
|
|
68
|
+
const restComb = comb(rest, len - 1);
|
|
69
|
+
restComb.forEach((comb) => {
|
|
70
|
+
result.push([array[i], ...comb]);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
return result;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* get all combinations of two elements in an array
|
|
78
|
+
* @example [1, 2, 3] => [[1], [2], [3], [1, 2], [1, 3], [2, 3], [1, 2, 3]]
|
|
79
|
+
* @param array
|
|
80
|
+
* @returns
|
|
81
|
+
*/
|
|
82
|
+
export function combine<T>(array: T[]): T[][] {
|
|
83
|
+
if (array.length === 1) return [array];
|
|
84
|
+
const result: T[][] = [];
|
|
85
|
+
for (let i = 1; i <= array.length; i++) {
|
|
86
|
+
result.push(...comb(array, i));
|
|
87
|
+
}
|
|
88
|
+
return result;
|
|
89
|
+
}
|
package/src/utils/coordinate.ts
CHANGED
|
@@ -37,6 +37,10 @@ export function isFisheye(coordinate: Coordinate): boolean {
|
|
|
37
37
|
return transformations.some(([type]) => type === 'fisheye');
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
export function isRadar(coordinate: Coordinate): boolean {
|
|
41
|
+
return isParallel(coordinate) && isPolar(coordinate);
|
|
42
|
+
}
|
|
43
|
+
|
|
40
44
|
export function isCircular(coordinate: Coordinate): boolean {
|
|
41
45
|
return isHelix(coordinate) || isPolar(coordinate);
|
|
42
46
|
}
|
|
@@ -45,6 +49,15 @@ export function isTheta(coordinate: Coordinate): boolean {
|
|
|
45
49
|
return isPolar(coordinate) && isTranspose(coordinate);
|
|
46
50
|
}
|
|
47
51
|
|
|
52
|
+
export function isNonCartesian(coordinate: Coordinate): boolean {
|
|
53
|
+
return (
|
|
54
|
+
isPolar(coordinate) ||
|
|
55
|
+
isParallel(coordinate) ||
|
|
56
|
+
isRadial(coordinate) ||
|
|
57
|
+
isTheta(coordinate)
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
48
61
|
export function getRadius(coordinate: Coordinate): number {
|
|
49
62
|
if (isCircular(coordinate)) {
|
|
50
63
|
const [width, height] = coordinate.getSize();
|
|
@@ -56,3 +69,19 @@ export function getRadius(coordinate: Coordinate): number {
|
|
|
56
69
|
}
|
|
57
70
|
return 0;
|
|
58
71
|
}
|
|
72
|
+
|
|
73
|
+
export function radiusOf(coordinate: Coordinate): [number, number] {
|
|
74
|
+
const { transformations } = coordinate.getOptions();
|
|
75
|
+
const [, , , innerRadius, outerRadius] = transformations.find(
|
|
76
|
+
(d) => d[0] === 'polar',
|
|
77
|
+
);
|
|
78
|
+
return [+innerRadius, +outerRadius];
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function angleOf(coordinate: Coordinate): [number, number] {
|
|
82
|
+
const { transformations } = coordinate.getOptions();
|
|
83
|
+
const [, startAngle, endAngle] = transformations.find(
|
|
84
|
+
(d) => d[0] === 'polar',
|
|
85
|
+
);
|
|
86
|
+
return [(+startAngle * 180) / Math.PI, (+endAngle * 180) / Math.PI];
|
|
87
|
+
}
|
package/src/utils/event.ts
CHANGED
|
@@ -18,29 +18,3 @@ export enum CHART_LIFE_CIRCLE {
|
|
|
18
18
|
BEFORE_CHANGE_SIZE = 'beforechangesize',
|
|
19
19
|
AFTER_CHANGE_SIZE = 'afterchangesize',
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
export function emitEvent(
|
|
23
|
-
event: Record<string, EventListener[]>,
|
|
24
|
-
eventName: string,
|
|
25
|
-
...args: any[]
|
|
26
|
-
) {
|
|
27
|
-
if (!event) return;
|
|
28
|
-
const listeners = event[eventName] || [];
|
|
29
|
-
listeners.forEach((listener) => {
|
|
30
|
-
listener.apply(this, args);
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export function offEvent(
|
|
35
|
-
event: Record<string, EventListener[]>,
|
|
36
|
-
eventName?: string,
|
|
37
|
-
) {
|
|
38
|
-
if (!event) return;
|
|
39
|
-
// Unbind all event.
|
|
40
|
-
if (!eventName) {
|
|
41
|
-
event = {};
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
delete event[eventName];
|
|
46
|
-
}
|
package/src/utils/scale.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { bisectLeft, sort } from 'd3-array';
|
|
2
2
|
|
|
3
|
-
function isOrdinalScale(scale) {
|
|
4
|
-
return scale.getBandWidth;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
3
|
function constrain(x, lo, hi) {
|
|
8
4
|
return Math.min(hi, Math.max(lo, x));
|
|
9
5
|
}
|
|
10
6
|
|
|
7
|
+
export function isOrdinalScale(scale) {
|
|
8
|
+
return scale.getBandWidth;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
11
|
export function invert(scale, x, start) {
|
|
12
12
|
if (!isOrdinalScale(scale)) return scale.invert(x);
|
|
13
13
|
const { adjustedRange } = scale;
|
package/src/utils/vector.ts
CHANGED
|
@@ -16,7 +16,7 @@ export function angle([x, y]: Vector2): number {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
* Calculate angle of [x, y]then + Math.PI / 2.
|
|
19
|
+
* Calculate angle of [x, y], then + Math.PI / 2.
|
|
20
20
|
* Because of the difference between `Geometric coordinate system` and `Visualization coordinate system`.
|
|
21
21
|
* @returns
|
|
22
22
|
*/
|
package/esm/shape/area/step.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"step.js","sourceRoot":"src/","sources":["shape/area/step.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAIhC,MAAM,CAAC,MAAM,IAAI,GAAoB,CAAC,OAAO,EAAE,EAAE;IAC/C,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE;QACrC,OAAO,KAAK,iBAAG,KAAK,EAAE,SAAS,IAAK,OAAO,EAAG,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;IAC9E,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,IAAI,CAAC,KAAK,qBACL,KAAK,CAAC,KAAK,CACf,CAAC"}
|
package/lib/shape/area/step.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"step.js","sourceRoot":"src/","sources":["shape/area/step.ts"],"names":[],"mappings":";;;AAAA,uCAAqC;AAErC,mCAAgC;AAIzB,MAAM,IAAI,GAAoB,CAAC,OAAO,EAAE,EAAE;IAC/C,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE;QACrC,OAAO,IAAA,aAAK,kBAAG,KAAK,EAAE,oBAAS,IAAK,OAAO,EAAG,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;IAC9E,CAAC,CAAC;AACJ,CAAC,CAAC;AAJW,QAAA,IAAI,QAIf;AAEF,YAAI,CAAC,KAAK,qBACL,aAAK,CAAC,KAAK,CACf,CAAC"}
|