@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
|
@@ -1,34 +1,144 @@
|
|
|
1
|
+
import type { Coordinate } from '@antv/coord';
|
|
2
|
+
import type { DisplayObject } from '@antv/g';
|
|
1
3
|
import { Category } from '@antv/gui';
|
|
2
|
-
import {
|
|
4
|
+
import { format } from 'd3-format';
|
|
5
|
+
import type {
|
|
6
|
+
FlexLayout,
|
|
7
|
+
G2Library,
|
|
8
|
+
G2Theme,
|
|
3
9
|
GuideComponentComponent as GCC,
|
|
4
|
-
|
|
10
|
+
GuideComponentOrientation as GCO,
|
|
11
|
+
GuideComponentPosition as GCP,
|
|
12
|
+
Scale,
|
|
5
13
|
} from '../runtime';
|
|
6
|
-
import {
|
|
14
|
+
import { useLibrary } from '../runtime/library';
|
|
15
|
+
import { Shape, ShapeComponent } from '../runtime/types/component';
|
|
16
|
+
import type { G2ShapeOptions } from '../runtime/types/options';
|
|
17
|
+
import { G2Layout, inferComponentLayout, titleContent, scaleOf } from './utils';
|
|
7
18
|
|
|
8
19
|
export type LegendCategoryOptions = {
|
|
9
|
-
position?: GuideComponentPosition;
|
|
10
|
-
labelFormatter?: (d: any) => string;
|
|
11
20
|
dx?: number;
|
|
12
21
|
dy?: number;
|
|
22
|
+
labelFormatter?: (d: any) => string;
|
|
23
|
+
layout?: FlexLayout;
|
|
24
|
+
orientation?: GCO;
|
|
25
|
+
position?: GCP;
|
|
13
26
|
title?: string | string[];
|
|
14
27
|
[key: string]: any;
|
|
15
28
|
};
|
|
16
29
|
|
|
17
30
|
function inferLayout(
|
|
18
|
-
position:
|
|
31
|
+
position: GCP,
|
|
19
32
|
gridRow?: number,
|
|
20
33
|
gridCol?: number,
|
|
21
34
|
): [number, number] {
|
|
22
35
|
const [gridRowLimit, gridColLimit] = [gridRow || 100, gridCol || 100];
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
36
|
+
|
|
37
|
+
switch (position) {
|
|
38
|
+
case 'top':
|
|
39
|
+
case 'bottom':
|
|
40
|
+
case 'top-left':
|
|
41
|
+
case 'top-right':
|
|
42
|
+
case 'bottom-left':
|
|
43
|
+
case 'bottom-right':
|
|
44
|
+
return [1, gridColLimit];
|
|
45
|
+
case 'left':
|
|
46
|
+
case 'right':
|
|
47
|
+
return [gridRowLimit, 1];
|
|
48
|
+
default:
|
|
49
|
+
return [gridRow, gridCol];
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function createShape(
|
|
54
|
+
shape: string,
|
|
55
|
+
library: G2Library,
|
|
56
|
+
coordinate: Coordinate,
|
|
57
|
+
theme: G2Theme,
|
|
58
|
+
style: Record<string, any> = {},
|
|
59
|
+
) {
|
|
60
|
+
const [useShape] = useLibrary<G2ShapeOptions, ShapeComponent, Shape>(
|
|
61
|
+
'shape',
|
|
62
|
+
library,
|
|
63
|
+
);
|
|
64
|
+
return () =>
|
|
65
|
+
useShape({ type: `point.${shape}` })(
|
|
66
|
+
[
|
|
67
|
+
[0, 0],
|
|
68
|
+
[0, 0],
|
|
69
|
+
],
|
|
70
|
+
{ size: 6, ...style },
|
|
71
|
+
coordinate,
|
|
72
|
+
theme,
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function inferItemMarker(
|
|
77
|
+
scales: Scale[],
|
|
78
|
+
options: LegendCategoryOptions,
|
|
79
|
+
library: G2Library,
|
|
80
|
+
coordinate: Coordinate,
|
|
81
|
+
theme: G2Theme,
|
|
82
|
+
): ((datum: any, i: number, data: any) => () => DisplayObject) | undefined {
|
|
83
|
+
const shapeScale = scaleOf(scales, 'shape');
|
|
84
|
+
|
|
85
|
+
const { itemMarker } = options;
|
|
86
|
+
if (shapeScale && !itemMarker) {
|
|
87
|
+
const { range } = shapeScale.getOptions();
|
|
88
|
+
|
|
89
|
+
return (d, i) =>
|
|
90
|
+
createShape(range[i], library, coordinate, theme, {
|
|
91
|
+
color: d.color,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
if (typeof itemMarker === 'function') {
|
|
95
|
+
return itemMarker;
|
|
96
|
+
}
|
|
97
|
+
return (d, i) =>
|
|
98
|
+
createShape(itemMarker || 'point', library, coordinate, theme, {
|
|
99
|
+
color: d.color,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function inferItemMarkerOpacity(scales: Scale[]) {
|
|
104
|
+
const scale = scaleOf(scales, 'opacity');
|
|
105
|
+
if (scale) {
|
|
106
|
+
const { range } = scale.getOptions();
|
|
107
|
+
return (d, i) => range[i];
|
|
108
|
+
}
|
|
109
|
+
return undefined;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function inferCategoryStyle(
|
|
113
|
+
scales: Scale[],
|
|
114
|
+
options: LegendCategoryOptions,
|
|
115
|
+
library: G2Library,
|
|
116
|
+
coordinate: Coordinate,
|
|
117
|
+
theme: G2Theme,
|
|
118
|
+
) {
|
|
119
|
+
const { labelFormatter = (d) => `${d}` } = options;
|
|
120
|
+
|
|
121
|
+
const baseStyle = {
|
|
122
|
+
itemMarker: inferItemMarker(scales, options, library, coordinate, theme),
|
|
123
|
+
itemMarkerOpacity: inferItemMarkerOpacity(scales),
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
const finalLabelFormatter =
|
|
127
|
+
typeof labelFormatter === 'string'
|
|
128
|
+
? format(labelFormatter)
|
|
129
|
+
: labelFormatter;
|
|
130
|
+
|
|
131
|
+
// here must exists a color scale
|
|
132
|
+
const scale = scaleOf(scales, 'color');
|
|
133
|
+
|
|
134
|
+
return {
|
|
135
|
+
...baseStyle,
|
|
136
|
+
data: scale.getOptions().domain.map((d) => ({
|
|
137
|
+
id: d,
|
|
138
|
+
label: finalLabelFormatter(d),
|
|
139
|
+
color: scale.map(d),
|
|
140
|
+
})),
|
|
141
|
+
};
|
|
32
142
|
}
|
|
33
143
|
|
|
34
144
|
/**
|
|
@@ -39,25 +149,27 @@ export const LegendCategory: GCC<LegendCategoryOptions> = (options) => {
|
|
|
39
149
|
order,
|
|
40
150
|
size,
|
|
41
151
|
position,
|
|
42
|
-
|
|
152
|
+
orientation,
|
|
153
|
+
itemMarker,
|
|
154
|
+
labelFormatter,
|
|
43
155
|
dx = 0,
|
|
44
156
|
dy = 0,
|
|
45
157
|
title,
|
|
46
158
|
gridCol,
|
|
47
159
|
gridRow,
|
|
160
|
+
layout,
|
|
48
161
|
...rest
|
|
49
162
|
} = options;
|
|
50
|
-
|
|
51
|
-
|
|
163
|
+
|
|
164
|
+
return (scales, value, coordinate, theme) => {
|
|
165
|
+
const { library, bbox } = value;
|
|
52
166
|
const { x, y, width, height } = bbox;
|
|
53
|
-
const items = domain.map((d) => ({
|
|
54
|
-
id: d,
|
|
55
|
-
label: labelFormatter(d),
|
|
56
|
-
value: '',
|
|
57
|
-
color: scale.map(d),
|
|
58
|
-
}));
|
|
59
167
|
|
|
60
|
-
|
|
168
|
+
const finalLayout = inferComponentLayout(
|
|
169
|
+
position,
|
|
170
|
+
value.scales?.[0]?.guide?.layout,
|
|
171
|
+
);
|
|
172
|
+
|
|
61
173
|
const [finalGridRow, finalGridCol] = inferLayout(
|
|
62
174
|
position,
|
|
63
175
|
gridRow,
|
|
@@ -65,27 +177,36 @@ export const LegendCategory: GCC<LegendCategoryOptions> = (options) => {
|
|
|
65
177
|
);
|
|
66
178
|
|
|
67
179
|
const legendStyle = {
|
|
68
|
-
|
|
69
|
-
x: x + dx,
|
|
70
|
-
y: y + dy,
|
|
71
|
-
orient: ['right', 'left', 'arcCenter'].includes(position)
|
|
180
|
+
orient: ['right', 'left', 'center'].includes(position)
|
|
72
181
|
? 'vertical'
|
|
73
182
|
: 'horizontal',
|
|
74
183
|
width,
|
|
75
184
|
height,
|
|
76
|
-
gridCol: finalGridCol,
|
|
77
|
-
gridRow: finalGridRow,
|
|
185
|
+
gridCol: gridCol ?? finalGridCol,
|
|
186
|
+
gridRow: gridRow ?? finalGridRow,
|
|
78
187
|
rowPadding: 0,
|
|
79
188
|
colPadding: 8,
|
|
80
189
|
titleText: titleContent(title),
|
|
81
|
-
|
|
190
|
+
...inferCategoryStyle(scales, options, library, coordinate, theme),
|
|
82
191
|
};
|
|
83
192
|
|
|
84
193
|
const { legend: legendTheme = {} } = theme;
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
194
|
+
const layoutWrapper = new G2Layout({
|
|
195
|
+
style: {
|
|
196
|
+
x: x + dx,
|
|
197
|
+
y: y + dy,
|
|
198
|
+
width,
|
|
199
|
+
height,
|
|
200
|
+
...finalLayout,
|
|
201
|
+
},
|
|
88
202
|
});
|
|
203
|
+
layoutWrapper.appendChild(
|
|
204
|
+
new Category({
|
|
205
|
+
className: 'legend-category',
|
|
206
|
+
style: Object.assign({}, legendTheme, legendStyle, rest),
|
|
207
|
+
}),
|
|
208
|
+
);
|
|
209
|
+
return layoutWrapper;
|
|
89
210
|
};
|
|
90
211
|
};
|
|
91
212
|
|
|
@@ -1,55 +1,156 @@
|
|
|
1
1
|
import { Continuous } from '@antv/gui';
|
|
2
|
-
import {
|
|
2
|
+
import { Quantile, Quantize, Threshold } from '@antv/scale';
|
|
3
|
+
import { format } from 'd3-format';
|
|
4
|
+
import type {
|
|
5
|
+
FlexLayout,
|
|
3
6
|
GuideComponentComponent as GCC,
|
|
4
|
-
GuideComponentPosition,
|
|
7
|
+
GuideComponentPosition as GCP,
|
|
8
|
+
Scale,
|
|
5
9
|
} from '../runtime';
|
|
6
|
-
import { titleContent } from './utils';
|
|
10
|
+
import { G2Layout, inferComponentLayout, titleContent, scaleOf } from './utils';
|
|
7
11
|
|
|
8
12
|
export type LegendContinuousOptions = {
|
|
9
|
-
|
|
13
|
+
layout?: FlexLayout;
|
|
14
|
+
position?: GCP;
|
|
10
15
|
title?: string | string[];
|
|
16
|
+
[key: string]: any;
|
|
11
17
|
};
|
|
12
18
|
|
|
19
|
+
function inferContinuousConfig(
|
|
20
|
+
scales: Scale[],
|
|
21
|
+
options: LegendContinuousOptions,
|
|
22
|
+
) {
|
|
23
|
+
const colorScale = scaleOf(scales, 'color');
|
|
24
|
+
const { domain, range } = colorScale.getOptions();
|
|
25
|
+
const { length = LegendContinuous.props.defaultLength } = options;
|
|
26
|
+
const [min, max] = [domain[0], domain.slice(-1)[0]];
|
|
27
|
+
|
|
28
|
+
if (colorScale instanceof Threshold) {
|
|
29
|
+
const thresholds = (colorScale as any).thresholds as number[];
|
|
30
|
+
// for quantize, quantile scale
|
|
31
|
+
if (colorScale instanceof Quantize || colorScale instanceof Quantile) {
|
|
32
|
+
return {
|
|
33
|
+
data: [min, ...thresholds, max].map((value, index) => ({
|
|
34
|
+
value: value / max,
|
|
35
|
+
label: value,
|
|
36
|
+
})),
|
|
37
|
+
color: range,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
// for threshhold
|
|
41
|
+
const data = [-Infinity, ...thresholds, Infinity].map((value, index) => ({
|
|
42
|
+
value: index,
|
|
43
|
+
label: value,
|
|
44
|
+
}));
|
|
45
|
+
return {
|
|
46
|
+
data,
|
|
47
|
+
color: range,
|
|
48
|
+
labelFilter: (datum, index) => {
|
|
49
|
+
return index > 0 && index < data.length - 1;
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// for linear, pow, sqrt, log, time, utc scale
|
|
55
|
+
const opacityScale = scaleOf(scales, 'opacity');
|
|
56
|
+
return {
|
|
57
|
+
data: colorScale.getTicks().map((value) => ({ value })),
|
|
58
|
+
color: new Array(length).fill(0).map((d, i) => {
|
|
59
|
+
const value = ((max - min) / (length - 1)) * i + min;
|
|
60
|
+
const color = colorScale.map(value);
|
|
61
|
+
const opacity = opacityScale ? opacityScale.map(value) : 1;
|
|
62
|
+
return color.replace(
|
|
63
|
+
/rgb[a]*\(([\d]{1,3}), ([\d]{1,3}), ([\d]{1,3})[\S\s]*\)/,
|
|
64
|
+
(match, p1, p2, p3) => `rgba(${p1}, ${p2}, ${p3}, ${opacity})`,
|
|
65
|
+
);
|
|
66
|
+
}),
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function inferContinuousLayout(options: LegendContinuousOptions) {
|
|
71
|
+
const {
|
|
72
|
+
position = 'top',
|
|
73
|
+
size,
|
|
74
|
+
length = LegendContinuous.props.defaultLength,
|
|
75
|
+
} = options;
|
|
76
|
+
|
|
77
|
+
const layouts = {
|
|
78
|
+
left: ['vertical', size, length],
|
|
79
|
+
right: ['vertical', size, length],
|
|
80
|
+
top: ['horizontal', length, size],
|
|
81
|
+
bottom: ['horizontal', length, size],
|
|
82
|
+
};
|
|
83
|
+
const [orient, width, height] = layouts[position];
|
|
84
|
+
return { orient, width, height };
|
|
85
|
+
}
|
|
86
|
+
|
|
13
87
|
/**
|
|
14
88
|
* Guide Component for continuous color scale.
|
|
15
89
|
* @todo Custom style.
|
|
16
90
|
*/
|
|
17
91
|
export const LegendContinuous: GCC<LegendContinuousOptions> = (options) => {
|
|
18
|
-
const {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
92
|
+
const {
|
|
93
|
+
title,
|
|
94
|
+
dx = 0,
|
|
95
|
+
dy = 0,
|
|
96
|
+
position,
|
|
97
|
+
layout,
|
|
98
|
+
labelFormatter,
|
|
99
|
+
...rest
|
|
100
|
+
} = options;
|
|
101
|
+
return (scales, value, coordinate, theme) => {
|
|
102
|
+
const { bbox } = value;
|
|
103
|
+
const { x, y, width, height } = bbox;
|
|
104
|
+
|
|
105
|
+
const finalLayout = inferComponentLayout(
|
|
106
|
+
position,
|
|
107
|
+
value.scales?.[0]?.guide?.layout,
|
|
108
|
+
);
|
|
109
|
+
const layoutWrapper = new G2Layout({
|
|
110
|
+
style: {
|
|
111
|
+
x: x + dx,
|
|
112
|
+
y: y + dy,
|
|
113
|
+
width,
|
|
114
|
+
height,
|
|
115
|
+
...finalLayout,
|
|
116
|
+
},
|
|
117
|
+
});
|
|
23
118
|
|
|
24
119
|
const { continuousLegend: legendTheme = {} } = theme;
|
|
25
120
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
121
|
+
layoutWrapper.appendChild(
|
|
122
|
+
new Continuous({
|
|
123
|
+
style: Object.assign(
|
|
124
|
+
{},
|
|
125
|
+
legendTheme,
|
|
126
|
+
{
|
|
127
|
+
x,
|
|
128
|
+
y,
|
|
129
|
+
titleText: titleContent(title),
|
|
130
|
+
titleFontSize: 12,
|
|
131
|
+
showHandle: false,
|
|
132
|
+
showIndicator: false,
|
|
133
|
+
labelAlign: 'value',
|
|
134
|
+
labelFormatter:
|
|
135
|
+
typeof labelFormatter === 'string'
|
|
136
|
+
? (d) => format(labelFormatter)(d.label)
|
|
137
|
+
: labelFormatter,
|
|
138
|
+
...inferContinuousLayout(options),
|
|
139
|
+
...inferContinuousConfig(scales, options),
|
|
140
|
+
},
|
|
141
|
+
rest,
|
|
142
|
+
),
|
|
143
|
+
}),
|
|
144
|
+
);
|
|
145
|
+
|
|
146
|
+
return layoutWrapper;
|
|
48
147
|
};
|
|
49
148
|
};
|
|
50
149
|
|
|
51
150
|
LegendContinuous.props = {
|
|
52
151
|
defaultPosition: 'top',
|
|
152
|
+
defaultOrientation: 'vertical',
|
|
53
153
|
defaultOrder: 1,
|
|
54
|
-
defaultSize:
|
|
154
|
+
defaultSize: 60,
|
|
155
|
+
defaultLength: 200,
|
|
55
156
|
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { GuideComponentComponent as GCC } from '../runtime';
|
|
2
|
+
import { LegendContinuous, LegendContinuousOptions } from './legendContinuous';
|
|
3
|
+
|
|
4
|
+
export type LegendContinuousBlockOptions = LegendContinuousOptions;
|
|
5
|
+
|
|
6
|
+
export const LegendContinuousBlock: GCC<LegendContinuousBlockOptions> = (
|
|
7
|
+
options,
|
|
8
|
+
) => {
|
|
9
|
+
return (...args) =>
|
|
10
|
+
LegendContinuous(Object.assign({}, { block: true }, options))(...args);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
LegendContinuousBlock.props = {
|
|
14
|
+
...LegendContinuous.props,
|
|
15
|
+
defaultPosition: 'top',
|
|
16
|
+
defaultOrientation: 'horizontal',
|
|
17
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { GuideComponentComponent as GCC } from '../runtime';
|
|
2
|
+
import { LegendContinuous, LegendContinuousOptions } from './legendContinuous';
|
|
3
|
+
|
|
4
|
+
export type LegendContinuousBlockSizeOptions = LegendContinuousOptions;
|
|
5
|
+
|
|
6
|
+
export const LegendContinuousBlockSize: GCC<
|
|
7
|
+
LegendContinuousBlockSizeOptions
|
|
8
|
+
> = (options) => {
|
|
9
|
+
return LegendContinuous(
|
|
10
|
+
Object.assign(
|
|
11
|
+
{},
|
|
12
|
+
{ type: 'size', block: true, labelShowTick: false },
|
|
13
|
+
options,
|
|
14
|
+
),
|
|
15
|
+
);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
LegendContinuousBlockSize.props = {
|
|
19
|
+
...LegendContinuous.props,
|
|
20
|
+
defaultPosition: 'top',
|
|
21
|
+
defaultOrientation: 'horizontal',
|
|
22
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { GuideComponentComponent as GCC } from '../runtime';
|
|
2
|
+
import { LegendContinuous, LegendContinuousOptions } from './legendContinuous';
|
|
3
|
+
|
|
4
|
+
export type LegendContinuousSizeOptions = LegendContinuousOptions;
|
|
5
|
+
|
|
6
|
+
export const LegendContinuousSize: GCC<LegendContinuousSizeOptions> = (
|
|
7
|
+
options,
|
|
8
|
+
) => {
|
|
9
|
+
return LegendContinuous(
|
|
10
|
+
Object.assign(
|
|
11
|
+
{},
|
|
12
|
+
{
|
|
13
|
+
type: 'size',
|
|
14
|
+
labelShowTick: false,
|
|
15
|
+
labelFilter: (datum, index, data) =>
|
|
16
|
+
index === 0 || index === data.length - 1,
|
|
17
|
+
},
|
|
18
|
+
options,
|
|
19
|
+
),
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
LegendContinuousSize.props = {
|
|
24
|
+
...LegendContinuous.props,
|
|
25
|
+
defaultPosition: 'top',
|
|
26
|
+
defaultOrientation: 'horizontal',
|
|
27
|
+
};
|
|
@@ -12,7 +12,7 @@ export type ScrollbarOptions = {
|
|
|
12
12
|
export const Scrollbar: GCC<ScrollbarOptions> = (options) => {
|
|
13
13
|
const { orient, labelFormatter, ...rest } = options;
|
|
14
14
|
|
|
15
|
-
return (
|
|
15
|
+
return (scales, value, coordinate, theme) => {
|
|
16
16
|
const { bbox } = value;
|
|
17
17
|
const { x, y, width, height } = bbox;
|
|
18
18
|
const { scrollbar: scrollbarTheme = {} } = theme;
|
package/src/component/slider.ts
CHANGED
|
@@ -16,7 +16,7 @@ export const Slider: GCC<SliderOptions> = (options) => {
|
|
|
16
16
|
// do not pass size.
|
|
17
17
|
const { orient, labelFormatter, size, ...rest } = options;
|
|
18
18
|
|
|
19
|
-
return (scale, value, coordinate, theme) => {
|
|
19
|
+
return ([scale], value, coordinate, theme) => {
|
|
20
20
|
const { bbox } = value;
|
|
21
21
|
const { x, y, width, height } = bbox;
|
|
22
22
|
const { slider: sliderTheme = {} } = theme;
|
package/src/component/title.ts
CHANGED
|
@@ -88,7 +88,7 @@ const Title = createComponent<TitleStyleProps>({
|
|
|
88
88
|
* Title Component.
|
|
89
89
|
*/
|
|
90
90
|
export const TitleComponent: GCC<TitleComponentOptions> = (options) => {
|
|
91
|
-
return (
|
|
91
|
+
return (scales, value, coordinate, theme) => {
|
|
92
92
|
const { x, y, width, height } = value.bbox;
|
|
93
93
|
return new Title({
|
|
94
94
|
style: deepMix(
|
package/src/component/utils.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { CustomElement, DisplayObjectConfig, Group } from '@antv/g';
|
|
2
2
|
import { deepMix } from '@antv/util';
|
|
3
|
+
import { Layout } from '@antv/gui';
|
|
3
4
|
import { select, Selection, G2Element } from '../utils/selection';
|
|
5
|
+
import { GuideComponentPosition, FlexLayout, Scale } from '../runtime';
|
|
4
6
|
|
|
5
7
|
type Descriptor<T> = {
|
|
6
8
|
render?: (attributes: T, container: CustomElement<T>) => void;
|
|
@@ -40,3 +42,47 @@ export function maybeAppend<T>(
|
|
|
40
42
|
export function titleContent(field: string | string[]): string {
|
|
41
43
|
return Array.isArray(field) ? field.join(', ') : `${field || ''}`;
|
|
42
44
|
}
|
|
45
|
+
|
|
46
|
+
export function inferComponentLayout(
|
|
47
|
+
position: GuideComponentPosition,
|
|
48
|
+
userDefinitions?: FlexLayout,
|
|
49
|
+
) {
|
|
50
|
+
const preset = {
|
|
51
|
+
display: 'flex',
|
|
52
|
+
flexDirection: 'row',
|
|
53
|
+
justifyContent: 'flex-start',
|
|
54
|
+
alignItems: 'center',
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
if (userDefinitions) {
|
|
58
|
+
return {
|
|
59
|
+
...preset,
|
|
60
|
+
...userDefinitions,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
let { flexDirection, justifyContent, alignItems } = preset;
|
|
64
|
+
|
|
65
|
+
const layout = {
|
|
66
|
+
top: ['row', 'center', 'center'],
|
|
67
|
+
bottom: ['row', 'center', 'center'],
|
|
68
|
+
left: ['colunm', 'center', 'center'],
|
|
69
|
+
right: ['colunm', 'center', 'center'],
|
|
70
|
+
center: ['column', 'center', 'center'],
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
if (position in layout) {
|
|
74
|
+
[flexDirection, justifyContent, alignItems] = layout[position];
|
|
75
|
+
}
|
|
76
|
+
return { display: 'flex', flexDirection, justifyContent, alignItems };
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export class G2Layout extends Layout {
|
|
80
|
+
update(options: any) {
|
|
81
|
+
this.attr(options);
|
|
82
|
+
(this.children?.[0] as any)?.update(options);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function scaleOf(scales: Scale[], type: string): Scale | undefined {
|
|
87
|
+
return scales.filter((s) => s.getOptions().name === type)?.[0];
|
|
88
|
+
}
|
|
@@ -17,7 +17,7 @@ export type FacetCircleOptions = Omit<FacetCircleComposition, 'type'>;
|
|
|
17
17
|
const setScale = useDefaultAdaptor<G2ViewTree>((options) => {
|
|
18
18
|
return {
|
|
19
19
|
scale: {
|
|
20
|
-
x: { guide: { type: '
|
|
20
|
+
x: { guide: { type: 'axisArc' }, paddingOuter: 0, paddingInner: 0.1 },
|
|
21
21
|
y: { guide: null, range: [0, 1], paddingOuter: 0, paddingInner: 0.1 },
|
|
22
22
|
},
|
|
23
23
|
};
|
package/src/coordinate/index.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export { Cartesian } from './cartesian';
|
|
2
|
-
export { Polar } from './polar';
|
|
2
|
+
export { Polar, getPolarOptions } from './polar';
|
|
3
3
|
export { Helix } from './helix';
|
|
4
4
|
export { Transpose } from './transpose';
|
|
5
5
|
export { Reflect } from './reflect';
|
|
6
6
|
export { ReflectX } from './reflectX';
|
|
7
7
|
export { ReflectY } from './reflectY';
|
|
8
|
-
export { Theta } from './theta';
|
|
9
|
-
export { Radial } from './radial';
|
|
8
|
+
export { Theta, getThetaOptions } from './theta';
|
|
9
|
+
export { Radial, getRadialOptions } from './radial';
|
|
10
10
|
export { Parallel } from './parallel';
|
|
11
11
|
export { Fisheye } from './fisheye';
|
|
12
12
|
export { FisheyeX } from './fisheyeX';
|
package/src/coordinate/polar.ts
CHANGED
|
@@ -3,20 +3,28 @@ import { PolarCoordinate } from '../spec';
|
|
|
3
3
|
|
|
4
4
|
export type PolarOptions = Omit<PolarCoordinate, 'type'>;
|
|
5
5
|
|
|
6
|
+
export const getPolarOptions = (options: PolarOptions = {}) => {
|
|
7
|
+
const defaultOptions = {
|
|
8
|
+
startAngle: -Math.PI / 2,
|
|
9
|
+
endAngle: (Math.PI * 3) / 2,
|
|
10
|
+
innerRadius: 0,
|
|
11
|
+
outerRadius: 1,
|
|
12
|
+
};
|
|
13
|
+
return { ...defaultOptions, ...options };
|
|
14
|
+
};
|
|
6
15
|
/**
|
|
7
16
|
* Polar transformation for circular charts using center of canvas as origin.
|
|
8
17
|
* @todo Adjust size of canvas by startAngle and endAngle to make chart as big as possible.
|
|
9
18
|
*/
|
|
10
|
-
export const Polar: CC<PolarOptions> = ({
|
|
11
|
-
startAngle
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
];
|
|
19
|
+
export const Polar: CC<PolarOptions> = (options) => {
|
|
20
|
+
const { startAngle, endAngle, innerRadius, outerRadius } =
|
|
21
|
+
getPolarOptions(options);
|
|
22
|
+
return [
|
|
23
|
+
['translate', 0, 0.5],
|
|
24
|
+
['reflect.y'],
|
|
25
|
+
['translate', 0, -0.5],
|
|
26
|
+
['polar', startAngle, endAngle, innerRadius, outerRadius],
|
|
27
|
+
];
|
|
28
|
+
};
|
|
21
29
|
|
|
22
30
|
Polar.props = {};
|