@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/interaction/event.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { ChartEvent } from '../utils/event';
|
|
2
|
+
|
|
1
3
|
function dataOf(element, view) {
|
|
2
4
|
const { __data__: datum } = element;
|
|
3
5
|
const { markKey, index, seriesIndex } = datum;
|
|
@@ -22,8 +24,7 @@ function bubblesEvent(eventType, view, emitter, predicate = (event) => true) {
|
|
|
22
24
|
return (e) => {
|
|
23
25
|
if (!predicate(e)) return;
|
|
24
26
|
const { target } = e;
|
|
25
|
-
const {
|
|
26
|
-
const [elementType, markType] = classList;
|
|
27
|
+
const { className: elementType, markType } = target;
|
|
27
28
|
if (elementType === 'element') {
|
|
28
29
|
updateData(e, target, view);
|
|
29
30
|
emitter.emit(`element:${eventType}`, e);
|
|
@@ -41,33 +42,42 @@ export function Event() {
|
|
|
41
42
|
const { container, view } = context;
|
|
42
43
|
|
|
43
44
|
// Click events.
|
|
44
|
-
const click = bubblesEvent(
|
|
45
|
+
const click = bubblesEvent(
|
|
46
|
+
ChartEvent.CLICK,
|
|
47
|
+
view,
|
|
48
|
+
emitter,
|
|
49
|
+
(e) => e.detail === 1,
|
|
50
|
+
);
|
|
45
51
|
const dblclick = bubblesEvent(
|
|
46
|
-
|
|
52
|
+
ChartEvent.DBLCLICK,
|
|
47
53
|
view,
|
|
48
54
|
emitter,
|
|
49
55
|
(e) => e.detail === 2,
|
|
50
56
|
);
|
|
51
57
|
|
|
52
58
|
// Pointer events.
|
|
53
|
-
const pointertap = bubblesEvent(
|
|
54
|
-
const pointerdown = bubblesEvent(
|
|
55
|
-
const pointerup = bubblesEvent(
|
|
56
|
-
const pointerover = bubblesEvent(
|
|
57
|
-
const pointerout = bubblesEvent(
|
|
58
|
-
const pointermove = bubblesEvent(
|
|
59
|
-
const pointerenter = bubblesEvent(
|
|
60
|
-
const pointerleave = bubblesEvent(
|
|
61
|
-
const pointerupoutside = bubblesEvent(
|
|
59
|
+
const pointertap = bubblesEvent(ChartEvent.POINTER_TAP, view, emitter);
|
|
60
|
+
const pointerdown = bubblesEvent(ChartEvent.POINTER_DOWN, view, emitter);
|
|
61
|
+
const pointerup = bubblesEvent(ChartEvent.POINTER_UP, view, emitter);
|
|
62
|
+
const pointerover = bubblesEvent(ChartEvent.POINTER_OVER, view, emitter);
|
|
63
|
+
const pointerout = bubblesEvent(ChartEvent.POINTER_OUT, view, emitter);
|
|
64
|
+
const pointermove = bubblesEvent(ChartEvent.POINTER_MOVE, view, emitter);
|
|
65
|
+
const pointerenter = bubblesEvent(ChartEvent.POINTER_ENTER, view, emitter);
|
|
66
|
+
const pointerleave = bubblesEvent(ChartEvent.POINTER_LEAVE, view, emitter);
|
|
67
|
+
const pointerupoutside = bubblesEvent(
|
|
68
|
+
ChartEvent.POINTER_UPOUTSIDE,
|
|
69
|
+
view,
|
|
70
|
+
emitter,
|
|
71
|
+
);
|
|
62
72
|
|
|
63
73
|
// Drag and drop events.
|
|
64
|
-
const dragstart = bubblesEvent(
|
|
65
|
-
const drag = bubblesEvent(
|
|
66
|
-
const dragend = bubblesEvent(
|
|
67
|
-
const dragenter = bubblesEvent(
|
|
68
|
-
const dragleave = bubblesEvent(
|
|
69
|
-
const dragover = bubblesEvent(
|
|
70
|
-
const drop = bubblesEvent(
|
|
74
|
+
const dragstart = bubblesEvent(ChartEvent.DRAG_START, view, emitter);
|
|
75
|
+
const drag = bubblesEvent(ChartEvent.DRAG, view, emitter);
|
|
76
|
+
const dragend = bubblesEvent(ChartEvent.DRAG_END, view, emitter);
|
|
77
|
+
const dragenter = bubblesEvent(ChartEvent.DRAG_ENTER, view, emitter);
|
|
78
|
+
const dragleave = bubblesEvent(ChartEvent.DRAG_LEAVE, view, emitter);
|
|
79
|
+
const dragover = bubblesEvent(ChartEvent.DRAG_OVER, view, emitter);
|
|
80
|
+
const drop = bubblesEvent(ChartEvent.DROP, view, emitter);
|
|
71
81
|
|
|
72
82
|
// For legacy usage.
|
|
73
83
|
container.addEventListener('click', click);
|
|
@@ -44,26 +44,6 @@ export function attributesOf(root) {
|
|
|
44
44
|
return child.attributes;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
function builtInAccessors(selectedLegend) {
|
|
48
|
-
// Get the value and scale type from legend.
|
|
49
|
-
const { data } = attributesOf(selectedLegend);
|
|
50
|
-
// In theory, scales' channels are the same
|
|
51
|
-
const { name: channel } = dataOf(selectedLegend).scales[0];
|
|
52
|
-
return [
|
|
53
|
-
channel,
|
|
54
|
-
{
|
|
55
|
-
legends: itemsOf,
|
|
56
|
-
marker: markerOf,
|
|
57
|
-
label: labelOf,
|
|
58
|
-
datum: (d) => {
|
|
59
|
-
const { __data__: datum } = d;
|
|
60
|
-
const { index } = datum;
|
|
61
|
-
return data[index].label;
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
] as any;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
47
|
function legendFilter(
|
|
68
48
|
root: DisplayObject,
|
|
69
49
|
{
|
|
@@ -72,7 +52,6 @@ function legendFilter(
|
|
|
72
52
|
label: labelOf, // given the legend returns the label
|
|
73
53
|
datum, // given the legend returns the value
|
|
74
54
|
filter, // invoke when dispatch filter event,
|
|
75
|
-
setAttribute, // setter for set element style,
|
|
76
55
|
state = {} as Record<string, any>, // state options
|
|
77
56
|
},
|
|
78
57
|
) {
|
|
@@ -93,12 +72,10 @@ function legendFilter(
|
|
|
93
72
|
const { setState: setM, removeState: removeM } = useState(
|
|
94
73
|
markerStyle,
|
|
95
74
|
undefined,
|
|
96
|
-
setAttribute,
|
|
97
75
|
);
|
|
98
76
|
const { setState: setL, removeState: removeL } = useState(
|
|
99
77
|
labelStyle,
|
|
100
78
|
undefined,
|
|
101
|
-
setAttribute,
|
|
102
79
|
);
|
|
103
80
|
|
|
104
81
|
const items: DisplayObject[] = Array.from(legends(root));
|
|
@@ -156,59 +133,66 @@ function legendFilter(
|
|
|
156
133
|
};
|
|
157
134
|
}
|
|
158
135
|
|
|
159
|
-
export function LegendFilter(
|
|
160
|
-
return (context) => {
|
|
136
|
+
export function LegendFilter() {
|
|
137
|
+
return (context, _, emitter) => {
|
|
161
138
|
const { container, view, options: viewOptions, update } = context;
|
|
162
139
|
|
|
163
|
-
// Use the first legend if channel is not specified,
|
|
164
|
-
// or use the first legend bind to specified channel.
|
|
165
140
|
const legends = legendsOf(container);
|
|
166
|
-
const selectedLegend = !channel
|
|
167
|
-
? legends[0]
|
|
168
|
-
: legends.find((d) => {
|
|
169
|
-
const { __data__ } = d.parentNode;
|
|
170
|
-
return __data__.scale.name === channel;
|
|
171
|
-
});
|
|
172
141
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
{ type: 'filter', [channel]: value },
|
|
192
|
-
...transform,
|
|
193
|
-
];
|
|
194
|
-
return deepMix({}, mark, {
|
|
195
|
-
transform: newTransform,
|
|
196
|
-
// Set domain of scale to preserve legends.
|
|
197
|
-
scale: {
|
|
198
|
-
[channel]: {
|
|
199
|
-
domain: scaleOrdinal.getOptions().domain,
|
|
200
|
-
},
|
|
142
|
+
const filter = async (channel, value) => {
|
|
143
|
+
const { scale } = view;
|
|
144
|
+
const { [channel]: scaleOrdinal } = scale;
|
|
145
|
+
const { marks } = viewOptions;
|
|
146
|
+
// Add filter transform for every marks,
|
|
147
|
+
// which will skip for mark without color channel.
|
|
148
|
+
const newMarks = marks.map((mark) => {
|
|
149
|
+
const { transform = [] } = mark;
|
|
150
|
+
const newTransform = [
|
|
151
|
+
{ type: 'filter', [channel]: value },
|
|
152
|
+
...transform,
|
|
153
|
+
];
|
|
154
|
+
return deepMix({}, mark, {
|
|
155
|
+
transform: newTransform,
|
|
156
|
+
// Set domain of scale to preserve legends.
|
|
157
|
+
scale: {
|
|
158
|
+
[channel]: {
|
|
159
|
+
domain: scaleOrdinal.getOptions().domain,
|
|
201
160
|
},
|
|
202
|
-
}
|
|
161
|
+
},
|
|
203
162
|
});
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
163
|
+
});
|
|
164
|
+
const newOptions = {
|
|
165
|
+
...viewOptions,
|
|
166
|
+
marks: newMarks,
|
|
167
|
+
};
|
|
168
|
+
return update(newOptions);
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
if (!legends.length) {
|
|
172
|
+
emitter.on('legend:filter', (options) => {
|
|
173
|
+
const { values, channel } = options;
|
|
174
|
+
filter(channel, values);
|
|
175
|
+
});
|
|
176
|
+
return () => {};
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const removes = legends.map((legend) => {
|
|
180
|
+
const { name: channel, domain } = dataOf(legend).scales[0];
|
|
181
|
+
return legendFilter(container, {
|
|
182
|
+
legends: itemsOf,
|
|
183
|
+
marker: markerOf,
|
|
184
|
+
label: labelOf,
|
|
185
|
+
datum: (d) => {
|
|
186
|
+
const { __data__: datum } = d;
|
|
187
|
+
const { index } = datum;
|
|
188
|
+
return domain[index];
|
|
189
|
+
},
|
|
190
|
+
filter: (value) => filter(channel, value),
|
|
191
|
+
state: legend.attributes.state,
|
|
192
|
+
});
|
|
212
193
|
});
|
|
194
|
+
return () => {
|
|
195
|
+
removes.forEach((remove) => remove());
|
|
196
|
+
};
|
|
213
197
|
};
|
|
214
198
|
}
|
|
@@ -10,8 +10,8 @@ function filterDataByDomain(options, scaleOptions) {
|
|
|
10
10
|
{
|
|
11
11
|
// Hide label to keep smooth transition.
|
|
12
12
|
axis: {
|
|
13
|
-
x: {
|
|
14
|
-
y: {
|
|
13
|
+
x: { transform: [{ type: 'hide' }] },
|
|
14
|
+
y: { transform: [{ type: 'hide' }] },
|
|
15
15
|
},
|
|
16
16
|
},
|
|
17
17
|
mark,
|
|
@@ -54,7 +54,7 @@ export function SliderFilter({
|
|
|
54
54
|
return (context) => {
|
|
55
55
|
const { container, view, options, update } = context;
|
|
56
56
|
const sliders = container.getElementsByClassName(SLIDER_CLASS_NAME);
|
|
57
|
-
if (!sliders.length) return;
|
|
57
|
+
if (!sliders.length) return () => {};
|
|
58
58
|
|
|
59
59
|
let filtering = false;
|
|
60
60
|
const { scale } = view;
|
|
@@ -69,7 +69,7 @@ export function SliderFilter({
|
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
for (const slider of sliders) {
|
|
72
|
-
const {
|
|
72
|
+
const { orientation } = slider.attributes;
|
|
73
73
|
|
|
74
74
|
const onValueChange = throttle(
|
|
75
75
|
async (event) => {
|
|
@@ -78,13 +78,13 @@ export function SliderFilter({
|
|
|
78
78
|
filtering = true;
|
|
79
79
|
|
|
80
80
|
// Update domain of the current channel.
|
|
81
|
-
const channel0 =
|
|
81
|
+
const channel0 = orientation === 'vertical' ? 'y' : 'x';
|
|
82
82
|
const scale0 = scale[channel0];
|
|
83
83
|
const domain0 = abstractValue(values, scale0);
|
|
84
84
|
channelDomain[channel0] = domain0;
|
|
85
85
|
|
|
86
86
|
// Get domain of the other channel.
|
|
87
|
-
const channel1 =
|
|
87
|
+
const channel1 = orientation === 'vertical' ? 'x' : 'y';
|
|
88
88
|
const domain1 = channelDomain[channel1];
|
|
89
89
|
|
|
90
90
|
// Filter data.
|
|
@@ -19,7 +19,7 @@ function getContainer(group: IElement) {
|
|
|
19
19
|
return group.getRootNode().defaultView.getConfig().container;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
function createTooltip(root, x0, y0) {
|
|
22
|
+
function createTooltip(root, x0, y0, position, enterable) {
|
|
23
23
|
const bbox = root.getBounds();
|
|
24
24
|
const {
|
|
25
25
|
min: [x, y],
|
|
@@ -31,15 +31,16 @@ function createTooltip(root, x0, y0) {
|
|
|
31
31
|
x: x0,
|
|
32
32
|
y: y0,
|
|
33
33
|
container: { x: 0, y: 0 },
|
|
34
|
-
|
|
34
|
+
data: [],
|
|
35
35
|
bounding: {
|
|
36
36
|
x,
|
|
37
37
|
y,
|
|
38
38
|
width: x1 - x,
|
|
39
39
|
height: y1 - y,
|
|
40
40
|
},
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
position,
|
|
42
|
+
enterable,
|
|
43
|
+
title: '',
|
|
43
44
|
offset: [10, 10],
|
|
44
45
|
style: {
|
|
45
46
|
'.tooltip': {},
|
|
@@ -57,18 +58,31 @@ function createTooltip(root, x0, y0) {
|
|
|
57
58
|
return tooltipElement;
|
|
58
59
|
}
|
|
59
60
|
|
|
60
|
-
function showTooltip(
|
|
61
|
+
function showTooltip({
|
|
62
|
+
root,
|
|
63
|
+
data,
|
|
64
|
+
x,
|
|
65
|
+
y,
|
|
66
|
+
render,
|
|
67
|
+
event,
|
|
68
|
+
single,
|
|
69
|
+
position = 'right-bottom',
|
|
70
|
+
enterable = false,
|
|
71
|
+
}) {
|
|
61
72
|
// All the views share the same tooltip.
|
|
62
73
|
const container = single ? getContainer(root) : root;
|
|
63
|
-
const { tooltipElement = createTooltip(root, x, y) } =
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
tooltipElement.position = [x, y];
|
|
74
|
+
const { tooltipElement = createTooltip(root, x, y, position, enterable) } =
|
|
75
|
+
container;
|
|
76
|
+
const { items, title = '' } = data;
|
|
67
77
|
tooltipElement.update({
|
|
68
|
-
|
|
69
|
-
|
|
78
|
+
x,
|
|
79
|
+
y,
|
|
80
|
+
data: items,
|
|
81
|
+
title,
|
|
82
|
+
position,
|
|
83
|
+
enterable,
|
|
70
84
|
...(render !== undefined && {
|
|
71
|
-
|
|
85
|
+
content: render(event, { items, title }),
|
|
72
86
|
}),
|
|
73
87
|
});
|
|
74
88
|
container.tooltipElement = tooltipElement;
|
|
@@ -270,6 +284,8 @@ export function seriesTooltip(
|
|
|
270
284
|
startY = 0,
|
|
271
285
|
body = true,
|
|
272
286
|
single = true,
|
|
287
|
+
position,
|
|
288
|
+
enterable,
|
|
273
289
|
}: Record<string, any>,
|
|
274
290
|
) {
|
|
275
291
|
const elements = elementsof(root);
|
|
@@ -352,7 +368,7 @@ export function seriesTooltip(
|
|
|
352
368
|
(event) => {
|
|
353
369
|
const mouse = mousePosition(root, event);
|
|
354
370
|
if (!mouse) return;
|
|
355
|
-
const bbox = root.
|
|
371
|
+
const bbox = root.getRenderBounds();
|
|
356
372
|
const x = bbox.min[0];
|
|
357
373
|
const y = bbox.min[1];
|
|
358
374
|
const focus = [mouse[0] - startX, mouse[1] - startY];
|
|
@@ -403,15 +419,17 @@ export function seriesTooltip(
|
|
|
403
419
|
}
|
|
404
420
|
|
|
405
421
|
if (body) {
|
|
406
|
-
showTooltip(
|
|
422
|
+
showTooltip({
|
|
407
423
|
root,
|
|
408
|
-
tooltipData,
|
|
409
|
-
mouse[0] + x,
|
|
410
|
-
mouse[1] + y,
|
|
424
|
+
data: tooltipData,
|
|
425
|
+
x: mouse[0] + x,
|
|
426
|
+
y: mouse[1] + y,
|
|
411
427
|
render,
|
|
412
428
|
event,
|
|
413
429
|
single,
|
|
414
|
-
|
|
430
|
+
position,
|
|
431
|
+
enterable,
|
|
432
|
+
});
|
|
415
433
|
}
|
|
416
434
|
|
|
417
435
|
if (crosshairs) {
|
|
@@ -441,8 +459,8 @@ export function seriesTooltip(
|
|
|
441
459
|
root.addEventListener('pointerleave', hide);
|
|
442
460
|
|
|
443
461
|
return () => {
|
|
444
|
-
root.removeEventListener('
|
|
445
|
-
root.removeEventListener('
|
|
462
|
+
root.removeEventListener('pointerenter', update);
|
|
463
|
+
root.removeEventListener('pointermove', update);
|
|
446
464
|
root.removeEventListener('pointerleave', hide);
|
|
447
465
|
destroyTooltip(root);
|
|
448
466
|
if (crosshairs) hideRuleY(root);
|
|
@@ -466,6 +484,8 @@ export function tooltip(
|
|
|
466
484
|
trailing = false,
|
|
467
485
|
groupKey = (d) => d, // group elements by specified key
|
|
468
486
|
single = true,
|
|
487
|
+
position,
|
|
488
|
+
enterable,
|
|
469
489
|
}: Record<string, any>,
|
|
470
490
|
) {
|
|
471
491
|
const elements = elementsof(root);
|
|
@@ -497,7 +517,17 @@ export function tooltip(
|
|
|
497
517
|
}
|
|
498
518
|
|
|
499
519
|
const { offsetX, offsetY } = event;
|
|
500
|
-
showTooltip(
|
|
520
|
+
showTooltip({
|
|
521
|
+
root,
|
|
522
|
+
data,
|
|
523
|
+
x: offsetX,
|
|
524
|
+
y: offsetY,
|
|
525
|
+
render,
|
|
526
|
+
event,
|
|
527
|
+
single,
|
|
528
|
+
position,
|
|
529
|
+
enterable,
|
|
530
|
+
});
|
|
501
531
|
},
|
|
502
532
|
wait,
|
|
503
533
|
{ leading, trailing },
|
package/src/interaction/utils.ts
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
import { isOrdinalScale } from '../utils/scale';
|
|
13
13
|
import { rect } from '../shape/interval/color';
|
|
14
14
|
import { isPolar, isTranspose } from '../utils/coordinate';
|
|
15
|
+
import { getStyle } from '../utils/style';
|
|
15
16
|
import { reorder } from '../shape/utils';
|
|
16
17
|
import { angle, angleBetween, sub } from '../utils/vector';
|
|
17
18
|
|
|
@@ -43,7 +44,7 @@ export function selectPlotArea(root: DisplayObject): DisplayObject {
|
|
|
43
44
|
|
|
44
45
|
export function mousePosition(target, event) {
|
|
45
46
|
const { offsetX, offsetY } = event;
|
|
46
|
-
const bbox = target.
|
|
47
|
+
const bbox = target.getRenderBounds();
|
|
47
48
|
const {
|
|
48
49
|
min: [x, y],
|
|
49
50
|
max: [x1, y1],
|
|
@@ -129,7 +130,7 @@ export function useState(
|
|
|
129
130
|
);
|
|
130
131
|
if (Object.keys(stateStyle).length === 0) return;
|
|
131
132
|
for (const [key, value] of Object.entries(stateStyle)) {
|
|
132
|
-
const currentValue = element
|
|
133
|
+
const currentValue = getStyle(element, key);
|
|
133
134
|
const v = valueof(value, element);
|
|
134
135
|
setAttribute(element, key, v);
|
|
135
136
|
// Store the attribute if it does not exist in original.
|
|
@@ -160,7 +161,7 @@ export function useState(
|
|
|
160
161
|
initState(element);
|
|
161
162
|
for (const state of states) {
|
|
162
163
|
const index = element[STATES].indexOf(state);
|
|
163
|
-
if (
|
|
164
|
+
if (index !== -1) {
|
|
164
165
|
element[STATES].splice(index, 1);
|
|
165
166
|
}
|
|
166
167
|
}
|
|
@@ -415,6 +416,7 @@ export function renderBackground({
|
|
|
415
416
|
fillOpacity = 0.3,
|
|
416
417
|
zIndex = -2,
|
|
417
418
|
padding = 0.001,
|
|
419
|
+
strokeWidth = 0,
|
|
418
420
|
...style
|
|
419
421
|
} = mapObject(rest, (d) => valueof(d, element));
|
|
420
422
|
const finalStyle = {
|
|
@@ -423,6 +425,7 @@ export function renderBackground({
|
|
|
423
425
|
fillOpacity,
|
|
424
426
|
zIndex,
|
|
425
427
|
padding,
|
|
428
|
+
strokeWidth,
|
|
426
429
|
};
|
|
427
430
|
const shapeOf = isOrdinalShape() ? bandShapeOf : cloneShapeOf;
|
|
428
431
|
const shape = shapeOf(element, finalStyle);
|
|
@@ -2,6 +2,7 @@ import { DisplayObject } from '@antv/g';
|
|
|
2
2
|
import { OverflowHideLabelTransform } from '../spec';
|
|
3
3
|
import { LabelTransformComponent as LLC } from '../runtime';
|
|
4
4
|
import { isOverflow, parseAABB } from '../utils/bounds';
|
|
5
|
+
import { hide, show } from '../utils/style';
|
|
5
6
|
|
|
6
7
|
export type OverflowHideOptions = Omit<OverflowHideLabelTransform, 'type'>;
|
|
7
8
|
|
|
@@ -11,12 +12,11 @@ export type OverflowHideOptions = Omit<OverflowHideLabelTransform, 'type'>;
|
|
|
11
12
|
export const OverflowHide: LLC<OverflowHideOptions> = (options) => {
|
|
12
13
|
return (labels: DisplayObject[], coordinate) => {
|
|
13
14
|
labels.forEach((l) => {
|
|
14
|
-
l
|
|
15
|
-
|
|
15
|
+
show(l);
|
|
16
16
|
const bounds = l.attr('bounds');
|
|
17
17
|
const b = l.getLocalBounds();
|
|
18
18
|
const overflow = isOverflow(parseAABB(b), bounds);
|
|
19
|
-
if (overflow) l
|
|
19
|
+
if (overflow) hide(l);
|
|
20
20
|
});
|
|
21
21
|
return labels;
|
|
22
22
|
};
|
|
@@ -2,6 +2,7 @@ import { DisplayObject } from '@antv/g';
|
|
|
2
2
|
import { LabelTransformComponent as LLC } from '../runtime';
|
|
3
3
|
import { OverlapHideLabelTransform } from '../spec';
|
|
4
4
|
import { isOverlap, parseAABB } from '../utils/bounds';
|
|
5
|
+
import { hide, show } from '../utils/style';
|
|
5
6
|
|
|
6
7
|
export type OverlapHideOptions = Omit<OverlapHideLabelTransform, 'type'>;
|
|
7
8
|
|
|
@@ -16,14 +17,14 @@ export const OverlapHide: LLC<OverlapHideOptions> = (options) => {
|
|
|
16
17
|
if (priority) labels.sort(priority);
|
|
17
18
|
|
|
18
19
|
labels.forEach((l) => {
|
|
19
|
-
l
|
|
20
|
+
show(l);
|
|
20
21
|
|
|
21
22
|
const b1 = l.getLocalBounds();
|
|
22
23
|
const overlaping = displayLabels.some((dl) =>
|
|
23
24
|
isOverlap(parseAABB(b1), parseAABB(dl.getLocalBounds())),
|
|
24
25
|
);
|
|
25
26
|
|
|
26
|
-
if (overlaping) l
|
|
27
|
+
if (overlaping) hide(l);
|
|
27
28
|
else displayLabels.push(l);
|
|
28
29
|
});
|
|
29
30
|
|
package/src/mark/boxplot.ts
CHANGED
|
@@ -66,7 +66,7 @@ export const Boxplot: CC<BoxPlotOptions> = (options) => {
|
|
|
66
66
|
animate,
|
|
67
67
|
...rest
|
|
68
68
|
} = options;
|
|
69
|
-
const {
|
|
69
|
+
const { point = true, ...restStyle } = style;
|
|
70
70
|
const { y } = encode;
|
|
71
71
|
const encodeY = { y, y1: y, y2: y, y3: y, y4: y };
|
|
72
72
|
const qy = { y1: q1, y2: q2, y3: q3 };
|
|
@@ -93,7 +93,7 @@ export const Boxplot: CC<BoxPlotOptions> = (options) => {
|
|
|
93
93
|
|
|
94
94
|
// Only show min and max instead of lower and upper.
|
|
95
95
|
// Only draw a box.
|
|
96
|
-
if (
|
|
96
|
+
if (!point) {
|
|
97
97
|
return [
|
|
98
98
|
{
|
|
99
99
|
type: 'box',
|
package/src/mark/gauge.ts
CHANGED
|
@@ -51,7 +51,7 @@ function dataTransform(data, scale) {
|
|
|
51
51
|
|
|
52
52
|
function getTextContent(textStyle, { target, total }) {
|
|
53
53
|
const { content } = textStyle;
|
|
54
|
-
return content ? content(target, total) : target;
|
|
54
|
+
return content ? content(target, total) : target.toString();
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
const indicatorShape: SC<ColorOptions> = (options) => {
|
|
@@ -171,6 +171,7 @@ export const Gauge: CC<GaugeOptions> = (options) => {
|
|
|
171
171
|
scale = {},
|
|
172
172
|
style = {},
|
|
173
173
|
animate = {},
|
|
174
|
+
transform = [],
|
|
174
175
|
...resOptions
|
|
175
176
|
} = options;
|
|
176
177
|
const {
|
package/src/mark/sankey.ts
CHANGED
|
@@ -48,7 +48,7 @@ export const Sankey: CC<SankeyOptions> = (options) => {
|
|
|
48
48
|
},
|
|
49
49
|
style: {
|
|
50
50
|
fillOpacity: 0.5,
|
|
51
|
-
stroke:
|
|
51
|
+
stroke: undefined,
|
|
52
52
|
},
|
|
53
53
|
};
|
|
54
54
|
|
|
@@ -137,6 +137,7 @@ export const Sankey: CC<SankeyOptions> = (options) => {
|
|
|
137
137
|
labels: linkLabels,
|
|
138
138
|
style: {
|
|
139
139
|
fill: linkEncode.color ? undefined : '#aaa',
|
|
140
|
+
strokeWidth: 0,
|
|
140
141
|
...subObject(style, 'link'),
|
|
141
142
|
},
|
|
142
143
|
tooltip: linkTooltip,
|
package/src/mark/utils.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { Band } from '@antv/scale';
|
|
2
2
|
import { stratify, hierarchy } from 'd3-hierarchy';
|
|
3
3
|
import { Primitive } from 'd3-array';
|
|
4
|
-
import { deepMix } from '@antv/util';
|
|
5
4
|
import { Vector2 } from '@antv/coord';
|
|
6
5
|
import { Scale } from '../runtime/types/component';
|
|
7
6
|
import { Channel } from '../runtime';
|
|
8
|
-
import { isUnset, subObject } from '../utils/helper';
|
|
9
7
|
|
|
10
8
|
export type ChannelOptions = {
|
|
11
9
|
shapes?: string[];
|
|
@@ -59,11 +57,11 @@ export function baseAnnotationChannels(
|
|
|
59
57
|
}
|
|
60
58
|
|
|
61
59
|
export function basePreInference() {
|
|
62
|
-
return [];
|
|
60
|
+
return [{ type: 'maybeKey' }];
|
|
63
61
|
}
|
|
64
62
|
|
|
65
63
|
export function basePostInference() {
|
|
66
|
-
return [
|
|
64
|
+
return [];
|
|
67
65
|
}
|
|
68
66
|
|
|
69
67
|
export function bandWidth(scale: Band, x: any): number {
|