@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
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
import type { Coordinate } from '@antv/coord';
|
|
2
2
|
import type { DisplayObject } from '@antv/g';
|
|
3
3
|
import { Category } from '@antv/gui';
|
|
4
|
+
import { last } from '@antv/util';
|
|
4
5
|
import { format } from 'd3-format';
|
|
5
6
|
import type {
|
|
6
7
|
FlexLayout,
|
|
7
8
|
G2Library,
|
|
9
|
+
G2MarkState,
|
|
8
10
|
G2Theme,
|
|
9
11
|
GuideComponentComponent as GCC,
|
|
10
12
|
GuideComponentOrientation as GCO,
|
|
11
13
|
GuideComponentPosition as GCP,
|
|
12
14
|
Scale,
|
|
13
15
|
} from '../runtime';
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import
|
|
16
|
+
import { GuideComponentContext } from '../runtime/types/component';
|
|
17
|
+
import type { G2Mark } from '../runtime/types/options';
|
|
18
|
+
import { useMarker } from '../utils/marker';
|
|
17
19
|
import {
|
|
20
|
+
adaptor,
|
|
18
21
|
domainOf,
|
|
19
22
|
G2Layout,
|
|
20
23
|
inferComponentLayout,
|
|
@@ -64,45 +67,64 @@ function createShape(
|
|
|
64
67
|
theme: G2Theme,
|
|
65
68
|
style: Record<string, any> = {},
|
|
66
69
|
) {
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
);
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
70
|
+
const marker =
|
|
71
|
+
(library[`shape.${shape}`]?.props?.defaultMarker as string) ||
|
|
72
|
+
last(shape.split('.'));
|
|
73
|
+
return () => useMarker(marker, style)(0, 0, 6);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function inferShape(scales: Scale[], markState: Map<G2Mark, G2MarkState>) {
|
|
77
|
+
const shapeScale = scaleOf(scales, 'shape');
|
|
78
|
+
const colorScale = scaleOf(scales, 'color');
|
|
79
|
+
// infer the main shape if multiple marks are used
|
|
80
|
+
const shapes: [string, string[]][] = [];
|
|
81
|
+
for (const [mark, state] of markState) {
|
|
82
|
+
const namespace = mark.type;
|
|
83
|
+
const domain =
|
|
84
|
+
colorScale?.getOptions().domain.length > 0
|
|
85
|
+
? colorScale?.getOptions().domain
|
|
86
|
+
: state.data;
|
|
87
|
+
const shape: string[] = domain.map((d, i) => {
|
|
88
|
+
if (shapeScale) return shapeScale.map(d || 'point');
|
|
89
|
+
return mark?.style?.shape || state.defaultShape || 'point';
|
|
90
|
+
});
|
|
91
|
+
if (typeof namespace === 'string') shapes.push([namespace, shape]);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (shapes.length === 0) return ['point', ['point']];
|
|
95
|
+
if (shapes.length === 1) return shapes[0];
|
|
96
|
+
if (!shapeScale) return shapes[0];
|
|
97
|
+
// Evaluate the maximum likelihood of shape
|
|
98
|
+
const { range } = shapeScale.getOptions();
|
|
99
|
+
return shapes
|
|
100
|
+
.map(([namespace, shape]) => {
|
|
101
|
+
let sum = 0;
|
|
102
|
+
for (let i = 0; i < shapes.length; i++) {
|
|
103
|
+
const targetShape = range[i % range.length];
|
|
104
|
+
if (shape[i] === targetShape) sum++;
|
|
105
|
+
}
|
|
106
|
+
return [sum / shape.length, [namespace, shape]] as const;
|
|
107
|
+
})
|
|
108
|
+
.sort((a, b) => b[0] - a[0])[0][1];
|
|
81
109
|
}
|
|
82
110
|
|
|
83
111
|
function inferItemMarker(
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
library: G2Library,
|
|
87
|
-
coordinate: Coordinate,
|
|
88
|
-
theme: G2Theme,
|
|
112
|
+
options,
|
|
113
|
+
{ scales, library, coordinate, theme, markState }: GuideComponentContext,
|
|
89
114
|
): ((datum: any, i: number, data: any) => () => DisplayObject) | undefined {
|
|
90
115
|
const shapeScale = scaleOf(scales, 'shape');
|
|
116
|
+
const [namespace, shapes] = inferShape(scales, markState);
|
|
91
117
|
|
|
92
118
|
const { itemMarker } = options;
|
|
93
119
|
if (shapeScale && !itemMarker) {
|
|
94
|
-
const { domain } = shapeScale.getOptions();
|
|
95
|
-
|
|
96
120
|
return (d, i) =>
|
|
97
|
-
createShape(
|
|
121
|
+
createShape(`${namespace}.${shapes[i]}`, library, coordinate, theme, {
|
|
98
122
|
color: d.color,
|
|
99
123
|
});
|
|
100
124
|
}
|
|
101
|
-
if (typeof itemMarker === 'function')
|
|
102
|
-
return itemMarker;
|
|
103
|
-
}
|
|
125
|
+
if (typeof itemMarker === 'function') return itemMarker;
|
|
104
126
|
return (d, i) =>
|
|
105
|
-
createShape(itemMarker ||
|
|
127
|
+
createShape(itemMarker || shapes[i], library, coordinate, theme, {
|
|
106
128
|
color: d.color,
|
|
107
129
|
});
|
|
108
130
|
}
|
|
@@ -124,17 +146,11 @@ function inferItemMarkerSize(scales: Scale[]) {
|
|
|
124
146
|
return 8;
|
|
125
147
|
}
|
|
126
148
|
|
|
127
|
-
function inferCategoryStyle(
|
|
128
|
-
scales: Scale[],
|
|
129
|
-
options: LegendCategoryOptions,
|
|
130
|
-
library: G2Library,
|
|
131
|
-
coordinate: Coordinate,
|
|
132
|
-
theme: G2Theme,
|
|
133
|
-
) {
|
|
149
|
+
function inferCategoryStyle(options, context: GuideComponentContext) {
|
|
134
150
|
const { labelFormatter = (d) => `${d}` } = options;
|
|
135
|
-
|
|
151
|
+
const { scales } = context;
|
|
136
152
|
const baseStyle = {
|
|
137
|
-
itemMarker: inferItemMarker(
|
|
153
|
+
itemMarker: inferItemMarker(options, context),
|
|
138
154
|
itemMarkerSize: inferItemMarkerSize(scales),
|
|
139
155
|
itemMarkerOpacity: inferItemMarkerOpacity(scales),
|
|
140
156
|
};
|
|
@@ -179,24 +195,21 @@ function inferLegendShape(
|
|
|
179
195
|
*/
|
|
180
196
|
export const LegendCategory: GCC<LegendCategoryOptions> = (options) => {
|
|
181
197
|
const {
|
|
198
|
+
labelFormatter,
|
|
199
|
+
layout,
|
|
182
200
|
order,
|
|
183
|
-
size,
|
|
184
|
-
position,
|
|
185
201
|
orientation,
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
dx = 0,
|
|
189
|
-
dy = 0,
|
|
202
|
+
position,
|
|
203
|
+
size,
|
|
190
204
|
title,
|
|
191
|
-
|
|
192
|
-
gridRow,
|
|
193
|
-
layout,
|
|
194
|
-
...rest
|
|
205
|
+
...style
|
|
195
206
|
} = options;
|
|
196
207
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
208
|
+
const { gridCol, gridRow } = style;
|
|
209
|
+
|
|
210
|
+
return (context) => {
|
|
211
|
+
const { value, theme } = context;
|
|
212
|
+
const { bbox } = value;
|
|
200
213
|
const { width, height } = inferLegendShape(value, options, LegendCategory);
|
|
201
214
|
|
|
202
215
|
const finalLayout = inferComponentLayout(
|
|
@@ -211,7 +224,7 @@ export const LegendCategory: GCC<LegendCategoryOptions> = (options) => {
|
|
|
211
224
|
);
|
|
212
225
|
|
|
213
226
|
const legendStyle = {
|
|
214
|
-
|
|
227
|
+
orientation: ['right', 'left', 'center'].includes(position)
|
|
215
228
|
? 'vertical'
|
|
216
229
|
: 'horizontal',
|
|
217
230
|
width,
|
|
@@ -221,14 +234,14 @@ export const LegendCategory: GCC<LegendCategoryOptions> = (options) => {
|
|
|
221
234
|
rowPadding: 0,
|
|
222
235
|
colPadding: 8,
|
|
223
236
|
titleText: titleContent(title),
|
|
224
|
-
...inferCategoryStyle(
|
|
237
|
+
...inferCategoryStyle(options, context),
|
|
225
238
|
};
|
|
226
239
|
|
|
227
240
|
const { legend: legendTheme = {} } = theme;
|
|
228
241
|
const layoutWrapper = new G2Layout({
|
|
229
242
|
style: {
|
|
230
|
-
x: x
|
|
231
|
-
y: y
|
|
243
|
+
x: bbox.x,
|
|
244
|
+
y: bbox.y,
|
|
232
245
|
width: bbox.width,
|
|
233
246
|
height: bbox.height,
|
|
234
247
|
...finalLayout,
|
|
@@ -238,7 +251,7 @@ export const LegendCategory: GCC<LegendCategoryOptions> = (options) => {
|
|
|
238
251
|
layoutWrapper.appendChild(
|
|
239
252
|
new Category({
|
|
240
253
|
className: 'legend-category',
|
|
241
|
-
style: Object.assign({}, legendTheme, legendStyle,
|
|
254
|
+
style: adaptor(Object.assign({}, legendTheme, legendStyle, style)),
|
|
242
255
|
}),
|
|
243
256
|
);
|
|
244
257
|
return layoutWrapper;
|
|
@@ -8,6 +8,7 @@ import type {
|
|
|
8
8
|
Scale,
|
|
9
9
|
} from '../runtime';
|
|
10
10
|
import {
|
|
11
|
+
adaptor,
|
|
11
12
|
G2Layout,
|
|
12
13
|
inferComponentLayout,
|
|
13
14
|
inferComponentShape,
|
|
@@ -31,13 +32,13 @@ function inferContinuousConfig(
|
|
|
31
32
|
const colorScale = scaleOf(scales, 'color');
|
|
32
33
|
const { domain, range } = colorScale.getOptions();
|
|
33
34
|
const [min, max] = [domain[0], domain.slice(-1)[0]];
|
|
34
|
-
const {
|
|
35
|
+
const { orientation, width, height, length } = inferComponentShape(
|
|
35
36
|
value,
|
|
36
37
|
options,
|
|
37
38
|
component,
|
|
38
39
|
);
|
|
39
40
|
|
|
40
|
-
const shape = {
|
|
41
|
+
const shape = { orientation, width, height };
|
|
41
42
|
|
|
42
43
|
if (colorScale instanceof Threshold) {
|
|
43
44
|
const thresholds = (colorScale as any).thresholds as number[];
|
|
@@ -90,8 +91,6 @@ function inferContinuousConfig(
|
|
|
90
91
|
*/
|
|
91
92
|
export const LegendContinuous: GCC<LegendContinuousOptions> = (options) => {
|
|
92
93
|
const {
|
|
93
|
-
dx = 0,
|
|
94
|
-
dy = 0,
|
|
95
94
|
labelFormatter,
|
|
96
95
|
layout,
|
|
97
96
|
order,
|
|
@@ -99,9 +98,10 @@ export const LegendContinuous: GCC<LegendContinuousOptions> = (options) => {
|
|
|
99
98
|
position,
|
|
100
99
|
size,
|
|
101
100
|
title,
|
|
101
|
+
style,
|
|
102
102
|
...rest
|
|
103
103
|
} = options;
|
|
104
|
-
return (scales, value,
|
|
104
|
+
return ({ scales, value, theme }) => {
|
|
105
105
|
const { bbox } = value;
|
|
106
106
|
const { x, y, width, height } = bbox;
|
|
107
107
|
|
|
@@ -111,8 +111,8 @@ export const LegendContinuous: GCC<LegendContinuousOptions> = (options) => {
|
|
|
111
111
|
);
|
|
112
112
|
const layoutWrapper = new G2Layout({
|
|
113
113
|
style: {
|
|
114
|
-
x
|
|
115
|
-
y
|
|
114
|
+
x,
|
|
115
|
+
y,
|
|
116
116
|
width,
|
|
117
117
|
height,
|
|
118
118
|
...finalLayout,
|
|
@@ -123,22 +123,30 @@ export const LegendContinuous: GCC<LegendContinuousOptions> = (options) => {
|
|
|
123
123
|
|
|
124
124
|
layoutWrapper.appendChild(
|
|
125
125
|
new Continuous({
|
|
126
|
-
style:
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
126
|
+
style: adaptor(
|
|
127
|
+
Object.assign(
|
|
128
|
+
{},
|
|
129
|
+
legendTheme,
|
|
130
|
+
{
|
|
131
|
+
titleText: titleContent(title),
|
|
132
|
+
titleFontSize: 12,
|
|
133
|
+
handle: false,
|
|
134
|
+
indicator: false,
|
|
135
|
+
labelAlign: 'value',
|
|
136
|
+
labelFormatter:
|
|
137
|
+
typeof labelFormatter === 'string'
|
|
138
|
+
? (d) => format(labelFormatter)(d.label)
|
|
139
|
+
: labelFormatter,
|
|
140
|
+
...inferContinuousConfig(
|
|
141
|
+
scales,
|
|
142
|
+
value,
|
|
143
|
+
options,
|
|
144
|
+
LegendContinuous,
|
|
145
|
+
),
|
|
146
|
+
...style,
|
|
147
|
+
},
|
|
148
|
+
rest,
|
|
149
|
+
),
|
|
142
150
|
),
|
|
143
151
|
}),
|
|
144
152
|
);
|
|
@@ -7,11 +7,7 @@ export const LegendContinuousBlockSize: GCC<
|
|
|
7
7
|
LegendContinuousBlockSizeOptions
|
|
8
8
|
> = (options) => {
|
|
9
9
|
return LegendContinuous(
|
|
10
|
-
Object.assign(
|
|
11
|
-
{},
|
|
12
|
-
{ type: 'size', block: true, labelShowTick: false },
|
|
13
|
-
options,
|
|
14
|
-
),
|
|
10
|
+
Object.assign({}, { type: 'size', block: true, tick: false }, options),
|
|
15
11
|
);
|
|
16
12
|
};
|
|
17
13
|
|
|
@@ -2,7 +2,7 @@ import { Scrollbar as ScrollbarComponent } from '@antv/gui';
|
|
|
2
2
|
import { GuideComponentComponent as GCC } from '../runtime';
|
|
3
3
|
|
|
4
4
|
export type ScrollbarOptions = {
|
|
5
|
-
|
|
5
|
+
orientation: 'horizontal' | 'vertical';
|
|
6
6
|
[key: string]: any;
|
|
7
7
|
};
|
|
8
8
|
|
|
@@ -10,9 +10,9 @@ export type ScrollbarOptions = {
|
|
|
10
10
|
* Scrollbar component.
|
|
11
11
|
*/
|
|
12
12
|
export const Scrollbar: GCC<ScrollbarOptions> = (options) => {
|
|
13
|
-
const {
|
|
13
|
+
const { orientation, labelFormatter, style, ...rest } = options;
|
|
14
14
|
|
|
15
|
-
return (
|
|
15
|
+
return ({ value, theme }) => {
|
|
16
16
|
const { bbox } = value;
|
|
17
17
|
const { x, y, width, height } = bbox;
|
|
18
18
|
const { scrollbar: scrollbarTheme = {} } = theme;
|
|
@@ -23,13 +23,13 @@ export const Scrollbar: GCC<ScrollbarOptions> = (options) => {
|
|
|
23
23
|
...style,
|
|
24
24
|
x,
|
|
25
25
|
y,
|
|
26
|
-
trackLength:
|
|
26
|
+
trackLength: orientation === 'horizontal' ? width : height,
|
|
27
27
|
...rest,
|
|
28
|
-
|
|
28
|
+
orientation,
|
|
29
29
|
value: 0,
|
|
30
30
|
// @todo Get actual length of content.
|
|
31
31
|
contentLength: 1500,
|
|
32
|
-
viewportLength:
|
|
32
|
+
viewportLength: orientation === 'horizontal' ? width : height,
|
|
33
33
|
}),
|
|
34
34
|
});
|
|
35
35
|
};
|
|
@@ -7,7 +7,7 @@ export type ScrollbarXOptions = ScrollbarOptions;
|
|
|
7
7
|
* ScrollbarX component.
|
|
8
8
|
*/
|
|
9
9
|
export const ScrollbarX: GCC<ScrollbarXOptions> = (options) => {
|
|
10
|
-
return Scrollbar({ ...options,
|
|
10
|
+
return Scrollbar({ ...options, orientation: 'horizontal' });
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
ScrollbarX.props = {
|
|
@@ -7,7 +7,7 @@ export type ScrollbarYOptions = ScrollbarOptions;
|
|
|
7
7
|
* ScrollbarY component.
|
|
8
8
|
*/
|
|
9
9
|
export const ScrollbarY: GCC<ScrollbarYOptions> = (options) => {
|
|
10
|
-
return Scrollbar({ ...options,
|
|
10
|
+
return Scrollbar({ ...options, orientation: 'vertical' });
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
ScrollbarY.props = {
|
package/src/component/slider.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { Slider as SliderComponent } from '@antv/gui';
|
|
2
2
|
import { format } from 'd3-format';
|
|
3
|
-
import {
|
|
4
|
-
import { GuideComponentComponent as GCC, Scale } from '../runtime';
|
|
3
|
+
import { GuideComponentComponent as GCC } from '../runtime';
|
|
5
4
|
import { invert } from '../utils/scale';
|
|
6
5
|
|
|
7
6
|
export type SliderOptions = {
|
|
8
|
-
|
|
7
|
+
orientation: 'horizontal' | 'vertical';
|
|
9
8
|
[key: string]: any;
|
|
10
9
|
};
|
|
11
10
|
|
|
@@ -14,13 +13,13 @@ export type SliderOptions = {
|
|
|
14
13
|
*/
|
|
15
14
|
export const Slider: GCC<SliderOptions> = (options) => {
|
|
16
15
|
// do not pass size.
|
|
17
|
-
const {
|
|
16
|
+
const { orientation, labelFormatter, size, style, ...rest } = options;
|
|
18
17
|
|
|
19
|
-
return ([scale], value,
|
|
18
|
+
return ({ scales: [scale], value, theme }) => {
|
|
20
19
|
const { bbox } = value;
|
|
21
20
|
const { x, y, width, height } = bbox;
|
|
22
21
|
const { slider: sliderTheme = {} } = theme;
|
|
23
|
-
const defaultFormatter = scale.getFormatter?.() || ((v) => v);
|
|
22
|
+
const defaultFormatter = scale.getFormatter?.() || ((v) => v.toString());
|
|
24
23
|
const formatter =
|
|
25
24
|
typeof labelFormatter === 'string'
|
|
26
25
|
? format(labelFormatter)
|
|
@@ -31,8 +30,8 @@ export const Slider: GCC<SliderOptions> = (options) => {
|
|
|
31
30
|
style: Object.assign({}, sliderTheme, {
|
|
32
31
|
x,
|
|
33
32
|
y,
|
|
34
|
-
trackLength:
|
|
35
|
-
|
|
33
|
+
trackLength: orientation === 'horizontal' ? width : height,
|
|
34
|
+
orientation,
|
|
36
35
|
formatter: (v) => {
|
|
37
36
|
const f = formatter || defaultFormatter;
|
|
38
37
|
// @todo Pass index to distinguish the left and the right value.
|
package/src/component/sliderX.ts
CHANGED
|
@@ -7,7 +7,7 @@ export type SliderXOptions = SliderOptions;
|
|
|
7
7
|
* SliderX component.
|
|
8
8
|
*/
|
|
9
9
|
export const SliderX: GCC<SliderXOptions> = (options) => {
|
|
10
|
-
return Slider({ ...options,
|
|
10
|
+
return Slider({ ...options, orientation: 'horizontal' });
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
SliderX.props = {
|
package/src/component/sliderY.ts
CHANGED
|
@@ -7,7 +7,7 @@ export type SliderYOptions = SliderOptions;
|
|
|
7
7
|
* SliderY component.
|
|
8
8
|
*/
|
|
9
9
|
export const SliderY: GCC<SliderYOptions> = (options) => {
|
|
10
|
-
return Slider({ ...options,
|
|
10
|
+
return Slider({ ...options, orientation: 'vertical' });
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
SliderY.props = {
|
package/src/component/title.ts
CHANGED
|
@@ -17,7 +17,7 @@ function inferStyleByAlign(
|
|
|
17
17
|
x: number,
|
|
18
18
|
y: number,
|
|
19
19
|
width: number,
|
|
20
|
-
align: TitleStyleProps['align'],
|
|
20
|
+
align: TitleStyleProps['style']['align'],
|
|
21
21
|
) {
|
|
22
22
|
switch (align) {
|
|
23
23
|
case 'center':
|
|
@@ -49,9 +49,7 @@ const Title = createComponent<TitleStyleProps>({
|
|
|
49
49
|
width,
|
|
50
50
|
title,
|
|
51
51
|
subtitle,
|
|
52
|
-
spacing = 2,
|
|
53
|
-
align = 'left',
|
|
54
|
-
style,
|
|
52
|
+
style: { spacing = 2, align = 'left', ...style },
|
|
55
53
|
} = attributes;
|
|
56
54
|
|
|
57
55
|
const titleStyle = subObject(style, 'title');
|
|
@@ -88,7 +86,7 @@ const Title = createComponent<TitleStyleProps>({
|
|
|
88
86
|
* Title Component.
|
|
89
87
|
*/
|
|
90
88
|
export const TitleComponent: GCC<TitleComponentOptions> = (options) => {
|
|
91
|
-
return (
|
|
89
|
+
return ({ value, theme }) => {
|
|
92
90
|
const { x, y, width, height } = value.bbox;
|
|
93
91
|
return new Title({
|
|
94
92
|
style: deepMix(
|
package/src/component/utils.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CustomElement, DisplayObjectConfig, Group } from '@antv/g';
|
|
2
2
|
import { Layout } from '@antv/gui';
|
|
3
|
-
import { deepMix } from '@antv/util';
|
|
3
|
+
import { deepMix, upperFirst } from '@antv/util';
|
|
4
4
|
import {
|
|
5
5
|
FlexLayout,
|
|
6
6
|
GuideComponentComponent,
|
|
@@ -120,9 +120,9 @@ export function inferComponentShape(
|
|
|
120
120
|
const { defaultSize, defaultLength } = component.props;
|
|
121
121
|
const size = userDefinedSize || defaultSize || bboxSize;
|
|
122
122
|
const length = userDefinedLength || defaultLength || bboxLength;
|
|
123
|
-
const
|
|
123
|
+
const orientation = isHorizontal ? 'horizontal' : 'vertical';
|
|
124
124
|
const [width, height] = isHorizontal ? [length, size] : [size, length];
|
|
125
|
-
return {
|
|
125
|
+
return { orientation, width, height, size, length };
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
export function domainOf(scales: Scale[]): any[] {
|
|
@@ -131,3 +131,27 @@ export function domainOf(scales: Scale[]): any[] {
|
|
|
131
131
|
.find((scale) => scale.getOptions().domain.length > 0)
|
|
132
132
|
.getOptions().domain;
|
|
133
133
|
}
|
|
134
|
+
|
|
135
|
+
export function adaptor<T>(style: T) {
|
|
136
|
+
const reservedKeys = [
|
|
137
|
+
'arrow',
|
|
138
|
+
'crosshairs',
|
|
139
|
+
'grid',
|
|
140
|
+
'handle',
|
|
141
|
+
'handleLabel',
|
|
142
|
+
'indicator',
|
|
143
|
+
'label',
|
|
144
|
+
'line',
|
|
145
|
+
'tick',
|
|
146
|
+
'tip',
|
|
147
|
+
'title',
|
|
148
|
+
'trunc',
|
|
149
|
+
];
|
|
150
|
+
const finalStyle = {};
|
|
151
|
+
Object.entries(style).forEach(([key, value]) => {
|
|
152
|
+
if (reservedKeys.includes(key))
|
|
153
|
+
finalStyle[`show${upperFirst(key)}`] = value;
|
|
154
|
+
else finalStyle[key] = value;
|
|
155
|
+
});
|
|
156
|
+
return finalStyle as T;
|
|
157
|
+
}
|
|
@@ -11,7 +11,7 @@ export const Fisheye: CC<FisheyeOptions> = ({
|
|
|
11
11
|
focusY = 0,
|
|
12
12
|
distortionX = 2,
|
|
13
13
|
distortionY = 2,
|
|
14
|
-
|
|
15
|
-
}) => [['fisheye', focusX, focusY, distortionX, distortionY,
|
|
14
|
+
visual = false,
|
|
15
|
+
}) => [['fisheye', focusX, focusY, distortionX, distortionY, visual]];
|
|
16
16
|
|
|
17
17
|
Fisheye.props = { transform: true };
|
|
Binary file
|
package/src/geo/geoView.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -104,8 +104,8 @@ export function BrushFilter({ hideX = true, hideY = true, ...rest }) {
|
|
|
104
104
|
{
|
|
105
105
|
// Hide label to keep smooth transition.
|
|
106
106
|
axis: {
|
|
107
|
-
...(hideX && { x: {
|
|
108
|
-
...(hideY && { y: {
|
|
107
|
+
...(hideX && { x: { transform: [{ type: 'hide' }] } }),
|
|
108
|
+
...(hideY && { y: { transform: [{ type: 'hide' }] } }),
|
|
109
109
|
},
|
|
110
110
|
},
|
|
111
111
|
mark,
|
|
@@ -83,8 +83,11 @@ export function brush(
|
|
|
83
83
|
mask = new Rect({
|
|
84
84
|
// @ts-ignore
|
|
85
85
|
style: {
|
|
86
|
+
x: 0,
|
|
87
|
+
y: 0,
|
|
88
|
+
width: 0,
|
|
89
|
+
height: 0,
|
|
86
90
|
draggable: true,
|
|
87
|
-
fill: 'transparent',
|
|
88
91
|
},
|
|
89
92
|
className: 'mask',
|
|
90
93
|
});
|
|
@@ -96,6 +99,8 @@ export function brush(
|
|
|
96
99
|
mask = new Rect({
|
|
97
100
|
// @ts-ignore
|
|
98
101
|
style: {
|
|
102
|
+
x: 0,
|
|
103
|
+
y: 0,
|
|
99
104
|
...style,
|
|
100
105
|
fill,
|
|
101
106
|
fillOpacity,
|
|
@@ -305,8 +310,8 @@ export function brushHighlight(
|
|
|
305
310
|
const {
|
|
306
311
|
width: rootWidth,
|
|
307
312
|
height: rootHeight,
|
|
308
|
-
x: ordinalX,
|
|
309
|
-
y: ordinalY,
|
|
313
|
+
x: ordinalX = 0,
|
|
314
|
+
y: ordinalY = 0,
|
|
310
315
|
} = bboxOf(root);
|
|
311
316
|
const extent = optionalExtent
|
|
312
317
|
? optionalExtent
|
|
@@ -3,15 +3,15 @@ import { deepMix } from '@antv/util';
|
|
|
3
3
|
import { group } from 'd3-array';
|
|
4
4
|
import { subObject } from '../utils/helper';
|
|
5
5
|
import {
|
|
6
|
-
createValueof,
|
|
7
6
|
createDatumof,
|
|
8
|
-
|
|
9
|
-
useState,
|
|
10
|
-
renderLink,
|
|
11
|
-
renderBackground,
|
|
12
|
-
selectPlotArea,
|
|
7
|
+
createValueof,
|
|
13
8
|
mergeState,
|
|
14
9
|
offsetTransform,
|
|
10
|
+
renderBackground,
|
|
11
|
+
renderLink,
|
|
12
|
+
selectG2Elements,
|
|
13
|
+
selectPlotArea,
|
|
14
|
+
useState,
|
|
15
15
|
} from './utils';
|
|
16
16
|
|
|
17
17
|
/**
|