@antv/g2 4.1.25 → 4.1.29
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/CHANGELOG.md +1116 -0
- package/{README.zh-CN.md → README.en-US.md} +39 -38
- package/README.md +39 -38
- package/dist/g2.min.js +31 -3
- package/dist/g2.min.js.map +1 -1
- package/esm/animate/index.js +1 -1
- package/esm/animate/index.js.map +1 -1
- package/esm/animate/interface.js +1 -0
- package/esm/chart/chart.js +1 -3
- package/esm/chart/chart.js.map +1 -1
- package/esm/chart/controller/annotation.js +14 -44
- package/esm/chart/controller/annotation.js.map +1 -1
- package/esm/chart/controller/coordinate.js +1 -2
- package/esm/chart/controller/coordinate.js.map +1 -1
- package/esm/chart/controller/scrollbar.js +3 -7
- package/esm/chart/controller/scrollbar.js.map +1 -1
- package/esm/chart/controller/slider.js +1 -2
- package/esm/chart/controller/slider.js.map +1 -1
- package/esm/chart/controller/tooltip.js +12 -7
- package/esm/chart/controller/tooltip.js.map +1 -1
- package/esm/chart/layout/auto.js +2 -2
- package/esm/chart/layout/auto.js.map +1 -1
- package/esm/chart/layout/constraint/bounds.d.ts +32 -0
- package/esm/chart/layout/constraint/bounds.js +30 -0
- package/esm/chart/layout/constraint/bounds.js.map +1 -0
- package/esm/chart/layout/constraint/constraint.d.ts +31 -0
- package/esm/chart/layout/constraint/constraint.js +81 -0
- package/esm/chart/layout/constraint/constraint.js.map +1 -0
- package/esm/chart/layout/constraint/gauss.d.ts +11 -0
- package/esm/chart/layout/constraint/gauss.js +63 -0
- package/esm/chart/layout/constraint/gauss.js.map +1 -0
- package/esm/chart/layout/constraint/index.d.ts +5 -0
- package/esm/chart/layout/constraint/index.js +30 -0
- package/esm/chart/layout/constraint/index.js.map +1 -0
- package/esm/chart/layout/constraint/solver.d.ts +40 -0
- package/esm/chart/layout/constraint/solver.js +77 -0
- package/esm/chart/layout/constraint/solver.js.map +1 -0
- package/esm/chart/layout/constraint/types.d.ts +21 -0
- package/esm/chart/layout/constraint/types.js +13 -0
- package/esm/chart/layout/constraint/types.js.map +1 -0
- package/esm/chart/layout/constraint/variable.d.ts +24 -0
- package/esm/chart/layout/constraint/variable.js +28 -0
- package/esm/chart/layout/constraint/variable.js.map +1 -0
- package/esm/chart/layout/padding-cal.js +2 -2
- package/esm/chart/layout/padding-cal.js.map +1 -1
- package/esm/chart/view.d.ts +41 -1
- package/esm/chart/view.js +65 -9
- package/esm/chart/view.js.map +1 -1
- package/esm/core.d.ts +1 -1
- package/esm/core.js +1 -1
- package/esm/core.js.map +1 -1
- package/esm/facet/facet.d.ts +5 -0
- package/esm/facet/facet.js +47 -12
- package/esm/facet/facet.js.map +1 -1
- package/esm/facet/tree.js +1 -1
- package/esm/facet/tree.js.map +1 -1
- package/esm/geometry/base.d.ts +34 -7
- package/esm/geometry/base.js +131 -74
- package/esm/geometry/base.js.map +1 -1
- package/esm/geometry/element/index.js.map +1 -1
- package/esm/geometry/heatmap.d.ts +1 -2
- package/esm/geometry/heatmap.js +13 -13
- package/esm/geometry/heatmap.js.map +1 -1
- package/esm/geometry/label/base.js +1 -1
- package/esm/geometry/label/base.js.map +1 -1
- package/esm/geometry/label/interface.js +1 -0
- package/esm/geometry/label/layout/interval/adjust-position.js.map +1 -1
- package/esm/geometry/label/layout/interval/hide-overlap.js.map +1 -1
- package/esm/geometry/label/layout/path/adjust-position.js.map +1 -1
- package/esm/geometry/label/layout/pie/distribute.js +1 -1
- package/esm/geometry/label/layout/pie/distribute.js.map +1 -1
- package/esm/geometry/label/layout/point/adjust-position.js.map +1 -1
- package/esm/geometry/label/pie.js +1 -2
- package/esm/geometry/label/pie.js.map +1 -1
- package/esm/geometry/path.d.ts +1 -2
- package/esm/geometry/path.js +46 -20
- package/esm/geometry/path.js.map +1 -1
- package/esm/geometry/shape/schema/index.js +1 -1
- package/esm/geometry/shape/schema/index.js.map +1 -1
- package/esm/geometry/util/diff.d.ts +11 -0
- package/esm/geometry/util/diff.js +30 -0
- package/esm/geometry/util/diff.js.map +1 -0
- package/esm/interface.d.ts +11 -10
- package/esm/interface.js +1 -0
- package/esm/interface.js.map +1 -1
- package/esm/theme/style-sheet/dark.d.ts +2 -2
- package/esm/theme/style-sheet/dark.js +2 -2
- package/esm/theme/style-sheet/dark.js.map +1 -1
- package/esm/theme/style-sheet/light.d.ts +2 -2
- package/esm/theme/style-sheet/light.js +2 -2
- package/esm/theme/style-sheet/light.js.map +1 -1
- package/esm/theme/util/create-by-style-sheet.js +1 -1
- package/esm/theme/util/create-by-style-sheet.js.map +1 -1
- package/esm/util/annotation.js +2 -0
- package/esm/util/annotation.js.map +1 -1
- package/esm/util/attr.js +2 -2
- package/esm/util/attr.js.map +1 -1
- package/esm/util/collision-detect.js +2 -2
- package/esm/util/collision-detect.js.map +1 -1
- package/esm/util/facet.js +1 -1
- package/esm/util/facet.js.map +1 -1
- package/esm/util/helper.d.ts +1 -1
- package/esm/util/helper.js +3 -3
- package/esm/util/helper.js.map +1 -1
- package/esm/util/legend.js +2 -1
- package/esm/util/legend.js.map +1 -1
- package/esm/util/padding.js +3 -3
- package/esm/util/padding.js.map +1 -1
- package/esm/util/scale.js +3 -4
- package/esm/util/scale.js.map +1 -1
- package/esm/util/stat.js +2 -2
- package/esm/util/stat.js.map +1 -1
- package/esm/util/text.js +2 -2
- package/esm/util/text.js.map +1 -1
- package/esm/util/types.js +1 -0
- package/lib/animate/animation/fade.js +3 -3
- package/lib/animate/animation/fade.js.map +1 -1
- package/lib/animate/animation/grow-in.js +3 -3
- package/lib/animate/animation/grow-in.js.map +1 -1
- package/lib/animate/animation/sector-path-update.js +11 -11
- package/lib/animate/animation/sector-path-update.js.map +1 -1
- package/lib/animate/animation/wave-in.js +2 -2
- package/lib/animate/animation/wave-in.js.map +1 -1
- package/lib/animate/animation/zoom.js +2 -2
- package/lib/animate/animation/zoom.js.map +1 -1
- package/lib/animate/index.js +10 -10
- package/lib/animate/index.js.map +1 -1
- package/lib/api.js +1 -1
- package/lib/api.js.map +1 -1
- package/lib/base.js +2 -2
- package/lib/base.js.map +1 -1
- package/lib/chart/chart.js +12 -14
- package/lib/chart/chart.js.map +1 -1
- package/lib/chart/controller/annotation.js +67 -97
- package/lib/chart/controller/annotation.js.map +1 -1
- package/lib/chart/controller/axis.js +64 -64
- package/lib/chart/controller/axis.js.map +1 -1
- package/lib/chart/controller/base.js +1 -1
- package/lib/chart/controller/base.js.map +1 -1
- package/lib/chart/controller/coordinate.js +6 -7
- package/lib/chart/controller/coordinate.js.map +1 -1
- package/lib/chart/controller/gesture.js +1 -1
- package/lib/chart/controller/gesture.js.map +1 -1
- package/lib/chart/controller/legend.js +45 -45
- package/lib/chart/controller/legend.js.map +1 -1
- package/lib/chart/controller/scrollbar.js +26 -30
- package/lib/chart/controller/scrollbar.js.map +1 -1
- package/lib/chart/controller/slider.js +25 -26
- package/lib/chart/controller/slider.js.map +1 -1
- package/lib/chart/controller/tooltip.js +45 -40
- package/lib/chart/controller/tooltip.js.map +1 -1
- package/lib/chart/index.js +7 -3
- package/lib/chart/index.js.map +1 -1
- package/lib/chart/layout/auto.js +6 -6
- package/lib/chart/layout/auto.js.map +1 -1
- package/lib/chart/layout/constraint/bounds.d.ts +32 -0
- package/lib/chart/layout/constraint/bounds.js +33 -0
- package/lib/chart/layout/constraint/bounds.js.map +1 -0
- package/lib/chart/layout/constraint/constraint.d.ts +31 -0
- package/lib/chart/layout/constraint/constraint.js +84 -0
- package/lib/chart/layout/constraint/constraint.js.map +1 -0
- package/lib/chart/layout/constraint/gauss.d.ts +11 -0
- package/lib/chart/layout/constraint/gauss.js +68 -0
- package/lib/chart/layout/constraint/gauss.js.map +1 -0
- package/lib/chart/layout/constraint/index.d.ts +5 -0
- package/lib/chart/layout/constraint/index.js +38 -0
- package/lib/chart/layout/constraint/index.js.map +1 -0
- package/lib/chart/layout/constraint/solver.d.ts +40 -0
- package/lib/chart/layout/constraint/solver.js +80 -0
- package/lib/chart/layout/constraint/solver.js.map +1 -0
- package/lib/chart/layout/constraint/types.d.ts +21 -0
- package/lib/chart/layout/constraint/types.js +16 -0
- package/lib/chart/layout/constraint/types.js.map +1 -0
- package/lib/chart/layout/constraint/variable.d.ts +24 -0
- package/lib/chart/layout/constraint/variable.js +31 -0
- package/lib/chart/layout/constraint/variable.js.map +1 -0
- package/lib/chart/layout/padding-cal.js +1 -1
- package/lib/chart/layout/padding-cal.js.map +1 -1
- package/lib/chart/util/scale-pool.js +12 -12
- package/lib/chart/util/scale-pool.js.map +1 -1
- package/lib/chart/view.d.ts +41 -1
- package/lib/chart/view.js +142 -86
- package/lib/chart/view.js.map +1 -1
- package/lib/component/labels.js +32 -32
- package/lib/component/labels.js.map +1 -1
- package/lib/component/update-label.js +4 -4
- package/lib/component/update-label.js.map +1 -1
- package/lib/core.d.ts +1 -1
- package/lib/core.js +8 -8
- package/lib/core.js.map +1 -1
- package/lib/dependents.js +1 -1
- package/lib/facet/circle.js +10 -10
- package/lib/facet/circle.js.map +1 -1
- package/lib/facet/facet.d.ts +5 -0
- package/lib/facet/facet.js +56 -21
- package/lib/facet/facet.js.map +1 -1
- package/lib/facet/index.js +7 -5
- package/lib/facet/index.js.map +1 -1
- package/lib/facet/list.js +9 -9
- package/lib/facet/list.js.map +1 -1
- package/lib/facet/matrix.js +13 -13
- package/lib/facet/matrix.js.map +1 -1
- package/lib/facet/mirror.js +10 -10
- package/lib/facet/mirror.js.map +1 -1
- package/lib/facet/rect.js +16 -16
- package/lib/facet/rect.js.map +1 -1
- package/lib/facet/tree.js +10 -10
- package/lib/facet/tree.js.map +1 -1
- package/lib/geometry/area.js +2 -2
- package/lib/geometry/area.js.map +1 -1
- package/lib/geometry/base.d.ts +34 -7
- package/lib/geometry/base.js +203 -146
- package/lib/geometry/base.js.map +1 -1
- package/lib/geometry/edge.js +2 -2
- package/lib/geometry/edge.js.map +1 -1
- package/lib/geometry/element/index.js +22 -22
- package/lib/geometry/element/index.js.map +1 -1
- package/lib/geometry/heatmap.d.ts +1 -2
- package/lib/geometry/heatmap.js +18 -18
- package/lib/geometry/heatmap.js.map +1 -1
- package/lib/geometry/interval.js +7 -7
- package/lib/geometry/interval.js.map +1 -1
- package/lib/geometry/label/base.js +33 -33
- package/lib/geometry/label/base.js.map +1 -1
- package/lib/geometry/label/interval.js +15 -15
- package/lib/geometry/label/interval.js.map +1 -1
- package/lib/geometry/label/layout/adjust-color.js +1 -1
- package/lib/geometry/label/layout/adjust-color.js.map +1 -1
- package/lib/geometry/label/layout/hide-overlap.js +3 -3
- package/lib/geometry/label/layout/hide-overlap.js.map +1 -1
- package/lib/geometry/label/layout/interval/adjust-position.js +2 -2
- package/lib/geometry/label/layout/interval/adjust-position.js.map +1 -1
- package/lib/geometry/label/layout/interval/hide-overlap.js +7 -7
- package/lib/geometry/label/layout/interval/hide-overlap.js.map +1 -1
- package/lib/geometry/label/layout/limit-in-canvas.js +2 -2
- package/lib/geometry/label/layout/limit-in-canvas.js.map +1 -1
- package/lib/geometry/label/layout/limit-in-plot.js +5 -5
- package/lib/geometry/label/layout/limit-in-plot.js.map +1 -1
- package/lib/geometry/label/layout/limit-in-shape.js +1 -1
- package/lib/geometry/label/layout/limit-in-shape.js.map +1 -1
- package/lib/geometry/label/layout/overlap.js +2 -2
- package/lib/geometry/label/layout/overlap.js.map +1 -1
- package/lib/geometry/label/layout/path/adjust-position.js +5 -5
- package/lib/geometry/label/layout/path/adjust-position.js.map +1 -1
- package/lib/geometry/label/layout/pie/distribute.js +8 -8
- package/lib/geometry/label/layout/pie/distribute.js.map +1 -1
- package/lib/geometry/label/layout/pie/outer.js +16 -16
- package/lib/geometry/label/layout/pie/outer.js.map +1 -1
- package/lib/geometry/label/layout/pie/spider.js +18 -18
- package/lib/geometry/label/layout/pie/spider.js.map +1 -1
- package/lib/geometry/label/layout/point/adjust-position.js +5 -5
- package/lib/geometry/label/layout/point/adjust-position.js.map +1 -1
- package/lib/geometry/label/pie.js +8 -9
- package/lib/geometry/label/pie.js.map +1 -1
- package/lib/geometry/label/polar.js +14 -14
- package/lib/geometry/label/polar.js.map +1 -1
- package/lib/geometry/label/util/index.js +4 -4
- package/lib/geometry/label/util/index.js.map +1 -1
- package/lib/geometry/line.js +2 -2
- package/lib/geometry/line.js.map +1 -1
- package/lib/geometry/path.d.ts +1 -2
- package/lib/geometry/path.js +50 -24
- package/lib/geometry/path.js.map +1 -1
- package/lib/geometry/point.js +3 -3
- package/lib/geometry/point.js.map +1 -1
- package/lib/geometry/polygon.js +5 -5
- package/lib/geometry/polygon.js.map +1 -1
- package/lib/geometry/schema.js +4 -4
- package/lib/geometry/schema.js.map +1 -1
- package/lib/geometry/shape/area/index.js +4 -4
- package/lib/geometry/shape/area/index.js.map +1 -1
- package/lib/geometry/shape/area/line.js +2 -2
- package/lib/geometry/shape/area/line.js.map +1 -1
- package/lib/geometry/shape/area/smooth-line.js +2 -2
- package/lib/geometry/shape/area/smooth-line.js.map +1 -1
- package/lib/geometry/shape/area/smooth.js +2 -2
- package/lib/geometry/shape/area/smooth.js.map +1 -1
- package/lib/geometry/shape/area/util.js +5 -5
- package/lib/geometry/shape/area/util.js.map +1 -1
- package/lib/geometry/shape/base.js +11 -11
- package/lib/geometry/shape/base.js.map +1 -1
- package/lib/geometry/shape/edge/arc.js +11 -11
- package/lib/geometry/shape/edge/arc.js.map +1 -1
- package/lib/geometry/shape/edge/index.js +6 -6
- package/lib/geometry/shape/edge/index.js.map +1 -1
- package/lib/geometry/shape/edge/smooth.js +4 -4
- package/lib/geometry/shape/edge/smooth.js.map +1 -1
- package/lib/geometry/shape/edge/util.js +1 -1
- package/lib/geometry/shape/edge/util.js.map +1 -1
- package/lib/geometry/shape/edge/vhv.js +4 -4
- package/lib/geometry/shape/edge/vhv.js.map +1 -1
- package/lib/geometry/shape/interval/funnel.js +5 -5
- package/lib/geometry/shape/interval/funnel.js.map +1 -1
- package/lib/geometry/shape/interval/hollow-rect.js +7 -7
- package/lib/geometry/shape/interval/hollow-rect.js.map +1 -1
- package/lib/geometry/shape/interval/index.js +10 -10
- package/lib/geometry/shape/interval/index.js.map +1 -1
- package/lib/geometry/shape/interval/line.js +7 -7
- package/lib/geometry/shape/interval/line.js.map +1 -1
- package/lib/geometry/shape/interval/pyramid.js +5 -5
- package/lib/geometry/shape/interval/pyramid.js.map +1 -1
- package/lib/geometry/shape/interval/tick.js +4 -4
- package/lib/geometry/shape/interval/tick.js.map +1 -1
- package/lib/geometry/shape/interval/util.js +8 -8
- package/lib/geometry/shape/interval/util.js.map +1 -1
- package/lib/geometry/shape/line/index.js +11 -11
- package/lib/geometry/shape/line/index.js.map +1 -1
- package/lib/geometry/shape/line/step.js +7 -7
- package/lib/geometry/shape/line/step.js.map +1 -1
- package/lib/geometry/shape/point/hollow.js +3 -3
- package/lib/geometry/shape/point/hollow.js.map +1 -1
- package/lib/geometry/shape/point/image.js +2 -2
- package/lib/geometry/shape/point/image.js.map +1 -1
- package/lib/geometry/shape/point/index.js +5 -5
- package/lib/geometry/shape/point/index.js.map +1 -1
- package/lib/geometry/shape/point/solid.js +3 -3
- package/lib/geometry/shape/point/solid.js.map +1 -1
- package/lib/geometry/shape/point/util.js +3 -3
- package/lib/geometry/shape/point/util.js.map +1 -1
- package/lib/geometry/shape/polygon/index.js +7 -7
- package/lib/geometry/shape/polygon/index.js.map +1 -1
- package/lib/geometry/shape/polygon/square.js +5 -5
- package/lib/geometry/shape/polygon/square.js.map +1 -1
- package/lib/geometry/shape/schema/box.js +6 -6
- package/lib/geometry/shape/schema/box.js.map +1 -1
- package/lib/geometry/shape/schema/candle.js +5 -5
- package/lib/geometry/shape/schema/candle.js.map +1 -1
- package/lib/geometry/shape/schema/index.js +2 -2
- package/lib/geometry/shape/schema/index.js.map +1 -1
- package/lib/geometry/shape/util/get-path-points.js +4 -4
- package/lib/geometry/shape/util/get-path-points.js.map +1 -1
- package/lib/geometry/shape/util/get-style.js +4 -4
- package/lib/geometry/shape/util/get-style.js.map +1 -1
- package/lib/geometry/shape/util/path.js +7 -6
- package/lib/geometry/shape/util/path.js.map +1 -1
- package/lib/geometry/shape/util/split-points.js +2 -2
- package/lib/geometry/shape/util/split-points.js.map +1 -1
- package/lib/geometry/shape/violin/hollow.js +8 -8
- package/lib/geometry/shape/violin/hollow.js.map +1 -1
- package/lib/geometry/shape/violin/index.js +9 -9
- package/lib/geometry/shape/violin/index.js.map +1 -1
- package/lib/geometry/shape/violin/smooth.js +4 -4
- package/lib/geometry/shape/violin/smooth.js.map +1 -1
- package/lib/geometry/util/diff.d.ts +11 -0
- package/lib/geometry/util/diff.js +34 -0
- package/lib/geometry/util/diff.js.map +1 -0
- package/lib/geometry/util/get-shape-type.js +1 -1
- package/lib/geometry/util/get-shape-type.js.map +1 -1
- package/lib/geometry/util/group-data.js +1 -1
- package/lib/geometry/util/group-data.js.map +1 -1
- package/lib/geometry/util/is-model-change.js +2 -2
- package/lib/geometry/util/is-model-change.js.map +1 -1
- package/lib/geometry/util/parse-fields.js +1 -1
- package/lib/geometry/util/parse-fields.js.map +1 -1
- package/lib/geometry/util/shape-size.js +9 -9
- package/lib/geometry/util/shape-size.js.map +1 -1
- package/lib/geometry/violin.js +5 -5
- package/lib/geometry/violin.js.map +1 -1
- package/lib/index.js +193 -193
- package/lib/index.js.map +1 -1
- package/lib/interaction/action/active-region.js +19 -19
- package/lib/interaction/action/active-region.js.map +1 -1
- package/lib/interaction/action/base.js +1 -1
- package/lib/interaction/action/base.js.map +1 -1
- package/lib/interaction/action/callback.js +2 -2
- package/lib/interaction/action/callback.js.map +1 -1
- package/lib/interaction/action/component/list-active.js +2 -2
- package/lib/interaction/action/component/list-active.js.map +1 -1
- package/lib/interaction/action/component/list-checked.js +5 -5
- package/lib/interaction/action/component/list-checked.js.map +1 -1
- package/lib/interaction/action/component/list-highlight-util.js +1 -1
- package/lib/interaction/action/component/list-highlight-util.js.map +1 -1
- package/lib/interaction/action/component/list-highlight.js +7 -7
- package/lib/interaction/action/component/list-highlight.js.map +1 -1
- package/lib/interaction/action/component/list-selected.js +2 -2
- package/lib/interaction/action/component/list-selected.js.map +1 -1
- package/lib/interaction/action/component/list-state.js +15 -15
- package/lib/interaction/action/component/list-state.js.map +1 -1
- package/lib/interaction/action/component/list-unchecked.js +2 -2
- package/lib/interaction/action/component/list-unchecked.js.map +1 -1
- package/lib/interaction/action/component/tooltip/ellipsis-text.js +6 -6
- package/lib/interaction/action/component/tooltip/ellipsis-text.js.map +1 -1
- package/lib/interaction/action/component/tooltip/geometry.js +4 -4
- package/lib/interaction/action/component/tooltip/geometry.js.map +1 -1
- package/lib/interaction/action/component/tooltip/sibling.js +7 -7
- package/lib/interaction/action/component/tooltip/sibling.js.map +1 -1
- package/lib/interaction/action/cursor.js +2 -2
- package/lib/interaction/action/cursor.js.map +1 -1
- package/lib/interaction/action/data/filter.js +7 -7
- package/lib/interaction/action/data/filter.js.map +1 -1
- package/lib/interaction/action/data/range-filter.js +3 -3
- package/lib/interaction/action/data/range-filter.js.map +1 -1
- package/lib/interaction/action/data/sibling-filter.js +6 -6
- package/lib/interaction/action/data/sibling-filter.js.map +1 -1
- package/lib/interaction/action/element/active.js +2 -2
- package/lib/interaction/action/element/active.js.map +1 -1
- package/lib/interaction/action/element/filter.js +16 -16
- package/lib/interaction/action/element/filter.js.map +1 -1
- package/lib/interaction/action/element/highlight-by-color.js +5 -5
- package/lib/interaction/action/element/highlight-by-color.js.map +1 -1
- package/lib/interaction/action/element/highlight-by-x.js +6 -6
- package/lib/interaction/action/element/highlight-by-x.js.map +1 -1
- package/lib/interaction/action/element/highlight-util.js +3 -3
- package/lib/interaction/action/element/highlight-util.js.map +1 -1
- package/lib/interaction/action/element/highlight.js +8 -8
- package/lib/interaction/action/element/highlight.js.map +1 -1
- package/lib/interaction/action/element/link-by-color.js +9 -9
- package/lib/interaction/action/element/link-by-color.js.map +1 -1
- package/lib/interaction/action/element/range-active.js +2 -2
- package/lib/interaction/action/element/range-active.js.map +1 -1
- package/lib/interaction/action/element/range-highlight.js +4 -4
- package/lib/interaction/action/element/range-highlight.js.map +1 -1
- package/lib/interaction/action/element/range-selected.js +2 -2
- package/lib/interaction/action/element/range-selected.js.map +1 -1
- package/lib/interaction/action/element/range-state.js +18 -18
- package/lib/interaction/action/element/range-state.js.map +1 -1
- package/lib/interaction/action/element/selected.js +2 -2
- package/lib/interaction/action/element/selected.js.map +1 -1
- package/lib/interaction/action/element/sibling-filter.js +18 -18
- package/lib/interaction/action/element/sibling-filter.js.map +1 -1
- package/lib/interaction/action/element/single-active.js +2 -2
- package/lib/interaction/action/element/single-active.js.map +1 -1
- package/lib/interaction/action/element/single-highlight.js +5 -5
- package/lib/interaction/action/element/single-highlight.js.map +1 -1
- package/lib/interaction/action/element/single-selected.js +2 -2
- package/lib/interaction/action/element/single-selected.js.map +1 -1
- package/lib/interaction/action/element/single-state.js +5 -5
- package/lib/interaction/action/element/single-state.js.map +1 -1
- package/lib/interaction/action/element/state-base.js +4 -4
- package/lib/interaction/action/element/state-base.js.map +1 -1
- package/lib/interaction/action/element/state.js +13 -13
- package/lib/interaction/action/element/state.js.map +1 -1
- package/lib/interaction/action/index.js +5 -1
- package/lib/interaction/action/index.js.map +1 -1
- package/lib/interaction/action/mask/base.js +5 -5
- package/lib/interaction/action/mask/base.js.map +1 -1
- package/lib/interaction/action/mask/circle.js +4 -4
- package/lib/interaction/action/mask/circle.js.map +1 -1
- package/lib/interaction/action/mask/dim-rect.js +6 -6
- package/lib/interaction/action/mask/dim-rect.js.map +1 -1
- package/lib/interaction/action/mask/path.js +3 -3
- package/lib/interaction/action/mask/path.js.map +1 -1
- package/lib/interaction/action/mask/rect.js +4 -4
- package/lib/interaction/action/mask/rect.js.map +1 -1
- package/lib/interaction/action/mask/smooth-path.js +3 -3
- package/lib/interaction/action/mask/smooth-path.js.map +1 -1
- package/lib/interaction/action/register.js +2 -2
- package/lib/interaction/action/register.js.map +1 -1
- package/lib/interaction/action/util.js +13 -13
- package/lib/interaction/action/util.js.map +1 -1
- package/lib/interaction/action/view/button.js +6 -6
- package/lib/interaction/action/view/button.js.map +1 -1
- package/lib/interaction/action/view/drag.js +3 -3
- package/lib/interaction/action/view/drag.js.map +1 -1
- package/lib/interaction/action/view/move.js +2 -2
- package/lib/interaction/action/view/move.js.map +1 -1
- package/lib/interaction/action/view/scale-transform.js +1 -1
- package/lib/interaction/action/view/scale-transform.js.map +1 -1
- package/lib/interaction/action/view/scale-translate.js +4 -4
- package/lib/interaction/action/view/scale-translate.js.map +1 -1
- package/lib/interaction/action/view/scale-zoom.js +3 -3
- package/lib/interaction/action/view/scale-zoom.js.map +1 -1
- package/lib/interaction/context.js +5 -5
- package/lib/interaction/context.js.map +1 -1
- package/lib/interaction/grammar-interaction.js +20 -20
- package/lib/interaction/grammar-interaction.js.map +1 -1
- package/lib/interaction/index.js +7 -7
- package/lib/interaction/index.js.map +1 -1
- package/lib/interface.d.ts +11 -10
- package/lib/interface.js.map +1 -1
- package/lib/theme/index.js +3 -3
- package/lib/theme/index.js.map +1 -1
- package/lib/theme/style-sheet/dark.d.ts +2 -2
- package/lib/theme/style-sheet/dark.js +5 -4
- package/lib/theme/style-sheet/dark.js.map +1 -1
- package/lib/theme/style-sheet/light.d.ts +2 -2
- package/lib/theme/style-sheet/light.js +5 -4
- package/lib/theme/style-sheet/light.js.map +1 -1
- package/lib/theme/util/create-by-style-sheet.js +12 -12
- package/lib/theme/util/create-by-style-sheet.js.map +1 -1
- package/lib/theme/util/create-theme.js +3 -3
- package/lib/theme/util/create-theme.js.map +1 -1
- package/lib/theme/util/index.js +1 -0
- package/lib/theme/util/index.js.map +1 -1
- package/lib/util/annotation.js +4 -2
- package/lib/util/annotation.js.map +1 -1
- package/lib/util/attr.js +1 -1
- package/lib/util/attr.js.map +1 -1
- package/lib/util/axis.js +8 -8
- package/lib/util/axis.js.map +1 -1
- package/lib/util/bbox.js +4 -3
- package/lib/util/bbox.js.map +1 -1
- package/lib/util/collision-detect.js +1 -1
- package/lib/util/collision-detect.js.map +1 -1
- package/lib/util/color.js +3 -2
- package/lib/util/color.js.map +1 -1
- package/lib/util/coordinate.js +5 -5
- package/lib/util/coordinate.js.map +1 -1
- package/lib/util/dom.js +1 -1
- package/lib/util/facet.js +1 -1
- package/lib/util/facet.js.map +1 -1
- package/lib/util/graphics.js +5 -5
- package/lib/util/graphics.js.map +1 -1
- package/lib/util/grid.js +5 -5
- package/lib/util/grid.js.map +1 -1
- package/lib/util/helper.d.ts +1 -1
- package/lib/util/helper.js +5 -5
- package/lib/util/helper.js.map +1 -1
- package/lib/util/legend.js +19 -18
- package/lib/util/legend.js.map +1 -1
- package/lib/util/padding.js +4 -4
- package/lib/util/padding.js.map +1 -1
- package/lib/util/scale.js +11 -12
- package/lib/util/scale.js.map +1 -1
- package/lib/util/stat.js +3 -3
- package/lib/util/stat.js.map +1 -1
- package/lib/util/text.js +12 -11
- package/lib/util/text.js.map +1 -1
- package/lib/util/tooltip.js +21 -21
- package/lib/util/tooltip.js.map +1 -1
- package/package.json +21 -27
- package/src/chart/controller/annotation.ts +14 -7
- package/src/chart/controller/tooltip.ts +11 -1
- package/src/chart/layout/constraint/bounds.ts +52 -0
- package/src/chart/layout/constraint/constraint.ts +98 -0
- package/src/chart/layout/constraint/gauss.ts +71 -0
- package/src/chart/layout/constraint/index.ts +30 -0
- package/src/chart/layout/constraint/solver.ts +98 -0
- package/src/chart/layout/constraint/types.ts +29 -0
- package/src/chart/layout/constraint/variable.ts +33 -0
- package/src/chart/view.ts +70 -5
- package/src/core.ts +1 -1
- package/src/facet/facet.ts +50 -20
- package/src/geometry/base.ts +133 -60
- package/src/geometry/heatmap.ts +17 -18
- package/src/geometry/path.ts +48 -22
- package/src/geometry/util/diff.ts +29 -0
- package/src/interface.ts +8 -6
- package/src/theme/style-sheet/dark.ts +2 -2
- package/src/theme/style-sheet/light.ts +2 -2
- package/src/util/annotation.ts +3 -1
- package/src/util/helper.ts +3 -3
- package/src/util/legend.ts +7 -4
package/lib/geometry/base.js
CHANGED
|
@@ -5,21 +5,22 @@ var adjust_1 = require("@antv/adjust");
|
|
|
5
5
|
var attr_1 = require("@antv/attr");
|
|
6
6
|
var util_1 = require("@antv/util");
|
|
7
7
|
var animate_1 = require("../animate");
|
|
8
|
-
var base_1 = tslib_1.__importDefault(require("../base"));
|
|
8
|
+
var base_1 = (0, tslib_1.__importDefault)(require("../base"));
|
|
9
9
|
var constant_1 = require("../constant");
|
|
10
10
|
var helper_1 = require("../util/helper");
|
|
11
|
-
var element_1 = tslib_1.__importDefault(require("./element"));
|
|
11
|
+
var element_1 = (0, tslib_1.__importDefault)(require("./element"));
|
|
12
12
|
var label_1 = require("./label");
|
|
13
13
|
var base_2 = require("./shape/base");
|
|
14
14
|
var group_data_1 = require("./util/group-data");
|
|
15
15
|
var is_model_change_1 = require("./util/is-model-change");
|
|
16
16
|
var parse_fields_1 = require("./util/parse-fields");
|
|
17
|
+
var diff_1 = require("./util/diff");
|
|
17
18
|
var coordinate_1 = require("../util/coordinate");
|
|
18
19
|
// 根据 elementId 查找对应的 label,因为有可能一个 element 对应多个 labels,所以在给 labels 打标识时做了处理
|
|
19
20
|
// 打标规则详见 ./label/base.ts#L263
|
|
20
21
|
function filterLabelsById(id, labelsMap) {
|
|
21
22
|
var labels = [];
|
|
22
|
-
util_1.each(labelsMap, function (label, labelId) {
|
|
23
|
+
(0, util_1.each)(labelsMap, function (label, labelId) {
|
|
23
24
|
var elementId = labelId.split(' ')[0];
|
|
24
25
|
if (elementId === id) {
|
|
25
26
|
labels.push(label);
|
|
@@ -31,7 +32,7 @@ function filterLabelsById(id, labelsMap) {
|
|
|
31
32
|
* Geometry 几何标记基类,主要负责数据到图形属性的映射以及绘制逻辑。
|
|
32
33
|
*/
|
|
33
34
|
var Geometry = /** @class */ (function (_super) {
|
|
34
|
-
tslib_1.__extends(Geometry, _super);
|
|
35
|
+
(0, tslib_1.__extends)(Geometry, _super);
|
|
35
36
|
/**
|
|
36
37
|
* 创建 Geometry 实例。
|
|
37
38
|
* @param cfg
|
|
@@ -102,19 +103,19 @@ var Geometry = /** @class */ (function (_super) {
|
|
|
102
103
|
*/
|
|
103
104
|
Geometry.prototype.position = function (cfg) {
|
|
104
105
|
var positionCfg = cfg;
|
|
105
|
-
if (!util_1.isPlainObject(cfg)) {
|
|
106
|
+
if (!(0, util_1.isPlainObject)(cfg)) {
|
|
106
107
|
// 字符串字段或者数组字段
|
|
107
108
|
positionCfg = {
|
|
108
|
-
fields: parse_fields_1.parseFields(cfg),
|
|
109
|
+
fields: (0, parse_fields_1.parseFields)(cfg),
|
|
109
110
|
};
|
|
110
111
|
}
|
|
111
|
-
var fields = util_1.get(positionCfg, 'fields');
|
|
112
|
+
var fields = (0, util_1.get)(positionCfg, 'fields');
|
|
112
113
|
if (fields.length === 1) {
|
|
113
114
|
// 默认填充一维 1*xx
|
|
114
115
|
fields.unshift('1');
|
|
115
|
-
util_1.set(positionCfg, 'fields', fields);
|
|
116
|
+
(0, util_1.set)(positionCfg, 'fields', fields);
|
|
116
117
|
}
|
|
117
|
-
util_1.set(this.attributeOption, 'position', positionCfg);
|
|
118
|
+
(0, util_1.set)(this.attributeOption, 'position', positionCfg);
|
|
118
119
|
return this;
|
|
119
120
|
};
|
|
120
121
|
Geometry.prototype.color = function (field, cfg) {
|
|
@@ -176,11 +177,11 @@ var Geometry = /** @class */ (function (_super) {
|
|
|
176
177
|
*/
|
|
177
178
|
Geometry.prototype.adjust = function (adjustCfg) {
|
|
178
179
|
var adjusts = adjustCfg;
|
|
179
|
-
if (util_1.isString(adjustCfg) || util_1.isPlainObject(adjustCfg)) {
|
|
180
|
+
if ((0, util_1.isString)(adjustCfg) || (0, util_1.isPlainObject)(adjustCfg)) {
|
|
180
181
|
adjusts = [adjustCfg];
|
|
181
182
|
}
|
|
182
|
-
util_1.each(adjusts, function (adjust, index) {
|
|
183
|
-
if (!util_1.isObject(adjust)) {
|
|
183
|
+
(0, util_1.each)(adjusts, function (adjust, index) {
|
|
184
|
+
if (!(0, util_1.isObject)(adjust)) {
|
|
184
185
|
adjusts[index] = { type: adjust };
|
|
185
186
|
}
|
|
186
187
|
});
|
|
@@ -188,8 +189,8 @@ var Geometry = /** @class */ (function (_super) {
|
|
|
188
189
|
return this;
|
|
189
190
|
};
|
|
190
191
|
Geometry.prototype.style = function (field, styleFunc) {
|
|
191
|
-
if (util_1.isString(field)) {
|
|
192
|
-
var fields = parse_fields_1.parseFields(field);
|
|
192
|
+
if ((0, util_1.isString)(field)) {
|
|
193
|
+
var fields = (0, parse_fields_1.parseFields)(field);
|
|
193
194
|
this.styleOption = {
|
|
194
195
|
fields: fields,
|
|
195
196
|
callback: styleFunc,
|
|
@@ -209,8 +210,8 @@ var Geometry = /** @class */ (function (_super) {
|
|
|
209
210
|
return this;
|
|
210
211
|
};
|
|
211
212
|
Geometry.prototype.tooltip = function (field, cfg) {
|
|
212
|
-
if (util_1.isString(field)) {
|
|
213
|
-
var fields = parse_fields_1.parseFields(field);
|
|
213
|
+
if ((0, util_1.isString)(field)) {
|
|
214
|
+
var fields = (0, parse_fields_1.parseFields)(field);
|
|
214
215
|
this.tooltipOption = {
|
|
215
216
|
fields: fields,
|
|
216
217
|
callback: cfg,
|
|
@@ -251,14 +252,14 @@ var Geometry = /** @class */ (function (_super) {
|
|
|
251
252
|
return this;
|
|
252
253
|
};
|
|
253
254
|
Geometry.prototype.label = function (field, secondParam, thirdParam) {
|
|
254
|
-
if (util_1.isString(field)) {
|
|
255
|
+
if ((0, util_1.isString)(field)) {
|
|
255
256
|
var labelOption = {};
|
|
256
|
-
var fields = parse_fields_1.parseFields(field);
|
|
257
|
+
var fields = (0, parse_fields_1.parseFields)(field);
|
|
257
258
|
labelOption.fields = fields;
|
|
258
|
-
if (util_1.isFunction(secondParam)) {
|
|
259
|
+
if ((0, util_1.isFunction)(secondParam)) {
|
|
259
260
|
labelOption.callback = secondParam;
|
|
260
261
|
}
|
|
261
|
-
else if (util_1.isPlainObject(secondParam)) {
|
|
262
|
+
else if ((0, util_1.isPlainObject)(secondParam)) {
|
|
262
263
|
labelOption.cfg = secondParam;
|
|
263
264
|
}
|
|
264
265
|
if (thirdParam) {
|
|
@@ -353,11 +354,11 @@ var Geometry = /** @class */ (function (_super) {
|
|
|
353
354
|
if (cfg === void 0) { cfg = {}; }
|
|
354
355
|
var data = cfg.data, isDataChanged = cfg.isDataChanged, isCoordinateChanged = cfg.isCoordinateChanged;
|
|
355
356
|
var _a = this, attributeOption = _a.attributeOption, lastAttributeOption = _a.lastAttributeOption;
|
|
356
|
-
if (!util_1.isEqual(attributeOption, lastAttributeOption)) {
|
|
357
|
+
if (!(0, util_1.isEqual)(attributeOption, lastAttributeOption)) {
|
|
357
358
|
// 映射发生改变,则重新创建图形属性
|
|
358
359
|
this.init(cfg);
|
|
359
360
|
}
|
|
360
|
-
else if (data && (isDataChanged || !util_1.isEqual(data, this.data))) {
|
|
361
|
+
else if (data && (isDataChanged || !(0, util_1.isEqual)(data, this.data))) {
|
|
361
362
|
// 数据发生变化
|
|
362
363
|
this.setCfg(cfg);
|
|
363
364
|
this.initAttributes(); // 创建图形属性
|
|
@@ -375,52 +376,43 @@ var Geometry = /** @class */ (function (_super) {
|
|
|
375
376
|
* 将原始数据映射至图形空间,同时创建图形对象。
|
|
376
377
|
*/
|
|
377
378
|
Geometry.prototype.paint = function (isUpdate) {
|
|
378
|
-
var _this = this;
|
|
379
379
|
if (isUpdate === void 0) { isUpdate = false; }
|
|
380
380
|
if (this.animateOption) {
|
|
381
|
-
this.animateOption = util_1.deepMix({}, animate_1.getDefaultAnimateCfg(this.type, this.coordinate), this.animateOption);
|
|
381
|
+
this.animateOption = (0, util_1.deepMix)({}, (0, animate_1.getDefaultAnimateCfg)(this.type, this.coordinate), this.animateOption);
|
|
382
382
|
}
|
|
383
383
|
this.defaultSize = undefined;
|
|
384
|
-
this.elements = [];
|
|
385
384
|
this.elementsMap = {};
|
|
385
|
+
this.elements = [];
|
|
386
386
|
var offscreenGroup = this.getOffscreenGroup();
|
|
387
387
|
offscreenGroup.clear();
|
|
388
388
|
var beforeMappingData = this.beforeMappingData;
|
|
389
389
|
var dataArray = this.beforeMapping(beforeMappingData);
|
|
390
|
-
|
|
391
|
-
for (var
|
|
392
|
-
var
|
|
393
|
-
|
|
394
|
-
mappingArray.push(mappingData);
|
|
395
|
-
this.createElements(mappingData, index, isUpdate);
|
|
390
|
+
this.dataArray = new Array(dataArray.length);
|
|
391
|
+
for (var i = 0; i < dataArray.length; i++) {
|
|
392
|
+
var data = dataArray[i];
|
|
393
|
+
this.dataArray[i] = this.mapping(data);
|
|
396
394
|
}
|
|
395
|
+
this.updateElements(this.dataArray, isUpdate);
|
|
396
|
+
this.lastElementsMap = this.elementsMap;
|
|
397
397
|
if (this.canDoGroupAnimation(isUpdate)) {
|
|
398
398
|
// 如果用户没有配置 appear.animation,就默认走整体动画
|
|
399
399
|
var container = this.container;
|
|
400
400
|
var type = this.type;
|
|
401
401
|
var coordinate = this.coordinate;
|
|
402
|
-
var animateCfg = util_1.get(this.animateOption, 'appear');
|
|
402
|
+
var animateCfg = (0, util_1.get)(this.animateOption, 'appear');
|
|
403
403
|
var yScale = this.getYScale();
|
|
404
404
|
var yMinPoint = coordinate.convert({
|
|
405
405
|
x: 0,
|
|
406
406
|
y: yScale.scale(this.getYMinValue()),
|
|
407
407
|
});
|
|
408
|
-
animate_1.doGroupAppearAnimate(container, animateCfg, type, coordinate, yMinPoint);
|
|
408
|
+
(0, animate_1.doGroupAppearAnimate)(container, animateCfg, type, coordinate, yMinPoint);
|
|
409
409
|
}
|
|
410
410
|
// 添加 label
|
|
411
411
|
if (this.labelOption) {
|
|
412
|
-
this.renderLabels(util_1.flatten(
|
|
412
|
+
this.renderLabels((0, util_1.flatten)(this.dataArray), isUpdate);
|
|
413
413
|
}
|
|
414
|
-
this.dataArray = mappingArray;
|
|
415
|
-
// 销毁被删除的 elements
|
|
416
|
-
util_1.each(this.lastElementsMap, function (deletedElement) {
|
|
417
|
-
// 更新动画配置,用户有可能在更新之前有对动画进行配置操作
|
|
418
|
-
deletedElement.animate = _this.animateOption;
|
|
419
|
-
deletedElement.destroy();
|
|
420
|
-
});
|
|
421
|
-
this.lastElementsMap = this.elementsMap;
|
|
422
414
|
// 缓存,用于更新
|
|
423
|
-
this.lastAttributeOption = tslib_1.__assign({}, this.attributeOption);
|
|
415
|
+
this.lastAttributeOption = (0, tslib_1.__assign)({}, this.attributeOption);
|
|
424
416
|
if (this.visible === false) {
|
|
425
417
|
// 用户在初始化的时候声明 visible: false
|
|
426
418
|
this.changeVisible(false);
|
|
@@ -503,7 +495,7 @@ var Geometry = /** @class */ (function (_super) {
|
|
|
503
495
|
*/
|
|
504
496
|
Geometry.prototype.getGroupAttributes = function () {
|
|
505
497
|
var rst = [];
|
|
506
|
-
util_1.each(this.attributes, function (attr) {
|
|
498
|
+
(0, util_1.each)(this.attributes, function (attr) {
|
|
507
499
|
if (constant_1.GROUP_ATTRS.includes(attr.type)) {
|
|
508
500
|
rst.push(attr);
|
|
509
501
|
}
|
|
@@ -514,7 +506,7 @@ var Geometry = /** @class */ (function (_super) {
|
|
|
514
506
|
Geometry.prototype.getDefaultValue = function (attrName) {
|
|
515
507
|
var value;
|
|
516
508
|
var attr = this.getAttribute(attrName);
|
|
517
|
-
if (attr && util_1.isEmpty(attr.scales)) {
|
|
509
|
+
if (attr && (0, util_1.isEmpty)(attr.scales)) {
|
|
518
510
|
// 获取映射至常量的值
|
|
519
511
|
value = attr.values[0];
|
|
520
512
|
}
|
|
@@ -529,7 +521,7 @@ var Geometry = /** @class */ (function (_super) {
|
|
|
529
521
|
Geometry.prototype.getAttributeValues = function (attr, obj) {
|
|
530
522
|
var params = [];
|
|
531
523
|
var scales = attr.scales;
|
|
532
|
-
for (var index = 0,
|
|
524
|
+
for (var index = 0, length_1 = scales.length; index < length_1; index++) {
|
|
533
525
|
var scale = scales[index];
|
|
534
526
|
var field = scale.field;
|
|
535
527
|
if (scale.isIdentity) {
|
|
@@ -541,9 +533,24 @@ var Geometry = /** @class */ (function (_super) {
|
|
|
541
533
|
}
|
|
542
534
|
return attr.mapping.apply(attr, params);
|
|
543
535
|
};
|
|
536
|
+
/**
|
|
537
|
+
* 获取对应的 adjust 实例
|
|
538
|
+
* @param adjustType
|
|
539
|
+
* @returns
|
|
540
|
+
*/
|
|
544
541
|
Geometry.prototype.getAdjust = function (adjustType) {
|
|
545
542
|
return this.adjusts[adjustType];
|
|
546
543
|
};
|
|
544
|
+
/**
|
|
545
|
+
* 获得 coordinate 实例
|
|
546
|
+
* @returns
|
|
547
|
+
*/
|
|
548
|
+
Geometry.prototype.getCoordinate = function () {
|
|
549
|
+
return this.coordinate;
|
|
550
|
+
};
|
|
551
|
+
Geometry.prototype.getData = function () {
|
|
552
|
+
return this.data;
|
|
553
|
+
};
|
|
547
554
|
/**
|
|
548
555
|
* 获取 shape 对应的 marker 样式。
|
|
549
556
|
* @param shapeName shape 具体名字
|
|
@@ -569,9 +576,17 @@ var Geometry = /** @class */ (function (_super) {
|
|
|
569
576
|
* @returns
|
|
570
577
|
*/
|
|
571
578
|
Geometry.prototype.getElementsBy = function (condition) {
|
|
572
|
-
return this.elements.filter(function (element) {
|
|
573
|
-
|
|
574
|
-
|
|
579
|
+
return this.elements.filter(function (element) { return condition(element); });
|
|
580
|
+
};
|
|
581
|
+
/**
|
|
582
|
+
* 获取 Geometry 的所有 Elements。
|
|
583
|
+
*
|
|
584
|
+
* ```typescript
|
|
585
|
+
* getElements();
|
|
586
|
+
* ```
|
|
587
|
+
*/
|
|
588
|
+
Geometry.prototype.getElements = function () {
|
|
589
|
+
return this.elements;
|
|
575
590
|
};
|
|
576
591
|
/**
|
|
577
592
|
* 获取数据对应的唯一 id。
|
|
@@ -579,7 +594,7 @@ var Geometry = /** @class */ (function (_super) {
|
|
|
579
594
|
* @returns
|
|
580
595
|
*/
|
|
581
596
|
Geometry.prototype.getElementId = function (data) {
|
|
582
|
-
data = util_1.isArray(data) ? data[0] : data;
|
|
597
|
+
data = (0, util_1.isArray)(data) ? data[0] : data;
|
|
583
598
|
var originData = data[constant_1.FIELD_ORIGIN];
|
|
584
599
|
// 如果用户声明了使用哪些字段作为 id 值
|
|
585
600
|
if (this.idFields.length) {
|
|
@@ -613,10 +628,10 @@ var Geometry = /** @class */ (function (_super) {
|
|
|
613
628
|
id = xVal + "-" + yVal;
|
|
614
629
|
}
|
|
615
630
|
var groupScales = this.groupScales;
|
|
616
|
-
if (util_1.isEmpty(groupScales)) {
|
|
617
|
-
groupScales = util_1.get(this.getAttribute('color'), 'scales', []);
|
|
631
|
+
if ((0, util_1.isEmpty)(groupScales)) {
|
|
632
|
+
groupScales = (0, util_1.get)(this.getAttribute('color'), 'scales', []);
|
|
618
633
|
}
|
|
619
|
-
for (var index = 0,
|
|
634
|
+
for (var index = 0, length_2 = groupScales.length; index < length_2; index++) {
|
|
620
635
|
var groupScale = groupScales[index];
|
|
621
636
|
var field = groupScale.field;
|
|
622
637
|
id = id + "-" + originData[field];
|
|
@@ -639,28 +654,28 @@ var Geometry = /** @class */ (function (_super) {
|
|
|
639
654
|
*/
|
|
640
655
|
Geometry.prototype.getScaleFields = function () {
|
|
641
656
|
var fields = [];
|
|
642
|
-
var tmpMap =
|
|
657
|
+
var tmpMap = new Map();
|
|
643
658
|
var _a = this, attributeOption = _a.attributeOption, labelOption = _a.labelOption, tooltipOption = _a.tooltipOption;
|
|
644
659
|
// 获取图形属性上的 fields
|
|
645
660
|
for (var attributeType in attributeOption) {
|
|
646
661
|
if (attributeOption.hasOwnProperty(attributeType)) {
|
|
647
662
|
var eachOpt = attributeOption[attributeType];
|
|
648
663
|
if (eachOpt.fields) {
|
|
649
|
-
helper_1.uniq(eachOpt.fields, fields, tmpMap);
|
|
664
|
+
(0, helper_1.uniq)(eachOpt.fields, fields, tmpMap);
|
|
650
665
|
}
|
|
651
666
|
else if (eachOpt.values) {
|
|
652
667
|
// 考虑 size(10), shape('circle') 等场景
|
|
653
|
-
helper_1.uniq(eachOpt.values, fields, tmpMap);
|
|
668
|
+
(0, helper_1.uniq)(eachOpt.values, fields, tmpMap);
|
|
654
669
|
}
|
|
655
670
|
}
|
|
656
671
|
}
|
|
657
672
|
// 获取 label 上的字段
|
|
658
673
|
if (labelOption && labelOption.fields) {
|
|
659
|
-
helper_1.uniq(labelOption.fields, fields, tmpMap);
|
|
674
|
+
(0, helper_1.uniq)(labelOption.fields, fields, tmpMap);
|
|
660
675
|
}
|
|
661
676
|
// 获取 tooltip 上的字段
|
|
662
|
-
if (util_1.isObject(tooltipOption) && tooltipOption.fields) {
|
|
663
|
-
helper_1.uniq(tooltipOption.fields, fields, tmpMap);
|
|
677
|
+
if ((0, util_1.isObject)(tooltipOption) && tooltipOption.fields) {
|
|
678
|
+
(0, helper_1.uniq)(tooltipOption.fields, fields, tmpMap);
|
|
664
679
|
}
|
|
665
680
|
return fields;
|
|
666
681
|
};
|
|
@@ -671,7 +686,7 @@ var Geometry = /** @class */ (function (_super) {
|
|
|
671
686
|
Geometry.prototype.changeVisible = function (visible) {
|
|
672
687
|
_super.prototype.changeVisible.call(this, visible);
|
|
673
688
|
var elements = this.elements;
|
|
674
|
-
for (var index = 0,
|
|
689
|
+
for (var index = 0, length_3 = elements.length; index < length_3; index++) {
|
|
675
690
|
var element = elements[index];
|
|
676
691
|
element.changeVisible(visible);
|
|
677
692
|
}
|
|
@@ -692,18 +707,35 @@ var Geometry = /** @class */ (function (_super) {
|
|
|
692
707
|
}
|
|
693
708
|
}
|
|
694
709
|
};
|
|
710
|
+
/**
|
|
711
|
+
* 获得所有的字段
|
|
712
|
+
*/
|
|
713
|
+
Geometry.prototype.getFields = function () {
|
|
714
|
+
var uniqMap = new Map();
|
|
715
|
+
var fields = [];
|
|
716
|
+
Object.values(this.attributeOption).forEach(function (cfg) {
|
|
717
|
+
var fs = (cfg === null || cfg === void 0 ? void 0 : cfg.fields) || [];
|
|
718
|
+
fs.forEach(function (f) {
|
|
719
|
+
if (!uniqMap.has(f)) {
|
|
720
|
+
fields.push(f);
|
|
721
|
+
}
|
|
722
|
+
uniqMap.set(f, true);
|
|
723
|
+
});
|
|
724
|
+
}, []);
|
|
725
|
+
return fields;
|
|
726
|
+
};
|
|
695
727
|
/**
|
|
696
728
|
* 获取当前配置中的所有分组 & 分类的字段。
|
|
697
729
|
* @return fields string[]
|
|
698
730
|
*/
|
|
699
731
|
Geometry.prototype.getGroupFields = function () {
|
|
700
732
|
var groupFields = [];
|
|
701
|
-
var tmpMap =
|
|
702
|
-
for (var index = 0,
|
|
733
|
+
var tmpMap = new Map(); // 用于去重过滤
|
|
734
|
+
for (var index = 0, length_4 = constant_1.GROUP_ATTRS.length; index < length_4; index++) {
|
|
703
735
|
var attributeName = constant_1.GROUP_ATTRS[index];
|
|
704
736
|
var cfg = this.attributeOption[attributeName];
|
|
705
737
|
if (cfg && cfg.fields) {
|
|
706
|
-
helper_1.uniq(cfg.fields, groupFields, tmpMap);
|
|
738
|
+
(0, helper_1.uniq)(cfg.fields, groupFields, tmpMap);
|
|
707
739
|
}
|
|
708
740
|
}
|
|
709
741
|
return groupFields;
|
|
@@ -715,6 +747,20 @@ var Geometry = /** @class */ (function (_super) {
|
|
|
715
747
|
var _a = this.attributeOption.position.fields, x = _a[0], y = _a[1];
|
|
716
748
|
return [x, y];
|
|
717
749
|
};
|
|
750
|
+
/**
|
|
751
|
+
* x 字段
|
|
752
|
+
* @returns
|
|
753
|
+
*/
|
|
754
|
+
Geometry.prototype.getXField = function () {
|
|
755
|
+
return (0, util_1.get)(this.getXYFields(), [0]);
|
|
756
|
+
};
|
|
757
|
+
/**
|
|
758
|
+
* y 字段
|
|
759
|
+
* @returns
|
|
760
|
+
*/
|
|
761
|
+
Geometry.prototype.getYField = function () {
|
|
762
|
+
return (0, util_1.get)(this.getXYFields(), [1]);
|
|
763
|
+
};
|
|
718
764
|
/**
|
|
719
765
|
* 获取该 Geometry 下所有生成的 shapes。
|
|
720
766
|
* @returns shapes
|
|
@@ -763,11 +809,11 @@ var Geometry = /** @class */ (function (_super) {
|
|
|
763
809
|
*/
|
|
764
810
|
Geometry.prototype.getShapeFactory = function () {
|
|
765
811
|
var shapeType = this.shapeType;
|
|
766
|
-
if (!base_2.getShapeFactory(shapeType)) {
|
|
812
|
+
if (!(0, base_2.getShapeFactory)(shapeType)) {
|
|
767
813
|
return;
|
|
768
814
|
}
|
|
769
815
|
if (!this.shapeFactory) {
|
|
770
|
-
this.shapeFactory = util_1.clone(base_2.getShapeFactory(shapeType)); // 防止多个 view 共享一个 shapeFactory 实例,导致 coordinate 被篡改
|
|
816
|
+
this.shapeFactory = (0, util_1.clone)((0, base_2.getShapeFactory)(shapeType)); // 防止多个 view 共享一个 shapeFactory 实例,导致 coordinate 被篡改
|
|
771
817
|
}
|
|
772
818
|
// 因为这里缓存了 shapeFactory,但是外部可能会变更 coordinate,导致无法重新设置到 shapeFactory 中
|
|
773
819
|
this.shapeFactory.coordinate = this.coordinate;
|
|
@@ -842,7 +888,7 @@ var Geometry = /** @class */ (function (_super) {
|
|
|
842
888
|
cfg.shape = shapeName;
|
|
843
889
|
// 获取默认样式
|
|
844
890
|
var theme = this.theme.geometries[this.shapeType];
|
|
845
|
-
cfg.defaultStyle = util_1.get(theme, [shapeName, 'default'], {}).style;
|
|
891
|
+
cfg.defaultStyle = (0, util_1.get)(theme, [shapeName, 'default'], {}).style;
|
|
846
892
|
if (!cfg.defaultStyle && this.getShapeFactory()) {
|
|
847
893
|
cfg.defaultStyle = this.getShapeFactory().getDefaultStyle(theme);
|
|
848
894
|
}
|
|
@@ -856,49 +902,69 @@ var Geometry = /** @class */ (function (_super) {
|
|
|
856
902
|
}
|
|
857
903
|
return cfg;
|
|
858
904
|
};
|
|
859
|
-
|
|
860
|
-
* 创建所有的 Elements。
|
|
861
|
-
* @param mappingData
|
|
862
|
-
* @param [isUpdate]
|
|
863
|
-
* @returns elements
|
|
864
|
-
*/
|
|
865
|
-
Geometry.prototype.createElements = function (mappingData, index, isUpdate) {
|
|
905
|
+
Geometry.prototype.updateElements = function (mappingDataArray, isUpdate) {
|
|
866
906
|
if (isUpdate === void 0) { isUpdate = false; }
|
|
867
|
-
var
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
907
|
+
var keyDatum = new Map();
|
|
908
|
+
var keys = [];
|
|
909
|
+
// 用来保持 diff 元素之后 added, updated 的相对顺序
|
|
910
|
+
var keyIndex = new Map();
|
|
911
|
+
var index = 0;
|
|
912
|
+
// 获得更新数据所有的 keys
|
|
913
|
+
// 将更新的数据用 key 索引
|
|
914
|
+
for (var i = 0; i < mappingDataArray.length; i++) {
|
|
915
|
+
var mappingData = mappingDataArray[i];
|
|
916
|
+
for (var j = 0; j < mappingData.length; j++) {
|
|
917
|
+
var mappingDatum = mappingData[j];
|
|
918
|
+
var key = this.getElementId(mappingDatum);
|
|
919
|
+
var finalKey = keyDatum.has(key) ? key + "-" + i + "-" + j : key;
|
|
920
|
+
keys.push(finalKey);
|
|
921
|
+
keyDatum.set(finalKey, mappingDatum);
|
|
922
|
+
keyIndex.set(finalKey, index);
|
|
923
|
+
index++;
|
|
874
924
|
}
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
925
|
+
}
|
|
926
|
+
this.elements = new Array(index);
|
|
927
|
+
var _a = (0, diff_1.diff)(this.lastElementsMap, keys), added = _a.added, updated = _a.updated, removed = _a.removed;
|
|
928
|
+
// 新建 element
|
|
929
|
+
for (var _i = 0, added_1 = added; _i < added_1.length; _i++) {
|
|
930
|
+
var key = added_1[_i];
|
|
931
|
+
var mappingDatum = keyDatum.get(key);
|
|
932
|
+
var element = this.createElement(mappingDatum, isUpdate);
|
|
933
|
+
var i = keyIndex.get(key);
|
|
934
|
+
this.elements[i] = element;
|
|
935
|
+
this.elementsMap[key] = element;
|
|
936
|
+
}
|
|
937
|
+
// 更新 element
|
|
938
|
+
for (var _b = 0, updated_1 = updated; _b < updated_1.length; _b++) {
|
|
939
|
+
var key = updated_1[_b];
|
|
940
|
+
var element = this.lastElementsMap[key];
|
|
941
|
+
var mappingDatum = keyDatum.get(key);
|
|
942
|
+
var currentShapeCfg = this.getDrawCfg(mappingDatum);
|
|
943
|
+
var preShapeCfg = element.getModel();
|
|
944
|
+
var i = keyIndex.get(key);
|
|
945
|
+
if (this.isCoordinateChanged || (0, is_model_change_1.isModelChange)(currentShapeCfg, preShapeCfg)) {
|
|
946
|
+
element.animate = this.animateOption;
|
|
947
|
+
// 通过绘制数据的变更来判断是否需要更新,因为用户有可能会修改图形属性映射
|
|
948
|
+
element.update(currentShapeCfg); // 更新对应的 element
|
|
890
949
|
}
|
|
891
|
-
elements
|
|
892
|
-
elementsMap[
|
|
950
|
+
this.elements[i] = element;
|
|
951
|
+
this.elementsMap[key] = element;
|
|
952
|
+
}
|
|
953
|
+
// 销毁被删除的 elements
|
|
954
|
+
for (var _c = 0, removed_1 = removed; _c < removed_1.length; _c++) {
|
|
955
|
+
var key = removed_1[_c];
|
|
956
|
+
var element = this.lastElementsMap[key];
|
|
957
|
+
// 更新动画配置,用户有可能在更新之前有对动画进行配置操作
|
|
958
|
+
element.animate = this.animateOption;
|
|
959
|
+
element.destroy();
|
|
893
960
|
}
|
|
894
961
|
// 对 elements 的 zIndex 进行反序
|
|
895
962
|
if (this.zIndexReversed) {
|
|
896
|
-
var
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
}
|
|
963
|
+
var length_5 = this.elements.length;
|
|
964
|
+
for (var i = 0; i < length_5; i++) {
|
|
965
|
+
this.elements[i].shape.setZIndex(length_5 - i);
|
|
966
|
+
}
|
|
900
967
|
}
|
|
901
|
-
return elements;
|
|
902
968
|
};
|
|
903
969
|
/**
|
|
904
970
|
* 获取渲染的 label 类型。
|
|
@@ -906,7 +972,7 @@ var Geometry = /** @class */ (function (_super) {
|
|
|
906
972
|
Geometry.prototype.getLabelType = function () {
|
|
907
973
|
var _a = this, labelOption = _a.labelOption, coordinate = _a.coordinate, type = _a.type;
|
|
908
974
|
var coordinateType = coordinate.type, isTransposed = coordinate.isTransposed;
|
|
909
|
-
var labelType = util_1.get(labelOption, ['cfg', 'type']);
|
|
975
|
+
var labelType = (0, util_1.get)(labelOption, ['cfg', 'type']);
|
|
910
976
|
if (!labelType) {
|
|
911
977
|
// 用户未定义,则进行默认的逻辑
|
|
912
978
|
if (coordinateType === 'polar') {
|
|
@@ -947,35 +1013,35 @@ var Geometry = /** @class */ (function (_super) {
|
|
|
947
1013
|
};
|
|
948
1014
|
// 创建图形属性相关的配置项
|
|
949
1015
|
Geometry.prototype.createAttrOption = function (attrName, field, cfg) {
|
|
950
|
-
if (util_1.isNil(field) || util_1.isObject(field)) {
|
|
951
|
-
if (util_1.isObject(field) && util_1.isEqual(Object.keys(field), ['values'])) {
|
|
1016
|
+
if ((0, util_1.isNil)(field) || (0, util_1.isObject)(field)) {
|
|
1017
|
+
if ((0, util_1.isObject)(field) && (0, util_1.isEqual)(Object.keys(field), ['values'])) {
|
|
952
1018
|
// shape({ values: [ 'funnel' ] })
|
|
953
|
-
util_1.set(this.attributeOption, attrName, {
|
|
1019
|
+
(0, util_1.set)(this.attributeOption, attrName, {
|
|
954
1020
|
fields: field.values,
|
|
955
1021
|
});
|
|
956
1022
|
}
|
|
957
1023
|
else {
|
|
958
|
-
util_1.set(this.attributeOption, attrName, field);
|
|
1024
|
+
(0, util_1.set)(this.attributeOption, attrName, field);
|
|
959
1025
|
}
|
|
960
1026
|
}
|
|
961
1027
|
else {
|
|
962
1028
|
var attrCfg = {};
|
|
963
|
-
if (util_1.isNumber(field)) {
|
|
1029
|
+
if ((0, util_1.isNumber)(field)) {
|
|
964
1030
|
// size(3)
|
|
965
1031
|
attrCfg.values = [field];
|
|
966
1032
|
}
|
|
967
1033
|
else {
|
|
968
|
-
attrCfg.fields = parse_fields_1.parseFields(field);
|
|
1034
|
+
attrCfg.fields = (0, parse_fields_1.parseFields)(field);
|
|
969
1035
|
}
|
|
970
1036
|
if (cfg) {
|
|
971
|
-
if (util_1.isFunction(cfg)) {
|
|
1037
|
+
if ((0, util_1.isFunction)(cfg)) {
|
|
972
1038
|
attrCfg.callback = cfg;
|
|
973
1039
|
}
|
|
974
1040
|
else {
|
|
975
1041
|
attrCfg.values = cfg;
|
|
976
1042
|
}
|
|
977
1043
|
}
|
|
978
|
-
util_1.set(this.attributeOption, attrName, attrCfg);
|
|
1044
|
+
(0, util_1.set)(this.attributeOption, attrName, attrCfg);
|
|
979
1045
|
}
|
|
980
1046
|
};
|
|
981
1047
|
Geometry.prototype.initAttributes = function () {
|
|
@@ -989,8 +1055,8 @@ var Geometry = /** @class */ (function (_super) {
|
|
|
989
1055
|
if (!option) {
|
|
990
1056
|
return { value: void 0 };
|
|
991
1057
|
}
|
|
992
|
-
var attrCfg = tslib_1.__assign({}, option);
|
|
993
|
-
var callback = attrCfg.callback, values = attrCfg.values,
|
|
1058
|
+
var attrCfg = (0, tslib_1.__assign)({}, option);
|
|
1059
|
+
var callback = attrCfg.callback, values = attrCfg.values, _b = attrCfg.fields, fields = _b === void 0 ? [] : _b;
|
|
994
1060
|
// 获取每一个字段对应的 scale
|
|
995
1061
|
var scales = fields.map(function (field) {
|
|
996
1062
|
var scale = _this.scales[field];
|
|
@@ -1023,7 +1089,7 @@ var Geometry = /** @class */ (function (_super) {
|
|
|
1023
1089
|
}
|
|
1024
1090
|
}
|
|
1025
1091
|
}
|
|
1026
|
-
var AttributeCtor = attr_1.getAttribute(attrType);
|
|
1092
|
+
var AttributeCtor = (0, attr_1.getAttribute)(attrType);
|
|
1027
1093
|
attributes[attrType] = new AttributeCtor(attrCfg);
|
|
1028
1094
|
}
|
|
1029
1095
|
};
|
|
@@ -1080,7 +1146,7 @@ var Geometry = /** @class */ (function (_super) {
|
|
|
1080
1146
|
var yScale = this.getYScale();
|
|
1081
1147
|
var xField = xScale.field;
|
|
1082
1148
|
var yField = yScale ? yScale.field : null;
|
|
1083
|
-
var xDimensionLength = coordinate_1.getXDimensionLength(this.coordinate);
|
|
1149
|
+
var xDimensionLength = (0, coordinate_1.getXDimensionLength)(this.coordinate);
|
|
1084
1150
|
var groupNum = xScale.values.length;
|
|
1085
1151
|
// 传入size计算相关参数,默认宽度、最大最小宽度约束
|
|
1086
1152
|
var sizeAttr = this.getAttribute('size');
|
|
@@ -1090,16 +1156,7 @@ var Geometry = /** @class */ (function (_super) {
|
|
|
1090
1156
|
}
|
|
1091
1157
|
for (var i = 0, len = adjustOption.length; i < len; i++) {
|
|
1092
1158
|
var adjust = adjustOption[i];
|
|
1093
|
-
var adjustCfg = tslib_1.__assign({ xField: xField,
|
|
1094
|
-
yField: yField,
|
|
1095
|
-
intervalPadding: intervalPadding,
|
|
1096
|
-
dodgePadding: dodgePadding,
|
|
1097
|
-
xDimensionLength: xDimensionLength,
|
|
1098
|
-
groupNum: groupNum,
|
|
1099
|
-
defaultSize: defaultSize,
|
|
1100
|
-
maxColumnWidth: maxColumnWidth,
|
|
1101
|
-
minColumnWidth: minColumnWidth,
|
|
1102
|
-
columnWidthRatio: columnWidthRatio }, adjust);
|
|
1159
|
+
var adjustCfg = (0, tslib_1.__assign)({ xField: xField, yField: yField, intervalPadding: intervalPadding, dodgePadding: dodgePadding, xDimensionLength: xDimensionLength, groupNum: groupNum, defaultSize: defaultSize, maxColumnWidth: maxColumnWidth, minColumnWidth: minColumnWidth, columnWidthRatio: columnWidthRatio }, adjust);
|
|
1103
1160
|
var type = adjust.type;
|
|
1104
1161
|
if (type === 'dodge') {
|
|
1105
1162
|
var adjustNames = [];
|
|
@@ -1126,11 +1183,11 @@ var Geometry = /** @class */ (function (_super) {
|
|
|
1126
1183
|
adjustCfg.size = size;
|
|
1127
1184
|
}
|
|
1128
1185
|
// 不进行 transpose 时,用户又没有设置这个参数时,默认从上向下
|
|
1129
|
-
if (!coordinate.isTransposed && util_1.isNil(adjustCfg.reverseOrder)) {
|
|
1186
|
+
if (!coordinate.isTransposed && (0, util_1.isNil)(adjustCfg.reverseOrder)) {
|
|
1130
1187
|
adjustCfg.reverseOrder = true;
|
|
1131
1188
|
}
|
|
1132
1189
|
}
|
|
1133
|
-
var adjustCtor = adjust_1.getAdjust(type);
|
|
1190
|
+
var adjustCtor = (0, adjust_1.getAdjust)(type);
|
|
1134
1191
|
var adjustInstance = new adjustCtor(adjustCfg);
|
|
1135
1192
|
result = adjustInstance.process(result);
|
|
1136
1193
|
this.adjusts[type] = adjustInstance;
|
|
@@ -1148,16 +1205,16 @@ var Geometry = /** @class */ (function (_super) {
|
|
|
1148
1205
|
var scale = groupScales[index];
|
|
1149
1206
|
var field = scale.field;
|
|
1150
1207
|
groupFields.push(field);
|
|
1151
|
-
if (util_1.get(scaleDefs, [field, 'values'])) {
|
|
1208
|
+
if ((0, util_1.get)(scaleDefs, [field, 'values'])) {
|
|
1152
1209
|
// 用户通过 view.scale() 接口指定了 values 属性
|
|
1153
1210
|
appendConditions[field] = scaleDefs[field].values;
|
|
1154
1211
|
}
|
|
1155
1212
|
}
|
|
1156
|
-
return group_data_1.group(data, groupFields, appendConditions);
|
|
1213
|
+
return (0, group_data_1.group)(data, groupFields, appendConditions);
|
|
1157
1214
|
};
|
|
1158
1215
|
// 更新发生层叠后的数据对应的度量范围
|
|
1159
1216
|
Geometry.prototype.updateStackRange = function (scale, dataArray) {
|
|
1160
|
-
var mergeArray = util_1.flatten(dataArray);
|
|
1217
|
+
var mergeArray = (0, util_1.flatten)(dataArray);
|
|
1161
1218
|
var field = scale.field;
|
|
1162
1219
|
var min = scale.min;
|
|
1163
1220
|
var max = scale.max;
|
|
@@ -1174,11 +1231,11 @@ var Geometry = /** @class */ (function (_super) {
|
|
|
1174
1231
|
}
|
|
1175
1232
|
var scaleDefs = this.scaleDefs;
|
|
1176
1233
|
var cfg = {};
|
|
1177
|
-
if (min < scale.min && !util_1.get(scaleDefs, [field, 'min'])) {
|
|
1234
|
+
if (min < scale.min && !(0, util_1.get)(scaleDefs, [field, 'min'])) {
|
|
1178
1235
|
// 用户如果在列定义中定义了 min,则以用户定义的为准
|
|
1179
1236
|
cfg.min = min;
|
|
1180
1237
|
}
|
|
1181
|
-
if (max > scale.max && !util_1.get(scaleDefs, [field, 'max'])) {
|
|
1238
|
+
if (max > scale.max && !(0, util_1.get)(scaleDefs, [field, 'max'])) {
|
|
1182
1239
|
// 用户如果在列定义中定义了 max
|
|
1183
1240
|
cfg.max = max;
|
|
1184
1241
|
}
|
|
@@ -1194,7 +1251,7 @@ var Geometry = /** @class */ (function (_super) {
|
|
|
1194
1251
|
}
|
|
1195
1252
|
if (this.generatePoints) {
|
|
1196
1253
|
// 需要生成关键点
|
|
1197
|
-
for (var index = 0,
|
|
1254
|
+
for (var index = 0, length_6 = source.length; index < length_6; index++) {
|
|
1198
1255
|
var currentData = source[index];
|
|
1199
1256
|
this.generateShapePoints(currentData);
|
|
1200
1257
|
var nextData = source[index + 1];
|
|
@@ -1221,7 +1278,7 @@ var Geometry = /** @class */ (function (_super) {
|
|
|
1221
1278
|
// 将数据归一化
|
|
1222
1279
|
Geometry.prototype.normalizeValues = function (values, scale) {
|
|
1223
1280
|
var rst = [];
|
|
1224
|
-
if (util_1.isArray(values)) {
|
|
1281
|
+
if ((0, util_1.isArray)(values)) {
|
|
1225
1282
|
for (var index = 0; index < values.length; index++) {
|
|
1226
1283
|
var value = values[index];
|
|
1227
1284
|
rst.push(scale.scale(value));
|
|
@@ -1253,7 +1310,7 @@ var Geometry = /** @class */ (function (_super) {
|
|
|
1253
1310
|
for (var j = 0; j < values.length; j += 1) {
|
|
1254
1311
|
var val = values[j];
|
|
1255
1312
|
var name_1 = names[j];
|
|
1256
|
-
newRecord[name_1] = util_1.isArray(val) && val.length === 1 ? val[0] : val; // 只有一个值时返回第一个属性值
|
|
1313
|
+
newRecord[name_1] = (0, util_1.isArray)(val) && val.length === 1 ? val[0] : val; // 只有一个值时返回第一个属性值
|
|
1257
1314
|
}
|
|
1258
1315
|
}
|
|
1259
1316
|
else {
|
|
@@ -1275,7 +1332,7 @@ var Geometry = /** @class */ (function (_super) {
|
|
|
1275
1332
|
var rstY;
|
|
1276
1333
|
var obj;
|
|
1277
1334
|
var coordinate = this.coordinate;
|
|
1278
|
-
if (util_1.isArray(x) && util_1.isArray(y)) {
|
|
1335
|
+
if ((0, util_1.isArray)(x) && (0, util_1.isArray)(y)) {
|
|
1279
1336
|
rstX = [];
|
|
1280
1337
|
rstY = [];
|
|
1281
1338
|
for (var i = 0, j = 0, xLen = x.length, yLen = y.length; i < xLen && j < yLen; i += 1, j += 1) {
|
|
@@ -1287,7 +1344,7 @@ var Geometry = /** @class */ (function (_super) {
|
|
|
1287
1344
|
rstY.push(obj.y);
|
|
1288
1345
|
}
|
|
1289
1346
|
}
|
|
1290
|
-
else if (util_1.isArray(y)) {
|
|
1347
|
+
else if ((0, util_1.isArray)(y)) {
|
|
1291
1348
|
rstY = [];
|
|
1292
1349
|
for (var index = 0; index < y.length; index++) {
|
|
1293
1350
|
var yVal = y[index];
|
|
@@ -1296,7 +1353,7 @@ var Geometry = /** @class */ (function (_super) {
|
|
|
1296
1353
|
y: yVal,
|
|
1297
1354
|
});
|
|
1298
1355
|
if (rstX && rstX !== obj.x) {
|
|
1299
|
-
if (!util_1.isArray(rstX)) {
|
|
1356
|
+
if (!(0, util_1.isArray)(rstX)) {
|
|
1300
1357
|
rstX = [rstX];
|
|
1301
1358
|
}
|
|
1302
1359
|
rstX.push(obj.x);
|
|
@@ -1307,7 +1364,7 @@ var Geometry = /** @class */ (function (_super) {
|
|
|
1307
1364
|
rstY.push(obj.y);
|
|
1308
1365
|
}
|
|
1309
1366
|
}
|
|
1310
|
-
else if (util_1.isArray(x)) {
|
|
1367
|
+
else if ((0, util_1.isArray)(x)) {
|
|
1311
1368
|
rstX = [];
|
|
1312
1369
|
for (var index = 0; index < x.length; index++) {
|
|
1313
1370
|
var xVal = x[index];
|
|
@@ -1316,7 +1373,7 @@ var Geometry = /** @class */ (function (_super) {
|
|
|
1316
1373
|
y: y,
|
|
1317
1374
|
});
|
|
1318
1375
|
if (rstY && rstY !== obj.y) {
|
|
1319
|
-
if (!util_1.isArray(rstY)) {
|
|
1376
|
+
if (!(0, util_1.isArray)(rstY)) {
|
|
1320
1377
|
rstY = [rstY];
|
|
1321
1378
|
}
|
|
1322
1379
|
rstY.push(obj.y);
|
|
@@ -1362,14 +1419,14 @@ var Geometry = /** @class */ (function (_super) {
|
|
|
1362
1419
|
if (scaleDefs) {
|
|
1363
1420
|
this.scaleDefs = scaleDefs;
|
|
1364
1421
|
this.idFields = [];
|
|
1365
|
-
util_1.each(scaleDefs, function (scaleDef, field) {
|
|
1422
|
+
(0, util_1.each)(scaleDefs, function (scaleDef, field) {
|
|
1366
1423
|
if (scaleDef && scaleDef.key) {
|
|
1367
1424
|
_this.idFields.push(field);
|
|
1368
1425
|
}
|
|
1369
1426
|
});
|
|
1370
1427
|
}
|
|
1371
1428
|
if (theme) {
|
|
1372
|
-
this.theme = this.userTheme ? util_1.deepMix({}, theme, this.userTheme) : theme; // 支持 geometry 层级的主题设置
|
|
1429
|
+
this.theme = this.userTheme ? (0, util_1.deepMix)({}, theme, this.userTheme) : theme; // 支持 geometry 层级的主题设置
|
|
1373
1430
|
}
|
|
1374
1431
|
};
|
|
1375
1432
|
Geometry.prototype.renderLabels = function (mappingArray, isUpdate) {
|
|
@@ -1378,14 +1435,14 @@ var Geometry = /** @class */ (function (_super) {
|
|
|
1378
1435
|
if (!geometryLabel) {
|
|
1379
1436
|
// 初次创建
|
|
1380
1437
|
var labelType = this.getLabelType();
|
|
1381
|
-
var GeometryLabelsCtor = label_1.getGeometryLabel(labelType);
|
|
1438
|
+
var GeometryLabelsCtor = (0, label_1.getGeometryLabel)(labelType);
|
|
1382
1439
|
geometryLabel = new GeometryLabelsCtor(this);
|
|
1383
1440
|
this.geometryLabel = geometryLabel;
|
|
1384
1441
|
}
|
|
1385
1442
|
geometryLabel.render(mappingArray, isUpdate);
|
|
1386
1443
|
// 将 label 同 element 进行关联
|
|
1387
1444
|
var labelsMap = geometryLabel.labelsRenderer.shapesMap;
|
|
1388
|
-
util_1.each(this.elementsMap, function (element, id) {
|
|
1445
|
+
(0, util_1.each)(this.elementsMap, function (element, id) {
|
|
1389
1446
|
var labels = filterLabelsById(id, labelsMap); // element 实例同 label 进行绑定
|
|
1390
1447
|
if (labels.length) {
|
|
1391
1448
|
element.labelShape = labels;
|
|
@@ -1412,8 +1469,8 @@ var Geometry = /** @class */ (function (_super) {
|
|
|
1412
1469
|
Geometry.prototype.canDoGroupAnimation = function (isUpdate) {
|
|
1413
1470
|
return (!isUpdate &&
|
|
1414
1471
|
this.animateOption &&
|
|
1415
|
-
(util_1.get(this.animateOption, 'appear') === undefined ||
|
|
1416
|
-
(util_1.get(this.animateOption, 'appear') && util_1.get(this.animateOption, ['appear', 'animation']) === undefined)));
|
|
1472
|
+
((0, util_1.get)(this.animateOption, 'appear') === undefined ||
|
|
1473
|
+
((0, util_1.get)(this.animateOption, 'appear') && (0, util_1.get)(this.animateOption, ['appear', 'animation']) === undefined)));
|
|
1417
1474
|
};
|
|
1418
1475
|
return Geometry;
|
|
1419
1476
|
}(base_1.default));
|