@antv/g2 5.0.0-rc.1 → 5.0.0
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/README.en-US.md +8 -5
- package/README.md +5 -6
- package/dist/g2-lite.min.js +4 -4
- package/dist/g2.min.js +4 -4
- package/esm/animation/fadeIn.js +1 -1
- package/esm/animation/fadeIn.js.map +1 -1
- package/esm/animation/fadeOut.js +1 -1
- package/esm/animation/fadeOut.js.map +1 -1
- package/esm/animation/morphing.js +1 -1
- package/esm/animation/morphing.js.map +1 -1
- package/esm/animation/scaleInX.js +1 -1
- package/esm/animation/scaleInX.js.map +1 -1
- package/esm/animation/scaleInY.js +1 -1
- package/esm/animation/scaleInY.js.map +1 -1
- package/esm/animation/scaleOutX.js +1 -1
- package/esm/animation/scaleOutX.js.map +1 -1
- package/esm/animation/scaleOutY.js +1 -1
- package/esm/animation/scaleOutY.js.map +1 -1
- package/esm/animation/waveIn.js +2 -2
- package/esm/animation/waveIn.js.map +1 -1
- package/esm/animation/zoomIn.js +1 -1
- package/esm/animation/zoomIn.js.map +1 -1
- package/esm/animation/zoomOut.js +1 -1
- package/esm/animation/zoomOut.js.map +1 -1
- package/esm/api/chart.d.ts +5 -2
- package/esm/api/chart.js +28 -20
- package/esm/api/chart.js.map +1 -1
- package/esm/api/composition/base.d.ts +8 -2
- package/esm/api/composition/base.js +29 -2
- package/esm/api/composition/base.js.map +1 -1
- package/esm/component/axis.js +46 -30
- package/esm/component/axis.js.map +1 -1
- package/esm/component/axisRadar.js +4 -3
- package/esm/component/axisRadar.js.map +1 -1
- package/esm/component/axisX.js.map +1 -1
- package/esm/component/legendCategory.js +63 -23
- package/esm/component/legendCategory.js.map +1 -1
- package/esm/component/legendContinuous.js +10 -8
- package/esm/component/legendContinuous.js.map +1 -1
- package/esm/component/legendContinuousBlockSize.js +1 -1
- package/esm/component/legendContinuousBlockSize.js.map +1 -1
- package/esm/component/legendContinuousSize.js +1 -1
- package/esm/component/legendContinuousSize.js.map +1 -1
- package/esm/component/scrollbar.d.ts +1 -1
- package/esm/component/scrollbar.js +4 -4
- package/esm/component/scrollbar.js.map +1 -1
- package/esm/component/scrollbarX.js +1 -1
- package/esm/component/scrollbarX.js.map +1 -1
- package/esm/component/scrollbarY.js +1 -1
- package/esm/component/scrollbarY.js.map +1 -1
- package/esm/component/slider.d.ts +1 -1
- package/esm/component/slider.js +4 -4
- package/esm/component/slider.js.map +1 -1
- package/esm/component/sliderX.js +1 -1
- package/esm/component/sliderX.js.map +1 -1
- package/esm/component/sliderY.js +1 -1
- package/esm/component/sliderY.js.map +1 -1
- package/esm/component/title.js +13 -2
- package/esm/component/title.js.map +1 -1
- package/esm/component/utils.d.ts +2 -1
- package/esm/component/utils.js +27 -3
- package/esm/component/utils.js.map +1 -1
- package/esm/coordinate/fisheye.js +1 -1
- package/esm/coordinate/fisheye.js.map +1 -1
- package/esm/geo/geoView.js +1 -1
- package/esm/geo/geoView.js.map +1 -1
- package/esm/index.d.ts +1 -0
- package/esm/index.js +1 -0
- package/esm/index.js.map +1 -1
- package/esm/interaction/brushFilter.js +1 -1
- package/esm/interaction/brushFilter.js.map +1 -1
- package/esm/interaction/brushHighlight.js +6 -3
- package/esm/interaction/brushHighlight.js.map +1 -1
- package/esm/interaction/elementHighlight.js +1 -1
- package/esm/interaction/elementHighlight.js.map +1 -1
- package/esm/interaction/event.js +20 -20
- package/esm/interaction/event.js.map +1 -1
- package/esm/interaction/fisheye.js +1 -1
- package/esm/interaction/fisheye.js.map +1 -1
- package/esm/interaction/legendFilter.d.ts +1 -4
- package/esm/interaction/legendFilter.js +52 -74
- package/esm/interaction/legendFilter.js.map +1 -1
- package/esm/interaction/sliderFilter.js +6 -6
- package/esm/interaction/sliderFilter.js.map +1 -1
- package/esm/interaction/tooltip.d.ts +2 -2
- package/esm/interaction/tooltip.js +40 -18
- package/esm/interaction/tooltip.js.map +1 -1
- package/esm/interaction/utils.js +7 -5
- package/esm/interaction/utils.js.map +1 -1
- package/esm/label-transform/overflowHide.js +3 -2
- package/esm/label-transform/overflowHide.js.map +1 -1
- package/esm/label-transform/overlapHide.js +3 -2
- package/esm/label-transform/overlapHide.js.map +1 -1
- package/esm/mark/boxplot.js +2 -2
- package/esm/mark/boxplot.js.map +1 -1
- package/esm/mark/gauge.js +2 -2
- package/esm/mark/gauge.js.map +1 -1
- package/esm/mark/sankey.js +2 -2
- package/esm/mark/sankey.js.map +1 -1
- package/esm/mark/utils.d.ts +2 -2
- package/esm/mark/utils.js +2 -2
- package/esm/mark/utils.js.map +1 -1
- package/esm/runtime/component.d.ts +3 -3
- package/esm/runtime/component.js +22 -7
- package/esm/runtime/component.js.map +1 -1
- package/esm/runtime/plot.js +58 -24
- package/esm/runtime/plot.js.map +1 -1
- package/esm/runtime/render.d.ts +2 -2
- package/esm/runtime/render.js +33 -10
- package/esm/runtime/render.js.map +1 -1
- package/esm/runtime/types/common.d.ts +12 -9
- package/esm/runtime/types/component.d.ts +13 -4
- package/esm/shape/area/area.js +1 -1
- package/esm/shape/area/area.js.map +1 -1
- package/esm/shape/area/curve.js +2 -1
- package/esm/shape/area/curve.js.map +1 -1
- package/esm/shape/area/hv.js +1 -1
- package/esm/shape/area/hv.js.map +1 -1
- package/esm/shape/area/hvh.js +1 -1
- package/esm/shape/area/hvh.js.map +1 -1
- package/esm/shape/area/smooth.js +1 -1
- package/esm/shape/area/smooth.js.map +1 -1
- package/esm/shape/area/vh.js +1 -1
- package/esm/shape/area/vh.js.map +1 -1
- package/esm/shape/box/box.js +1 -0
- package/esm/shape/box/box.js.map +1 -1
- package/esm/shape/connector/connector.d.ts +2 -2
- package/esm/shape/connector/connector.js +3 -2
- package/esm/shape/connector/connector.js.map +1 -1
- package/esm/shape/interval/color.js +18 -9
- package/esm/shape/interval/color.js.map +1 -1
- package/esm/shape/interval/funnel.js +1 -1
- package/esm/shape/interval/funnel.js.map +1 -1
- package/esm/shape/interval/hollow.js +1 -1
- package/esm/shape/interval/hollow.js.map +1 -1
- package/esm/shape/interval/pyramid.js +1 -1
- package/esm/shape/interval/pyramid.js.map +1 -1
- package/esm/shape/interval/rect.js +1 -1
- package/esm/shape/interval/rect.js.map +1 -1
- package/esm/shape/label/label.js +4 -2
- package/esm/shape/label/label.js.map +1 -1
- package/esm/shape/label/position/area.js +1 -1
- package/esm/shape/label/position/area.js.map +1 -1
- package/esm/shape/line/curve.js +3 -2
- package/esm/shape/line/curve.js.map +1 -1
- package/esm/shape/line/hv.js +1 -1
- package/esm/shape/line/hv.js.map +1 -1
- package/esm/shape/line/hvh.js +1 -1
- package/esm/shape/line/hvh.js.map +1 -1
- package/esm/shape/line/line.js +1 -1
- package/esm/shape/line/line.js.map +1 -1
- package/esm/shape/line/smooth.js +1 -1
- package/esm/shape/line/smooth.js.map +1 -1
- package/esm/shape/line/vh.js +1 -1
- package/esm/shape/line/vh.js.map +1 -1
- package/esm/shape/lineXY/line.js +1 -0
- package/esm/shape/lineXY/line.js.map +1 -1
- package/esm/shape/link/arc.js +1 -0
- package/esm/shape/link/arc.js.map +1 -1
- package/esm/shape/link/link.js +1 -0
- package/esm/shape/link/link.js.map +1 -1
- package/esm/shape/link/smooth.js +1 -0
- package/esm/shape/link/smooth.js.map +1 -1
- package/esm/shape/link/vhv.js +1 -0
- package/esm/shape/link/vhv.js.map +1 -1
- package/esm/shape/path/hollow.js +1 -0
- package/esm/shape/path/hollow.js.map +1 -1
- package/esm/shape/path/path.js +1 -0
- package/esm/shape/path/path.js.map +1 -1
- package/esm/shape/point/bowtie.js +1 -1
- package/esm/shape/point/bowtie.js.map +1 -1
- package/esm/shape/point/color.js +2 -2
- package/esm/shape/point/color.js.map +1 -1
- package/esm/shape/point/cross.js +1 -1
- package/esm/shape/point/cross.js.map +1 -1
- package/esm/shape/point/diamond.js +1 -1
- package/esm/shape/point/diamond.js.map +1 -1
- package/esm/shape/point/hexagon.js +1 -1
- package/esm/shape/point/hexagon.js.map +1 -1
- package/esm/shape/point/hollow.js +1 -1
- package/esm/shape/point/hollow.js.map +1 -1
- package/esm/shape/point/hollowBowtie.js +1 -1
- package/esm/shape/point/hollowBowtie.js.map +1 -1
- package/esm/shape/point/hollowDiamond.js +1 -1
- package/esm/shape/point/hollowDiamond.js.map +1 -1
- package/esm/shape/point/hollowHexagon.js +1 -1
- package/esm/shape/point/hollowHexagon.js.map +1 -1
- package/esm/shape/point/hollowSquare.js +1 -1
- package/esm/shape/point/hollowSquare.js.map +1 -1
- package/esm/shape/point/hollowTriangle.js +1 -1
- package/esm/shape/point/hollowTriangle.js.map +1 -1
- package/esm/shape/point/hollowTriangleDown.js +1 -1
- package/esm/shape/point/hollowTriangleDown.js.map +1 -1
- package/esm/shape/point/hyphen.js +1 -1
- package/esm/shape/point/hyphen.js.map +1 -1
- package/esm/shape/point/line.js +1 -1
- package/esm/shape/point/line.js.map +1 -1
- package/esm/shape/point/plus.js +1 -1
- package/esm/shape/point/plus.js.map +1 -1
- package/esm/shape/point/point.js +1 -1
- package/esm/shape/point/point.js.map +1 -1
- package/esm/shape/point/square.js +1 -1
- package/esm/shape/point/square.js.map +1 -1
- package/esm/shape/point/tick.js +1 -1
- package/esm/shape/point/tick.js.map +1 -1
- package/esm/shape/point/triangle.js +1 -1
- package/esm/shape/point/triangle.js.map +1 -1
- package/esm/shape/point/triangleDown.js +1 -1
- package/esm/shape/point/triangleDown.js.map +1 -1
- package/esm/shape/polygon/polygon.js +1 -0
- package/esm/shape/polygon/polygon.js.map +1 -1
- package/esm/shape/polygon/ribbon.js +1 -0
- package/esm/shape/polygon/ribbon.js.map +1 -1
- package/esm/shape/shape/shape.js +1 -0
- package/esm/shape/shape/shape.js.map +1 -1
- package/esm/shape/text/advance.js +3 -1
- package/esm/shape/text/advance.js.map +1 -1
- package/esm/shape/text/badge.js +1 -0
- package/esm/shape/text/badge.js.map +1 -1
- package/esm/shape/text/text.js +2 -1
- package/esm/shape/text/text.js.map +1 -1
- package/esm/shape/utils.d.ts +1 -16
- package/esm/shape/utils.js +2 -2
- package/esm/shape/utils.js.map +1 -1
- package/esm/shape/vector/vector.js +1 -0
- package/esm/shape/vector/vector.js.map +1 -1
- package/esm/spec/component.d.ts +10 -9
- package/esm/spec/coordinateTransform.d.ts +1 -1
- package/esm/spec/interaction.d.ts +2 -0
- package/esm/spec/scale.d.ts +3 -2
- package/esm/spec/theme.d.ts +8 -2
- package/esm/stdlib/index.js +2 -2
- package/esm/stdlib/index.js.map +1 -1
- package/esm/theme/academy.js +77 -78
- package/esm/theme/academy.js.map +1 -1
- package/esm/theme/classic.d.ts +6 -0
- package/esm/theme/{light.js → classic.js} +80 -90
- package/esm/theme/classic.js.map +1 -0
- package/esm/theme/classicDark.d.ts +6 -0
- package/esm/theme/{dark.js → classicDark.js} +78 -87
- package/esm/theme/classicDark.js.map +1 -0
- package/esm/theme/index.d.ts +2 -2
- package/esm/theme/index.js +2 -2
- package/esm/theme/index.js.map +1 -1
- package/esm/transform/filter.js +4 -1
- package/esm/transform/filter.js.map +1 -1
- package/esm/utils/event.d.ts +33 -14
- package/esm/utils/event.js +43 -16
- package/esm/utils/event.js.map +1 -1
- package/esm/utils/helper.js +2 -1
- package/esm/utils/helper.js.map +1 -1
- package/esm/utils/marker.d.ts +10 -0
- package/esm/utils/marker.js +250 -0
- package/esm/utils/marker.js.map +1 -0
- package/esm/utils/style.d.ts +5 -0
- package/esm/utils/style.js +23 -0
- package/esm/utils/style.js.map +1 -0
- package/lib/animation/fadeIn.js +1 -1
- package/lib/animation/fadeIn.js.map +1 -1
- package/lib/animation/fadeOut.js +1 -1
- package/lib/animation/fadeOut.js.map +1 -1
- package/lib/animation/morphing.js +1 -1
- package/lib/animation/morphing.js.map +1 -1
- package/lib/animation/scaleInX.js +1 -1
- package/lib/animation/scaleInX.js.map +1 -1
- package/lib/animation/scaleInY.js +1 -1
- package/lib/animation/scaleInY.js.map +1 -1
- package/lib/animation/scaleOutX.js +1 -1
- package/lib/animation/scaleOutX.js.map +1 -1
- package/lib/animation/scaleOutY.js +1 -1
- package/lib/animation/scaleOutY.js.map +1 -1
- package/lib/animation/waveIn.js +2 -2
- package/lib/animation/waveIn.js.map +1 -1
- package/lib/animation/zoomIn.js +1 -1
- package/lib/animation/zoomIn.js.map +1 -1
- package/lib/animation/zoomOut.js +1 -1
- package/lib/animation/zoomOut.js.map +1 -1
- package/lib/api/chart.d.ts +5 -2
- package/lib/api/chart.js +28 -20
- package/lib/api/chart.js.map +1 -1
- package/lib/api/composition/base.d.ts +8 -2
- package/lib/api/composition/base.js +29 -2
- package/lib/api/composition/base.js.map +1 -1
- package/lib/component/axis.js +45 -29
- package/lib/component/axis.js.map +1 -1
- package/lib/component/axisRadar.js +4 -3
- package/lib/component/axisRadar.js.map +1 -1
- package/lib/component/axisX.js.map +1 -1
- package/lib/component/legendCategory.js +62 -22
- package/lib/component/legendCategory.js.map +1 -1
- package/lib/component/legendContinuous.js +9 -7
- package/lib/component/legendContinuous.js.map +1 -1
- package/lib/component/legendContinuousBlockSize.js +1 -1
- package/lib/component/legendContinuousBlockSize.js.map +1 -1
- package/lib/component/legendContinuousSize.js +1 -1
- package/lib/component/legendContinuousSize.js.map +1 -1
- package/lib/component/scrollbar.d.ts +1 -1
- package/lib/component/scrollbar.js +4 -4
- package/lib/component/scrollbar.js.map +1 -1
- package/lib/component/scrollbarX.js +1 -1
- package/lib/component/scrollbarX.js.map +1 -1
- package/lib/component/scrollbarY.js +1 -1
- package/lib/component/scrollbarY.js.map +1 -1
- package/lib/component/slider.d.ts +1 -1
- package/lib/component/slider.js +4 -4
- package/lib/component/slider.js.map +1 -1
- package/lib/component/sliderX.js +1 -1
- package/lib/component/sliderX.js.map +1 -1
- package/lib/component/sliderY.js +1 -1
- package/lib/component/sliderY.js.map +1 -1
- package/lib/component/title.js +13 -2
- package/lib/component/title.js.map +1 -1
- package/lib/component/utils.d.ts +2 -1
- package/lib/component/utils.js +28 -3
- package/lib/component/utils.js.map +1 -1
- package/lib/coordinate/fisheye.js +1 -1
- package/lib/coordinate/fisheye.js.map +1 -1
- package/lib/geo/geoView.js +1 -1
- package/lib/geo/geoView.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -1
- package/lib/index.js.map +1 -1
- package/lib/interaction/brushFilter.js +1 -1
- package/lib/interaction/brushFilter.js.map +1 -1
- package/lib/interaction/brushHighlight.js +6 -3
- package/lib/interaction/brushHighlight.js.map +1 -1
- package/lib/interaction/event.js +20 -20
- package/lib/interaction/event.js.map +1 -1
- package/lib/interaction/fisheye.js +1 -1
- package/lib/interaction/fisheye.js.map +1 -1
- package/lib/interaction/legendFilter.d.ts +1 -4
- package/lib/interaction/legendFilter.js +52 -74
- package/lib/interaction/legendFilter.js.map +1 -1
- package/lib/interaction/sliderFilter.js +6 -6
- package/lib/interaction/sliderFilter.js.map +1 -1
- package/lib/interaction/tooltip.d.ts +2 -2
- package/lib/interaction/tooltip.js +40 -18
- package/lib/interaction/tooltip.js.map +1 -1
- package/lib/interaction/utils.js +7 -5
- package/lib/interaction/utils.js.map +1 -1
- package/lib/label-transform/overflowHide.js +3 -2
- package/lib/label-transform/overflowHide.js.map +1 -1
- package/lib/label-transform/overlapHide.js +3 -2
- package/lib/label-transform/overlapHide.js.map +1 -1
- package/lib/mark/boxplot.js +2 -2
- package/lib/mark/boxplot.js.map +1 -1
- package/lib/mark/gauge.js +2 -2
- package/lib/mark/gauge.js.map +1 -1
- package/lib/mark/sankey.js +2 -2
- package/lib/mark/sankey.js.map +1 -1
- package/lib/mark/utils.d.ts +2 -2
- package/lib/mark/utils.js +2 -2
- package/lib/mark/utils.js.map +1 -1
- package/lib/runtime/component.d.ts +3 -3
- package/lib/runtime/component.js +22 -7
- package/lib/runtime/component.js.map +1 -1
- package/lib/runtime/plot.js +57 -23
- package/lib/runtime/plot.js.map +1 -1
- package/lib/runtime/render.d.ts +2 -2
- package/lib/runtime/render.js +32 -9
- package/lib/runtime/render.js.map +1 -1
- package/lib/runtime/types/common.d.ts +12 -9
- package/lib/runtime/types/component.d.ts +13 -4
- package/lib/shape/area/area.js +1 -1
- package/lib/shape/area/area.js.map +1 -1
- package/lib/shape/area/curve.js +2 -1
- package/lib/shape/area/curve.js.map +1 -1
- package/lib/shape/area/hv.js +1 -1
- package/lib/shape/area/hv.js.map +1 -1
- package/lib/shape/area/hvh.js +1 -1
- package/lib/shape/area/hvh.js.map +1 -1
- package/lib/shape/area/smooth.js +1 -1
- package/lib/shape/area/smooth.js.map +1 -1
- package/lib/shape/area/vh.js +1 -1
- package/lib/shape/area/vh.js.map +1 -1
- package/lib/shape/box/box.js +1 -0
- package/lib/shape/box/box.js.map +1 -1
- package/lib/shape/connector/connector.d.ts +2 -2
- package/lib/shape/connector/connector.js +3 -2
- package/lib/shape/connector/connector.js.map +1 -1
- package/lib/shape/interval/color.js +18 -9
- package/lib/shape/interval/color.js.map +1 -1
- package/lib/shape/interval/funnel.js +1 -1
- package/lib/shape/interval/funnel.js.map +1 -1
- package/lib/shape/interval/hollow.js +1 -1
- package/lib/shape/interval/hollow.js.map +1 -1
- package/lib/shape/interval/pyramid.js +1 -1
- package/lib/shape/interval/pyramid.js.map +1 -1
- package/lib/shape/interval/rect.js +1 -1
- package/lib/shape/interval/rect.js.map +1 -1
- package/lib/shape/label/label.js +4 -2
- package/lib/shape/label/label.js.map +1 -1
- package/lib/shape/label/position/area.js +1 -1
- package/lib/shape/label/position/area.js.map +1 -1
- package/lib/shape/line/curve.js +3 -2
- package/lib/shape/line/curve.js.map +1 -1
- package/lib/shape/line/hv.js +1 -1
- package/lib/shape/line/hv.js.map +1 -1
- package/lib/shape/line/hvh.js +1 -1
- package/lib/shape/line/hvh.js.map +1 -1
- package/lib/shape/line/line.js +1 -1
- package/lib/shape/line/line.js.map +1 -1
- package/lib/shape/line/smooth.js +1 -1
- package/lib/shape/line/smooth.js.map +1 -1
- package/lib/shape/line/vh.js +1 -1
- package/lib/shape/line/vh.js.map +1 -1
- package/lib/shape/lineXY/line.js +1 -0
- package/lib/shape/lineXY/line.js.map +1 -1
- package/lib/shape/link/arc.js +1 -0
- package/lib/shape/link/arc.js.map +1 -1
- package/lib/shape/link/link.js +1 -0
- package/lib/shape/link/link.js.map +1 -1
- package/lib/shape/link/smooth.js +1 -0
- package/lib/shape/link/smooth.js.map +1 -1
- package/lib/shape/link/vhv.js +1 -0
- package/lib/shape/link/vhv.js.map +1 -1
- package/lib/shape/path/hollow.js +1 -0
- package/lib/shape/path/hollow.js.map +1 -1
- package/lib/shape/path/path.js +1 -0
- package/lib/shape/path/path.js.map +1 -1
- package/lib/shape/point/bowtie.js +1 -1
- package/lib/shape/point/bowtie.js.map +1 -1
- package/lib/shape/point/color.js +2 -25
- package/lib/shape/point/color.js.map +1 -1
- package/lib/shape/point/cross.js +1 -1
- package/lib/shape/point/cross.js.map +1 -1
- package/lib/shape/point/diamond.js +1 -1
- package/lib/shape/point/diamond.js.map +1 -1
- package/lib/shape/point/hexagon.js +1 -1
- package/lib/shape/point/hexagon.js.map +1 -1
- package/lib/shape/point/hollow.js +1 -1
- package/lib/shape/point/hollow.js.map +1 -1
- package/lib/shape/point/hollowBowtie.js +1 -1
- package/lib/shape/point/hollowBowtie.js.map +1 -1
- package/lib/shape/point/hollowDiamond.js +1 -1
- package/lib/shape/point/hollowDiamond.js.map +1 -1
- package/lib/shape/point/hollowHexagon.js +1 -1
- package/lib/shape/point/hollowHexagon.js.map +1 -1
- package/lib/shape/point/hollowSquare.js +1 -1
- package/lib/shape/point/hollowSquare.js.map +1 -1
- package/lib/shape/point/hollowTriangle.js +1 -1
- package/lib/shape/point/hollowTriangle.js.map +1 -1
- package/lib/shape/point/hollowTriangleDown.js +1 -1
- package/lib/shape/point/hollowTriangleDown.js.map +1 -1
- package/lib/shape/point/hyphen.js +1 -1
- package/lib/shape/point/hyphen.js.map +1 -1
- package/lib/shape/point/line.js +1 -1
- package/lib/shape/point/line.js.map +1 -1
- package/lib/shape/point/plus.js +1 -1
- package/lib/shape/point/plus.js.map +1 -1
- package/lib/shape/point/point.js +1 -1
- package/lib/shape/point/point.js.map +1 -1
- package/lib/shape/point/square.js +1 -1
- package/lib/shape/point/square.js.map +1 -1
- package/lib/shape/point/tick.js +1 -1
- package/lib/shape/point/tick.js.map +1 -1
- package/lib/shape/point/triangle.js +1 -1
- package/lib/shape/point/triangle.js.map +1 -1
- package/lib/shape/point/triangleDown.js +1 -1
- package/lib/shape/point/triangleDown.js.map +1 -1
- package/lib/shape/polygon/polygon.js +1 -0
- package/lib/shape/polygon/polygon.js.map +1 -1
- package/lib/shape/polygon/ribbon.js +1 -0
- package/lib/shape/polygon/ribbon.js.map +1 -1
- package/lib/shape/shape/shape.js +1 -0
- package/lib/shape/shape/shape.js.map +1 -1
- package/lib/shape/text/advance.js +3 -1
- package/lib/shape/text/advance.js.map +1 -1
- package/lib/shape/text/badge.js +1 -0
- package/lib/shape/text/badge.js.map +1 -1
- package/lib/shape/text/text.js +2 -1
- package/lib/shape/text/text.js.map +1 -1
- package/lib/shape/utils.d.ts +1 -16
- package/lib/shape/utils.js +2 -2
- package/lib/shape/utils.js.map +1 -1
- package/lib/shape/vector/vector.js +1 -0
- package/lib/shape/vector/vector.js.map +1 -1
- package/lib/spec/component.d.ts +10 -9
- package/lib/spec/coordinateTransform.d.ts +1 -1
- package/lib/spec/interaction.d.ts +2 -0
- package/lib/spec/scale.d.ts +3 -2
- package/lib/spec/theme.d.ts +8 -2
- package/lib/stdlib/index.js +1 -1
- package/lib/stdlib/index.js.map +1 -1
- package/lib/theme/academy.js +77 -78
- package/lib/theme/academy.js.map +1 -1
- package/lib/theme/classic.d.ts +6 -0
- package/lib/theme/{light.js → classic.js} +82 -92
- package/lib/theme/classic.js.map +1 -0
- package/lib/theme/classicDark.d.ts +6 -0
- package/lib/theme/{dark.js → classicDark.js} +80 -89
- package/lib/theme/classicDark.js.map +1 -0
- package/lib/theme/index.d.ts +2 -2
- package/lib/theme/index.js +5 -5
- package/lib/theme/index.js.map +1 -1
- package/lib/transform/filter.js +4 -1
- package/lib/transform/filter.js.map +1 -1
- package/lib/utils/event.d.ts +33 -14
- package/lib/utils/event.js +44 -17
- package/lib/utils/event.js.map +1 -1
- package/lib/utils/helper.js +2 -1
- package/lib/utils/helper.js.map +1 -1
- package/lib/utils/marker.d.ts +10 -0
- package/lib/utils/marker.js +256 -0
- package/lib/utils/marker.js.map +1 -0
- package/lib/utils/style.d.ts +5 -0
- package/lib/utils/style.js +30 -0
- package/lib/utils/style.js.map +1 -0
- package/package.json +3 -3
- package/src/.DS_Store +0 -0
- package/src/animation/fadeIn.ts +1 -1
- package/src/animation/fadeOut.ts +1 -1
- package/src/animation/morphing.ts +1 -1
- package/src/animation/scaleInX.ts +4 -4
- package/src/animation/scaleInY.ts +4 -4
- package/src/animation/scaleOutX.ts +4 -4
- package/src/animation/scaleOutY.ts +4 -4
- package/src/animation/waveIn.ts +4 -4
- package/src/animation/zoomIn.ts +4 -4
- package/src/animation/zoomOut.ts +4 -4
- package/src/api/chart.ts +30 -23
- package/src/api/composition/base.ts +30 -4
- package/src/component/axis.ts +83 -66
- package/src/component/axisRadar.ts +4 -3
- package/src/component/axisX.ts +0 -1
- package/src/component/legendCategory.ts +69 -56
- package/src/component/legendContinuous.ts +31 -23
- package/src/component/legendContinuousBlockSize.ts +1 -5
- package/src/component/legendContinuousSize.ts +1 -1
- package/src/component/scrollbar.ts +6 -6
- package/src/component/scrollbarX.ts +1 -1
- package/src/component/scrollbarY.ts +1 -1
- package/src/component/slider.ts +7 -8
- package/src/component/sliderX.ts +1 -1
- package/src/component/sliderY.ts +1 -1
- package/src/component/title.ts +3 -5
- package/src/component/utils.ts +27 -3
- package/src/coordinate/fisheye.ts +2 -2
- package/src/data/.DS_Store +0 -0
- package/src/geo/geoView.ts +1 -1
- package/src/index.ts +1 -0
- package/src/interaction/brushFilter.ts +2 -2
- package/src/interaction/brushHighlight.ts +8 -3
- package/src/interaction/elementHighlight.ts +6 -6
- package/src/interaction/event.ts +30 -20
- package/src/interaction/fisheye.ts +1 -1
- package/src/interaction/legendFilter.ts +54 -70
- package/src/interaction/sliderFilter.ts +6 -6
- package/src/interaction/tooltip.ts +51 -21
- package/src/interaction/utils.ts +6 -3
- package/src/label-transform/overflowHide.ts +3 -3
- package/src/label-transform/overlapHide.ts +3 -2
- package/src/mark/boxplot.ts +2 -2
- package/src/mark/gauge.ts +2 -1
- package/src/mark/sankey.ts +2 -1
- package/src/mark/utils.ts +2 -4
- package/src/runtime/component.ts +34 -14
- package/src/runtime/plot.ts +72 -20
- package/src/runtime/render.ts +37 -9
- package/src/runtime/types/common.ts +13 -10
- package/src/runtime/types/component.ts +16 -8
- package/src/shape/.DS_Store +0 -0
- package/src/shape/area/area.ts +1 -0
- package/src/shape/area/curve.ts +2 -1
- package/src/shape/area/hv.ts +1 -0
- package/src/shape/area/hvh.ts +1 -0
- package/src/shape/area/smooth.ts +1 -0
- package/src/shape/area/vh.ts +1 -0
- package/src/shape/box/box.ts +1 -0
- package/src/shape/connector/connector.ts +6 -4
- package/src/shape/interval/color.ts +19 -4
- package/src/shape/interval/funnel.ts +1 -0
- package/src/shape/interval/hollow.ts +1 -0
- package/src/shape/interval/pyramid.ts +1 -0
- package/src/shape/interval/rect.ts +1 -0
- package/src/shape/label/label.ts +4 -2
- package/src/shape/label/position/area.ts +1 -1
- package/src/shape/line/curve.ts +3 -2
- package/src/shape/line/hv.ts +1 -0
- package/src/shape/line/hvh.ts +1 -0
- package/src/shape/line/line.ts +1 -0
- package/src/shape/line/smooth.ts +1 -0
- package/src/shape/line/vh.ts +1 -0
- package/src/shape/lineXY/line.ts +1 -0
- package/src/shape/link/arc.ts +1 -0
- package/src/shape/link/link.ts +1 -0
- package/src/shape/link/smooth.ts +1 -0
- package/src/shape/link/vhv.ts +1 -0
- package/src/shape/path/hollow.ts +1 -0
- package/src/shape/path/path.ts +1 -0
- package/src/shape/point/bowtie.ts +1 -0
- package/src/shape/point/color.ts +4 -4
- package/src/shape/point/cross.ts +1 -0
- package/src/shape/point/diamond.ts +1 -0
- package/src/shape/point/hexagon.ts +1 -0
- package/src/shape/point/hollow.ts +1 -0
- package/src/shape/point/hollowBowtie.ts +1 -0
- package/src/shape/point/hollowDiamond.ts +1 -0
- package/src/shape/point/hollowHexagon.ts +1 -0
- package/src/shape/point/hollowSquare.ts +1 -0
- package/src/shape/point/hollowTriangle.ts +1 -0
- package/src/shape/point/hollowTriangleDown.ts +1 -0
- package/src/shape/point/hyphen.ts +1 -0
- package/src/shape/point/line.ts +1 -0
- package/src/shape/point/plus.ts +1 -0
- package/src/shape/point/point.ts +1 -0
- package/src/shape/point/square.ts +1 -0
- package/src/shape/point/tick.ts +1 -0
- package/src/shape/point/triangle.ts +1 -0
- package/src/shape/point/triangleDown.ts +1 -0
- package/src/shape/polygon/polygon.ts +1 -0
- package/src/shape/polygon/ribbon.ts +1 -0
- package/src/shape/shape/shape.ts +1 -0
- package/src/shape/text/advance.ts +3 -2
- package/src/shape/text/badge.ts +1 -0
- package/src/shape/text/text.ts +2 -1
- package/src/shape/utils.ts +4 -22
- package/src/shape/vector/vector.ts +1 -0
- package/src/spec/component.ts +10 -9
- package/src/spec/coordinateTransform.ts +1 -1
- package/src/spec/interaction.ts +3 -0
- package/src/spec/scale.ts +3 -2
- package/src/spec/theme.ts +22 -2
- package/src/stdlib/index.ts +3 -3
- package/src/theme/academy.ts +77 -78
- package/src/theme/{light.ts → classic.ts} +80 -90
- package/src/theme/{dark.ts → classicDark.ts} +78 -88
- package/src/theme/index.ts +2 -2
- package/src/transform/filter.ts +4 -1
- package/src/utils/event.ts +47 -15
- package/src/utils/helper.ts +2 -1
- package/src/utils/marker.ts +293 -0
- package/src/utils/style.ts +34 -0
- package/esm/shape/point/symbol.d.ts +0 -49
- package/esm/shape/point/symbol.js +0 -143
- package/esm/shape/point/symbol.js.map +0 -1
- package/esm/theme/dark.d.ts +0 -6
- package/esm/theme/dark.js.map +0 -1
- package/esm/theme/light.d.ts +0 -6
- package/esm/theme/light.js.map +0 -1
- package/lib/shape/point/symbol.d.ts +0 -49
- package/lib/shape/point/symbol.js +0 -158
- package/lib/shape/point/symbol.js.map +0 -1
- package/lib/theme/dark.d.ts +0 -6
- package/lib/theme/dark.js.map +0 -1
- package/lib/theme/light.d.ts +0 -6
- package/lib/theme/light.js.map +0 -1
- package/src/shape/point/symbol.ts +0 -154
|
@@ -17,10 +17,10 @@ export const ScaleOutY: AC<ScaleOutYOptions> = (options) => {
|
|
|
17
17
|
const [shape] = from;
|
|
18
18
|
const { height } = shape.getBoundingClientRect();
|
|
19
19
|
const {
|
|
20
|
-
transform: prefix,
|
|
21
|
-
fillOpacity,
|
|
22
|
-
strokeOpacity,
|
|
23
|
-
opacity,
|
|
20
|
+
transform: prefix = '',
|
|
21
|
+
fillOpacity = 1,
|
|
22
|
+
strokeOpacity = 1,
|
|
23
|
+
opacity = 1,
|
|
24
24
|
} = shape.style;
|
|
25
25
|
const [transformOrigin, transform]: [[number, number], string] =
|
|
26
26
|
isTranspose(coordinate)
|
package/src/animation/waveIn.ts
CHANGED
|
@@ -37,9 +37,9 @@ export const WaveIn: AC<WaveInOptions> = (options) => {
|
|
|
37
37
|
const {
|
|
38
38
|
radius = 0,
|
|
39
39
|
inset = 0,
|
|
40
|
-
fillOpacity,
|
|
41
|
-
strokeOpacity,
|
|
42
|
-
opacity,
|
|
40
|
+
fillOpacity = 1,
|
|
41
|
+
strokeOpacity = 1,
|
|
42
|
+
opacity = 1,
|
|
43
43
|
} = style;
|
|
44
44
|
|
|
45
45
|
const { points, y, y1 } = __data__;
|
|
@@ -62,7 +62,7 @@ export const WaveIn: AC<WaveInOptions> = (options) => {
|
|
|
62
62
|
transform: `translate(${center[0]}, ${center[1]})`,
|
|
63
63
|
});
|
|
64
64
|
const convertedPathDefinition = convertToPath(pathForConversion);
|
|
65
|
-
pathForConversion.style.transform = '
|
|
65
|
+
pathForConversion.style.transform = '';
|
|
66
66
|
return convertedPathDefinition;
|
|
67
67
|
};
|
|
68
68
|
|
package/src/animation/zoomIn.ts
CHANGED
|
@@ -12,10 +12,10 @@ export const ZoomIn: AC<ZoomInOptions> = (options) => {
|
|
|
12
12
|
return (from, to, value, coordinate, defaults) => {
|
|
13
13
|
const [shape] = from;
|
|
14
14
|
const {
|
|
15
|
-
transform: prefix,
|
|
16
|
-
fillOpacity,
|
|
17
|
-
strokeOpacity,
|
|
18
|
-
opacity,
|
|
15
|
+
transform: prefix = '',
|
|
16
|
+
fillOpacity = 1,
|
|
17
|
+
strokeOpacity = 1,
|
|
18
|
+
opacity = 1,
|
|
19
19
|
} = shape.style;
|
|
20
20
|
const keyframes = [
|
|
21
21
|
{
|
package/src/animation/zoomOut.ts
CHANGED
|
@@ -12,10 +12,10 @@ export const ZoomOut: AC<ZoomOutOptions> = (options) => {
|
|
|
12
12
|
return (from, to, value, coordinate, defaults) => {
|
|
13
13
|
const [shape] = from;
|
|
14
14
|
const {
|
|
15
|
-
transform: prefix,
|
|
16
|
-
fillOpacity,
|
|
17
|
-
strokeOpacity,
|
|
18
|
-
opacity,
|
|
15
|
+
transform: prefix = '',
|
|
16
|
+
fillOpacity = 1,
|
|
17
|
+
strokeOpacity = 1,
|
|
18
|
+
opacity = 1,
|
|
19
19
|
} = shape.style;
|
|
20
20
|
const keyframes = [
|
|
21
21
|
{ transform: `${prefix} scale(1)`.trimStart() },
|
package/src/api/chart.ts
CHANGED
|
@@ -6,7 +6,7 @@ import EventEmitter from '@antv/event-emitter';
|
|
|
6
6
|
import { G2Context, render, destroy } from '../runtime';
|
|
7
7
|
import { ViewComposition } from '../spec';
|
|
8
8
|
import { getChartSize } from '../utils/size';
|
|
9
|
-
import {
|
|
9
|
+
import { ChartEvent } from '../utils/event';
|
|
10
10
|
import { G2ViewTree } from '../runtime/types/options';
|
|
11
11
|
import { Node } from './node';
|
|
12
12
|
import {
|
|
@@ -26,6 +26,7 @@ import { composition, Composition, View } from './composition';
|
|
|
26
26
|
import { library } from './library';
|
|
27
27
|
|
|
28
28
|
export const SPEC_EXTERNAL_KEYS = ['container', 'renderer'];
|
|
29
|
+
export const G2_CHART_KEY = 'G2_CHART_KEY';
|
|
29
30
|
|
|
30
31
|
function normalizeContainer(container: string | HTMLElement): HTMLElement {
|
|
31
32
|
if (container === undefined) return document.createElement('div');
|
|
@@ -38,7 +39,6 @@ function normalizeContainer(container: string | HTMLElement): HTMLElement {
|
|
|
38
39
|
|
|
39
40
|
export function removeContainer(container: HTMLElement) {
|
|
40
41
|
const parent = container.parentNode;
|
|
41
|
-
|
|
42
42
|
if (parent) {
|
|
43
43
|
parent.removeChild(container);
|
|
44
44
|
}
|
|
@@ -65,6 +65,7 @@ function normalizeRoot(node: Node) {
|
|
|
65
65
|
root.attr('padding', node.attr('padding'));
|
|
66
66
|
root.attr('margin', node.attr('margin'));
|
|
67
67
|
root.attr('inset', node.attr('inset'));
|
|
68
|
+
root.attr('theme', node.attr('theme'));
|
|
68
69
|
return root;
|
|
69
70
|
}
|
|
70
71
|
|
|
@@ -122,6 +123,7 @@ export type ChartOptions = ViewComposition & {
|
|
|
122
123
|
autoFit?: boolean;
|
|
123
124
|
renderer?: CanvasRenderer;
|
|
124
125
|
plugins?: RendererPlugin[];
|
|
126
|
+
theme: string;
|
|
125
127
|
};
|
|
126
128
|
|
|
127
129
|
type ChartProps = Concrete<ViewComposition>;
|
|
@@ -142,6 +144,7 @@ export interface Chart extends Composition, Mark {
|
|
|
142
144
|
axis: ObjectAttribute<ChartOptions['axis'], Chart>;
|
|
143
145
|
legend: ObjectAttribute<ChartOptions['legend'], Chart>;
|
|
144
146
|
style: ObjectAttribute<ChartOptions['style'], Chart>;
|
|
147
|
+
labelTransform: ArrayAttribute<ChartOptions['labelTransform'], Chart>;
|
|
145
148
|
}
|
|
146
149
|
|
|
147
150
|
export const props: NodePropertyDescriptor[] = [
|
|
@@ -152,13 +155,12 @@ export const props: NodePropertyDescriptor[] = [
|
|
|
152
155
|
{ name: 'interaction', type: 'object' },
|
|
153
156
|
{ name: 'theme', type: 'object' },
|
|
154
157
|
{ name: 'title', type: 'value' },
|
|
155
|
-
{ name: 'key', type: 'value' },
|
|
156
158
|
{ name: 'transform', type: 'array' },
|
|
157
|
-
{ name: 'theme', type: 'object' },
|
|
158
159
|
{ name: 'scale', type: 'object' },
|
|
159
160
|
{ name: 'axis', type: 'object' },
|
|
160
161
|
{ name: 'legend', type: 'object' },
|
|
161
162
|
{ name: 'style', type: 'object' },
|
|
163
|
+
{ name: 'labelTransform', type: 'array' },
|
|
162
164
|
...nodeProps(mark),
|
|
163
165
|
...containerProps(composition),
|
|
164
166
|
];
|
|
@@ -170,9 +172,10 @@ export class Chart extends View<ChartOptions> {
|
|
|
170
172
|
private _emitter: EventEmitter;
|
|
171
173
|
private _options: G2ViewTree;
|
|
172
174
|
|
|
173
|
-
constructor(options: ChartOptions
|
|
174
|
-
const { container, canvas, ...rest } = options;
|
|
175
|
+
constructor(options: ChartOptions) {
|
|
176
|
+
const { container, canvas, key = G2_CHART_KEY, ...rest } = options || {};
|
|
175
177
|
super(rest, 'view');
|
|
178
|
+
this.attr('key', key);
|
|
176
179
|
this._container = normalizeContainer(container);
|
|
177
180
|
this._emitter = new EventEmitter();
|
|
178
181
|
this._context = { library, emitter: this._emitter, canvas };
|
|
@@ -208,8 +211,12 @@ export class Chart extends View<ChartOptions> {
|
|
|
208
211
|
);
|
|
209
212
|
}
|
|
210
213
|
|
|
211
|
-
return new Promise((resolve) => {
|
|
212
|
-
|
|
214
|
+
return new Promise((resolve, reject) => {
|
|
215
|
+
try {
|
|
216
|
+
render(this.options(), this._context, () => resolve(this), reject);
|
|
217
|
+
} catch (e) {
|
|
218
|
+
reject(e);
|
|
219
|
+
}
|
|
213
220
|
});
|
|
214
221
|
}
|
|
215
222
|
/**
|
|
@@ -233,10 +240,9 @@ export class Chart extends View<ChartOptions> {
|
|
|
233
240
|
return this._options || optionsOf(this);
|
|
234
241
|
}
|
|
235
242
|
this._options = deepMix(
|
|
236
|
-
this._options ||
|
|
243
|
+
this._options || optionsOf(this),
|
|
237
244
|
omit(options, SPEC_EXTERNAL_KEYS),
|
|
238
245
|
);
|
|
239
|
-
|
|
240
246
|
return this;
|
|
241
247
|
}
|
|
242
248
|
|
|
@@ -268,21 +274,22 @@ export class Chart extends View<ChartOptions> {
|
|
|
268
274
|
return this;
|
|
269
275
|
}
|
|
270
276
|
|
|
271
|
-
|
|
277
|
+
clear() {
|
|
272
278
|
const options = this.options();
|
|
273
|
-
this.emit(
|
|
274
|
-
this.
|
|
275
|
-
destroy(options, this._context);
|
|
276
|
-
|
|
277
|
-
removeContainer(this._container);
|
|
278
|
-
this.emit(CHART_LIFE_CIRCLE.AFTER_DESTROY);
|
|
279
|
+
this.emit(ChartEvent.BEFORE_CLEAR);
|
|
280
|
+
this._options = {};
|
|
281
|
+
destroy(options, this._context, false);
|
|
282
|
+
this.emit(ChartEvent.AFTER_CLEAR);
|
|
279
283
|
}
|
|
280
284
|
|
|
281
|
-
|
|
285
|
+
destroy() {
|
|
282
286
|
const options = this.options();
|
|
283
|
-
this.emit(
|
|
284
|
-
|
|
285
|
-
this.
|
|
287
|
+
this.emit(ChartEvent.BEFORE_DESTROY);
|
|
288
|
+
this.unbindAutoFit();
|
|
289
|
+
this._options = {};
|
|
290
|
+
destroy(options, this._context, true);
|
|
291
|
+
removeContainer(this._container);
|
|
292
|
+
this.emit(ChartEvent.AFTER_DESTROY);
|
|
286
293
|
}
|
|
287
294
|
|
|
288
295
|
forceFit() {
|
|
@@ -303,12 +310,12 @@ export class Chart extends View<ChartOptions> {
|
|
|
303
310
|
if (width === adjustedWidth && height === adjustedHeight) {
|
|
304
311
|
return Promise.resolve(this);
|
|
305
312
|
}
|
|
306
|
-
this.emit(
|
|
313
|
+
this.emit(ChartEvent.BEFORE_CHANGE_SIZE);
|
|
307
314
|
this.width(adjustedWidth);
|
|
308
315
|
this.height(adjustedHeight);
|
|
309
316
|
const finished = this.render();
|
|
310
317
|
finished.then(() => {
|
|
311
|
-
this.emit(
|
|
318
|
+
this.emit(ChartEvent.AFTER_CHANGE_SIZE);
|
|
312
319
|
});
|
|
313
320
|
return finished;
|
|
314
321
|
}
|
|
@@ -1,13 +1,29 @@
|
|
|
1
|
-
import { DisplayObject } from '@antv/g';
|
|
2
1
|
import { Coordinate } from '@antv/coord';
|
|
2
|
+
import { DisplayObject } from '@antv/g';
|
|
3
|
+
import { Scale, G2Theme, G2ViewDescriptor } from '../../runtime';
|
|
4
|
+
import { hide, show } from '../../utils/style';
|
|
3
5
|
import { Node } from '../node';
|
|
4
|
-
import { G2Theme, G2ViewDescriptor } from '../../runtime';
|
|
5
6
|
|
|
6
7
|
export class CompositionNode<
|
|
7
8
|
Value extends Record<string, any> = Record<string, any>,
|
|
8
9
|
ParentValue extends Record<string, any> = Record<string, any>,
|
|
9
10
|
ChildValue extends Record<string, any> = Record<string, any>,
|
|
10
11
|
> extends Node<Value, ParentValue, ChildValue> {
|
|
12
|
+
/**
|
|
13
|
+
* Change current node data and its children data.
|
|
14
|
+
*/
|
|
15
|
+
changeData(data: any) {
|
|
16
|
+
const chart = this.getRoot();
|
|
17
|
+
if (!chart) return;
|
|
18
|
+
this.attr('data', data);
|
|
19
|
+
if (this.children?.length) {
|
|
20
|
+
this.children.forEach((child) => {
|
|
21
|
+
child.attr('data', data);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
return chart?.render();
|
|
25
|
+
}
|
|
26
|
+
|
|
11
27
|
/**
|
|
12
28
|
* Get view instance by key.
|
|
13
29
|
*/
|
|
@@ -18,6 +34,16 @@ export class CompositionNode<
|
|
|
18
34
|
return views.find((view) => view.key === this.attr('key'));
|
|
19
35
|
}
|
|
20
36
|
|
|
37
|
+
getScale(): Record<string, Scale> {
|
|
38
|
+
return this.getView()?.scale;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
getScaleByChannel(channel: string): Scale {
|
|
42
|
+
const scale = this.getScale();
|
|
43
|
+
if (scale) return scale[channel];
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
21
47
|
getCoordinate(): Coordinate {
|
|
22
48
|
return this.getView()?.coordinate;
|
|
23
49
|
}
|
|
@@ -40,7 +66,7 @@ export class CompositionNode<
|
|
|
40
66
|
show() {
|
|
41
67
|
const group = this.getGroup();
|
|
42
68
|
if (!group) return;
|
|
43
|
-
!group.isVisible() && group
|
|
69
|
+
!group.isVisible() && show(group);
|
|
44
70
|
}
|
|
45
71
|
|
|
46
72
|
/**
|
|
@@ -49,6 +75,6 @@ export class CompositionNode<
|
|
|
49
75
|
hide() {
|
|
50
76
|
const group = this.getGroup();
|
|
51
77
|
if (!group) return;
|
|
52
|
-
group.isVisible() && group
|
|
78
|
+
group.isVisible() && hide(group);
|
|
53
79
|
}
|
|
54
80
|
}
|
package/src/component/axis.ts
CHANGED
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
radiusOf,
|
|
24
24
|
} from '../utils/coordinate';
|
|
25
25
|
import { capitalizeFirst } from '../utils/helper';
|
|
26
|
-
import {
|
|
26
|
+
import { adaptor, isVertical, isHorizontal, titleContent } from './utils';
|
|
27
27
|
|
|
28
28
|
export type AxisOptions = {
|
|
29
29
|
position?: GCP;
|
|
@@ -141,6 +141,7 @@ function getTicks(
|
|
|
141
141
|
const ticks = ticksOf(scale, domain, tickMethod);
|
|
142
142
|
const filteredTicks = tickFilter ? ticks.filter(tickFilter) : ticks;
|
|
143
143
|
const labelFormatter = scale.getFormatter?.() || defaultTickFormatter;
|
|
144
|
+
const toString = (d) => (typeof d === 'object' ? d : String(d));
|
|
144
145
|
const applyInset = createInset(position, coordinate);
|
|
145
146
|
const applyFisheye = createFisheye(position, coordinate);
|
|
146
147
|
|
|
@@ -150,7 +151,7 @@ function getTicks(
|
|
|
150
151
|
const tick = applyInset(scale.map(d) + offset);
|
|
151
152
|
return {
|
|
152
153
|
value: isTranspose(coordinate) && scale.getTicks?.() ? 1 - tick : tick,
|
|
153
|
-
label: labelFormatter(d, i, array),
|
|
154
|
+
label: toString(labelFormatter(prettyNumber(d), i, array)),
|
|
154
155
|
id: String(i),
|
|
155
156
|
};
|
|
156
157
|
});
|
|
@@ -166,7 +167,7 @@ function getTicks(
|
|
|
166
167
|
const tick = applyFisheye(applyInset(scale.map(d) + offset));
|
|
167
168
|
return {
|
|
168
169
|
value: tick,
|
|
169
|
-
label:
|
|
170
|
+
label: toString(labelFormatter(prettyNumber(d), i, array)),
|
|
170
171
|
id: String(i),
|
|
171
172
|
};
|
|
172
173
|
});
|
|
@@ -178,12 +179,36 @@ function inferGridLength(position: GCP, coordinate: Coordinate) {
|
|
|
178
179
|
return width;
|
|
179
180
|
}
|
|
180
181
|
|
|
181
|
-
function
|
|
182
|
-
const
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
182
|
+
function inferLabelOverlap(transform = [], style: Record<string, any>) {
|
|
183
|
+
const {
|
|
184
|
+
labelAutoRotate = true,
|
|
185
|
+
labelAutoHide = false,
|
|
186
|
+
labelAutoEllipsis = false,
|
|
187
|
+
} = style;
|
|
188
|
+
|
|
189
|
+
const finalTransforms = [...transform];
|
|
190
|
+
|
|
191
|
+
const mutateLabelOverlap = (overlap, state) => {
|
|
192
|
+
if (state) {
|
|
193
|
+
const index = finalTransforms.findIndex((t) => t.type === overlap.type);
|
|
194
|
+
if (index !== -1) finalTransforms[index] = overlap;
|
|
195
|
+
else finalTransforms.push(overlap);
|
|
196
|
+
} else {
|
|
197
|
+
const index = finalTransforms.findIndex((t) => t.type === overlap.type);
|
|
198
|
+
if (index !== -1) finalTransforms.splice(index, 1);
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
mutateLabelOverlap(
|
|
203
|
+
{
|
|
204
|
+
type: 'rotate',
|
|
205
|
+
optionalAngles: [0, 15, 30, 45, 60, 90],
|
|
206
|
+
},
|
|
207
|
+
labelAutoRotate,
|
|
208
|
+
);
|
|
209
|
+
mutateLabelOverlap({ type: 'ellipsis', minLength: 20 }, labelAutoEllipsis);
|
|
210
|
+
mutateLabelOverlap({ type: 'hide' }, labelAutoHide);
|
|
211
|
+
return finalTransforms;
|
|
187
212
|
}
|
|
188
213
|
|
|
189
214
|
function inferArcStyle(
|
|
@@ -204,11 +229,12 @@ function inferArcStyle(
|
|
|
204
229
|
const common = {
|
|
205
230
|
center,
|
|
206
231
|
radius,
|
|
207
|
-
|
|
232
|
+
startAngle,
|
|
233
|
+
endAngle,
|
|
208
234
|
titleFillOpacity: 0,
|
|
209
235
|
titlePosition: 'inner',
|
|
210
|
-
|
|
211
|
-
|
|
236
|
+
line: false,
|
|
237
|
+
tick: true,
|
|
212
238
|
gridLength: (outerRadius - innerRadius) * r,
|
|
213
239
|
};
|
|
214
240
|
|
|
@@ -250,7 +276,6 @@ function inferAxisLinearOverrideStyle(
|
|
|
250
276
|
): {
|
|
251
277
|
startPos?: [number, number];
|
|
252
278
|
endPos?: [number, number];
|
|
253
|
-
showLine?: boolean;
|
|
254
279
|
[k: string]: any;
|
|
255
280
|
} {
|
|
256
281
|
const { x, y, width, height } = bbox;
|
|
@@ -274,7 +299,6 @@ function inferAxisLinearOverrideStyle(
|
|
|
274
299
|
return {
|
|
275
300
|
startPos: [x + width, y],
|
|
276
301
|
endPos: [x + width, y + height],
|
|
277
|
-
showLine: true,
|
|
278
302
|
};
|
|
279
303
|
}
|
|
280
304
|
// axisX
|
|
@@ -282,7 +306,6 @@ function inferAxisLinearOverrideStyle(
|
|
|
282
306
|
return {
|
|
283
307
|
startPos: [x, y + height],
|
|
284
308
|
endPos: [x + width, y + height],
|
|
285
|
-
showLine: true,
|
|
286
309
|
};
|
|
287
310
|
}
|
|
288
311
|
// axis with rotate
|
|
@@ -334,13 +357,12 @@ const ArcAxisComponent: GCC<AxisOptions> = (options) => {
|
|
|
334
357
|
tickFilter,
|
|
335
358
|
tickCount,
|
|
336
359
|
tickMethod,
|
|
337
|
-
title,
|
|
338
|
-
grid: showGrid = false,
|
|
339
360
|
important = {},
|
|
340
|
-
style,
|
|
361
|
+
style = {},
|
|
341
362
|
...rest
|
|
342
363
|
} = options;
|
|
343
|
-
|
|
364
|
+
const { title, grid = false } = style;
|
|
365
|
+
return ({ scales: [scale], value, coordinate, theme }) => {
|
|
344
366
|
const { bbox } = value;
|
|
345
367
|
const { domain } = scale.getOptions();
|
|
346
368
|
const ticks = getTicks(
|
|
@@ -366,14 +388,16 @@ const ArcAxisComponent: GCC<AxisOptions> = (options) => {
|
|
|
366
388
|
|
|
367
389
|
const { axis: axisTheme } = theme;
|
|
368
390
|
return new AxisComponent({
|
|
369
|
-
style:
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
391
|
+
style: adaptor(
|
|
392
|
+
deepMix({}, axisTheme, defaultStyle, {
|
|
393
|
+
type: 'arc',
|
|
394
|
+
data: ticks,
|
|
395
|
+
titleText: titleContent(title),
|
|
396
|
+
grid,
|
|
397
|
+
...rest,
|
|
398
|
+
...important,
|
|
399
|
+
}),
|
|
400
|
+
),
|
|
377
401
|
});
|
|
378
402
|
};
|
|
379
403
|
};
|
|
@@ -416,7 +440,9 @@ function inferDefaultStyle(
|
|
|
416
440
|
return {
|
|
417
441
|
...themeStyle,
|
|
418
442
|
labelDirection: direction === 'right' ? 'negative' : 'positive',
|
|
419
|
-
|
|
443
|
+
...(direction === 'center'
|
|
444
|
+
? { labelTransform: 'translate(50%,0)' }
|
|
445
|
+
: null),
|
|
420
446
|
tickDirection: direction === 'right' ? 'negative' : 'positive',
|
|
421
447
|
labelSpacing: direction === 'center' ? 0 : 4,
|
|
422
448
|
titleSpacing: isVertical(orientation) ? 10 : 0,
|
|
@@ -435,30 +461,19 @@ const LinearAxisComponent: GCC<AxisOptions> = (options) => {
|
|
|
435
461
|
orientation,
|
|
436
462
|
position,
|
|
437
463
|
size,
|
|
464
|
+
style = {},
|
|
465
|
+
title,
|
|
438
466
|
tickCount,
|
|
439
467
|
tickFilter,
|
|
440
468
|
tickMethod,
|
|
441
|
-
title,
|
|
442
469
|
transform,
|
|
443
|
-
style,
|
|
444
470
|
...userDefinitions
|
|
445
471
|
} = options;
|
|
446
472
|
|
|
447
|
-
return ([scale], value, coordinate, theme) => {
|
|
473
|
+
return ({ scales: [scale], value, coordinate, theme }) => {
|
|
448
474
|
const { bbox } = value;
|
|
449
475
|
const { domain } = scale.getOptions();
|
|
450
476
|
|
|
451
|
-
const ticks = getTicks(
|
|
452
|
-
scale,
|
|
453
|
-
domain,
|
|
454
|
-
tickCount,
|
|
455
|
-
labelFormatter,
|
|
456
|
-
tickFilter,
|
|
457
|
-
tickMethod,
|
|
458
|
-
position,
|
|
459
|
-
coordinate,
|
|
460
|
-
);
|
|
461
|
-
|
|
462
477
|
const defaultStyle = inferDefaultStyle(
|
|
463
478
|
scale,
|
|
464
479
|
coordinate,
|
|
@@ -467,46 +482,48 @@ const LinearAxisComponent: GCC<AxisOptions> = (options) => {
|
|
|
467
482
|
position,
|
|
468
483
|
orientation,
|
|
469
484
|
);
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
} = Object.assign({}, defaultStyle, userDefinitions);
|
|
478
|
-
|
|
479
|
-
const showGrid = inferGrid(grid, coordinate, scale);
|
|
485
|
+
|
|
486
|
+
const internalAxisStyle = {
|
|
487
|
+
...defaultStyle,
|
|
488
|
+
...style,
|
|
489
|
+
...userDefinitions,
|
|
490
|
+
};
|
|
491
|
+
|
|
480
492
|
const gridLength = inferGridLength(position, coordinate);
|
|
481
493
|
|
|
482
|
-
const
|
|
494
|
+
const overrideStyle = inferAxisLinearOverrideStyle(
|
|
483
495
|
position,
|
|
484
496
|
orientation,
|
|
485
497
|
bbox,
|
|
486
498
|
coordinate,
|
|
487
499
|
);
|
|
488
|
-
const
|
|
489
|
-
...
|
|
490
|
-
...style,
|
|
500
|
+
const finalAxisStyle = {
|
|
501
|
+
...internalAxisStyle,
|
|
491
502
|
type: 'linear' as const,
|
|
492
|
-
data:
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
503
|
+
data: getTicks(
|
|
504
|
+
scale,
|
|
505
|
+
domain,
|
|
506
|
+
tickCount,
|
|
507
|
+
labelFormatter,
|
|
508
|
+
tickFilter,
|
|
509
|
+
tickMethod,
|
|
510
|
+
position,
|
|
511
|
+
coordinate,
|
|
512
|
+
),
|
|
513
|
+
titleText: titleContent(title),
|
|
514
|
+
labelOverlap: inferLabelOverlap(transform, internalAxisStyle),
|
|
515
|
+
grid: inferGrid(internalAxisStyle.grid, coordinate, scale),
|
|
498
516
|
gridLength,
|
|
499
|
-
...userDefinitions,
|
|
500
517
|
// Always showLine, make title could align the end of axis.
|
|
501
|
-
|
|
502
|
-
...(!
|
|
518
|
+
line: true,
|
|
519
|
+
...(!internalAxisStyle.line ? { lineOpacity: 0 } : null),
|
|
503
520
|
...overrideStyle,
|
|
504
521
|
...important,
|
|
505
522
|
};
|
|
506
523
|
|
|
507
524
|
return new AxisComponent({
|
|
508
525
|
className: 'axis',
|
|
509
|
-
style:
|
|
526
|
+
style: adaptor(finalAxisStyle),
|
|
510
527
|
});
|
|
511
528
|
};
|
|
512
529
|
};
|
|
@@ -43,7 +43,7 @@ function inferAxisStyle(
|
|
|
43
43
|
|
|
44
44
|
return {
|
|
45
45
|
...radarTheme,
|
|
46
|
-
|
|
46
|
+
grid: name === 'position',
|
|
47
47
|
gridConnect: 'line',
|
|
48
48
|
gridControlAngles: new Array(radar.count).fill(0).map((_, i) => {
|
|
49
49
|
const angle = (endAngle - startAngle) / radar.count;
|
|
@@ -54,7 +54,8 @@ function inferAxisStyle(
|
|
|
54
54
|
|
|
55
55
|
export const AxisRadar: GCC<AxisRadarOptions> = (options) => {
|
|
56
56
|
const { important = {}, ...restOptions } = options;
|
|
57
|
-
return (
|
|
57
|
+
return (context) => {
|
|
58
|
+
const { theme, coordinate, value } = context;
|
|
58
59
|
return LinearAxis({
|
|
59
60
|
...restOptions,
|
|
60
61
|
...inferTitleTransform(options.orientation),
|
|
@@ -62,7 +63,7 @@ export const AxisRadar: GCC<AxisRadarOptions> = (options) => {
|
|
|
62
63
|
...inferAxisStyle(options, theme, coordinate, value),
|
|
63
64
|
...important,
|
|
64
65
|
},
|
|
65
|
-
})(
|
|
66
|
+
})(context);
|
|
66
67
|
};
|
|
67
68
|
};
|
|
68
69
|
|
package/src/component/axisX.ts
CHANGED