@antv/g2 5.4.2 → 5.4.4
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 +2 -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 +11 -2
- package/esm/component/legendCategory.js.map +1 -1
- package/esm/component/legendContinuous.js +8 -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 +2 -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/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 +1 -0
- package/esm/interaction/index.js +1 -0
- package/esm/interaction/index.js.map +1 -1
- package/esm/interaction/legendFilter.d.ts +2 -0
- package/esm/interaction/legendFilter.js +237 -22
- 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.d.ts +2 -2
- package/esm/interaction/tooltip.js +16 -9
- package/esm/interaction/tooltip.js.map +1 -1
- package/esm/interaction/treemapDrillDown.js.map +1 -1
- package/esm/interaction/utils.d.ts +2 -2
- package/esm/interaction/utils.js.map +1 -1
- 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 +2 -1
- package/esm/lib/core.js +2 -1
- package/esm/lib/core.js.map +1 -1
- package/esm/lib/std.d.ts +1 -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/line.js.map +1 -1
- 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 +2 -1
- 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 +15 -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 +2 -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 +11 -2
- package/lib/component/legendCategory.js.map +1 -1
- package/lib/component/legendContinuous.js +8 -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 +2 -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/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 +1 -0
- package/lib/interaction/index.js +3 -1
- package/lib/interaction/index.js.map +1 -1
- package/lib/interaction/legendFilter.d.ts +2 -0
- package/lib/interaction/legendFilter.js +249 -33
- 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.d.ts +2 -2
- package/lib/interaction/tooltip.js +22 -16
- 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 +2 -2
- package/lib/interaction/utils.js +34 -34
- package/lib/interaction/utils.js.map +1 -1
- 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 +2 -1
- package/lib/lib/core.js +2 -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.js +1 -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 +1 -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/line.js.map +1 -1
- 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 +4 -4
- 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 +15 -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 +5 -4
- package/src/component/axis.ts +3 -0
- package/src/component/constant.ts +12 -0
- package/src/component/legendCategory.ts +13 -1
- package/src/component/legendContinuous.ts +6 -0
- package/src/component/scrollbar.ts +2 -1
- package/src/interaction/elementHoverScale.ts +285 -0
- package/src/interaction/event.ts +10 -2
- package/src/interaction/index.ts +1 -0
- package/src/interaction/legendFilter.ts +260 -14
- package/src/interaction/scrollbarFilter.ts +2 -1
- package/src/interaction/tooltip.ts +16 -7
- package/src/lib/core.ts +2 -0
- package/src/runtime/mark.ts +2 -2
- package/src/runtime/plot.ts +1 -0
- package/src/spec/interaction.ts +16 -0
- package/src/theme/create.ts +3 -1
- package/src/theme/dark.ts +5 -4
- package/src/utils/helper.ts +6 -6
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { DisplayObject } from '@antv/g';
|
|
2
2
|
import { deepMix, throttle } from '@antv/util';
|
|
3
|
+
import { Base } from '@antv/scale';
|
|
3
4
|
import { subObject } from '../utils/helper';
|
|
4
5
|
import { ANNOTATION_MARKS } from '../component/constant';
|
|
5
6
|
import { useState, setCursor, restoreCursor } from './utils';
|
|
6
7
|
|
|
7
8
|
export const CATEGORY_LEGEND_CLASS_NAME = 'legend-category';
|
|
9
|
+
export const CATEGORY_LEGEND_CLASS_NAME_HTML = 'legend-html';
|
|
8
10
|
|
|
9
11
|
export const CONTINUOUS_LEGEND_CLASS_NAME = 'legend-continuous';
|
|
10
12
|
|
|
@@ -35,6 +37,9 @@ export function itemsOf(root) {
|
|
|
35
37
|
export function legendsOf(root) {
|
|
36
38
|
return root.getElementsByClassName(CATEGORY_LEGEND_CLASS_NAME);
|
|
37
39
|
}
|
|
40
|
+
export function legendsHtmlOf(root) {
|
|
41
|
+
return root.getElementsByClassName(CATEGORY_LEGEND_CLASS_NAME_HTML);
|
|
42
|
+
}
|
|
38
43
|
|
|
39
44
|
export function legendsContinuousOf(root) {
|
|
40
45
|
return root.getElementsByClassName(CONTINUOUS_LEGEND_CLASS_NAME);
|
|
@@ -65,6 +70,21 @@ export function attributesOf(root) {
|
|
|
65
70
|
return child.attributes;
|
|
66
71
|
}
|
|
67
72
|
|
|
73
|
+
function getScaleByMarkKey(
|
|
74
|
+
scale: Record<string, Base<any>>,
|
|
75
|
+
markKey: string,
|
|
76
|
+
channelName: string,
|
|
77
|
+
) {
|
|
78
|
+
const seriesKey = Object.keys(scale).find((channel) => {
|
|
79
|
+
if (channel.startsWith(channelName)) {
|
|
80
|
+
const options = scale[channel].getOptions();
|
|
81
|
+
return options.name === channelName && options.markKey === markKey;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
return scale[seriesKey] ?? scale[channelName];
|
|
86
|
+
}
|
|
87
|
+
|
|
68
88
|
function legendFilterOrdinal(
|
|
69
89
|
root: DisplayObject,
|
|
70
90
|
{
|
|
@@ -254,22 +274,215 @@ function legendFilterOrdinal(
|
|
|
254
274
|
if (focusIcon) {
|
|
255
275
|
focusIcon.removeEventListener('click', focusIconClick.get(item));
|
|
256
276
|
}
|
|
257
|
-
|
|
258
|
-
emitter.on('legend:focus', onFocus);
|
|
259
|
-
emitter.off('legend:filter', onFilter);
|
|
260
|
-
emitter.off('legend:reset', onEnd);
|
|
261
277
|
}
|
|
278
|
+
emitter.off('legend:focus', onFocus);
|
|
279
|
+
emitter.off('legend:filter', onFilter);
|
|
280
|
+
emitter.off('legend:reset', onEnd);
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
function legendFilterOrdinalHtml(
|
|
285
|
+
root: DisplayObject,
|
|
286
|
+
{ domain, filter, defaultSelect, emitter, channel },
|
|
287
|
+
) {
|
|
288
|
+
// HTML DOM event handlers.
|
|
289
|
+
const htmlItemClick = new Map();
|
|
290
|
+
const htmlItemPointerenter = new Map();
|
|
291
|
+
const htmlItemPointerout = new Map();
|
|
292
|
+
|
|
293
|
+
let selectedValues = [...domain];
|
|
294
|
+
|
|
295
|
+
// Helper function to get chart container element.
|
|
296
|
+
const getChartContainer = () => {
|
|
297
|
+
// Use the same approach as tooltip.ts to get container.
|
|
298
|
+
const view = root.ownerDocument?.defaultView;
|
|
299
|
+
if (!view) return document.body;
|
|
300
|
+
|
|
301
|
+
const canvas: any = view.getContextService().getDomElement();
|
|
302
|
+
return (canvas.parentElement as unknown as HTMLElement) || document.body;
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
// Helper function to bind HTML DOM events.
|
|
306
|
+
const bindHtmlDomEvents = () => {
|
|
307
|
+
const chartContainer = getChartContainer();
|
|
308
|
+
|
|
309
|
+
// Find HTML legend containers within this chart's container.
|
|
310
|
+
const htmlContainer = chartContainer.querySelector('.legend-html');
|
|
311
|
+
|
|
312
|
+
const htmlClick = async (event) => {
|
|
313
|
+
// Find the element with legend-value attribute by traversing up from the target.
|
|
314
|
+
let targetElement = event.target as Element;
|
|
315
|
+
while (targetElement && !targetElement.hasAttribute('legend-value')) {
|
|
316
|
+
targetElement = targetElement.parentElement;
|
|
317
|
+
if (targetElement === htmlContainer) break; // Stop if we reach the container.
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
if (!targetElement || !targetElement.hasAttribute('legend-value')) return;
|
|
321
|
+
|
|
322
|
+
event.preventDefault();
|
|
323
|
+
event.stopPropagation();
|
|
324
|
+
|
|
325
|
+
const value = targetElement.getAttribute('legend-value');
|
|
326
|
+
if (!value) return;
|
|
327
|
+
|
|
328
|
+
const index = selectedValues.indexOf(value);
|
|
329
|
+
if (index === -1) selectedValues.push(value);
|
|
330
|
+
else selectedValues.splice(index, 1);
|
|
331
|
+
|
|
332
|
+
await filter(selectedValues);
|
|
333
|
+
updateHtmlLegendState();
|
|
334
|
+
|
|
335
|
+
if (selectedValues.length === domain.length) {
|
|
336
|
+
emitter.emit('legend:reset', { nativeEvent: true });
|
|
337
|
+
} else {
|
|
338
|
+
emitter.emit('legend:filter', {
|
|
339
|
+
nativeEvent: true,
|
|
340
|
+
data: {
|
|
341
|
+
channel,
|
|
342
|
+
values: selectedValues,
|
|
343
|
+
},
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
// Bind HTML DOM events to the container using event delegation.
|
|
349
|
+
htmlContainer.addEventListener('click', htmlClick);
|
|
350
|
+
|
|
351
|
+
// Store handlers for cleanup.
|
|
352
|
+
htmlItemClick.set(htmlContainer, htmlClick);
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
// Helper function to update HTML legend visual state.
|
|
356
|
+
const updateHtmlLegendState = () => {
|
|
357
|
+
const chartContainer = getChartContainer();
|
|
358
|
+
const htmlLegendItems = chartContainer.querySelectorAll('[legend-value]');
|
|
359
|
+
|
|
360
|
+
htmlLegendItems.forEach((htmlItem) => {
|
|
361
|
+
const value = htmlItem.getAttribute('legend-value');
|
|
362
|
+
if (!value) return;
|
|
363
|
+
|
|
364
|
+
// Check if this value exists in the domain (belongs to this chart instance).
|
|
365
|
+
if (!domain.includes(value)) return;
|
|
366
|
+
|
|
367
|
+
const isSelected = selectedValues.includes(value);
|
|
368
|
+
const htmlElement = htmlItem as HTMLElement;
|
|
369
|
+
|
|
370
|
+
if (!isSelected) {
|
|
371
|
+
// Apply unselected style.
|
|
372
|
+
// User can override style via CSS.
|
|
373
|
+
htmlElement.style.opacity = '0.4';
|
|
374
|
+
htmlElement.classList.add('legend-item-inactive');
|
|
375
|
+
} else {
|
|
376
|
+
// Apply selected style.
|
|
377
|
+
htmlElement.style.opacity = '1';
|
|
378
|
+
htmlElement.classList.remove('legend-item-inactive');
|
|
379
|
+
}
|
|
380
|
+
});
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
// Bind HTML DOM events.
|
|
384
|
+
bindHtmlDomEvents();
|
|
385
|
+
|
|
386
|
+
const onFocus = async (event) => {
|
|
387
|
+
const { nativeEvent } = event;
|
|
388
|
+
if (nativeEvent) return;
|
|
389
|
+
|
|
390
|
+
const { data } = event;
|
|
391
|
+
const { channel: specifiedChannel, value } = data;
|
|
392
|
+
if (specifiedChannel !== channel) return;
|
|
393
|
+
|
|
394
|
+
selectedValues = [value];
|
|
395
|
+
|
|
396
|
+
await filter(selectedValues);
|
|
397
|
+
updateHtmlLegendState();
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
const onFilter = async (event) => {
|
|
401
|
+
const { nativeEvent } = event;
|
|
402
|
+
if (nativeEvent) return;
|
|
403
|
+
const { data } = event;
|
|
404
|
+
const { channel: specifiedChannel, values } = data;
|
|
405
|
+
if (specifiedChannel !== channel) return;
|
|
406
|
+
selectedValues = values;
|
|
407
|
+
await filter(selectedValues);
|
|
408
|
+
updateHtmlLegendState();
|
|
409
|
+
};
|
|
410
|
+
|
|
411
|
+
const onEnd = async (event) => {
|
|
412
|
+
const { nativeEvent } = event;
|
|
413
|
+
if (nativeEvent) return;
|
|
414
|
+
selectedValues = [...domain];
|
|
415
|
+
await filter(selectedValues);
|
|
416
|
+
updateHtmlLegendState();
|
|
417
|
+
};
|
|
418
|
+
|
|
419
|
+
emitter.on('legend:filter', onFilter);
|
|
420
|
+
emitter.on('legend:focus', onFocus);
|
|
421
|
+
emitter.on('legend:reset', onEnd);
|
|
422
|
+
|
|
423
|
+
if (defaultSelect) {
|
|
424
|
+
emitter.emit('legend:filter', {
|
|
425
|
+
data: { channel, values: defaultSelect },
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
return () => {
|
|
430
|
+
// Clean up HTML DOM event listeners.
|
|
431
|
+
const chartContainer = getChartContainer();
|
|
432
|
+
const htmlLegendItems = chartContainer.querySelectorAll('[legend-value]');
|
|
433
|
+
|
|
434
|
+
htmlLegendItems.forEach((htmlItem) => {
|
|
435
|
+
const value = htmlItem.getAttribute('legend-value');
|
|
436
|
+
if (!value) return;
|
|
437
|
+
|
|
438
|
+
// Only clean up items that belong to this chart instance.
|
|
439
|
+
if (!domain.includes(value)) return;
|
|
440
|
+
|
|
441
|
+
const clickHandler = htmlItemClick.get(htmlItem);
|
|
442
|
+
const pointerenterHandler = htmlItemPointerenter.get(htmlItem);
|
|
443
|
+
const pointeroutHandler = htmlItemPointerout.get(htmlItem);
|
|
444
|
+
|
|
445
|
+
if (clickHandler) {
|
|
446
|
+
htmlItem.removeEventListener('click', clickHandler);
|
|
447
|
+
}
|
|
448
|
+
if (pointerenterHandler) {
|
|
449
|
+
htmlItem.removeEventListener('pointerenter', pointerenterHandler);
|
|
450
|
+
}
|
|
451
|
+
if (pointeroutHandler) {
|
|
452
|
+
htmlItem.removeEventListener('pointerout', pointeroutHandler);
|
|
453
|
+
}
|
|
454
|
+
});
|
|
455
|
+
|
|
456
|
+
// Clear HTML DOM handler maps.
|
|
457
|
+
htmlItemClick.clear();
|
|
458
|
+
htmlItemPointerenter.clear();
|
|
459
|
+
htmlItemPointerout.clear();
|
|
460
|
+
|
|
461
|
+
// Clean up emitter listeners.
|
|
462
|
+
emitter.off('legend:filter', onFilter);
|
|
463
|
+
emitter.off('legend:focus', onFocus);
|
|
464
|
+
emitter.off('legend:reset', onEnd);
|
|
262
465
|
};
|
|
263
466
|
}
|
|
264
467
|
|
|
265
468
|
function legendFilterContinuous(_, { legend, filter, emitter, channel }) {
|
|
266
|
-
const
|
|
267
|
-
|
|
469
|
+
const { attributes } = legend;
|
|
470
|
+
const onValueChange = (data) => {
|
|
471
|
+
const { value } = data.detail;
|
|
472
|
+
const domainValue = value.map((d) => {
|
|
473
|
+
const matchRealValue = attributes.data?.find((item) => item.value === d);
|
|
474
|
+
// For threshold/quantile scale, use domain value instead of threshold index.
|
|
475
|
+
if (matchRealValue) return matchRealValue.domainValue ?? d;
|
|
476
|
+
|
|
477
|
+
return d;
|
|
478
|
+
});
|
|
479
|
+
|
|
480
|
+
filter(domainValue);
|
|
268
481
|
emitter.emit({
|
|
269
482
|
nativeEvent: true,
|
|
270
483
|
data: {
|
|
271
484
|
channel,
|
|
272
|
-
values:
|
|
485
|
+
values: domainValue,
|
|
273
486
|
},
|
|
274
487
|
});
|
|
275
488
|
};
|
|
@@ -296,9 +509,20 @@ async function filterView(
|
|
|
296
509
|
const { marks } = viewOptions;
|
|
297
510
|
// Add filter transform for every marks,
|
|
298
511
|
// which will skip for mark without color channel.
|
|
512
|
+
|
|
513
|
+
const channelScale = legend.attributes?.scales?.find(
|
|
514
|
+
(s) => s.name === channel,
|
|
515
|
+
);
|
|
299
516
|
const newMarks = marks.map((mark) => {
|
|
300
|
-
|
|
517
|
+
// Only filter marks with the same scale key.
|
|
518
|
+
if (
|
|
519
|
+
// if key is not defined, use default channel name.
|
|
520
|
+
(mark.scale[channel].key ?? channel) !==
|
|
521
|
+
(channelScale?.key ?? channelScale?.name)
|
|
522
|
+
)
|
|
523
|
+
return mark;
|
|
301
524
|
|
|
525
|
+
if (mark.type === 'legends') return mark;
|
|
302
526
|
// Skip Annotation marks.
|
|
303
527
|
if (ANNOTATION_MARKS.includes(mark.type)) return mark;
|
|
304
528
|
|
|
@@ -311,16 +535,24 @@ async function filterView(
|
|
|
311
535
|
if (data.length) {
|
|
312
536
|
newTransform.splice(index + 1, 0, {
|
|
313
537
|
type: 'filter',
|
|
314
|
-
[channel]: {
|
|
538
|
+
[channel]: {
|
|
539
|
+
value,
|
|
540
|
+
ordinal,
|
|
541
|
+
},
|
|
315
542
|
});
|
|
316
543
|
}
|
|
317
544
|
|
|
318
545
|
// Set domain of scale to preserve encoding.
|
|
319
546
|
const newScale = Object.fromEntries(
|
|
320
|
-
channels.map((channel) =>
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
547
|
+
channels.map((channel) => {
|
|
548
|
+
const matchScale = getScaleByMarkKey(
|
|
549
|
+
view.scale,
|
|
550
|
+
viewOptions.key,
|
|
551
|
+
channel,
|
|
552
|
+
);
|
|
553
|
+
|
|
554
|
+
return [channel, { domain: matchScale.getOptions().domain }];
|
|
555
|
+
}),
|
|
324
556
|
);
|
|
325
557
|
return deepMix({}, mark, {
|
|
326
558
|
transform: newTransform,
|
|
@@ -353,6 +585,7 @@ export function LegendFilter() {
|
|
|
353
585
|
};
|
|
354
586
|
const legends = [
|
|
355
587
|
...legendsOf(container),
|
|
588
|
+
...legendsHtmlOf(container),
|
|
356
589
|
...legendsContinuousOf(container),
|
|
357
590
|
];
|
|
358
591
|
const allChannels = legends.flatMap(channelsOf);
|
|
@@ -370,8 +603,9 @@ export function LegendFilter() {
|
|
|
370
603
|
channels,
|
|
371
604
|
allChannels,
|
|
372
605
|
};
|
|
606
|
+
|
|
373
607
|
if (legend.className === CATEGORY_LEGEND_CLASS_NAME) {
|
|
374
|
-
return legendFilterOrdinal(
|
|
608
|
+
return legendFilterOrdinal(legend, {
|
|
375
609
|
legends: itemsOf,
|
|
376
610
|
marker: markerOf,
|
|
377
611
|
label: labelOf,
|
|
@@ -390,6 +624,18 @@ export function LegendFilter() {
|
|
|
390
624
|
channel,
|
|
391
625
|
emitter,
|
|
392
626
|
});
|
|
627
|
+
} else if (legend.className === CATEGORY_LEGEND_CLASS_NAME_HTML) {
|
|
628
|
+
return legendFilterOrdinalHtml(container, {
|
|
629
|
+
domain,
|
|
630
|
+
filter: (value) => {
|
|
631
|
+
const options = { ...common, value, ordinal: true };
|
|
632
|
+
if (isFacet) filter(facets, options);
|
|
633
|
+
else filter(context, options);
|
|
634
|
+
},
|
|
635
|
+
defaultSelect: legend.attributes.defaultSelect,
|
|
636
|
+
channel,
|
|
637
|
+
emitter,
|
|
638
|
+
});
|
|
393
639
|
} else {
|
|
394
640
|
return legendFilterContinuous(container, {
|
|
395
641
|
legend,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { G2_CLASS_PREFIX } from '../component/constant';
|
|
1
2
|
import { SliderFilter } from './sliderFilter';
|
|
2
3
|
|
|
3
|
-
export const SCROLLBAR_CLASS_NAME =
|
|
4
|
+
export const SCROLLBAR_CLASS_NAME = `${G2_CLASS_PREFIX}scrollbar`;
|
|
4
5
|
|
|
5
6
|
export function ScrollbarFilter(options: any = {}) {
|
|
6
7
|
return (context, _, emitter) => {
|
|
@@ -14,6 +14,7 @@ import { angle, sub, dist } from '../utils/vector';
|
|
|
14
14
|
import { invert } from '../utils/scale';
|
|
15
15
|
import { BBox } from '../runtime';
|
|
16
16
|
import { CALLBACK_ITEM_SYMBOL } from '../runtime/transform';
|
|
17
|
+
import { G2_CLASS_PREFIX, g2Selector } from '../component/constant';
|
|
17
18
|
import {
|
|
18
19
|
selectG2Elements,
|
|
19
20
|
createXKey,
|
|
@@ -79,8 +80,8 @@ function createTooltip(
|
|
|
79
80
|
offset: [number, number] = [10, 10],
|
|
80
81
|
) {
|
|
81
82
|
const defaults = {
|
|
82
|
-
'
|
|
83
|
-
'
|
|
83
|
+
[g2Selector('tooltip')]: {},
|
|
84
|
+
[g2Selector('tooltip-title')]: {
|
|
84
85
|
overflow: 'hidden',
|
|
85
86
|
'white-space': 'nowrap',
|
|
86
87
|
'text-overflow': 'ellipsis',
|
|
@@ -99,7 +100,7 @@ function createTooltip(
|
|
|
99
100
|
title: '',
|
|
100
101
|
offset,
|
|
101
102
|
template: {
|
|
102
|
-
prefixCls:
|
|
103
|
+
prefixCls: G2_CLASS_PREFIX,
|
|
103
104
|
},
|
|
104
105
|
style: deepMix(defaults, css),
|
|
105
106
|
},
|
|
@@ -529,7 +530,7 @@ function updateMarker(root, { data, style, theme }) {
|
|
|
529
530
|
const fill = type === 'hollow' ? 'transparent' : originColor;
|
|
530
531
|
const stroke = type === 'hollow' ? originColor : '#fff';
|
|
531
532
|
const shape = new Circle({
|
|
532
|
-
className:
|
|
533
|
+
className: `${G2_CLASS_PREFIX}tooltip-marker`,
|
|
533
534
|
style: {
|
|
534
535
|
cx: point[0],
|
|
535
536
|
cy: point[1],
|
|
@@ -948,6 +949,7 @@ export function seriesTooltip(
|
|
|
948
949
|
style: _style = {},
|
|
949
950
|
css = {},
|
|
950
951
|
clickLock = false,
|
|
952
|
+
disableAutoHide = false,
|
|
951
953
|
...rest
|
|
952
954
|
}: Record<string, any>,
|
|
953
955
|
) {
|
|
@@ -1095,7 +1097,8 @@ export function seriesTooltip(
|
|
|
1095
1097
|
) as (...args: any[]) => void;
|
|
1096
1098
|
|
|
1097
1099
|
const hide = (event: MouseEvent) => {
|
|
1098
|
-
if (clickLock && root.getAttribute(LOCKED_SYMBOL))
|
|
1100
|
+
if ((clickLock && root.getAttribute(LOCKED_SYMBOL)) || disableAutoHide)
|
|
1101
|
+
return;
|
|
1099
1102
|
hideTooltip({ root, single, emitter, event });
|
|
1100
1103
|
};
|
|
1101
1104
|
|
|
@@ -1220,6 +1223,7 @@ export function tooltip(
|
|
|
1220
1223
|
preserve = false,
|
|
1221
1224
|
css = {},
|
|
1222
1225
|
clickLock = false,
|
|
1226
|
+
disableAutoHide = false,
|
|
1223
1227
|
}: Record<string, any>,
|
|
1224
1228
|
) {
|
|
1225
1229
|
const elements = elementsof(root);
|
|
@@ -1236,7 +1240,9 @@ export function tooltip(
|
|
|
1236
1240
|
shared,
|
|
1237
1241
|
});
|
|
1238
1242
|
if (!element) {
|
|
1239
|
-
|
|
1243
|
+
if (!disableAutoHide) {
|
|
1244
|
+
hideTooltip({ root, single, emitter, event });
|
|
1245
|
+
}
|
|
1240
1246
|
return;
|
|
1241
1247
|
}
|
|
1242
1248
|
const k = groupKey(element);
|
|
@@ -1258,7 +1264,9 @@ export function tooltip(
|
|
|
1258
1264
|
}
|
|
1259
1265
|
|
|
1260
1266
|
if (isEmptyTooltipData(data)) {
|
|
1261
|
-
|
|
1267
|
+
if (!disableAutoHide) {
|
|
1268
|
+
hideTooltip({ root, single, emitter, event });
|
|
1269
|
+
}
|
|
1262
1270
|
return;
|
|
1263
1271
|
}
|
|
1264
1272
|
|
|
@@ -1295,6 +1303,7 @@ export function tooltip(
|
|
|
1295
1303
|
) as (...args: any[]) => void;
|
|
1296
1304
|
|
|
1297
1305
|
const pointerleave = (event) => {
|
|
1306
|
+
if (disableAutoHide) return;
|
|
1298
1307
|
hideTooltip({ root, single, emitter, event });
|
|
1299
1308
|
};
|
|
1300
1309
|
|
package/src/lib/core.ts
CHANGED
|
@@ -85,6 +85,7 @@ import {
|
|
|
85
85
|
ElementHighlight,
|
|
86
86
|
ElementHighlightByX,
|
|
87
87
|
ElementHighlightByColor,
|
|
88
|
+
ElementHoverScale,
|
|
88
89
|
ElementSelect,
|
|
89
90
|
ElementSelectByX,
|
|
90
91
|
ElementSelectByColor,
|
|
@@ -296,6 +297,7 @@ export function corelib() {
|
|
|
296
297
|
'interaction.elementHighlight': ElementHighlight,
|
|
297
298
|
'interaction.elementHighlightByX': ElementHighlightByX,
|
|
298
299
|
'interaction.elementHighlightByColor': ElementHighlightByColor,
|
|
300
|
+
'interaction.elementHoverScale': ElementHoverScale,
|
|
299
301
|
'interaction.elementSelect': ElementSelect,
|
|
300
302
|
'interaction.elementSelectByX': ElementSelectByX,
|
|
301
303
|
'interaction.elementSelectByColor': ElementSelectByColor,
|
package/src/runtime/mark.ts
CHANGED
|
@@ -39,7 +39,7 @@ export async function initializeMark(
|
|
|
39
39
|
context,
|
|
40
40
|
);
|
|
41
41
|
|
|
42
|
-
const { encode, scale, data, tooltip, key:
|
|
42
|
+
const { encode, scale, data, tooltip, key: markKey } = transformedMark;
|
|
43
43
|
|
|
44
44
|
// Skip mark with non-tabular data. Do not skip empty
|
|
45
45
|
// data, they are useful for facet to display axes.
|
|
@@ -107,7 +107,7 @@ export async function initializeMark(
|
|
|
107
107
|
scaleKey: independent || isConstant ? Symbol('independent') : key,
|
|
108
108
|
scale: {
|
|
109
109
|
type,
|
|
110
|
-
|
|
110
|
+
markKey,
|
|
111
111
|
range: finalRange,
|
|
112
112
|
...scaleOptions,
|
|
113
113
|
quantitative,
|
package/src/runtime/plot.ts
CHANGED
package/src/spec/interaction.ts
CHANGED
|
@@ -7,6 +7,7 @@ export type Interaction =
|
|
|
7
7
|
| ElementHighlightInteraction
|
|
8
8
|
| ElementHighlightByColorInteraction
|
|
9
9
|
| ElementHighlightByXInteraction
|
|
10
|
+
| ElementHoverScaleInteraction
|
|
10
11
|
| ElementSelectByColorInteraction
|
|
11
12
|
| ElementSelectByXInteraction
|
|
12
13
|
| ElementSelectInteraction
|
|
@@ -30,6 +31,7 @@ export type InteractionTypes =
|
|
|
30
31
|
| 'elementHighlight'
|
|
31
32
|
| 'elementHighlightByX'
|
|
32
33
|
| 'elementHighlightByColor'
|
|
34
|
+
| 'elementHoverScale'
|
|
33
35
|
| 'fisheye'
|
|
34
36
|
| 'chartIndex'
|
|
35
37
|
| 'elementSelect'
|
|
@@ -144,6 +146,19 @@ export type ElementHighlightByColorInteraction = {
|
|
|
144
146
|
delay?: number;
|
|
145
147
|
} & Record<`${'link' | 'background'}${any}`, any>;
|
|
146
148
|
|
|
149
|
+
export type ElementHoverScaleInteraction = {
|
|
150
|
+
type?: 'elementHoverScale';
|
|
151
|
+
scale?: number;
|
|
152
|
+
scaleOrigin?: string;
|
|
153
|
+
shadow?: boolean;
|
|
154
|
+
shadowColor?: string;
|
|
155
|
+
shadowBlur?: number;
|
|
156
|
+
shadowOffsetX?: number;
|
|
157
|
+
shadowOffsetY?: number;
|
|
158
|
+
zIndex?: number;
|
|
159
|
+
delay?: number;
|
|
160
|
+
} & Record<`state${any}`, any>;
|
|
161
|
+
|
|
147
162
|
export type PoptipInteraction = {
|
|
148
163
|
type?: 'poptip';
|
|
149
164
|
offsetX?: number;
|
|
@@ -189,6 +204,7 @@ export type TooltipInteraction = {
|
|
|
189
204
|
marker?: boolean;
|
|
190
205
|
groupName?: boolean;
|
|
191
206
|
disableNative?: boolean;
|
|
207
|
+
disableAutoHide?: boolean;
|
|
192
208
|
offset?: [number, number];
|
|
193
209
|
position?: TooltipStyleProps['position'];
|
|
194
210
|
bounding?: BBox;
|
package/src/theme/create.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { g2Selector } from '../component/constant';
|
|
2
|
+
|
|
1
3
|
export function create({
|
|
2
4
|
colorDefault,
|
|
3
5
|
colorBlack,
|
|
@@ -436,7 +438,7 @@ export function create({
|
|
|
436
438
|
},
|
|
437
439
|
tooltip: {
|
|
438
440
|
css: {
|
|
439
|
-
'
|
|
441
|
+
[g2Selector('tooltip')]: {
|
|
440
442
|
'font-family': 'sans-serif',
|
|
441
443
|
},
|
|
442
444
|
},
|
package/src/theme/dark.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { deepMix } from '@antv/util';
|
|
2
2
|
import { ThemeComponent as TC, Theme } from '../runtime';
|
|
3
|
+
import { g2Selector } from '../component/constant';
|
|
3
4
|
import { create } from './create';
|
|
4
5
|
|
|
5
6
|
export type DarkOptions = Theme;
|
|
@@ -66,17 +67,17 @@ export const Dark: TC<DarkOptions> = (options) => {
|
|
|
66
67
|
crosshairsLineWidth: 1,
|
|
67
68
|
crosshairsStrokeOpacity: 0.25,
|
|
68
69
|
css: {
|
|
69
|
-
'
|
|
70
|
+
[g2Selector('tooltip')]: {
|
|
70
71
|
background: '#1f1f1f',
|
|
71
72
|
opacity: 0.95,
|
|
72
73
|
},
|
|
73
|
-
'
|
|
74
|
+
[g2Selector('tooltip-title')]: {
|
|
74
75
|
color: '#A6A6A6',
|
|
75
76
|
},
|
|
76
|
-
'
|
|
77
|
+
[g2Selector('tooltip-list-item-name-label')]: {
|
|
77
78
|
color: '#A6A6A6',
|
|
78
79
|
},
|
|
79
|
-
'
|
|
80
|
+
[g2Selector('tooltip-list-item-value')]: {
|
|
80
81
|
color: '#A6A6A6',
|
|
81
82
|
},
|
|
82
83
|
},
|
package/src/utils/helper.ts
CHANGED
|
@@ -62,16 +62,16 @@ export function seriesOf(elemenet: G2Element): string {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
|
-
* Get series scale by
|
|
65
|
+
* Get series scale by markKey
|
|
66
66
|
*/
|
|
67
|
-
function
|
|
68
|
-
// For path mark,
|
|
69
|
-
const
|
|
67
|
+
function getSeriesByMarkKey(scale: Record<string, Base<any>>, datum) {
|
|
68
|
+
// For path mark, markKey is in datum.element?.__data__?.markKey.
|
|
69
|
+
const markKey = datum.markKey ?? datum.element?.__data__?.markKey;
|
|
70
70
|
|
|
71
71
|
const seriesKey = Object.keys(scale).find((channel) => {
|
|
72
72
|
if (channel.startsWith('series')) {
|
|
73
73
|
const options = scale[channel].getOptions();
|
|
74
|
-
return options.name === 'series' && options.
|
|
74
|
+
return options.name === 'series' && options.markKey === markKey;
|
|
75
75
|
}
|
|
76
76
|
});
|
|
77
77
|
return scale[seriesKey] ?? scale.series;
|
|
@@ -83,7 +83,7 @@ function getSeriesByMarkerKey(scale: Record<string, Base<any>>, datum) {
|
|
|
83
83
|
export function groupNameOf(scale: Record<string, Base<any>>, datum) {
|
|
84
84
|
const { color: scaleColor, facet = false } = scale;
|
|
85
85
|
const { color, series } = datum;
|
|
86
|
-
const scaleSeries =
|
|
86
|
+
const scaleSeries = getSeriesByMarkKey(scale, datum);
|
|
87
87
|
|
|
88
88
|
const invertAble = (scale) => {
|
|
89
89
|
return (
|