@antv/g2 5.4.3 → 5.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/g2.lite.min.js +10 -10
- package/dist/g2.min.js +10 -10
- package/esm/animation/morphing.js.map +1 -1
- package/esm/animation/scaleInY.js.map +1 -1
- package/esm/animation/utils.js.map +1 -1
- package/esm/animation/waveIn.js.map +1 -1
- package/esm/api/composition.js.map +1 -1
- package/esm/api/define.js.map +1 -1
- package/esm/api/mark.js.map +1 -1
- package/esm/api/node.js.map +1 -1
- package/esm/api/runtime.js +6 -2
- package/esm/api/runtime.js.map +1 -1
- package/esm/api/utils.js.map +1 -1
- package/esm/component/axis.js +3 -2
- package/esm/component/axis.js.map +1 -1
- package/esm/component/axisRadar.js.map +1 -1
- package/esm/component/constant.d.ts +8 -0
- package/esm/component/constant.js +10 -0
- package/esm/component/constant.js.map +1 -1
- package/esm/component/legendCategory.js +4 -1
- package/esm/component/legendCategory.js.map +1 -1
- package/esm/component/legendContinuous.js +4 -3
- package/esm/component/legendContinuous.js.map +1 -1
- package/esm/component/scrollbar.js +2 -1
- package/esm/component/scrollbar.js.map +1 -1
- package/esm/component/slider.js.map +1 -1
- package/esm/component/title.js.map +1 -1
- package/esm/component/utils.d.ts +1 -1
- package/esm/component/utils.js.map +1 -1
- package/esm/composition/facetRect.js.map +1 -1
- package/esm/composition/geoView.js.map +1 -1
- package/esm/composition/repeatMatrix.js.map +1 -1
- package/esm/composition/spaceFlex.js.map +1 -1
- package/esm/composition/timingKeyframe.js.map +1 -1
- package/esm/composition/utils.js.map +1 -1
- package/esm/data/cluster.d.ts +1 -1
- package/esm/data/ema.js.map +1 -1
- package/esm/data/fetch.js.map +1 -1
- package/esm/data/pick.js.map +1 -1
- package/esm/data/sankey.js.map +1 -1
- package/esm/data/sortBy.js.map +1 -1
- package/esm/data/utils/arc/arc.d.ts +6 -6
- package/esm/data/utils/arc/arc.js.map +1 -1
- package/esm/data/utils/d3-cloud/index.js.map +1 -1
- package/esm/data/utils/d3-sankey/sankey.d.ts +5 -5
- package/esm/data/utils/d3-sankey/sankey.js.map +1 -1
- package/esm/data/utils/fields.js.map +1 -1
- package/esm/data/utils/memo.js +1 -1
- package/esm/data/utils/memo.js.map +1 -1
- package/esm/data/utils/venn/circleintersection.js.map +1 -1
- package/esm/data/utils/venn/diagram.js.map +1 -1
- package/esm/data/utils/venn/fmin/bisect.js.map +1 -1
- package/esm/data/utils/venn/fmin/blas1.js.map +1 -1
- package/esm/data/utils/venn/fmin/conjugateGradient.js.map +1 -1
- package/esm/data/utils/venn/fmin/gradientDescent.js.map +1 -1
- package/esm/data/utils/venn/fmin/linesearch.js.map +1 -1
- package/esm/data/utils/venn/fmin/nelderMead.js.map +1 -1
- package/esm/data/utils/venn/layout.js.map +1 -1
- package/esm/data/wordCloud.js.map +1 -1
- package/esm/index.d.ts +6 -0
- package/esm/interaction/adaptiveFilter.js.map +1 -1
- package/esm/interaction/brushAxisHighlight.js +1 -1
- package/esm/interaction/brushAxisHighlight.js.map +1 -1
- package/esm/interaction/brushFilter.js.map +1 -1
- package/esm/interaction/brushHighlight.js.map +1 -1
- package/esm/interaction/chartIndex.js.map +1 -1
- package/esm/interaction/drillDown.d.ts +6 -0
- package/esm/interaction/drillDown.js +210 -0
- package/esm/interaction/drillDown.js.map +1 -0
- package/esm/interaction/elementHighlight.js.map +1 -1
- package/esm/interaction/elementHoverScale.d.ts +23 -0
- package/esm/interaction/elementHoverScale.js +222 -0
- package/esm/interaction/elementHoverScale.js.map +1 -0
- package/esm/interaction/elementPointMove.js.map +1 -1
- package/esm/interaction/elementSelect.js.map +1 -1
- package/esm/interaction/event.js +10 -2
- package/esm/interaction/event.js.map +1 -1
- package/esm/interaction/fisheye.js.map +1 -1
- package/esm/interaction/index.d.ts +2 -0
- package/esm/interaction/index.js +2 -0
- package/esm/interaction/index.js.map +1 -1
- package/esm/interaction/legendFilter.js +38 -16
- package/esm/interaction/legendFilter.js.map +1 -1
- package/esm/interaction/legendHighlight.js.map +1 -1
- package/esm/interaction/poptip.js.map +1 -1
- package/esm/interaction/scrollbarFilter.js +2 -1
- package/esm/interaction/scrollbarFilter.js.map +1 -1
- package/esm/interaction/sliderFilter.js.map +1 -1
- package/esm/interaction/sliderWheel.js.map +1 -1
- package/esm/interaction/tooltip.js +6 -5
- package/esm/interaction/tooltip.js.map +1 -1
- package/esm/interaction/treemapDrillDown.js.map +1 -1
- package/esm/interaction/utils.d.ts +16 -2
- package/esm/interaction/utils.js +57 -9
- package/esm/interaction/utils.js.map +1 -1
- package/esm/label-transform/exceedAdjust.js +17 -0
- package/esm/label-transform/exceedAdjust.js.map +1 -1
- package/esm/label-transform/overflowStroke.js.map +1 -1
- package/esm/label-transform/overlapDodgeY.js.map +1 -1
- package/esm/lib/core.d.ts +3 -1
- package/esm/lib/core.js +3 -1
- package/esm/lib/core.js.map +1 -1
- package/esm/lib/graph.d.ts +1 -0
- package/esm/lib/graph.js +2 -1
- package/esm/lib/graph.js.map +1 -1
- package/esm/lib/std.d.ts +3 -0
- package/esm/mark/area.js.map +1 -1
- package/esm/mark/box.js +3 -3
- package/esm/mark/box.js.map +1 -1
- package/esm/mark/boxplot.js.map +1 -1
- package/esm/mark/chord.js +2 -2
- package/esm/mark/chord.js.map +1 -1
- package/esm/mark/density.js +1 -1
- package/esm/mark/density.js.map +1 -1
- package/esm/mark/gauge.js.map +1 -1
- package/esm/mark/index.d.ts +1 -0
- package/esm/mark/index.js +1 -0
- package/esm/mark/index.js.map +1 -1
- package/esm/mark/line.js.map +1 -1
- package/esm/mark/partition.d.ts +42 -0
- package/esm/mark/partition.js +217 -0
- package/esm/mark/partition.js.map +1 -0
- package/esm/mark/polygon.js.map +1 -1
- package/esm/mark/sankey.js.map +1 -1
- package/esm/mark/utils.js.map +1 -1
- package/esm/runtime/component.js.map +1 -1
- package/esm/runtime/coordinate.js.map +1 -1
- package/esm/runtime/layout.js.map +1 -1
- package/esm/runtime/mark.js +2 -2
- package/esm/runtime/mark.js.map +1 -1
- package/esm/runtime/option-preprocess/axis-breaks.js.map +1 -1
- package/esm/runtime/option-preprocess/index.js.map +1 -1
- package/esm/runtime/option-preprocess/style.js.map +1 -1
- package/esm/runtime/plot.js +13 -2
- package/esm/runtime/plot.js.map +1 -1
- package/esm/runtime/render.js.map +1 -1
- package/esm/runtime/scale.js.map +1 -1
- package/esm/runtime/transform.js.map +1 -1
- package/esm/shape/area/curve.js.map +1 -1
- package/esm/shape/axis-breaks/axis-breaks.js.map +1 -1
- package/esm/shape/box/box.js.map +1 -1
- package/esm/shape/box/violin.js.map +1 -1
- package/esm/shape/connector/connector.js.map +1 -1
- package/esm/shape/heatmap/renderer/gradient.js.map +1 -1
- package/esm/shape/heatmap/renderer/index.js.map +1 -1
- package/esm/shape/interval/color.js.map +1 -1
- package/esm/shape/interval/funnel.js.map +1 -1
- package/esm/shape/interval/pyramid.js.map +1 -1
- package/esm/shape/label/label.js.map +1 -1
- package/esm/shape/label/position/default.js.map +1 -1
- package/esm/shape/label/position/outside.js.map +1 -1
- package/esm/shape/label/position/utils.js.map +1 -1
- package/esm/shape/line/curve.js.map +1 -1
- package/esm/shape/line/trail.js.map +1 -1
- package/esm/shape/link/arc.js.map +1 -1
- package/esm/shape/link/vhv.js.map +1 -1
- package/esm/shape/liquid/liquid.js.map +1 -1
- package/esm/shape/liquid/wave.js.map +1 -1
- package/esm/shape/point/color.js.map +1 -1
- package/esm/shape/polygon/polygon.js.map +1 -1
- package/esm/shape/polygon/ribbon.js.map +1 -1
- package/esm/shape/text/advance.d.ts +1 -1
- package/esm/shape/text/advance.js.map +1 -1
- package/esm/shape/utils.js.map +1 -1
- package/esm/shape/vector/vector.js.map +1 -1
- package/esm/spec/interaction.d.ts +23 -2
- package/esm/spec/mark.d.ts +13 -2
- package/esm/theme/create.d.ts +1 -1
- package/esm/theme/create.js +3 -2
- package/esm/theme/create.js.map +1 -1
- package/esm/theme/dark.js +5 -4
- package/esm/theme/dark.js.map +1 -1
- package/esm/transform/diffY.js.map +1 -1
- package/esm/transform/dodgeX.js.map +1 -1
- package/esm/transform/filter.js.map +1 -1
- package/esm/transform/maybeDefaultX.js.map +1 -1
- package/esm/transform/maybeDefaultY.js.map +1 -1
- package/esm/transform/maybeTitle.js.map +1 -1
- package/esm/transform/maybeVisualPosition.js +1 -1
- package/esm/transform/maybeVisualPosition.js.map +1 -1
- package/esm/transform/normalizeY.js.map +1 -1
- package/esm/transform/pack.js.map +1 -1
- package/esm/transform/sample.js.map +1 -1
- package/esm/transform/sort.js.map +1 -1
- package/esm/transform/stackEnter.js.map +1 -1
- package/esm/transform/stackY.js +2 -2
- package/esm/transform/stackY.js.map +1 -1
- package/esm/transform/symmetryY.js.map +1 -1
- package/esm/transform/utils/helper.js.map +1 -1
- package/esm/transform/utils/lttb.js.map +1 -1
- package/esm/transform/utils/order.js.map +1 -1
- package/esm/utils/angle.js.map +1 -1
- package/esm/utils/array.js.map +1 -1
- package/esm/utils/coordinate.d.ts +0 -1
- package/esm/utils/coordinate.js.map +1 -1
- package/esm/utils/expr.js.map +1 -1
- package/esm/utils/helper.js +6 -6
- package/esm/utils/helper.js.map +1 -1
- package/esm/utils/marker.d.ts +1 -1
- package/esm/utils/scale.js.map +1 -1
- package/esm/utils/selection.js.map +1 -1
- package/esm/utils/style.js.map +1 -1
- package/esm/utils/traverse-elements.js.map +1 -1
- package/esm/utils/treeDataTransform.js.map +1 -1
- package/esm/utils/vector.js.map +1 -1
- package/lib/animation/morphing.js.map +1 -1
- package/lib/animation/scaleInY.js.map +1 -1
- package/lib/animation/utils.js +2 -2
- package/lib/animation/utils.js.map +1 -1
- package/lib/animation/waveIn.js.map +1 -1
- package/lib/api/composition.js +2 -2
- package/lib/api/composition.js.map +1 -1
- package/lib/api/define.js +2 -3
- package/lib/api/define.js.map +1 -1
- package/lib/api/extend.js +1 -2
- package/lib/api/extend.js.map +1 -1
- package/lib/api/library.js +2 -2
- package/lib/api/library.js.map +1 -1
- package/lib/api/mark.js +2 -2
- package/lib/api/mark.js.map +1 -1
- package/lib/api/node.js.map +1 -1
- package/lib/api/runtime.js +6 -2
- package/lib/api/runtime.js.map +1 -1
- package/lib/api/utils.js +9 -9
- package/lib/api/utils.js.map +1 -1
- package/lib/component/axis.js +5 -4
- package/lib/component/axis.js.map +1 -1
- package/lib/component/axisRadar.js.map +1 -1
- package/lib/component/axisX.js +2 -2
- package/lib/component/axisX.js.map +1 -1
- package/lib/component/constant.d.ts +8 -0
- package/lib/component/constant.js +12 -1
- package/lib/component/constant.js.map +1 -1
- package/lib/component/legendCategory.js +4 -1
- package/lib/component/legendCategory.js.map +1 -1
- package/lib/component/legendContinuous.js +4 -3
- package/lib/component/legendContinuous.js.map +1 -1
- package/lib/component/scrollbar.js +2 -1
- package/lib/component/scrollbar.js.map +1 -1
- package/lib/component/slider.js.map +1 -1
- package/lib/component/title.js.map +1 -1
- package/lib/component/utils.d.ts +1 -1
- package/lib/component/utils.js +11 -11
- package/lib/component/utils.js.map +1 -1
- package/lib/composition/facetRect.js +2 -2
- package/lib/composition/facetRect.js.map +1 -1
- package/lib/composition/geoView.js +17 -7
- package/lib/composition/geoView.js.map +1 -1
- package/lib/composition/repeatMatrix.js.map +1 -1
- package/lib/composition/spaceFlex.js.map +1 -1
- package/lib/composition/timingKeyframe.js.map +1 -1
- package/lib/composition/utils.js +4 -5
- package/lib/composition/utils.js.map +1 -1
- package/lib/data/cluster.d.ts +1 -1
- package/lib/data/ema.js +2 -2
- package/lib/data/ema.js.map +1 -1
- package/lib/data/fetch.js.map +1 -1
- package/lib/data/filter.js +2 -2
- package/lib/data/filter.js.map +1 -1
- package/lib/data/fold.js +2 -2
- package/lib/data/fold.js.map +1 -1
- package/lib/data/kde.js +2 -2
- package/lib/data/kde.js.map +1 -1
- package/lib/data/pick.js.map +1 -1
- package/lib/data/rename.js +2 -2
- package/lib/data/rename.js.map +1 -1
- package/lib/data/sankey.js.map +1 -1
- package/lib/data/sort.js +2 -2
- package/lib/data/sort.js.map +1 -1
- package/lib/data/sortBy.js.map +1 -1
- package/lib/data/utils/arc/arc.d.ts +6 -6
- package/lib/data/utils/arc/arc.js +18 -9
- package/lib/data/utils/arc/arc.js.map +1 -1
- package/lib/data/utils/arc/sort.js +4 -5
- package/lib/data/utils/arc/sort.js.map +1 -1
- package/lib/data/utils/d3-cloud/index.js +1 -2
- package/lib/data/utils/d3-cloud/index.js.map +1 -1
- package/lib/data/utils/d3-sankey/align.js +4 -5
- package/lib/data/utils/d3-sankey/align.js.map +1 -1
- package/lib/data/utils/d3-sankey/constant.js +1 -2
- package/lib/data/utils/d3-sankey/constant.js.map +1 -1
- package/lib/data/utils/d3-sankey/sankey.d.ts +5 -5
- package/lib/data/utils/d3-sankey/sankey.js +1 -2
- package/lib/data/utils/d3-sankey/sankey.js.map +1 -1
- package/lib/data/utils/fields.js +1 -2
- package/lib/data/utils/fields.js.map +1 -1
- package/lib/data/utils/flow.js +1 -2
- package/lib/data/utils/flow.js.map +1 -1
- package/lib/data/utils/memo.js +4 -5
- package/lib/data/utils/memo.js.map +1 -1
- package/lib/data/utils/venn/circleintersection.js +7 -8
- package/lib/data/utils/venn/circleintersection.js.map +1 -1
- package/lib/data/utils/venn/diagram.js +1 -2
- package/lib/data/utils/venn/diagram.js.map +1 -1
- package/lib/data/utils/venn/fmin/bisect.js +1 -2
- package/lib/data/utils/venn/fmin/bisect.js.map +1 -1
- package/lib/data/utils/venn/fmin/blas1.js +7 -8
- package/lib/data/utils/venn/fmin/blas1.js.map +1 -1
- package/lib/data/utils/venn/fmin/conjugateGradient.js +2 -3
- package/lib/data/utils/venn/fmin/conjugateGradient.js.map +1 -1
- package/lib/data/utils/venn/fmin/gradientDescent.js +2 -3
- package/lib/data/utils/venn/fmin/gradientDescent.js.map +1 -1
- package/lib/data/utils/venn/fmin/linesearch.js +1 -2
- package/lib/data/utils/venn/fmin/linesearch.js.map +1 -1
- package/lib/data/utils/venn/fmin/nelderMead.js +1 -2
- package/lib/data/utils/venn/fmin/nelderMead.js.map +1 -1
- package/lib/data/utils/venn/layout.js +10 -11
- package/lib/data/utils/venn/layout.js.map +1 -1
- package/lib/data/wordCloud.js +3 -3
- package/lib/data/wordCloud.js.map +1 -1
- package/lib/index.d.ts +6 -0
- package/lib/interaction/adaptiveFilter.js +7 -8
- package/lib/interaction/adaptiveFilter.js.map +1 -1
- package/lib/interaction/brushAxisHighlight.js +4 -4
- package/lib/interaction/brushAxisHighlight.js.map +1 -1
- package/lib/interaction/brushFilter.js +2 -3
- package/lib/interaction/brushFilter.js.map +1 -1
- package/lib/interaction/brushHighlight.js +3 -4
- package/lib/interaction/brushHighlight.js.map +1 -1
- package/lib/interaction/brushXFilter.js +1 -2
- package/lib/interaction/brushXFilter.js.map +1 -1
- package/lib/interaction/brushXHighlight.js +2 -3
- package/lib/interaction/brushXHighlight.js.map +1 -1
- package/lib/interaction/brushYFilter.js +1 -2
- package/lib/interaction/brushYFilter.js.map +1 -1
- package/lib/interaction/brushYHighlight.js +2 -3
- package/lib/interaction/brushYHighlight.js.map +1 -1
- package/lib/interaction/chartIndex.js +1 -2
- package/lib/interaction/chartIndex.js.map +1 -1
- package/lib/interaction/drillDown.d.ts +6 -0
- package/lib/interaction/drillDown.js +213 -0
- package/lib/interaction/drillDown.js.map +1 -0
- package/lib/interaction/elementHighlight.js +2 -3
- package/lib/interaction/elementHighlight.js.map +1 -1
- package/lib/interaction/elementHighlightByColor.js +1 -2
- package/lib/interaction/elementHighlightByColor.js.map +1 -1
- package/lib/interaction/elementHighlightByX.js +1 -2
- package/lib/interaction/elementHighlightByX.js.map +1 -1
- package/lib/interaction/elementHoverScale.d.ts +23 -0
- package/lib/interaction/elementHoverScale.js +226 -0
- package/lib/interaction/elementHoverScale.js.map +1 -0
- package/lib/interaction/elementPointMove.js +1 -2
- package/lib/interaction/elementPointMove.js.map +1 -1
- package/lib/interaction/elementSelect.js +2 -3
- package/lib/interaction/elementSelect.js.map +1 -1
- package/lib/interaction/elementSelectByColor.js +1 -2
- package/lib/interaction/elementSelectByColor.js.map +1 -1
- package/lib/interaction/elementSelectByX.js +1 -2
- package/lib/interaction/elementSelectByX.js.map +1 -1
- package/lib/interaction/event.js +11 -4
- package/lib/interaction/event.js.map +1 -1
- package/lib/interaction/fisheye.js +1 -2
- package/lib/interaction/fisheye.js.map +1 -1
- package/lib/interaction/index.d.ts +2 -0
- package/lib/interaction/index.js +5 -1
- package/lib/interaction/index.js.map +1 -1
- package/lib/interaction/legendFilter.js +50 -28
- package/lib/interaction/legendFilter.js.map +1 -1
- package/lib/interaction/legendHighlight.js +1 -2
- package/lib/interaction/legendHighlight.js.map +1 -1
- package/lib/interaction/poptip.js +1 -2
- package/lib/interaction/poptip.js.map +1 -1
- package/lib/interaction/scrollbarFilter.js +4 -3
- package/lib/interaction/scrollbarFilter.js.map +1 -1
- package/lib/interaction/sliderFilter.js +2 -2
- package/lib/interaction/sliderFilter.js.map +1 -1
- package/lib/interaction/sliderWheel.js +1 -2
- package/lib/interaction/sliderWheel.js.map +1 -1
- package/lib/interaction/tooltip.js +12 -12
- package/lib/interaction/tooltip.js.map +1 -1
- package/lib/interaction/treemapDrillDown.js +1 -2
- package/lib/interaction/treemapDrillDown.js.map +1 -1
- package/lib/interaction/utils.d.ts +16 -2
- package/lib/interaction/utils.js +91 -43
- package/lib/interaction/utils.js.map +1 -1
- package/lib/label-transform/exceedAdjust.js +17 -0
- package/lib/label-transform/exceedAdjust.js.map +1 -1
- package/lib/label-transform/overflowStroke.js.map +1 -1
- package/lib/label-transform/overlapDodgeY.js.map +1 -1
- package/lib/label-transform/utils.js +2 -3
- package/lib/label-transform/utils.js.map +1 -1
- package/lib/lib/builtinlib.js +1 -2
- package/lib/lib/builtinlib.js.map +1 -1
- package/lib/lib/core.d.ts +3 -1
- package/lib/lib/core.js +3 -2
- package/lib/lib/core.js.map +1 -1
- package/lib/lib/geo.js +1 -2
- package/lib/lib/geo.js.map +1 -1
- package/lib/lib/graph.d.ts +1 -0
- package/lib/lib/graph.js +2 -2
- package/lib/lib/graph.js.map +1 -1
- package/lib/lib/lite.js +1 -2
- package/lib/lib/lite.js.map +1 -1
- package/lib/lib/plot.js +1 -2
- package/lib/lib/plot.js.map +1 -1
- package/lib/lib/std.d.ts +3 -0
- package/lib/lib/std.js +1 -2
- package/lib/lib/std.js.map +1 -1
- package/lib/mark/area.js.map +1 -1
- package/lib/mark/box.js +3 -3
- package/lib/mark/box.js.map +1 -1
- package/lib/mark/boxplot.js.map +1 -1
- package/lib/mark/chord.js +2 -2
- package/lib/mark/chord.js.map +1 -1
- package/lib/mark/density.js +1 -1
- package/lib/mark/density.js.map +1 -1
- package/lib/mark/gauge.js.map +1 -1
- package/lib/mark/index.d.ts +1 -0
- package/lib/mark/index.js +3 -1
- package/lib/mark/index.js.map +1 -1
- package/lib/mark/line.js.map +1 -1
- package/lib/mark/partition.d.ts +42 -0
- package/lib/mark/partition.js +223 -0
- package/lib/mark/partition.js.map +1 -0
- package/lib/mark/polygon.js.map +1 -1
- package/lib/mark/range.js +2 -2
- package/lib/mark/range.js.map +1 -1
- package/lib/mark/sankey.js.map +1 -1
- package/lib/mark/utils.js +16 -17
- package/lib/mark/utils.js.map +1 -1
- package/lib/runtime/component.js +10 -11
- package/lib/runtime/component.js.map +1 -1
- package/lib/runtime/coordinate.js +12 -13
- package/lib/runtime/coordinate.js.map +1 -1
- package/lib/runtime/layout.js +4 -5
- package/lib/runtime/layout.js.map +1 -1
- package/lib/runtime/library.js +2 -3
- package/lib/runtime/library.js.map +1 -1
- package/lib/runtime/mark.js +4 -5
- package/lib/runtime/mark.js.map +1 -1
- package/lib/runtime/option-preprocess/axis-breaks.js +2 -2
- package/lib/runtime/option-preprocess/axis-breaks.js.map +1 -1
- package/lib/runtime/option-preprocess/index.js +1 -2
- package/lib/runtime/option-preprocess/index.js.map +1 -1
- package/lib/runtime/option-preprocess/style.js +1 -2
- package/lib/runtime/option-preprocess/style.js.map +1 -1
- package/lib/runtime/plot.js +15 -5
- package/lib/runtime/plot.js.map +1 -1
- package/lib/runtime/render.js +3 -4
- package/lib/runtime/render.js.map +1 -1
- package/lib/runtime/scale.js +27 -18
- package/lib/runtime/scale.js.map +1 -1
- package/lib/runtime/transform.js +13 -13
- package/lib/runtime/transform.js.map +1 -1
- package/lib/shape/area/curve.js.map +1 -1
- package/lib/shape/axis-breaks/axis-breaks.js.map +1 -1
- package/lib/shape/box/box.js.map +1 -1
- package/lib/shape/box/violin.js.map +1 -1
- package/lib/shape/connector/connector.js.map +1 -1
- package/lib/shape/heatmap/renderer/gradient.js +1 -2
- package/lib/shape/heatmap/renderer/gradient.js.map +1 -1
- package/lib/shape/heatmap/renderer/index.js +1 -2
- package/lib/shape/heatmap/renderer/index.js.map +1 -1
- package/lib/shape/interval/color.js +2 -2
- package/lib/shape/interval/color.js.map +1 -1
- package/lib/shape/interval/funnel.js.map +1 -1
- package/lib/shape/interval/pyramid.js.map +1 -1
- package/lib/shape/label/label.js +17 -7
- package/lib/shape/label/label.js.map +1 -1
- package/lib/shape/label/position/area.js +1 -2
- package/lib/shape/label/position/area.js.map +1 -1
- package/lib/shape/label/position/default.js +6 -7
- package/lib/shape/label/position/default.js.map +1 -1
- package/lib/shape/label/position/outside.js +5 -6
- package/lib/shape/label/position/outside.js.map +1 -1
- package/lib/shape/label/position/spider.js +1 -2
- package/lib/shape/label/position/spider.js.map +1 -1
- package/lib/shape/label/position/surround.js +1 -2
- package/lib/shape/label/position/surround.js.map +1 -1
- package/lib/shape/label/position/utils.js +2 -3
- package/lib/shape/label/position/utils.js.map +1 -1
- package/lib/shape/line/curve.js.map +1 -1
- package/lib/shape/line/trail.js.map +1 -1
- package/lib/shape/link/arc.js.map +1 -1
- package/lib/shape/link/vhv.js.map +1 -1
- package/lib/shape/liquid/liquid.js.map +1 -1
- package/lib/shape/liquid/wave.js +1 -2
- package/lib/shape/liquid/wave.js.map +1 -1
- package/lib/shape/point/color.js +2 -2
- package/lib/shape/point/color.js.map +1 -1
- package/lib/shape/polygon/polygon.js.map +1 -1
- package/lib/shape/polygon/ribbon.js.map +1 -1
- package/lib/shape/text/advance.d.ts +1 -1
- package/lib/shape/text/advance.js.map +1 -1
- package/lib/shape/utils.js +11 -12
- package/lib/shape/utils.js.map +1 -1
- package/lib/shape/vector/vector.js.map +1 -1
- package/lib/spec/interaction.d.ts +23 -2
- package/lib/spec/mark.d.ts +13 -2
- package/lib/theme/create.d.ts +1 -1
- package/lib/theme/create.js +4 -4
- package/lib/theme/create.js.map +1 -1
- package/lib/theme/dark.js +5 -4
- package/lib/theme/dark.js.map +1 -1
- package/lib/transform/diffY.js.map +1 -1
- package/lib/transform/dodgeX.js.map +1 -1
- package/lib/transform/filter.js.map +1 -1
- package/lib/transform/jitter.js +3 -3
- package/lib/transform/jitter.js.map +1 -1
- package/lib/transform/maybeDefaultX.js.map +1 -1
- package/lib/transform/maybeDefaultY.js.map +1 -1
- package/lib/transform/maybeTitle.js.map +1 -1
- package/lib/transform/maybeVisualPosition.js +1 -1
- package/lib/transform/maybeVisualPosition.js.map +1 -1
- package/lib/transform/normalizeY.js.map +1 -1
- package/lib/transform/pack.js.map +1 -1
- package/lib/transform/sample.js.map +1 -1
- package/lib/transform/sort.js.map +1 -1
- package/lib/transform/stackEnter.js.map +1 -1
- package/lib/transform/stackY.js +2 -2
- package/lib/transform/stackY.js.map +1 -1
- package/lib/transform/symmetryY.js.map +1 -1
- package/lib/transform/utils/helper.js +8 -9
- package/lib/transform/utils/helper.js.map +1 -1
- package/lib/transform/utils/lttb.js +1 -2
- package/lib/transform/utils/lttb.js.map +1 -1
- package/lib/transform/utils/order.js +4 -5
- package/lib/transform/utils/order.js.map +1 -1
- package/lib/utils/angle.js +3 -4
- package/lib/utils/angle.js.map +1 -1
- package/lib/utils/array.js +9 -10
- package/lib/utils/array.js.map +1 -1
- package/lib/utils/bounds.js +4 -5
- package/lib/utils/bounds.js.map +1 -1
- package/lib/utils/color.js +1 -2
- package/lib/utils/color.js.map +1 -1
- package/lib/utils/coordinate.d.ts +0 -1
- package/lib/utils/coordinate.js +14 -15
- package/lib/utils/coordinate.js.map +1 -1
- package/lib/utils/createElement.js +1 -2
- package/lib/utils/createElement.js.map +1 -1
- package/lib/utils/dateFormat.js +1 -2
- package/lib/utils/dateFormat.js.map +1 -1
- package/lib/utils/expr.js +2 -2
- package/lib/utils/expr.js.map +1 -1
- package/lib/utils/flow.js +1 -2
- package/lib/utils/flow.js.map +1 -1
- package/lib/utils/helper.js +30 -31
- package/lib/utils/helper.js.map +1 -1
- package/lib/utils/lru.js +1 -2
- package/lib/utils/lru.js.map +1 -1
- package/lib/utils/mark.js +4 -5
- package/lib/utils/mark.js.map +1 -1
- package/lib/utils/marker.d.ts +1 -1
- package/lib/utils/marker.js +4 -4
- package/lib/utils/marker.js.map +1 -1
- package/lib/utils/number.js +2 -3
- package/lib/utils/number.js.map +1 -1
- package/lib/utils/scale.js +7 -7
- package/lib/utils/scale.js.map +1 -1
- package/lib/utils/selection.js +2 -2
- package/lib/utils/selection.js.map +1 -1
- package/lib/utils/size.js +2 -3
- package/lib/utils/size.js.map +1 -1
- package/lib/utils/string.js +2 -3
- package/lib/utils/string.js.map +1 -1
- package/lib/utils/style.js +4 -5
- package/lib/utils/style.js.map +1 -1
- package/lib/utils/traverse-elements.js +1 -2
- package/lib/utils/traverse-elements.js.map +1 -1
- package/lib/utils/treeDataTransform.js +1 -2
- package/lib/utils/treeDataTransform.js.map +1 -1
- package/lib/utils/vector.js +8 -9
- package/lib/utils/vector.js.map +1 -1
- package/package.json +6 -5
- package/src/api/runtime.ts +5 -0
- package/src/component/axis.ts +3 -0
- package/src/component/constant.ts +12 -0
- package/src/component/legendCategory.ts +4 -1
- package/src/component/legendContinuous.ts +2 -0
- package/src/component/scrollbar.ts +2 -1
- package/src/interaction/drillDown.ts +258 -0
- package/src/interaction/elementHoverScale.ts +285 -0
- package/src/interaction/event.ts +10 -2
- package/src/interaction/index.ts +2 -0
- package/src/interaction/legendFilter.ts +42 -7
- package/src/interaction/scrollbarFilter.ts +2 -1
- package/src/interaction/tooltip.ts +6 -5
- package/src/interaction/utils.ts +65 -8
- package/src/label-transform/exceedAdjust.ts +22 -0
- package/src/lib/core.ts +4 -0
- package/src/lib/graph.ts +10 -1
- package/src/mark/index.ts +1 -0
- package/src/mark/partition.ts +312 -0
- package/src/runtime/mark.ts +2 -2
- package/src/runtime/plot.ts +11 -1
- package/src/spec/interaction.ts +28 -1
- package/src/spec/mark.ts +18 -0
- package/src/theme/create.ts +3 -1
- package/src/theme/dark.ts +5 -4
- package/src/utils/helper.ts +6 -6
package/src/api/runtime.ts
CHANGED
|
@@ -468,6 +468,11 @@ export class Runtime<Spec extends G2Spec = G2Spec> extends CompositionNode {
|
|
|
468
468
|
height,
|
|
469
469
|
renderer: this._renderer,
|
|
470
470
|
});
|
|
471
|
+
|
|
472
|
+
const dom = this._context.canvas
|
|
473
|
+
?.getContextService()
|
|
474
|
+
?.getDomElement() as HTMLCanvasElement;
|
|
475
|
+
if (dom) dom.style.display = 'block';
|
|
471
476
|
}
|
|
472
477
|
|
|
473
478
|
private _addToTrailing(): Promise<Runtime<Spec>> {
|
package/src/component/axis.ts
CHANGED
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
import { prettyNumber } from '../utils/number';
|
|
29
29
|
import { capitalizeFirst } from '../utils/helper';
|
|
30
30
|
import { adaptor, isVertical, titleContent } from './utils';
|
|
31
|
+
import { G2_CLASS_PREFIX } from './constant';
|
|
31
32
|
|
|
32
33
|
export type AxisOptions = {
|
|
33
34
|
position?: GCP;
|
|
@@ -482,6 +483,7 @@ const ArcAxisComponent: GCC<AxisOptions> = (options) => {
|
|
|
482
483
|
data: labels,
|
|
483
484
|
titleText: titleContent(title),
|
|
484
485
|
grid,
|
|
486
|
+
classNamePrefix: G2_CLASS_PREFIX,
|
|
485
487
|
...(tickLength !== undefined ? { tickLength } : null),
|
|
486
488
|
...rest,
|
|
487
489
|
...important,
|
|
@@ -634,6 +636,7 @@ const LinearAxisComponent: GCC<AxisOptions> = (options) => {
|
|
|
634
636
|
// Always showLine, make title could align the end of axis.
|
|
635
637
|
line: true,
|
|
636
638
|
indexBBox,
|
|
639
|
+
classNamePrefix: G2_CLASS_PREFIX,
|
|
637
640
|
...(tickLength !== undefined ? { tickLength } : null),
|
|
638
641
|
...(!internalAxisStyle.line ? { lineOpacity: 0 } : null),
|
|
639
642
|
...overrideStyle,
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* G2 component class name prefix
|
|
3
|
+
*/
|
|
4
|
+
export const G2_CLASS_PREFIX = 'g2-';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Helper function to create G2 CSS class selector
|
|
8
|
+
*/
|
|
9
|
+
export function g2Selector(className: string): string {
|
|
10
|
+
return `.${G2_CLASS_PREFIX}${className}`;
|
|
11
|
+
}
|
|
12
|
+
|
|
1
13
|
// [legend type, [channels, scale type][][]]
|
|
2
14
|
type InferStrategy = [string, [string, string][][]];
|
|
3
15
|
|
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
scaleOf,
|
|
25
25
|
titleContent,
|
|
26
26
|
} from './utils';
|
|
27
|
+
import { G2_CLASS_PREFIX } from './constant';
|
|
27
28
|
|
|
28
29
|
export type LegendCategoryOptions = {
|
|
29
30
|
dx?: number;
|
|
@@ -271,7 +272,9 @@ export const LegendCategory: GCC<LegendCategoryOptions> = (options) => {
|
|
|
271
272
|
|
|
272
273
|
// Filter out the data items with empty string IDs in the wordCloud's data before generating the legend.
|
|
273
274
|
const categoryStyle = adaptor(
|
|
274
|
-
Object.assign({}, legendTheme, filterEmptyIds(legendStyle), style
|
|
275
|
+
Object.assign({}, legendTheme, filterEmptyIds(legendStyle), style, {
|
|
276
|
+
classNamePrefix: G2_CLASS_PREFIX,
|
|
277
|
+
}),
|
|
275
278
|
);
|
|
276
279
|
|
|
277
280
|
// If render is provided, use HTML to render.
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
scaleOf,
|
|
21
21
|
titleContent,
|
|
22
22
|
} from './utils';
|
|
23
|
+
import { G2_CLASS_PREFIX } from './constant';
|
|
23
24
|
|
|
24
25
|
export type LegendContinuousOptions = {
|
|
25
26
|
layout?: FlexLayout;
|
|
@@ -256,6 +257,7 @@ export const LegendContinuous: GCC<LegendContinuousOptions> = (options) => {
|
|
|
256
257
|
theme,
|
|
257
258
|
),
|
|
258
259
|
...style,
|
|
260
|
+
classNamePrefix: G2_CLASS_PREFIX,
|
|
259
261
|
},
|
|
260
262
|
rest,
|
|
261
263
|
),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Scrollbar as ScrollbarComponent } from '@antv/component';
|
|
2
2
|
import { DisplayObject } from '@antv/g';
|
|
3
3
|
import { GuideComponentComponent as GCC } from '../runtime';
|
|
4
|
+
import { G2_CLASS_PREFIX } from './constant';
|
|
4
5
|
|
|
5
6
|
export type ScrollbarOptions = {
|
|
6
7
|
orientation?: 'horizontal' | 'vertical';
|
|
@@ -24,7 +25,7 @@ export const Scrollbar: GCC<ScrollbarOptions> = (options) => {
|
|
|
24
25
|
const [r0, r1] = range;
|
|
25
26
|
const value1 = r1 > r0 ? 0 : 1;
|
|
26
27
|
return new ScrollbarComponent({
|
|
27
|
-
className:
|
|
28
|
+
className: `${G2_CLASS_PREFIX}scrollbar`,
|
|
28
29
|
style: Object.assign({}, scrollbarTheme, {
|
|
29
30
|
...style,
|
|
30
31
|
x,
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import type { DisplayObject } from '@antv/g';
|
|
2
|
+
import { get, deepMix, pick, keys } from '@antv/util';
|
|
3
|
+
import { DrillDownInteraction } from 'spec';
|
|
4
|
+
import { select } from '../utils/selection';
|
|
5
|
+
import { PLOT_CLASS_NAME } from '../runtime';
|
|
6
|
+
import {
|
|
7
|
+
CHILD_NODE_COUNT,
|
|
8
|
+
PARTITION_TYPE,
|
|
9
|
+
PARTITION_TYPE_FIELD,
|
|
10
|
+
} from '../mark/partition';
|
|
11
|
+
|
|
12
|
+
// Get partition element.
|
|
13
|
+
const getElementsPartition = (plot: DisplayObject) => {
|
|
14
|
+
return plot.querySelectorAll('.element').filter((item) => {
|
|
15
|
+
const itemStyle = (item as any).style || {};
|
|
16
|
+
return itemStyle[PARTITION_TYPE_FIELD] === PARTITION_TYPE;
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
function selectPlotArea(root: DisplayObject): DisplayObject {
|
|
21
|
+
return select(root).select(`.${PLOT_CLASS_NAME}`).node();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Default breadCrumb config.
|
|
25
|
+
const DEFAULT_BREADCRUMB = {
|
|
26
|
+
rootText: 'root',
|
|
27
|
+
style: {
|
|
28
|
+
fill: 'rgba(0, 0, 0, 0.6)',
|
|
29
|
+
fontSize: 11,
|
|
30
|
+
},
|
|
31
|
+
y: 4,
|
|
32
|
+
active: {
|
|
33
|
+
fill: 'rgba(0, 0, 0, 0.4)',
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* DrillDown interaction for partition visualization.
|
|
39
|
+
* Based on the proven sunburst drilldown implementation.
|
|
40
|
+
*/
|
|
41
|
+
export function DrillDown(drillDownOptions: DrillDownInteraction = {}) {
|
|
42
|
+
const { breadCrumb: textConfig = {} } = drillDownOptions;
|
|
43
|
+
const breadCrumb = deepMix({}, DEFAULT_BREADCRUMB, textConfig);
|
|
44
|
+
|
|
45
|
+
return (context: any) => {
|
|
46
|
+
const { update, setState, container, view, options: viewOptions } = context;
|
|
47
|
+
|
|
48
|
+
const document = container.ownerDocument;
|
|
49
|
+
|
|
50
|
+
const plotArea = selectPlotArea(container);
|
|
51
|
+
|
|
52
|
+
const partitionMark = viewOptions.marks.find(
|
|
53
|
+
({ id }: any) => id === PARTITION_TYPE,
|
|
54
|
+
);
|
|
55
|
+
if (!partitionMark) return;
|
|
56
|
+
const { state } = partitionMark;
|
|
57
|
+
|
|
58
|
+
// Create breadCrumbTextsGroup to save textSeparator and drillTexts.
|
|
59
|
+
const textGroup = document.createElement('g');
|
|
60
|
+
textGroup.style.transform = `translate(${breadCrumb.x || 0}px, ${
|
|
61
|
+
breadCrumb.y || 0
|
|
62
|
+
}px)`;
|
|
63
|
+
|
|
64
|
+
textGroup.setAttribute('x', 'drilldown-breadcrumb');
|
|
65
|
+
plotArea.appendChild(textGroup);
|
|
66
|
+
|
|
67
|
+
// Modify data and scale according to the path and level of current click to achieve drilling down, drilling up and initialization effects.
|
|
68
|
+
const drillDownClick = async (path: string[]) => {
|
|
69
|
+
// Clear text.
|
|
70
|
+
textGroup.removeChildren();
|
|
71
|
+
|
|
72
|
+
// More path creation text.
|
|
73
|
+
if (path && path.length > 0) {
|
|
74
|
+
// Create root text.
|
|
75
|
+
const rootText = document.createElement('text', {
|
|
76
|
+
style: {
|
|
77
|
+
text: breadCrumb.rootText,
|
|
78
|
+
...breadCrumb.style,
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
textGroup.appendChild(rootText);
|
|
83
|
+
|
|
84
|
+
let name = '';
|
|
85
|
+
const pathArray = path;
|
|
86
|
+
let y = breadCrumb.style.y;
|
|
87
|
+
let x = rootText.getBBox().width;
|
|
88
|
+
|
|
89
|
+
const maxWidth = plotArea.getBBox().width;
|
|
90
|
+
|
|
91
|
+
// Create path: 'type1 / type2 / type3' -> '/ type1 / type2 / type3'.
|
|
92
|
+
const drillTexts = pathArray.map((text, index) => {
|
|
93
|
+
const textSeparator = document.createElement('text', {
|
|
94
|
+
style: {
|
|
95
|
+
x,
|
|
96
|
+
text: ' / ',
|
|
97
|
+
...breadCrumb.style,
|
|
98
|
+
y,
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
textGroup.appendChild(textSeparator);
|
|
103
|
+
|
|
104
|
+
x += textSeparator.getBBox().width;
|
|
105
|
+
|
|
106
|
+
name = `${name}${text} / `;
|
|
107
|
+
|
|
108
|
+
const drillText = document.createElement('text', {
|
|
109
|
+
name: name.replace(/\s\/\s$/, ''),
|
|
110
|
+
style: {
|
|
111
|
+
text,
|
|
112
|
+
x,
|
|
113
|
+
...breadCrumb.style,
|
|
114
|
+
y,
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
textGroup.appendChild(drillText);
|
|
119
|
+
|
|
120
|
+
x += drillText.getBBox().width;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Page width exceeds maximum, line feed.
|
|
124
|
+
* | ----maxWidth---- |
|
|
125
|
+
* | / type1 / type2 / type3 |
|
|
126
|
+
* ->
|
|
127
|
+
* | ----maxWidth---- |
|
|
128
|
+
* | / type1 / type2 |
|
|
129
|
+
* | / type3 |
|
|
130
|
+
*/
|
|
131
|
+
if (x > maxWidth) {
|
|
132
|
+
y = textGroup.getBBox().height;
|
|
133
|
+
x = 0;
|
|
134
|
+
textSeparator.attr({
|
|
135
|
+
x,
|
|
136
|
+
y,
|
|
137
|
+
});
|
|
138
|
+
x += textSeparator.getBBox().width;
|
|
139
|
+
drillText.attr({
|
|
140
|
+
x,
|
|
141
|
+
y,
|
|
142
|
+
});
|
|
143
|
+
x += drillText.getBBox().width;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return drillText;
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
// Add active state and drilldown interaction.
|
|
150
|
+
const textStack = [rootText, ...drillTexts];
|
|
151
|
+
textStack.forEach((item, index) => {
|
|
152
|
+
// Skip the last drillText
|
|
153
|
+
if (index === drillTexts.length) return;
|
|
154
|
+
const originalAttrs = { ...item.attributes };
|
|
155
|
+
item.attr('cursor', 'pointer');
|
|
156
|
+
item.addEventListener('mouseenter', () => {
|
|
157
|
+
item.attr(breadCrumb.active);
|
|
158
|
+
});
|
|
159
|
+
item.addEventListener('mouseleave', () => {
|
|
160
|
+
item.attr(originalAttrs);
|
|
161
|
+
});
|
|
162
|
+
item.addEventListener('click', () => {
|
|
163
|
+
drillDownClick(path.slice(0, index));
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Update marks.
|
|
169
|
+
setState('drillDown', (viewOptions: any) => {
|
|
170
|
+
const { marks } = viewOptions;
|
|
171
|
+
// Add filter transform for every mark,
|
|
172
|
+
// which will skip for mark without color channel.
|
|
173
|
+
const newMarks = marks.map((mark: any) => {
|
|
174
|
+
if (mark.id !== PARTITION_TYPE && mark.type !== 'rect') return mark;
|
|
175
|
+
|
|
176
|
+
// Inset after aggregate transform, such as group and bin.
|
|
177
|
+
const { data } = mark;
|
|
178
|
+
|
|
179
|
+
const newData = data.filter((item: any) => {
|
|
180
|
+
const itemPath = item.path ?? [];
|
|
181
|
+
if (path.length === 0) return true;
|
|
182
|
+
if (!Array.isArray(itemPath) || itemPath.length < path.length)
|
|
183
|
+
return false;
|
|
184
|
+
for (let i = 0; i < path.length; i++) {
|
|
185
|
+
if (itemPath[i] !== path[i]) return false;
|
|
186
|
+
}
|
|
187
|
+
return true;
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
// DrillDown by filtering the data and scale.
|
|
191
|
+
return deepMix({}, mark, {
|
|
192
|
+
data: newData,
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
return { ...viewOptions, marks: newMarks };
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
await update();
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
const createDrillClick = (e: Event) => {
|
|
202
|
+
const item = e.target as DisplayObject;
|
|
203
|
+
|
|
204
|
+
// Get properties directly from DOM element attributes instead of using get function.
|
|
205
|
+
const markType = (item as any).markType;
|
|
206
|
+
const itemStyle = (item as any).style || {};
|
|
207
|
+
const partitionType = itemStyle[PARTITION_TYPE_FIELD];
|
|
208
|
+
const childNodeCount = itemStyle[CHILD_NODE_COUNT];
|
|
209
|
+
const itemData = (item as any).__data__;
|
|
210
|
+
|
|
211
|
+
if (
|
|
212
|
+
markType !== 'rect' ||
|
|
213
|
+
partitionType !== PARTITION_TYPE ||
|
|
214
|
+
!childNodeCount
|
|
215
|
+
) {
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const path = itemData?.data?.path ?? [];
|
|
220
|
+
drillDownClick(path);
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
// Add click drill interaction.
|
|
224
|
+
plotArea.addEventListener('click', createDrillClick);
|
|
225
|
+
|
|
226
|
+
// Change attribute keys.
|
|
227
|
+
const changeStyleKey = keys({ ...state.active, ...state.inactive });
|
|
228
|
+
|
|
229
|
+
const createActive = () => {
|
|
230
|
+
const elements = getElementsPartition(plotArea);
|
|
231
|
+
elements.forEach((element: DisplayObject) => {
|
|
232
|
+
const childNodeCount = get(element, ['style', CHILD_NODE_COUNT]);
|
|
233
|
+
const cursor = get(element, ['style', 'cursor']);
|
|
234
|
+
if (cursor !== 'pointer' && childNodeCount) {
|
|
235
|
+
(element as any).style.cursor = 'pointer';
|
|
236
|
+
const originalAttrs = pick(element.attributes, changeStyleKey);
|
|
237
|
+
|
|
238
|
+
element.addEventListener('mouseenter', () => {
|
|
239
|
+
element.attr(state.active);
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
element.addEventListener('mouseleave', () => {
|
|
243
|
+
element.attr(deepMix(originalAttrs, state.inactive));
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
// Animate elements update and add active state.
|
|
250
|
+
plotArea.addEventListener('mousemove', createActive);
|
|
251
|
+
|
|
252
|
+
return () => {
|
|
253
|
+
textGroup.remove();
|
|
254
|
+
plotArea.removeEventListener('click', createDrillClick);
|
|
255
|
+
plotArea.removeEventListener('mousemove', createActive);
|
|
256
|
+
};
|
|
257
|
+
};
|
|
258
|
+
}
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import { DisplayObject } from '@antv/g';
|
|
2
|
+
import { deepMix } from '@antv/util';
|
|
3
|
+
import { group } from '@antv/vendor/d3-array';
|
|
4
|
+
import {
|
|
5
|
+
createDatumof,
|
|
6
|
+
createUseState,
|
|
7
|
+
createValueof,
|
|
8
|
+
mergeState,
|
|
9
|
+
selectElementByData,
|
|
10
|
+
selectG2Elements,
|
|
11
|
+
selectPlotArea,
|
|
12
|
+
} from './utils';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Scale up elements on hover.
|
|
16
|
+
*/
|
|
17
|
+
export function elementHoverScale(
|
|
18
|
+
root: DisplayObject,
|
|
19
|
+
{
|
|
20
|
+
elements: elementsof,
|
|
21
|
+
datum,
|
|
22
|
+
groupKey = (element) => element,
|
|
23
|
+
scaleFactor = 1.04,
|
|
24
|
+
scaleOrigin = 'center center',
|
|
25
|
+
shadow = true,
|
|
26
|
+
shadowColor = 'rgba(0, 0, 0, 0.4)',
|
|
27
|
+
shadowBlur = 10,
|
|
28
|
+
shadowOffsetX = 0,
|
|
29
|
+
shadowOffsetY = 2,
|
|
30
|
+
zIndex = 10,
|
|
31
|
+
delay = 60,
|
|
32
|
+
emitter,
|
|
33
|
+
state = {},
|
|
34
|
+
}: Record<string, any>,
|
|
35
|
+
) {
|
|
36
|
+
// Helper function to get current valid elements
|
|
37
|
+
const getCurrentElements = () => {
|
|
38
|
+
return elementsof(root) ?? [];
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const initialElements = getCurrentElements();
|
|
42
|
+
const valueof = createValueof(initialElements, datum);
|
|
43
|
+
|
|
44
|
+
const elementStyle = deepMix(state, {
|
|
45
|
+
active: {},
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const useState = createUseState(elementStyle, initialElements);
|
|
49
|
+
const { updateState, removeState, hasState } = useState(valueof);
|
|
50
|
+
|
|
51
|
+
const originalStyles = new Map<DisplayObject, Record<string, any>>();
|
|
52
|
+
const hoveredElements = new Set<DisplayObject>();
|
|
53
|
+
|
|
54
|
+
let out;
|
|
55
|
+
|
|
56
|
+
const applyHoverEffect = (element: DisplayObject) => {
|
|
57
|
+
if (hoveredElements.has(element)) return;
|
|
58
|
+
|
|
59
|
+
// Capture current state before applying effect
|
|
60
|
+
const currentTransform = element.style.transform || '';
|
|
61
|
+
const currentTransformOrigin = element.style.transformOrigin || '';
|
|
62
|
+
|
|
63
|
+
originalStyles.set(element, {
|
|
64
|
+
transform: currentTransform,
|
|
65
|
+
transformOrigin: currentTransformOrigin,
|
|
66
|
+
zIndex: element.style.zIndex || 0,
|
|
67
|
+
shadowColor: element.style.shadowColor || '',
|
|
68
|
+
shadowBlur: element.style.shadowBlur || 0,
|
|
69
|
+
shadowOffsetX: element.style.shadowOffsetX || 0,
|
|
70
|
+
shadowOffsetY: element.style.shadowOffsetY || 0,
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
// Treat 'none' as empty string since it means no transform
|
|
74
|
+
const prefix =
|
|
75
|
+
currentTransform && currentTransform !== 'none' ? currentTransform : '';
|
|
76
|
+
const scaleTransform = `scale(${scaleFactor})`;
|
|
77
|
+
|
|
78
|
+
// Build new transform: append or replace scale in existing transform
|
|
79
|
+
let newTransform: string;
|
|
80
|
+
if (prefix && !prefix.includes('scale')) {
|
|
81
|
+
newTransform = `${prefix} ${scaleTransform}`.trimStart();
|
|
82
|
+
} else if (prefix && prefix.includes('scale')) {
|
|
83
|
+
newTransform = prefix
|
|
84
|
+
.replace(/scale\([^)]+\)/g, scaleTransform)
|
|
85
|
+
.trimStart();
|
|
86
|
+
} else {
|
|
87
|
+
newTransform = scaleTransform;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Apply styles
|
|
91
|
+
element.style.transformOrigin = scaleOrigin;
|
|
92
|
+
element.style.transform = newTransform;
|
|
93
|
+
element.style.zIndex = zIndex;
|
|
94
|
+
|
|
95
|
+
if (shadow) {
|
|
96
|
+
element.style.shadowColor = shadowColor;
|
|
97
|
+
element.style.shadowBlur = shadowBlur;
|
|
98
|
+
element.style.shadowOffsetX = shadowOffsetX;
|
|
99
|
+
element.style.shadowOffsetY = shadowOffsetY;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
hoveredElements.add(element);
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const removeHoverEffect = (element: DisplayObject) => {
|
|
106
|
+
const original = originalStyles.get(element);
|
|
107
|
+
if (!original) return;
|
|
108
|
+
|
|
109
|
+
// Restore all original styles
|
|
110
|
+
element.style.transform = original.transform;
|
|
111
|
+
element.style.transformOrigin = original.transformOrigin;
|
|
112
|
+
element.style.zIndex = original.zIndex;
|
|
113
|
+
element.style.shadowColor = original.shadowColor;
|
|
114
|
+
element.style.shadowBlur = original.shadowBlur;
|
|
115
|
+
element.style.shadowOffsetX = original.shadowOffsetX;
|
|
116
|
+
element.style.shadowOffsetY = original.shadowOffsetY;
|
|
117
|
+
|
|
118
|
+
hoveredElements.delete(element);
|
|
119
|
+
originalStyles.delete(element);
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
const pointerover = (event) => {
|
|
123
|
+
const { nativeEvent = true } = event;
|
|
124
|
+
const element = event.target;
|
|
125
|
+
|
|
126
|
+
// Get current elements dynamically to handle chart updates (e.g., legend filter)
|
|
127
|
+
const validElements = getCurrentElements();
|
|
128
|
+
const currentElementSet = new Set(validElements);
|
|
129
|
+
|
|
130
|
+
if (!currentElementSet.has(element)) return;
|
|
131
|
+
if (out) clearTimeout(out);
|
|
132
|
+
|
|
133
|
+
const currentKeyGroup = group(validElements, groupKey);
|
|
134
|
+
const k = groupKey(element);
|
|
135
|
+
const currentGroup = currentKeyGroup.get(k);
|
|
136
|
+
|
|
137
|
+
if (!currentGroup) return;
|
|
138
|
+
|
|
139
|
+
const groupSet = new Set(currentGroup);
|
|
140
|
+
|
|
141
|
+
// Remove hover effects from elements not in current group
|
|
142
|
+
for (const e of validElements) {
|
|
143
|
+
if (!groupSet.has(e)) {
|
|
144
|
+
removeState(e, 'active');
|
|
145
|
+
removeHoverEffect(e);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// Apply hover effects to current group
|
|
150
|
+
for (const e of currentGroup) {
|
|
151
|
+
if (!hasState(e, 'active')) updateState(e, 'active');
|
|
152
|
+
applyHoverEffect(e as DisplayObject);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// Emit events
|
|
156
|
+
if (!nativeEvent) return;
|
|
157
|
+
emitter.emit('element:hoverscale', {
|
|
158
|
+
nativeEvent,
|
|
159
|
+
data: {
|
|
160
|
+
data: datum(element),
|
|
161
|
+
group: currentGroup.map(datum),
|
|
162
|
+
},
|
|
163
|
+
});
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
const delayReset = () => {
|
|
167
|
+
if (out) clearTimeout(out);
|
|
168
|
+
out = setTimeout(() => {
|
|
169
|
+
reset();
|
|
170
|
+
out = null;
|
|
171
|
+
}, delay);
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
const reset = (nativeEvent = true) => {
|
|
175
|
+
const validElements = getCurrentElements();
|
|
176
|
+
|
|
177
|
+
// Remove hover effects and states from all valid elements
|
|
178
|
+
for (const e of validElements) {
|
|
179
|
+
removeState(e, 'active');
|
|
180
|
+
removeHoverEffect(e);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
hoveredElements.clear();
|
|
184
|
+
|
|
185
|
+
if (nativeEvent) {
|
|
186
|
+
emitter.emit('element:unhoverscale', { nativeEvent });
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
const pointerout = (event) => {
|
|
191
|
+
if (delay > 0) delayReset();
|
|
192
|
+
else reset();
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
const pointerleave = () => {
|
|
196
|
+
reset();
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
root.addEventListener('pointerover', pointerover);
|
|
200
|
+
root.addEventListener('pointermove', pointerover);
|
|
201
|
+
root.addEventListener('pointerout', pointerout);
|
|
202
|
+
root.addEventListener('pointerleave', pointerleave);
|
|
203
|
+
|
|
204
|
+
const onReset = (e) => {
|
|
205
|
+
const { nativeEvent } = e;
|
|
206
|
+
if (nativeEvent) return;
|
|
207
|
+
reset(false);
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
const onHoverScale = (e) => {
|
|
211
|
+
const { nativeEvent } = e;
|
|
212
|
+
if (nativeEvent) return;
|
|
213
|
+
|
|
214
|
+
const { data } = e.data;
|
|
215
|
+
const currentElements = getCurrentElements();
|
|
216
|
+
const element = selectElementByData(currentElements, data, datum);
|
|
217
|
+
if (!element) return;
|
|
218
|
+
|
|
219
|
+
pointerover({ target: element, nativeEvent: false });
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
emitter.on('element:hoverscale', onHoverScale);
|
|
223
|
+
emitter.on('element:unhoverscale', onReset);
|
|
224
|
+
|
|
225
|
+
return () => {
|
|
226
|
+
root.removeEventListener('pointerover', pointerover);
|
|
227
|
+
root.removeEventListener('pointermove', pointerover);
|
|
228
|
+
root.removeEventListener('pointerout', pointerout);
|
|
229
|
+
root.removeEventListener('pointerleave', pointerleave);
|
|
230
|
+
emitter.off('element:hoverscale', onHoverScale);
|
|
231
|
+
emitter.off('element:unhoverscale', onReset);
|
|
232
|
+
|
|
233
|
+
// Clean up all hover effects from current elements
|
|
234
|
+
const validElements = getCurrentElements();
|
|
235
|
+
for (const e of validElements) {
|
|
236
|
+
removeHoverEffect(e);
|
|
237
|
+
}
|
|
238
|
+
originalStyles.clear();
|
|
239
|
+
hoveredElements.clear();
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export function ElementHoverScale({
|
|
244
|
+
delay,
|
|
245
|
+
createGroup,
|
|
246
|
+
scale: scaleFactorParam,
|
|
247
|
+
scaleOrigin,
|
|
248
|
+
shadow,
|
|
249
|
+
shadowColor,
|
|
250
|
+
shadowBlur,
|
|
251
|
+
shadowOffsetX,
|
|
252
|
+
shadowOffsetY,
|
|
253
|
+
zIndex,
|
|
254
|
+
...rest
|
|
255
|
+
}) {
|
|
256
|
+
return (context, _contexts, emitter) => {
|
|
257
|
+
const { container, view, options } = context;
|
|
258
|
+
const plotArea = selectPlotArea(container);
|
|
259
|
+
const datumof = createDatumof(view);
|
|
260
|
+
|
|
261
|
+
return elementHoverScale(plotArea, {
|
|
262
|
+
elements: selectG2Elements,
|
|
263
|
+
datum: datumof,
|
|
264
|
+
groupKey: createGroup
|
|
265
|
+
? (element) => createGroup(view)(datumof(element))
|
|
266
|
+
: undefined,
|
|
267
|
+
state: mergeState(options, ['active']),
|
|
268
|
+
scaleFactor: scaleFactorParam,
|
|
269
|
+
scaleOrigin,
|
|
270
|
+
shadow,
|
|
271
|
+
shadowColor,
|
|
272
|
+
shadowBlur,
|
|
273
|
+
shadowOffsetX,
|
|
274
|
+
shadowOffsetY,
|
|
275
|
+
zIndex,
|
|
276
|
+
delay,
|
|
277
|
+
emitter,
|
|
278
|
+
...rest,
|
|
279
|
+
});
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
ElementHoverScale.props = {
|
|
284
|
+
reapplyWhenUpdate: true,
|
|
285
|
+
};
|
package/src/interaction/event.ts
CHANGED
|
@@ -57,10 +57,18 @@ function bubblesEvent(eventType, view, emitter, predicate = (event) => true) {
|
|
|
57
57
|
//label children [Text2, Rect2, Path2],
|
|
58
58
|
e1['data'] = { data: root.attributes.datum };
|
|
59
59
|
emitter.emit(`label:${eventType}`, e1);
|
|
60
|
-
|
|
60
|
+
// Support multiple classNames (e.g., "axis-label-item g2-axis-label-item")
|
|
61
|
+
const classNames = className.split(/\s+/).filter(Boolean);
|
|
62
|
+
classNames.forEach((cls) => {
|
|
63
|
+
emitter.emit(`${cls}:${eventType}`, e1);
|
|
64
|
+
});
|
|
61
65
|
} else {
|
|
62
66
|
emitter.emit(`component:${eventType}`, e1);
|
|
63
|
-
|
|
67
|
+
// Support multiple classNames (e.g., "axis-tick-item g2-axis-tick-item")
|
|
68
|
+
const classNames = className.split(/\s+/).filter(Boolean);
|
|
69
|
+
classNames.forEach((cls) => {
|
|
70
|
+
emitter.emit(`${cls}:${eventType}`, e1);
|
|
71
|
+
});
|
|
64
72
|
}
|
|
65
73
|
};
|
|
66
74
|
}
|
package/src/interaction/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { ElementHighlight } from './elementHighlight';
|
|
2
2
|
export { ElementHighlightByX } from './elementHighlightByX';
|
|
3
3
|
export { ElementHighlightByColor } from './elementHighlightByColor';
|
|
4
|
+
export { ElementHoverScale } from './elementHoverScale';
|
|
4
5
|
export { ElementSelect } from './elementSelect';
|
|
5
6
|
export { ElementSelectByX } from './elementSelectByX';
|
|
6
7
|
export { ElementSelectByColor } from './elementSelectByColor';
|
|
@@ -22,4 +23,5 @@ export { ScrollbarFilter } from './scrollbarFilter';
|
|
|
22
23
|
export { Poptip } from './poptip';
|
|
23
24
|
export { Event } from './event';
|
|
24
25
|
export { TreemapDrillDown } from './treemapDrillDown';
|
|
26
|
+
export { DrillDown } from './drillDown';
|
|
25
27
|
export { ElementPointMove } from './elementPointMove';
|