@antv/g2 5.3.5-beta.0 → 5.3.6-beta.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 +25 -23
- package/dist/g2.min.js +25 -23
- package/esm/animation/morphing.js +11 -6
- 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.d.ts +1 -0
- package/esm/component/axis.js +5 -5
- package/esm/component/axis.js.map +1 -1
- package/esm/component/axisRadar.js.map +1 -1
- package/esm/component/legendCategory.js.map +1 -1
- package/esm/component/legendContinuous.js +1 -1
- package/esm/component/legendContinuous.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/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/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/elementPointMove.js.map +1 -1
- package/esm/interaction/elementSelect.js.map +1 -1
- package/esm/interaction/event.js.map +1 -1
- package/esm/interaction/fisheye.js.map +1 -1
- package/esm/interaction/legendFilter.d.ts +2 -0
- package/esm/interaction/legendFilter.js +66 -10
- 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 +3 -3
- package/esm/interaction/scrollbarFilter.js.map +1 -1
- package/esm/interaction/sliderFilter.js +2 -5
- package/esm/interaction/sliderFilter.js.map +1 -1
- package/esm/interaction/tooltip.js +61 -12
- 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 +7 -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/builtinlib.d.ts +4 -0
- package/esm/lib/builtinlib.js +2 -1
- package/esm/lib/builtinlib.js.map +1 -1
- 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/interval.js +3 -1
- package/esm/mark/interval.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 +29 -0
- package/esm/mark/sankey.js.map +1 -1
- package/esm/mark/utils.js +31 -1
- package/esm/mark/utils.js.map +1 -1
- package/esm/runtime/component.js +17 -6
- package/esm/runtime/component.js.map +1 -1
- package/esm/runtime/constant.d.ts +2 -0
- package/esm/runtime/constant.js +2 -0
- package/esm/runtime/constant.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 -1
- package/esm/runtime/mark.js.map +1 -1
- package/esm/runtime/option-preprocess/axis-breaks.d.ts +6 -0
- package/esm/runtime/option-preprocess/axis-breaks.js +25 -0
- package/esm/runtime/option-preprocess/axis-breaks.js.map +1 -0
- package/esm/runtime/option-preprocess/index.js +2 -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 +58 -8
- 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.d.ts +1 -0
- package/esm/runtime/transform.js +9 -0
- package/esm/runtime/transform.js.map +1 -1
- package/esm/shape/area/curve.js.map +1 -1
- package/esm/shape/axis-breaks/axis-breaks.d.ts +19 -0
- package/esm/shape/axis-breaks/axis-breaks.js +146 -0
- package/esm/shape/axis-breaks/axis-breaks.js.map +1 -0
- 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/index.d.ts +2 -0
- package/esm/shape/index.js +1 -0
- package/esm/shape/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 +3 -2
- package/esm/shape/utils.js.map +1 -1
- package/esm/shape/vector/vector.js.map +1 -1
- package/esm/spec/labelTransform.d.ts +1 -1
- package/esm/theme/create.d.ts +1 -0
- package/esm/theme/create.js +3 -2
- package/esm/theme/create.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.map +1 -1
- package/esm/utils/marker.d.ts +1 -1
- package/esm/utils/scale.js +3 -0
- package/esm/utils/scale.js.map +1 -1
- package/esm/utils/selection.js +7 -2
- 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 +10 -5
- 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.d.ts +1 -0
- package/lib/component/axis.js +7 -7
- 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/legendCategory.js.map +1 -1
- package/lib/component/legendContinuous.js +1 -1
- package/lib/component/legendContinuous.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/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/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/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 +1 -2
- 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/legendFilter.d.ts +2 -0
- package/lib/interaction/legendFilter.js +77 -20
- 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 +5 -5
- package/lib/interaction/scrollbarFilter.js.map +1 -1
- package/lib/interaction/sliderFilter.js +4 -7
- package/lib/interaction/sliderFilter.js.map +1 -1
- package/lib/interaction/tooltip.js +66 -18
- 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 +28 -28
- package/lib/interaction/utils.js.map +1 -1
- package/lib/label-transform/exceedAdjust.js +7 -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.d.ts +4 -0
- package/lib/lib/builtinlib.js +2 -2
- package/lib/lib/builtinlib.js.map +1 -1
- package/lib/lib/core.js +1 -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.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/interval.js +3 -1
- package/lib/mark/interval.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 +29 -0
- package/lib/mark/sankey.js.map +1 -1
- package/lib/mark/utils.js +47 -18
- package/lib/mark/utils.js.map +1 -1
- package/lib/runtime/component.js +27 -17
- package/lib/runtime/component.js.map +1 -1
- package/lib/runtime/constant.d.ts +2 -0
- package/lib/runtime/constant.js +3 -1
- package/lib/runtime/constant.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 +3 -3
- package/lib/runtime/mark.js.map +1 -1
- package/lib/runtime/option-preprocess/axis-breaks.d.ts +6 -0
- package/lib/runtime/option-preprocess/axis-breaks.js +30 -0
- package/lib/runtime/option-preprocess/axis-breaks.js.map +1 -0
- package/lib/runtime/option-preprocess/index.js +3 -3
- 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 +58 -9
- 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.d.ts +1 -0
- package/lib/runtime/transform.js +22 -12
- package/lib/runtime/transform.js.map +1 -1
- package/lib/shape/area/curve.js.map +1 -1
- package/lib/shape/axis-breaks/axis-breaks.d.ts +19 -0
- package/lib/shape/axis-breaks/axis-breaks.js +150 -0
- package/lib/shape/axis-breaks/axis-breaks.js.map +1 -0
- 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/index.d.ts +2 -0
- package/lib/shape/index.js +3 -1
- package/lib/shape/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 +14 -14
- package/lib/shape/utils.js.map +1 -1
- package/lib/shape/vector/vector.js.map +1 -1
- package/lib/spec/labelTransform.d.ts +1 -1
- package/lib/theme/create.d.ts +1 -0
- package/lib/theme/create.js +4 -4
- package/lib/theme/create.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 +24 -25
- 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 +9 -7
- package/lib/utils/scale.js.map +1 -1
- package/lib/utils/selection.js +9 -4
- 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 -5
- package/src/animation/morphing.ts +33 -10
- package/src/component/axis.ts +5 -0
- package/src/interaction/legendFilter.ts +66 -0
- package/src/interaction/scrollbarFilter.ts +2 -2
- package/src/interaction/sliderFilter.ts +0 -4
- package/src/interaction/tooltip.ts +78 -20
- package/src/label-transform/exceedAdjust.ts +9 -2
- package/src/lib/builtinlib.ts +2 -1
- package/src/mark/interval.ts +3 -1
- package/src/mark/sankey.ts +30 -0
- package/src/mark/utils.ts +38 -1
- package/src/runtime/component.ts +20 -3
- package/src/runtime/constant.ts +2 -0
- package/src/runtime/mark.ts +2 -0
- package/src/runtime/option-preprocess/axis-breaks.ts +36 -0
- package/src/runtime/option-preprocess/index.ts +2 -1
- package/src/runtime/plot.ts +82 -7
- package/src/runtime/transform.ts +17 -0
- package/src/shape/axis-breaks/axis-breaks.ts +198 -0
- package/src/shape/index.ts +2 -0
- package/src/shape/utils.ts +3 -2
- package/src/spec/labelTransform.ts +1 -1
- package/src/theme/create.ts +2 -1
- package/src/utils/scale.ts +3 -0
- package/src/utils/selection.ts +7 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Circle, DisplayObject, IElement, Line } from '@antv/g';
|
|
2
2
|
import { sort, group, mean, bisector, minIndex } from '@antv/vendor/d3-array';
|
|
3
|
-
import { deepMix, lowerFirst, set, throttle, last } from '@antv/util';
|
|
3
|
+
import { deepMix, lowerFirst, set, throttle, last, isNumber } from '@antv/util';
|
|
4
4
|
import { Tooltip as TooltipComponent } from '@antv/component';
|
|
5
5
|
import {
|
|
6
6
|
defined,
|
|
@@ -198,9 +198,29 @@ function showUndefined(item) {
|
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
function heatmapItem(element) {
|
|
201
|
-
const datum = element
|
|
202
|
-
const
|
|
201
|
+
const { __data__: datum } = element;
|
|
202
|
+
const { title, items = [] } = datum;
|
|
203
203
|
|
|
204
|
+
// Check if there are user-defined items using the existing CALLBACK_ITEM_SYMBOL
|
|
205
|
+
const hasCustomItems = items.some((item) => CALLBACK_ITEM_SYMBOL in item);
|
|
206
|
+
|
|
207
|
+
if (hasCustomItems) {
|
|
208
|
+
// User has defined custom items, pass them through as is
|
|
209
|
+
const newItems = items
|
|
210
|
+
.filter(defined)
|
|
211
|
+
.map(({ color = itemColorOf(element), ...item }) => ({
|
|
212
|
+
...item,
|
|
213
|
+
color,
|
|
214
|
+
}))
|
|
215
|
+
.map(showUndefined);
|
|
216
|
+
return {
|
|
217
|
+
...(title && { title }),
|
|
218
|
+
items: newItems,
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// No user-defined items, use special logic for heatmap
|
|
223
|
+
const normalizedX = datum?.normalized?.x ?? 0;
|
|
204
224
|
const originalDatum = element.parentNode?.__data__;
|
|
205
225
|
const encode = originalDatum?.encode ?? {};
|
|
206
226
|
const { x = {}, y = {}, color = {} } = encode;
|
|
@@ -288,6 +308,7 @@ function groupItems(
|
|
|
288
308
|
...item,
|
|
289
309
|
color,
|
|
290
310
|
name: name1 || title,
|
|
311
|
+
channel: name,
|
|
291
312
|
};
|
|
292
313
|
},
|
|
293
314
|
);
|
|
@@ -571,6 +592,35 @@ function normalizedPosition(coordinate, position) {
|
|
|
571
592
|
};
|
|
572
593
|
}
|
|
573
594
|
|
|
595
|
+
/**
|
|
596
|
+
* Determine whether the band widths occupied by different categories are the same.
|
|
597
|
+
*/
|
|
598
|
+
function equalBandWidth(scale) {
|
|
599
|
+
const { x } = scale;
|
|
600
|
+
if (!x || !x.valueBandWidth) return true;
|
|
601
|
+
const { valueBandWidth } = x;
|
|
602
|
+
if (isNumber(valueBandWidth)) return true;
|
|
603
|
+
return new Set(valueBandWidth.values()).size === 1;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
/**
|
|
607
|
+
* Get the index of the element closest to the abstractX
|
|
608
|
+
*/
|
|
609
|
+
function findNearestElementIndex(scale, abstractX): number {
|
|
610
|
+
const { adjustedRange, valueBandWidth, valueStep } = scale;
|
|
611
|
+
const values: number[] = Array.from(valueBandWidth.values());
|
|
612
|
+
const steps: number[] = Array.from(valueStep.values());
|
|
613
|
+
const ranges = adjustedRange.map((v, i) => {
|
|
614
|
+
const halfStep = (steps[i] - values[i]) / 2;
|
|
615
|
+
return [v - halfStep, v + values[i] + halfStep];
|
|
616
|
+
});
|
|
617
|
+
const index = ranges.findIndex(
|
|
618
|
+
([start, end]) => start <= abstractX && abstractX <= end,
|
|
619
|
+
);
|
|
620
|
+
if (index !== -1) return index;
|
|
621
|
+
return abstractX > 0.5 ? adjustedRange.length - 1 : 0;
|
|
622
|
+
}
|
|
623
|
+
|
|
574
624
|
/**
|
|
575
625
|
* Finds a single element based on the mouse event in a non-series context (e.g., single item tooltip).
|
|
576
626
|
* @param root - The root display object of the chart.
|
|
@@ -596,18 +646,20 @@ export function findSingleElement({
|
|
|
596
646
|
const inInterval = (d) => d.markType === 'interval';
|
|
597
647
|
const isBar = elements.every(inInterval) && !isPolar(coordinate);
|
|
598
648
|
const scaleX = scale.x;
|
|
649
|
+
const isEqualWidth = equalBandWidth(scale);
|
|
599
650
|
const scaleSeries = scale.series;
|
|
600
651
|
const bandWidth = scaleX?.getBandWidth?.() ?? 0;
|
|
601
|
-
const xof =
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
652
|
+
const xof =
|
|
653
|
+
scaleSeries && scaleSeries.valueBandWidth
|
|
654
|
+
? (d) => {
|
|
655
|
+
const seriesCount = Math.round(1 / scaleSeries.valueBandWidth);
|
|
656
|
+
return (
|
|
657
|
+
d.__data__.x +
|
|
658
|
+
d.__data__.series * bandWidth +
|
|
659
|
+
bandWidth / (seriesCount * 2)
|
|
660
|
+
);
|
|
661
|
+
}
|
|
662
|
+
: (d) => d.__data__.x + bandWidth / 2;
|
|
611
663
|
|
|
612
664
|
// Sort for bisector search.
|
|
613
665
|
if (isBar) elements.sort((a, b) => xof(a) - xof(b));
|
|
@@ -635,7 +687,9 @@ export function findSingleElement({
|
|
|
635
687
|
if (!mouse) return;
|
|
636
688
|
const [abstractX] = coordinate.invert(mouse);
|
|
637
689
|
const search = bisector(xof).center;
|
|
638
|
-
const i =
|
|
690
|
+
const i = isEqualWidth
|
|
691
|
+
? search(elements, abstractX)
|
|
692
|
+
: findNearestElementIndex(scaleX, abstractX);
|
|
639
693
|
const target = elements[i];
|
|
640
694
|
|
|
641
695
|
if (!shared) {
|
|
@@ -643,7 +697,7 @@ export function findSingleElement({
|
|
|
643
697
|
const isGrouped = elements.find(
|
|
644
698
|
(d) => d !== target && xof(d) === xof(target),
|
|
645
699
|
);
|
|
646
|
-
if (isGrouped) return findElementByTarget(event);
|
|
700
|
+
if (isGrouped) return findElementByTarget(event) || isGrouped;
|
|
647
701
|
}
|
|
648
702
|
return target;
|
|
649
703
|
}
|
|
@@ -1068,6 +1122,11 @@ export function seriesTooltip(
|
|
|
1068
1122
|
destroy();
|
|
1069
1123
|
};
|
|
1070
1124
|
|
|
1125
|
+
const pointerleave = (e) => {
|
|
1126
|
+
if (mousePosition(root, e)) return;
|
|
1127
|
+
hide(e);
|
|
1128
|
+
};
|
|
1129
|
+
|
|
1071
1130
|
const onTooltipEnable = () => {
|
|
1072
1131
|
addEventListeners();
|
|
1073
1132
|
};
|
|
@@ -1078,10 +1137,7 @@ export function seriesTooltip(
|
|
|
1078
1137
|
root.addEventListener('pointerenter', update);
|
|
1079
1138
|
root.addEventListener('pointermove', update);
|
|
1080
1139
|
// Only emit pointerleave event when the pointer is not in the root area.
|
|
1081
|
-
root.addEventListener('pointerleave',
|
|
1082
|
-
if (mousePosition(root, e)) return;
|
|
1083
|
-
hide(e);
|
|
1084
|
-
});
|
|
1140
|
+
root.addEventListener('pointerleave', pointerleave);
|
|
1085
1141
|
root.addEventListener('pointerup', hide);
|
|
1086
1142
|
}
|
|
1087
1143
|
};
|
|
@@ -1091,7 +1147,7 @@ export function seriesTooltip(
|
|
|
1091
1147
|
root.removeEventListener('pointerdown', update);
|
|
1092
1148
|
root.removeEventListener('pointerenter', update);
|
|
1093
1149
|
root.removeEventListener('pointermove', update);
|
|
1094
|
-
root.removeEventListener('pointerleave',
|
|
1150
|
+
root.removeEventListener('pointerleave', pointerleave);
|
|
1095
1151
|
root.removeEventListener('pointerup', hide);
|
|
1096
1152
|
}
|
|
1097
1153
|
};
|
|
@@ -1286,6 +1342,8 @@ export function tooltip(
|
|
|
1286
1342
|
removeEventListeners();
|
|
1287
1343
|
emitter.off('tooltip:show', onTooltipShow);
|
|
1288
1344
|
emitter.off('tooltip:hide', onTooltipHide);
|
|
1345
|
+
emitter.off('tooltip:enable', onTooltipEnable);
|
|
1346
|
+
emitter.off('tooltip:disable', onTooltipDisable);
|
|
1289
1347
|
if (preserve) {
|
|
1290
1348
|
hideTooltip({ root, single, emitter, nativeEvent: false });
|
|
1291
1349
|
} else {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DisplayObject } from '@antv/g';
|
|
1
|
+
import { AABB, DisplayObject } from '@antv/g';
|
|
2
2
|
import { LabelTransformComponent as LLC } from '../runtime';
|
|
3
3
|
import { ExceedAdjustLabel } from '../spec';
|
|
4
4
|
import { Bounds } from '../utils/bounds';
|
|
@@ -28,6 +28,13 @@ const adjustPosition = (target: Bounds, edge: Bounds) => {
|
|
|
28
28
|
return [changeX, changeY];
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
+
const union = (a: AABB, b: AABB) => {
|
|
32
|
+
return {
|
|
33
|
+
min: [Math.min(a.min[0], b.min[0]), Math.min(a.min[1], b.min[1])],
|
|
34
|
+
max: [Math.max(a.max[0], b.max[0]), Math.max(a.max[1], b.max[1])],
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
|
|
31
38
|
export type ExceedAdjustOptions = Omit<ExceedAdjustLabel, 'type'> & {
|
|
32
39
|
/** X-axis offset default is 0 */
|
|
33
40
|
offsetX?: number;
|
|
@@ -85,7 +92,7 @@ export const ExceedAdjust: LLC<ExceedAdjustOptions> = (options = {}) => {
|
|
|
85
92
|
|
|
86
93
|
labels.forEach((l) => {
|
|
87
94
|
show(l);
|
|
88
|
-
const { max, min } = l.getRenderBounds();
|
|
95
|
+
const { max, min } = union(l.getRenderBounds(), l.getBounds());
|
|
89
96
|
const [xMax, yMax] = max,
|
|
90
97
|
[xMin, yMin] = min;
|
|
91
98
|
const changeValue = adjustPosition(
|
package/src/lib/builtinlib.ts
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
LegendContinuousSize,
|
|
8
8
|
} from '../component';
|
|
9
9
|
import { Mark, View } from '../composition';
|
|
10
|
-
import { LabelShape } from '../shape';
|
|
10
|
+
import { LabelShape, BreakShape } from '../shape';
|
|
11
11
|
import { Event } from '../interaction/event';
|
|
12
12
|
|
|
13
13
|
// Some private visual components, they are not public to
|
|
@@ -24,5 +24,6 @@ export function builtinlib() {
|
|
|
24
24
|
'composition.mark': Mark,
|
|
25
25
|
'composition.view': View,
|
|
26
26
|
'shape.label.label': LabelShape,
|
|
27
|
+
'shape.break': BreakShape,
|
|
27
28
|
} as const;
|
|
28
29
|
}
|
package/src/mark/interval.ts
CHANGED
|
@@ -38,7 +38,9 @@ export type IntervalOptions = Omit<IntervalMark, 'type'>;
|
|
|
38
38
|
*/
|
|
39
39
|
export const Interval: MC<IntervalOptions> = () => {
|
|
40
40
|
return (index, scale, value, coordinate) => {
|
|
41
|
-
const { x: X,
|
|
41
|
+
const { x: X, y1: Y1, series: S, size: SZ } = value;
|
|
42
|
+
let { y: Y } = value;
|
|
43
|
+
Y = Y.map((d) => (d !== undefined ? d : 1));
|
|
42
44
|
|
|
43
45
|
// Calc width for each interval.
|
|
44
46
|
// The scales for x and series channels must be band scale.
|
package/src/mark/sankey.ts
CHANGED
|
@@ -75,6 +75,36 @@ export const Sankey: CC<SankeyOptions> = (options) => {
|
|
|
75
75
|
// Initialize data, generating nodes by link if is not specified.
|
|
76
76
|
const { links, nodes } = initializeData(data, encode);
|
|
77
77
|
|
|
78
|
+
// Early check for empty data - return empty marks instead of processing
|
|
79
|
+
if (!links || links.length === 0) {
|
|
80
|
+
return [
|
|
81
|
+
// Empty node mark
|
|
82
|
+
deepMix({}, DEFAULT_NODE_OPTIONS, {
|
|
83
|
+
data: [],
|
|
84
|
+
encode: {},
|
|
85
|
+
scale,
|
|
86
|
+
style: subObject(style, 'node'),
|
|
87
|
+
labels: [],
|
|
88
|
+
tooltip: false,
|
|
89
|
+
animate: false,
|
|
90
|
+
axis: false,
|
|
91
|
+
interaction,
|
|
92
|
+
state: {},
|
|
93
|
+
}),
|
|
94
|
+
// Empty link mark
|
|
95
|
+
deepMix({}, DEFAULT_LINK_OPTIONS, {
|
|
96
|
+
data: [],
|
|
97
|
+
encode: {},
|
|
98
|
+
labels: [],
|
|
99
|
+
style: subObject(style, 'link'),
|
|
100
|
+
tooltip: false,
|
|
101
|
+
animate: false,
|
|
102
|
+
interaction,
|
|
103
|
+
state: {},
|
|
104
|
+
}),
|
|
105
|
+
];
|
|
106
|
+
}
|
|
107
|
+
|
|
78
108
|
// Extract encode for node and link.
|
|
79
109
|
const nodeEncode = subObject(encode, 'node');
|
|
80
110
|
const linkEncode = subObject(encode, 'link');
|
package/src/mark/utils.ts
CHANGED
|
@@ -130,6 +130,31 @@ export function valueof(data: Record<string, any>[], encode: Encode): any[] {
|
|
|
130
130
|
return Array.from(data, field(encode));
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
+
/**
|
|
134
|
+
* Normalizes data input for graph charts (sankey, chord, forceGraph) to ensure consistent format
|
|
135
|
+
* Supports both array input (like other charts) and object input (original format)
|
|
136
|
+
*
|
|
137
|
+
* @param data - Input data, can be array or object with links/nodes properties
|
|
138
|
+
* @returns Normalized data object with links and optional nodes properties
|
|
139
|
+
*/
|
|
140
|
+
function normalizeGraphData(data: any): { links: any[]; nodes?: any[] } {
|
|
141
|
+
// Handle array input - convert to { links: data } format
|
|
142
|
+
if (Array.isArray(data)) {
|
|
143
|
+
return { links: data };
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// Handle object input - return as is (original format)
|
|
147
|
+
if (data && typeof data === 'object') {
|
|
148
|
+
return {
|
|
149
|
+
links: data.links || [],
|
|
150
|
+
nodes: data.nodes,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// Handle null/undefined and unexpected input types
|
|
155
|
+
return { links: [] };
|
|
156
|
+
}
|
|
157
|
+
|
|
133
158
|
export function initializeData(
|
|
134
159
|
data: { nodes?: any[]; links: any[] },
|
|
135
160
|
encode: Record<string, Encode>,
|
|
@@ -137,15 +162,27 @@ export function initializeData(
|
|
|
137
162
|
links: { target: string; source: string; value: any }[];
|
|
138
163
|
nodes: { key: string }[];
|
|
139
164
|
} {
|
|
165
|
+
const normalizedData = normalizeGraphData(data);
|
|
140
166
|
const {
|
|
141
167
|
source = (d) => d.source,
|
|
142
168
|
target = (d) => d.target,
|
|
143
169
|
value = (d) => d.value,
|
|
144
170
|
} = encode;
|
|
145
|
-
|
|
171
|
+
|
|
172
|
+
const { links, nodes } = normalizedData;
|
|
173
|
+
|
|
174
|
+
// Early return for empty links
|
|
175
|
+
if (!links.length) {
|
|
176
|
+
return {
|
|
177
|
+
links: [],
|
|
178
|
+
nodes: nodes || [],
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
|
|
146
182
|
const LS = valueof(links, source);
|
|
147
183
|
const LT = valueof(links, target);
|
|
148
184
|
const LV = valueof(links, value);
|
|
185
|
+
|
|
149
186
|
return {
|
|
150
187
|
links: links.map((_, i) => ({
|
|
151
188
|
target: LT[i],
|
package/src/runtime/component.ts
CHANGED
|
@@ -724,7 +724,18 @@ function computeAxisSize(
|
|
|
724
724
|
// Compute Labels.
|
|
725
725
|
const scale = createScale(component, library);
|
|
726
726
|
const labelBBoxes = computeLabelsBBox(rest, scale);
|
|
727
|
-
|
|
727
|
+
|
|
728
|
+
// Compute dynamic tickLength if it's a function
|
|
729
|
+
let maxTickLength = tickLength;
|
|
730
|
+
if (typeof component.tickLength === 'function') {
|
|
731
|
+
const ticks = scale.getTicks?.() || scale.getOptions().domain;
|
|
732
|
+
const tickLengths = ticks.map((d, i, array) =>
|
|
733
|
+
component.tickLength(d, i, array),
|
|
734
|
+
);
|
|
735
|
+
maxTickLength = Math.max(...tickLengths, 0);
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
const paddingTick = maxTickLength + labelSpacing;
|
|
728
739
|
if (labelBBoxes && labelBBoxes.length) {
|
|
729
740
|
const maxLabelWidth = max(labelBBoxes, (d) => d.width);
|
|
730
741
|
const maxLabelHeight = max(labelBBoxes, (d) => d.height);
|
|
@@ -748,7 +759,7 @@ function computeAxisSize(
|
|
|
748
759
|
}
|
|
749
760
|
}
|
|
750
761
|
} else {
|
|
751
|
-
component.size =
|
|
762
|
+
component.size = maxTickLength;
|
|
752
763
|
}
|
|
753
764
|
|
|
754
765
|
// Compute title.
|
|
@@ -835,7 +846,9 @@ function computeCategoryLegendSize(
|
|
|
835
846
|
};
|
|
836
847
|
|
|
837
848
|
const {
|
|
849
|
+
focus,
|
|
838
850
|
itemSpacing,
|
|
851
|
+
focusMarkerSize,
|
|
839
852
|
itemMarkerSize,
|
|
840
853
|
titleSpacing,
|
|
841
854
|
rowPadding,
|
|
@@ -866,7 +879,11 @@ function computeCategoryLegendSize(
|
|
|
866
879
|
|
|
867
880
|
const height = Math.max(labelBBoxes[0].height, itemMarkerSize) + rowPadding;
|
|
868
881
|
const widthOf = (w, padding = 0) =>
|
|
869
|
-
itemMarkerSize +
|
|
882
|
+
itemMarkerSize +
|
|
883
|
+
w +
|
|
884
|
+
itemSpacing[0] +
|
|
885
|
+
padding +
|
|
886
|
+
(focus ? focusMarkerSize + itemSpacing[2] : 0);
|
|
870
887
|
|
|
871
888
|
// Only support grid layout for vertical area.
|
|
872
889
|
const computeVerticalSize = () => {
|
package/src/runtime/constant.ts
CHANGED
|
@@ -7,3 +7,5 @@ export const COMPONENT_CLASS_NAME = 'component';
|
|
|
7
7
|
export const LABEL_CLASS_NAME = 'label';
|
|
8
8
|
export const AREA_CLASS_NAME = 'area';
|
|
9
9
|
export const MASK_CLASS_NAME = 'mask';
|
|
10
|
+
export const BREAK_CLASS_NAME = 'axis-breaks';
|
|
11
|
+
export const BREAK_GROUP_CLASS_NAME = 'axis-breaks-group';
|
package/src/runtime/mark.ts
CHANGED
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
maybeNonAnimate,
|
|
25
25
|
normalizeTooltip,
|
|
26
26
|
extractTooltip,
|
|
27
|
+
appendMarkScaleKey,
|
|
27
28
|
} from './transform';
|
|
28
29
|
|
|
29
30
|
export async function initializeMark(
|
|
@@ -159,6 +160,7 @@ async function applyMarkTransform(
|
|
|
159
160
|
maybeNonAnimate,
|
|
160
161
|
addGuideToScale,
|
|
161
162
|
normalizeTooltip,
|
|
163
|
+
appendMarkScaleKey,
|
|
162
164
|
...preInference.map(useTransform),
|
|
163
165
|
...transform.map(useTransform),
|
|
164
166
|
...postInference.map(useTransform),
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { get, set } from '@antv/util';
|
|
2
|
+
import { G2ViewTree } from '../types/options';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Convert a percentage string to a ratio.
|
|
6
|
+
*/
|
|
7
|
+
export const percentToRatio = (gap: string) => {
|
|
8
|
+
if (!gap || typeof gap !== 'string') {
|
|
9
|
+
return gap;
|
|
10
|
+
}
|
|
11
|
+
const value = gap.endsWith('%')
|
|
12
|
+
? parseFloat(gap.slice(0, -1)) / 100
|
|
13
|
+
: parseFloat(gap);
|
|
14
|
+
if (isNaN(value) || value < 0 || value > 1) {
|
|
15
|
+
throw new Error(`Invalid gap value: ${gap}. It should be between 0 and 1.`);
|
|
16
|
+
}
|
|
17
|
+
return value;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export function axisBreaks<T extends G2ViewTree = G2ViewTree>(options: T): T {
|
|
21
|
+
const { axis } = options;
|
|
22
|
+
const breaks = get(axis, 'y.breaks');
|
|
23
|
+
|
|
24
|
+
if (breaks) {
|
|
25
|
+
set(
|
|
26
|
+
options,
|
|
27
|
+
'scale.y.breaks',
|
|
28
|
+
breaks.map((item) => ({
|
|
29
|
+
key: `break-${item.start}-${item.end}`,
|
|
30
|
+
...item,
|
|
31
|
+
gap: percentToRatio(item.gap),
|
|
32
|
+
})),
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
return options;
|
|
36
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { G2ViewTree } from '../types/options';
|
|
2
2
|
import { flow } from '../../utils/flow';
|
|
3
3
|
import { columnWidthRatio } from './style';
|
|
4
|
+
import { axisBreaks } from './axis-breaks';
|
|
4
5
|
|
|
5
6
|
export function preprocessOption<T extends G2ViewTree = G2ViewTree>(
|
|
6
7
|
options: T,
|
|
@@ -19,5 +20,5 @@ export function preprocessOption<T extends G2ViewTree = G2ViewTree>(
|
|
|
19
20
|
// Entry point for all syntactic sugar functions.
|
|
20
21
|
function adapter<T extends G2ViewTree = G2ViewTree>(options: T): T {
|
|
21
22
|
//@todo define a type for params of flow
|
|
22
|
-
return flow(columnWidthRatio)(options);
|
|
23
|
+
return flow(columnWidthRatio, axisBreaks)(options);
|
|
23
24
|
}
|
package/src/runtime/plot.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Vector2 } from '@antv/coord';
|
|
2
2
|
import { DisplayObject, IAnimation as GAnimation, Rect } from '@antv/g';
|
|
3
|
-
import { deepMix, upperFirst, isArray } from '@antv/util';
|
|
3
|
+
import { deepMix, upperFirst, isArray, get } from '@antv/util';
|
|
4
4
|
import { group, groups } from '@antv/vendor/d3-array';
|
|
5
5
|
import { format } from '@antv/vendor/d3-format';
|
|
6
6
|
import { mapObject } from '../utils/array';
|
|
@@ -32,6 +32,8 @@ import {
|
|
|
32
32
|
MAIN_LAYER_CLASS_NAME,
|
|
33
33
|
PLOT_CLASS_NAME,
|
|
34
34
|
VIEW_CLASS_NAME,
|
|
35
|
+
BREAK_CLASS_NAME,
|
|
36
|
+
BREAK_GROUP_CLASS_NAME,
|
|
35
37
|
} from './constant';
|
|
36
38
|
import { coordinate2Transform, createCoordinate } from './coordinate';
|
|
37
39
|
import {
|
|
@@ -872,6 +874,7 @@ function initializeState(
|
|
|
872
874
|
style: framedStyle,
|
|
873
875
|
components,
|
|
874
876
|
data: dataMap,
|
|
877
|
+
options: options,
|
|
875
878
|
labelTransform: compose(labelTransform.map(useLabelTransform)),
|
|
876
879
|
};
|
|
877
880
|
|
|
@@ -1027,11 +1030,12 @@ async function plotView(
|
|
|
1027
1030
|
(update) =>
|
|
1028
1031
|
update
|
|
1029
1032
|
.call(updateLayers, Array.from(markState.keys()))
|
|
1030
|
-
.call(
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1033
|
+
.call(updateBBox)
|
|
1034
|
+
// .call((selection) => {
|
|
1035
|
+
// return animationExtent
|
|
1036
|
+
// ? animateBBox(selection, animationExtent)
|
|
1037
|
+
// : updateBBox(selection);
|
|
1038
|
+
// })
|
|
1035
1039
|
.call(applyClip, clip),
|
|
1036
1040
|
)
|
|
1037
1041
|
.transitions();
|
|
@@ -1099,6 +1103,11 @@ async function plotView(
|
|
|
1099
1103
|
}
|
|
1100
1104
|
return animation;
|
|
1101
1105
|
})
|
|
1106
|
+
.each(function (d, i, element) {
|
|
1107
|
+
if (element.__removed__) {
|
|
1108
|
+
element.__removed__ = false;
|
|
1109
|
+
}
|
|
1110
|
+
})
|
|
1102
1111
|
.attr('markType', type)
|
|
1103
1112
|
.attr('className', ELEMENT_CLASS_NAME);
|
|
1104
1113
|
}),
|
|
@@ -1155,6 +1164,7 @@ async function plotView(
|
|
|
1155
1164
|
|
|
1156
1165
|
// Plot label for this view.
|
|
1157
1166
|
plotLabel(view, selection, transitions, library, context);
|
|
1167
|
+
plotBreak(view, selection, transitions, library, context);
|
|
1158
1168
|
}
|
|
1159
1169
|
|
|
1160
1170
|
/**
|
|
@@ -1283,7 +1293,72 @@ function getLabels(
|
|
|
1283
1293
|
points,
|
|
1284
1294
|
dependentElement: element,
|
|
1285
1295
|
}));
|
|
1286
|
-
return selector ? selector(F) : F;
|
|
1296
|
+
return selector ? (selector(F) as any) : F;
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
/**
|
|
1300
|
+
* Plot break shapes.
|
|
1301
|
+
*/
|
|
1302
|
+
function plotBreak(
|
|
1303
|
+
view: G2ViewDescriptor,
|
|
1304
|
+
selection: Selection,
|
|
1305
|
+
transitions: GAnimation[],
|
|
1306
|
+
library: G2Library,
|
|
1307
|
+
context: G2Context,
|
|
1308
|
+
) {
|
|
1309
|
+
const scale = view.scale;
|
|
1310
|
+
const breaks = get(scale, 'y.options.breaks', []);
|
|
1311
|
+
const { document } = context.canvas;
|
|
1312
|
+
[BREAK_CLASS_NAME, BREAK_GROUP_CLASS_NAME].forEach((d) => {
|
|
1313
|
+
document.getElementsByClassName(d).forEach((e) => {
|
|
1314
|
+
e.remove();
|
|
1315
|
+
});
|
|
1316
|
+
});
|
|
1317
|
+
if (!breaks.length) {
|
|
1318
|
+
return;
|
|
1319
|
+
}
|
|
1320
|
+
const breakLayer = selection.select(className(PLOT_CLASS_NAME)).node();
|
|
1321
|
+
const [useShape] = useLibrary<G2ShapeOptions, ShapeComponent, Shape>(
|
|
1322
|
+
'shape',
|
|
1323
|
+
library,
|
|
1324
|
+
);
|
|
1325
|
+
const breaksShapeFunction = new Map();
|
|
1326
|
+
breaks.forEach((breakConfig, index) => {
|
|
1327
|
+
breaksShapeFunction.set(
|
|
1328
|
+
breakConfig,
|
|
1329
|
+
useShape(
|
|
1330
|
+
{
|
|
1331
|
+
type: 'break',
|
|
1332
|
+
},
|
|
1333
|
+
{
|
|
1334
|
+
view,
|
|
1335
|
+
selection,
|
|
1336
|
+
transitions,
|
|
1337
|
+
context,
|
|
1338
|
+
update: plotView,
|
|
1339
|
+
},
|
|
1340
|
+
),
|
|
1341
|
+
);
|
|
1342
|
+
});
|
|
1343
|
+
|
|
1344
|
+
// Render all breaks.
|
|
1345
|
+
select(breakLayer)
|
|
1346
|
+
.selectAll(className(BREAK_CLASS_NAME))
|
|
1347
|
+
.data(breaks, (d) => d.key)
|
|
1348
|
+
.join(
|
|
1349
|
+
(enter) =>
|
|
1350
|
+
enter
|
|
1351
|
+
.append((d, index) => breaksShapeFunction.get(d)(d, index))
|
|
1352
|
+
.attr('className', BREAK_CLASS_NAME),
|
|
1353
|
+
(update) =>
|
|
1354
|
+
update.each(function (d, i, element) {
|
|
1355
|
+
const shapeFunction = breaksShapeFunction.get(d);
|
|
1356
|
+
const node = shapeFunction(d, i);
|
|
1357
|
+
copyAttributes(element, node);
|
|
1358
|
+
}),
|
|
1359
|
+
(exit) => exit.remove(),
|
|
1360
|
+
)
|
|
1361
|
+
.nodes();
|
|
1287
1362
|
}
|
|
1288
1363
|
|
|
1289
1364
|
function filterValid([I, P, S]: [number[], Vector2[][], number[][]?]): [
|
package/src/runtime/transform.ts
CHANGED
|
@@ -314,6 +314,23 @@ export function maybeNonAnimate(
|
|
|
314
314
|
return [I, mark];
|
|
315
315
|
}
|
|
316
316
|
|
|
317
|
+
export function appendMarkScaleKey(
|
|
318
|
+
I: number[],
|
|
319
|
+
mark: G2Mark,
|
|
320
|
+
context: G2Context,
|
|
321
|
+
): [number[], G2Mark] {
|
|
322
|
+
deepMix(mark, {
|
|
323
|
+
scale: {
|
|
324
|
+
series: {
|
|
325
|
+
key: `DEFAULT_${mark.type}_SERIES_KEY`,
|
|
326
|
+
...(mark?.scale?.series ?? {}),
|
|
327
|
+
},
|
|
328
|
+
},
|
|
329
|
+
});
|
|
330
|
+
|
|
331
|
+
return [I, mark];
|
|
332
|
+
}
|
|
333
|
+
|
|
317
334
|
function isTypedChannel(channel): boolean {
|
|
318
335
|
if (
|
|
319
336
|
typeof channel !== 'object' ||
|