@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
package/src/runtime/component.ts
CHANGED
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
* @see https://github.com/antvis/G2/discussions/4557
|
|
3
3
|
*/
|
|
4
4
|
import { Coordinate } from '@antv/coord';
|
|
5
|
-
import { group } from 'd3-array';
|
|
6
5
|
import { isEqual } from '@antv/util';
|
|
7
|
-
import {
|
|
6
|
+
import { group } from 'd3-array';
|
|
8
7
|
import {
|
|
9
8
|
getPolarOptions,
|
|
10
9
|
getRadialOptions,
|
|
@@ -12,6 +11,7 @@ import {
|
|
|
12
11
|
type RadialOptions,
|
|
13
12
|
} from '../coordinate';
|
|
14
13
|
import { combine } from '../utils/array';
|
|
14
|
+
import { defined } from '../utils/helper';
|
|
15
15
|
import {
|
|
16
16
|
coordOf,
|
|
17
17
|
isHelix,
|
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
import { useLibrary } from './library';
|
|
28
28
|
import { isValidScale, useRelationScale } from './scale';
|
|
29
29
|
import {
|
|
30
|
+
G2MarkState,
|
|
30
31
|
G2Theme,
|
|
31
32
|
GuideComponentOrientation as GCO,
|
|
32
33
|
GuideComponentPosition as GCP,
|
|
@@ -39,6 +40,7 @@ import {
|
|
|
39
40
|
G2CoordinateOptions,
|
|
40
41
|
G2GuideComponentOptions,
|
|
41
42
|
G2Library,
|
|
43
|
+
G2Mark,
|
|
42
44
|
G2ScaleOptions,
|
|
43
45
|
G2View,
|
|
44
46
|
} from './types/options';
|
|
@@ -132,9 +134,10 @@ export function inferComponent(
|
|
|
132
134
|
|
|
133
135
|
export function renderComponent(
|
|
134
136
|
component: G2GuideComponentOptions,
|
|
135
|
-
|
|
137
|
+
coordinate: Coordinate,
|
|
136
138
|
theme: G2Theme,
|
|
137
139
|
library: G2Library,
|
|
140
|
+
markState: Map<G2Mark, G2MarkState>,
|
|
138
141
|
) {
|
|
139
142
|
const [useGuideComponent] = useLibrary<
|
|
140
143
|
G2GuideComponentOptions,
|
|
@@ -147,26 +150,43 @@ export function renderComponent(
|
|
|
147
150
|
);
|
|
148
151
|
const value = { bbox, scales: scaleDescriptors, library };
|
|
149
152
|
const render = useGuideComponent(options);
|
|
150
|
-
return render(
|
|
153
|
+
return render({ coordinate, library, markState, scales, theme, value });
|
|
151
154
|
}
|
|
152
155
|
|
|
153
156
|
function inferLegendComponentType(
|
|
154
157
|
scales: G2ScaleOptions[],
|
|
155
158
|
coordinates: G2CoordinateOptions[],
|
|
156
159
|
) {
|
|
157
|
-
const acceptScales = scales
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
160
|
+
const acceptScales = scales
|
|
161
|
+
.filter((scale) =>
|
|
162
|
+
typeof scale.type === 'string'
|
|
163
|
+
? ['shape', 'size', 'color', 'opacity'].includes(scale.name)
|
|
164
|
+
: true,
|
|
165
|
+
)
|
|
166
|
+
// not support constant size scale
|
|
167
|
+
.filter((scale) => !(scale.type === 'constant' && scale.name === 'size'));
|
|
168
|
+
|
|
169
|
+
// scale with undefined field
|
|
170
|
+
const undefinedScales = acceptScales.filter((scale) => !scale.field);
|
|
171
|
+
const definedScales = acceptScales.filter((scale) => !!scale.field);
|
|
162
172
|
|
|
163
173
|
// exclude the scales that all type are constant
|
|
164
174
|
const scalesByField = new Map(
|
|
165
|
-
Array.from(
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
175
|
+
Array.from(group(definedScales, (d) => d.field))
|
|
176
|
+
.map(
|
|
177
|
+
([field, scales]) =>
|
|
178
|
+
[
|
|
179
|
+
field,
|
|
180
|
+
[
|
|
181
|
+
...scales,
|
|
182
|
+
...undefinedScales.filter((scale) => scale.type === 'constant'),
|
|
183
|
+
],
|
|
184
|
+
] as const,
|
|
185
|
+
)
|
|
186
|
+
.concat([[undefined, undefinedScales]])
|
|
187
|
+
.filter(([field, scales]) =>
|
|
188
|
+
scales.some((scale) => scale.type !== 'constant'),
|
|
189
|
+
),
|
|
170
190
|
) as Map<string, G2ScaleOptions[]>;
|
|
171
191
|
|
|
172
192
|
if (scalesByField.size === 0) return [];
|
package/src/runtime/plot.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { deepMix, upperFirst } from '@antv/util';
|
|
|
4
4
|
import { group } from 'd3-array';
|
|
5
5
|
import { format } from 'd3-format';
|
|
6
6
|
import { mapObject } from '../utils/array';
|
|
7
|
-
import {
|
|
7
|
+
import { ChartEvent } from '../utils/event';
|
|
8
8
|
import {
|
|
9
9
|
appendTransform,
|
|
10
10
|
copyAttributes,
|
|
@@ -171,7 +171,7 @@ export async function plot<T extends G2ViewTree>(
|
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
context.emitter.emit(
|
|
174
|
+
context.emitter.emit(ChartEvent.BEFORE_PAINT);
|
|
175
175
|
|
|
176
176
|
// Plot chart.
|
|
177
177
|
const enterContainer = new Map<G2ViewDescriptor, DisplayObject>();
|
|
@@ -245,7 +245,7 @@ export async function plot<T extends G2ViewTree>(
|
|
|
245
245
|
for (const option of inferInteraction(options)) {
|
|
246
246
|
// Remove interaction for existed views.
|
|
247
247
|
const prevInteraction = nameInteraction.get(option.type);
|
|
248
|
-
if (prevInteraction) prevInteraction.destroy();
|
|
248
|
+
if (prevInteraction) prevInteraction.destroy?.();
|
|
249
249
|
|
|
250
250
|
// Apply new interaction.
|
|
251
251
|
const interaction = useInteraction(option);
|
|
@@ -274,7 +274,7 @@ export async function plot<T extends G2ViewTree>(
|
|
|
274
274
|
context.views = views;
|
|
275
275
|
context.animations = transitions;
|
|
276
276
|
|
|
277
|
-
context.emitter.emit(
|
|
277
|
+
context.emitter.emit(ChartEvent.AFTER_PAINT);
|
|
278
278
|
|
|
279
279
|
// Note!!!
|
|
280
280
|
// The returned promise will never resolved if one of nodeGenerator
|
|
@@ -303,14 +303,43 @@ function createUpdateView(
|
|
|
303
303
|
const transitions = [];
|
|
304
304
|
const [newView, newChildren] = await initializeView(newOptions, library);
|
|
305
305
|
plotView(newView, selection, transitions, library);
|
|
306
|
+
updateTooltip(selection, newOptions, newView, library, context);
|
|
306
307
|
for (const child of newChildren) {
|
|
307
308
|
plot(child, selection, library, context);
|
|
308
309
|
}
|
|
309
|
-
return {
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
310
|
+
return { options: newOptions, view: newView };
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
function updateTooltip(selection, options, view, library, context) {
|
|
315
|
+
const [useInteraction] = useLibrary<
|
|
316
|
+
G2InteractionOptions,
|
|
317
|
+
InteractionComponent,
|
|
318
|
+
Interaction
|
|
319
|
+
>('interaction', library);
|
|
320
|
+
|
|
321
|
+
// Instances for tooltip.
|
|
322
|
+
const container = selection.node();
|
|
323
|
+
const nameInteraction = container['nameInteraction'];
|
|
324
|
+
const { interaction } = options;
|
|
325
|
+
const tooltipOptions = inferInteraction(interaction).find(
|
|
326
|
+
(d) => d.type === 'tooltip',
|
|
327
|
+
);
|
|
328
|
+
|
|
329
|
+
// Destroy older tooltip.
|
|
330
|
+
const tooltip = nameInteraction.get('tooltip');
|
|
331
|
+
if (!tooltip) return;
|
|
332
|
+
tooltip.destroy?.();
|
|
333
|
+
|
|
334
|
+
// Apply new tooltip interaction.
|
|
335
|
+
const applyTooltip = useInteraction(tooltipOptions);
|
|
336
|
+
const target = {
|
|
337
|
+
options,
|
|
338
|
+
view,
|
|
339
|
+
container: selection.node(),
|
|
340
|
+
update: (options) => Promise.resolve(options),
|
|
313
341
|
};
|
|
342
|
+
applyTooltip(target, [], context.emitter);
|
|
314
343
|
}
|
|
315
344
|
|
|
316
345
|
async function initializeView(
|
|
@@ -694,6 +723,7 @@ async function plotView(
|
|
|
694
723
|
coordinate,
|
|
695
724
|
theme,
|
|
696
725
|
library,
|
|
726
|
+
markState,
|
|
697
727
|
),
|
|
698
728
|
),
|
|
699
729
|
(update) =>
|
|
@@ -705,6 +735,7 @@ async function plotView(
|
|
|
705
735
|
coordinate,
|
|
706
736
|
theme,
|
|
707
737
|
library,
|
|
738
|
+
markState,
|
|
708
739
|
);
|
|
709
740
|
const { attributes } = newComponent;
|
|
710
741
|
const [node] = this.childNodes;
|
|
@@ -726,7 +757,7 @@ async function plotView(
|
|
|
726
757
|
enter
|
|
727
758
|
// Make this layer interactive, such as click and mousemove events.
|
|
728
759
|
.append('rect')
|
|
729
|
-
|
|
760
|
+
.style('zIndex', 0)
|
|
730
761
|
.style('fill', 'transparent')
|
|
731
762
|
.attr('className', PLOT_CLASS_NAME)
|
|
732
763
|
.call(updateBBox)
|
|
@@ -749,15 +780,18 @@ async function plotView(
|
|
|
749
780
|
for (const [mark, state] of markState.entries()) {
|
|
750
781
|
const { data } = state;
|
|
751
782
|
const { key, class: cls, type } = mark;
|
|
783
|
+
const viewNode = selection.select(`#${key}`);
|
|
752
784
|
const shapeFunction = createMarkShapeFunction(mark, state, view, library);
|
|
753
785
|
const enterFunction = createEnterFunction(mark, state, view, library);
|
|
754
786
|
const updateFunction = createUpdateFunction(mark, state, view, library);
|
|
755
787
|
const exitFunction = createExitFunction(mark, state, view, library);
|
|
756
|
-
const facetElements = selectFacetElements(
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
788
|
+
const facetElements = selectFacetElements(
|
|
789
|
+
selection,
|
|
790
|
+
viewNode,
|
|
791
|
+
cls,
|
|
792
|
+
'element',
|
|
793
|
+
);
|
|
794
|
+
const T = viewNode
|
|
761
795
|
.selectAll(className(ELEMENT_CLASS_NAME))
|
|
762
796
|
.selectFacetAll(facetElements)
|
|
763
797
|
.data(
|
|
@@ -769,7 +803,10 @@ async function plotView(
|
|
|
769
803
|
(enter) =>
|
|
770
804
|
enter
|
|
771
805
|
.append(shapeFunction)
|
|
772
|
-
|
|
806
|
+
// Note!!! Only one className can be set.
|
|
807
|
+
// Using attribute as alternative for other classNames.
|
|
808
|
+
.attr('className', ELEMENT_CLASS_NAME)
|
|
809
|
+
.attr('markType', type)
|
|
773
810
|
.transition(function (data) {
|
|
774
811
|
return enterFunction(data, [this]);
|
|
775
812
|
}),
|
|
@@ -803,6 +840,7 @@ async function plotView(
|
|
|
803
840
|
// Append elements to be merged.
|
|
804
841
|
.append(shapeFunction)
|
|
805
842
|
.attr('className', ELEMENT_CLASS_NAME)
|
|
843
|
+
.attr('markType', type)
|
|
806
844
|
.transition(function (data) {
|
|
807
845
|
// Remove merged elements after animation finishing.
|
|
808
846
|
const { __fromElements__: fromElements } = this;
|
|
@@ -819,6 +857,7 @@ async function plotView(
|
|
|
819
857
|
const toElements = enter
|
|
820
858
|
.append(shapeFunction)
|
|
821
859
|
.attr('className', ELEMENT_CLASS_NAME)
|
|
860
|
+
.attr('markType', type)
|
|
822
861
|
.nodes();
|
|
823
862
|
return updateFunction(data, [this], toElements);
|
|
824
863
|
})
|
|
@@ -1114,12 +1153,18 @@ function computeAnimationExtent(markState): [number, number] {
|
|
|
1114
1153
|
|
|
1115
1154
|
function selectFacetElements(
|
|
1116
1155
|
selection: Selection,
|
|
1156
|
+
current: Selection,
|
|
1117
1157
|
facetClassName: string,
|
|
1118
1158
|
elementClassName: string,
|
|
1119
1159
|
): DisplayObject[] {
|
|
1120
1160
|
const group = selection.node().parentElement;
|
|
1121
1161
|
return group
|
|
1122
|
-
.findAll(
|
|
1162
|
+
.findAll(
|
|
1163
|
+
(node) =>
|
|
1164
|
+
node.style.facet !== undefined &&
|
|
1165
|
+
node.style.facet === facetClassName &&
|
|
1166
|
+
node !== current.node(), // Exclude current view.
|
|
1167
|
+
)
|
|
1123
1168
|
.flatMap((node) => node.getElementsByClassName(elementClassName));
|
|
1124
1169
|
}
|
|
1125
1170
|
|
|
@@ -1292,9 +1337,10 @@ function createExitFunction(
|
|
|
1292
1337
|
return createAnimationFunction('exit', mark, state, view, library);
|
|
1293
1338
|
}
|
|
1294
1339
|
|
|
1295
|
-
function inferTheme(theme: G2ThemeOptions = {
|
|
1296
|
-
|
|
1297
|
-
|
|
1340
|
+
function inferTheme(theme: G2ThemeOptions = {}): G2ThemeOptions {
|
|
1341
|
+
if (typeof theme === 'string') return { type: theme };
|
|
1342
|
+
const { type = 'classic', ...rest } = theme;
|
|
1343
|
+
return { ...rest, type };
|
|
1298
1344
|
}
|
|
1299
1345
|
|
|
1300
1346
|
/**
|
|
@@ -1304,6 +1350,9 @@ function inferInteraction(view: G2View): G2InteractionOptions[] {
|
|
|
1304
1350
|
const defaults = {
|
|
1305
1351
|
event: true,
|
|
1306
1352
|
tooltip: true,
|
|
1353
|
+
// @todo Inferred by slider self.
|
|
1354
|
+
sliderFilter: true,
|
|
1355
|
+
legendFilter: true,
|
|
1307
1356
|
};
|
|
1308
1357
|
const { interaction = {} } = view;
|
|
1309
1358
|
return Object.entries(deepMix(defaults, interaction))
|
|
@@ -1395,7 +1444,10 @@ function updateLayers(selection: Selection, marks: G2Mark[]) {
|
|
|
1395
1444
|
|
|
1396
1445
|
const labelLayer = selection.select(className(LABEL_LAYER_CLASS_NAME)).node();
|
|
1397
1446
|
if (labelLayer) return;
|
|
1398
|
-
selection
|
|
1447
|
+
selection
|
|
1448
|
+
.append('g')
|
|
1449
|
+
.attr('className', LABEL_LAYER_CLASS_NAME)
|
|
1450
|
+
.style('zIndex', 0);
|
|
1399
1451
|
}
|
|
1400
1452
|
|
|
1401
1453
|
function className(...names: string[]): string {
|
package/src/runtime/render.ts
CHANGED
|
@@ -5,9 +5,11 @@ import { deepMix } from '@antv/util';
|
|
|
5
5
|
import EventEmitter from '@antv/event-emitter';
|
|
6
6
|
import { createLibrary } from '../stdlib';
|
|
7
7
|
import { select } from '../utils/selection';
|
|
8
|
-
import {
|
|
8
|
+
import { ChartEvent } from '../utils/event';
|
|
9
|
+
import { error } from '../utils/helper';
|
|
9
10
|
import { G2Context, G2ViewTree } from './types/options';
|
|
10
11
|
import { plot } from './plot';
|
|
12
|
+
import { VIEW_CLASS_NAME } from './constant';
|
|
11
13
|
|
|
12
14
|
/**
|
|
13
15
|
* Infer key for each node of view tree.
|
|
@@ -61,10 +63,16 @@ function Canvas(width: number, height: number): GCanvas {
|
|
|
61
63
|
export function render<T extends G2ViewTree = G2ViewTree>(
|
|
62
64
|
options: T,
|
|
63
65
|
context: G2Context = {},
|
|
64
|
-
|
|
66
|
+
resolve?: () => void,
|
|
67
|
+
reject?: (e: Error) => void,
|
|
65
68
|
): HTMLElement {
|
|
66
69
|
// Initialize the context if it is not provided.
|
|
67
|
-
const { width = 640, height = 480,
|
|
70
|
+
const { width = 640, height = 480, theme } = options;
|
|
71
|
+
if (!theme) {
|
|
72
|
+
error(
|
|
73
|
+
'ChartOptions.theme is required, such as `const chart = new Chart({ theme: "classic"})`.',
|
|
74
|
+
);
|
|
75
|
+
}
|
|
68
76
|
const keyed = inferKeys(options);
|
|
69
77
|
const {
|
|
70
78
|
canvas = Canvas(width, height),
|
|
@@ -76,7 +84,7 @@ export function render<T extends G2ViewTree = G2ViewTree>(
|
|
|
76
84
|
context.emitter = emitter;
|
|
77
85
|
canvas.resize(width, height);
|
|
78
86
|
|
|
79
|
-
emitter.emit(
|
|
87
|
+
emitter.emit(ChartEvent.BEFORE_RENDER);
|
|
80
88
|
|
|
81
89
|
// Plot the chart and mutate context.
|
|
82
90
|
// Make sure that plot chart after container is ready for every time.
|
|
@@ -86,8 +94,11 @@ export function render<T extends G2ViewTree = G2ViewTree>(
|
|
|
86
94
|
plot<T>({ ...keyed, width, height }, selection, library, context),
|
|
87
95
|
)
|
|
88
96
|
.then(() => {
|
|
89
|
-
emitter.emit(
|
|
90
|
-
|
|
97
|
+
emitter.emit(ChartEvent.AFTER_RENDER);
|
|
98
|
+
resolve?.();
|
|
99
|
+
})
|
|
100
|
+
.catch((e) => {
|
|
101
|
+
reject?.(e);
|
|
91
102
|
});
|
|
92
103
|
|
|
93
104
|
// Return the container HTML element wraps the canvas or svg element.
|
|
@@ -119,11 +130,11 @@ export function renderToMountedElement<T extends G2ViewTree = G2ViewTree>(
|
|
|
119
130
|
context.library = library;
|
|
120
131
|
context.emitter = emitter;
|
|
121
132
|
|
|
122
|
-
emitter.emit(
|
|
133
|
+
emitter.emit(ChartEvent.BEFORE_RENDER);
|
|
123
134
|
// Plot the chart and mutate context.
|
|
124
135
|
// Make sure that plot chart after container is ready for every time.
|
|
125
136
|
plot<T>({ ...keyed, width, height }, selection, library, context).then(() => {
|
|
126
|
-
emitter.emit(
|
|
137
|
+
emitter.emit(ChartEvent.AFTER_RENDER);
|
|
127
138
|
callback?.();
|
|
128
139
|
});
|
|
129
140
|
|
|
@@ -134,14 +145,31 @@ export function renderToMountedElement<T extends G2ViewTree = G2ViewTree>(
|
|
|
134
145
|
export function destroy<T extends G2ViewTree = G2ViewTree>(
|
|
135
146
|
options: T,
|
|
136
147
|
context: G2Context = {},
|
|
148
|
+
isDestroyCanvas = false,
|
|
137
149
|
) {
|
|
138
150
|
const { canvas, emitter } = context;
|
|
139
151
|
if (canvas) {
|
|
140
|
-
canvas
|
|
152
|
+
destroyAllInteractions(canvas);
|
|
153
|
+
isDestroyCanvas ? canvas.destroy() : canvas.destroyChildren();
|
|
141
154
|
}
|
|
142
155
|
emitter.off();
|
|
143
156
|
}
|
|
144
157
|
|
|
158
|
+
/**
|
|
159
|
+
* Destroy all interactions mounted on the canvas.
|
|
160
|
+
*/
|
|
161
|
+
function destroyAllInteractions(canvas: GCanvas) {
|
|
162
|
+
const viewGroups = canvas.getRoot().querySelectorAll(`.${VIEW_CLASS_NAME}`);
|
|
163
|
+
viewGroups?.forEach((group) => {
|
|
164
|
+
const { nameInteraction = new Map() }: Record<string, any> = group;
|
|
165
|
+
if (nameInteraction?.size > 0) {
|
|
166
|
+
Array.from(nameInteraction?.values()).forEach((value: any) => {
|
|
167
|
+
value?.destroy();
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
|
|
145
173
|
function normalizeContainer(container: HTMLElement | string): HTMLElement {
|
|
146
174
|
return typeof container === 'string'
|
|
147
175
|
? document.getElementById(container)
|
|
@@ -20,20 +20,23 @@ export type G2Title = {
|
|
|
20
20
|
* Text of subtitle.
|
|
21
21
|
*/
|
|
22
22
|
subtitle?: string | null;
|
|
23
|
-
/**
|
|
24
|
-
* Align method for title.
|
|
25
|
-
*/
|
|
26
|
-
align?: 'left' | 'center' | 'right';
|
|
27
|
-
/**
|
|
28
|
-
* The vertical spacing between title and subtitle, default is 2.
|
|
29
|
-
*/
|
|
30
|
-
spacing?: number;
|
|
31
|
-
|
|
32
23
|
/**
|
|
33
24
|
* Styles.
|
|
34
25
|
*/
|
|
35
26
|
style?: WithPrefix<Omit<TextStyleProps, 'x' | 'y' | 'text'>, 'title'> & // G.Text style for title.
|
|
36
|
-
WithPrefix<Omit<TextStyleProps, 'x' | 'y' | 'text'>, 'subtitle'
|
|
27
|
+
WithPrefix<Omit<TextStyleProps, 'x' | 'y' | 'text'>, 'subtitle'> & {
|
|
28
|
+
// G.Text style for subtitle.
|
|
29
|
+
titleAlign?: 'left' | 'center' | 'right';
|
|
30
|
+
subtitleAilgn?: 'left' | 'center' | 'right';
|
|
31
|
+
/**
|
|
32
|
+
* Align method for title.
|
|
33
|
+
*/
|
|
34
|
+
align?: 'left' | 'center' | 'right';
|
|
35
|
+
/**
|
|
36
|
+
* The vertical spacing between title and subtitle, default is 2.
|
|
37
|
+
*/
|
|
38
|
+
spacing?: number;
|
|
39
|
+
};
|
|
37
40
|
};
|
|
38
41
|
|
|
39
42
|
export type G2ViewDescriptor = {
|
|
@@ -9,11 +9,12 @@ import {
|
|
|
9
9
|
IndexedValue,
|
|
10
10
|
Layout,
|
|
11
11
|
Vector2,
|
|
12
|
+
G2MarkState,
|
|
12
13
|
} from './common';
|
|
13
14
|
import { DataComponent } from './data';
|
|
14
15
|
import { Encode, EncodeComponent } from './encode';
|
|
15
16
|
import { Mark, MarkComponent } from './mark';
|
|
16
|
-
import { G2ViewTree } from './options';
|
|
17
|
+
import { G2ViewTree, G2Library, G2Mark } from './options';
|
|
17
18
|
import { Transform, TransformComponent } from './transform';
|
|
18
19
|
|
|
19
20
|
export type G2ComponentNamespaces =
|
|
@@ -109,7 +110,7 @@ export type Scale = {
|
|
|
109
110
|
getTicks?: () => any[];
|
|
110
111
|
getBandWidth?: (d?: any) => number;
|
|
111
112
|
getFormatter?: () => (x: any) => string;
|
|
112
|
-
getOptions
|
|
113
|
+
getOptions: () => Record<string, any>;
|
|
113
114
|
update(options: Record<string, any>): void;
|
|
114
115
|
};
|
|
115
116
|
export type ScaleComponent<O = Record<string, unknown>> = G2BaseComponent<
|
|
@@ -145,6 +146,7 @@ export type Shape = (
|
|
|
145
146
|
point2d?: Vector2[][],
|
|
146
147
|
) => DisplayObject;
|
|
147
148
|
export type ShapeProps = {
|
|
149
|
+
defaultMarker?: string;
|
|
148
150
|
defaultEnterAnimation?: string;
|
|
149
151
|
defaultUpdateAnimation?: string;
|
|
150
152
|
defaultExitAnimation?: string;
|
|
@@ -161,12 +163,17 @@ export type ThemeComponent<O = Record<string, unknown>> = G2BaseComponent<
|
|
|
161
163
|
O
|
|
162
164
|
>;
|
|
163
165
|
|
|
164
|
-
export type
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
166
|
+
export type GuideComponentContext = {
|
|
167
|
+
coordinate: Coordinate;
|
|
168
|
+
library: G2Library;
|
|
169
|
+
markState: Map<G2Mark, G2MarkState>;
|
|
170
|
+
scales: Scale[];
|
|
171
|
+
theme: G2Theme;
|
|
172
|
+
value: Record<string, any>;
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
export type GuideComponent = (context: GuideComponentContext) => DisplayObject;
|
|
176
|
+
|
|
170
177
|
export type GuideComponentProps = {
|
|
171
178
|
defaultPosition?: GuideComponentPosition;
|
|
172
179
|
defaultOrientation?: GuideComponentOrientation;
|
|
@@ -174,6 +181,7 @@ export type GuideComponentProps = {
|
|
|
174
181
|
defaultOrder: number;
|
|
175
182
|
[key: string]: any;
|
|
176
183
|
};
|
|
184
|
+
|
|
177
185
|
export type GuideComponentComponent<O = Record<string, unknown>> =
|
|
178
186
|
G2BaseComponent<GuideComponent, O, GuideComponentProps>;
|
|
179
187
|
|
|
Binary file
|
package/src/shape/area/area.ts
CHANGED
package/src/shape/area/curve.ts
CHANGED
|
@@ -81,7 +81,7 @@ export const Curve: SC<CurveOptions> = (options) => {
|
|
|
81
81
|
curve,
|
|
82
82
|
gradient = false,
|
|
83
83
|
defined = (d) => !Number.isNaN(d) && d !== undefined && d !== null,
|
|
84
|
-
connectNulls = false,
|
|
84
|
+
connect: connectNulls = false,
|
|
85
85
|
...style
|
|
86
86
|
} = options;
|
|
87
87
|
return (P, value, coordinate, theme) => {
|
|
@@ -203,6 +203,7 @@ export const Curve: SC<CurveOptions> = (options) => {
|
|
|
203
203
|
};
|
|
204
204
|
|
|
205
205
|
Curve.props = {
|
|
206
|
+
defaultMarker: 'smooth',
|
|
206
207
|
defaultEnterAnimation: 'fadeIn',
|
|
207
208
|
defaultUpdateAnimation: 'morphing',
|
|
208
209
|
defaultExitAnimation: 'fadeOut',
|
package/src/shape/area/hv.ts
CHANGED
package/src/shape/area/hvh.ts
CHANGED
package/src/shape/area/smooth.ts
CHANGED
package/src/shape/area/vh.ts
CHANGED
package/src/shape/box/box.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { Coordinate } from '@antv/coord';
|
|
2
|
+
import type { PathArray } from '@antv/util';
|
|
2
3
|
import { PathStyleProps } from '@antv/g';
|
|
3
4
|
import { Marker } from '@antv/gui';
|
|
4
5
|
import { line as d3line } from 'd3-shape';
|
|
5
|
-
import { isTranspose } from '../../utils/coordinate';
|
|
6
|
-
import { select } from '../../utils/selection';
|
|
7
6
|
import { ShapeComponent as SC, Vector2, WithPrefix } from '../../runtime';
|
|
8
|
-
import { applyStyle, getShapeTheme, PathCommand } from '../utils';
|
|
9
7
|
import { createElement } from '../../shape/createElement';
|
|
8
|
+
import { isTranspose } from '../../utils/coordinate';
|
|
10
9
|
import { subObject } from '../../utils/helper';
|
|
10
|
+
import { select } from '../../utils/selection';
|
|
11
|
+
import { applyStyle, getShapeTheme } from '../utils';
|
|
11
12
|
|
|
12
13
|
export type ConnectorOptions = ConnectorPathStyleProps & Record<string, any>;
|
|
13
14
|
|
|
@@ -15,7 +16,7 @@ type MarkerStyleProps<P extends string> = WithPrefix<Record<string, any>, P>;
|
|
|
15
16
|
|
|
16
17
|
type ConnectorPathStyleProps = Omit<PathStyleProps, 'path'> &
|
|
17
18
|
MarkerStyleProps<'endMarker'> & {
|
|
18
|
-
connectorPath?:
|
|
19
|
+
connectorPath?: PathArray[];
|
|
19
20
|
endMarker?: boolean;
|
|
20
21
|
};
|
|
21
22
|
|
|
@@ -121,6 +122,7 @@ export const Connector: SC<ConnectorOptions> = (options) => {
|
|
|
121
122
|
};
|
|
122
123
|
|
|
123
124
|
Connector.props = {
|
|
125
|
+
defaultMarker: 'line',
|
|
124
126
|
defaultEnterAnimation: 'fadeIn',
|
|
125
127
|
defaultUpdateAnimation: 'morphing',
|
|
126
128
|
defaultExitAnimation: 'fadeOut',
|
|
@@ -134,12 +134,27 @@ export const Color: SC<ColorOptions> = (options) => {
|
|
|
134
134
|
|
|
135
135
|
// Extended style, which is not supported by native g shape,
|
|
136
136
|
// should apply at first.
|
|
137
|
+
const standardDirRadius = [
|
|
138
|
+
first ? radiusTopLeft : innerRadiusTopLeft,
|
|
139
|
+
first ? radiusTopRight : innerRadiusTopRight,
|
|
140
|
+
last ? radiusBottomRight : innerRadiusBottomRight,
|
|
141
|
+
last ? radiusBottomLeft : innerRadiusBottomLeft,
|
|
142
|
+
];
|
|
143
|
+
const standardDir = [
|
|
144
|
+
'radiusTopLeft',
|
|
145
|
+
'radiusTopRight',
|
|
146
|
+
'radiusBottomRight',
|
|
147
|
+
'radiusBottomLeft',
|
|
148
|
+
];
|
|
149
|
+
// Transpose: rotate it clockwise by 90.
|
|
150
|
+
if (isTranspose(coordinate)) {
|
|
151
|
+
standardDir.push(standardDir.shift());
|
|
152
|
+
}
|
|
137
153
|
const extendedStyle = {
|
|
138
154
|
radius,
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
radiusBottomLeft: last ? radiusBottomLeft : innerRadiusBottomLeft,
|
|
155
|
+
...Object.fromEntries(
|
|
156
|
+
standardDir.map((d, i) => [d, standardDirRadius[i]]),
|
|
157
|
+
),
|
|
143
158
|
inset,
|
|
144
159
|
insetLeft,
|
|
145
160
|
insetRight,
|