@visactor/vchart 1.7.1 → 1.7.3
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/build/es5/index.js +1 -1
- package/build/index.js +17050 -13892
- package/build/index.min.js +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/animation/utils.d.ts +1 -0
- package/cjs/animation/utils.js +16 -8
- package/cjs/animation/utils.js.map +1 -1
- package/cjs/chart/bar/bar-3d.d.ts +2 -2
- package/cjs/chart/bar/bar-3d.js +2 -2
- package/cjs/chart/bar/bar-3d.js.map +1 -1
- package/cjs/chart/base-chart.d.ts +2 -5
- package/cjs/chart/base-chart.js +8 -46
- package/cjs/chart/base-chart.js.map +1 -1
- package/cjs/chart/cartesian/interface.d.ts +1 -1
- package/cjs/chart/cartesian/interface.js.map +1 -1
- package/cjs/chart/index.js +1 -2
- package/cjs/chart/interface/chart.d.ts +3 -3
- package/cjs/chart/interface/chart.js.map +1 -1
- package/cjs/chart/sequence/sequence.js +1 -0
- package/cjs/chart/sequence/sequence.js.map +1 -1
- package/cjs/compile/compiler.js +2 -1
- package/cjs/compile/mark/compilable-mark.js +6 -9
- package/cjs/compile/mark/compilable-mark.js.map +1 -1
- package/cjs/component/axis/base-axis.d.ts +2 -1
- package/cjs/component/axis/base-axis.js +5 -1
- package/cjs/component/axis/base-axis.js.map +1 -1
- package/cjs/component/axis/cartesian/axis.d.ts +1 -1
- package/cjs/component/axis/cartesian/axis.js +5 -3
- package/cjs/component/axis/cartesian/axis.js.map +1 -1
- package/cjs/component/axis/cartesian/band-axis.js +2 -2
- package/cjs/component/axis/cartesian/band-axis.js.map +1 -1
- package/cjs/component/axis/cartesian/util/common.d.ts +0 -2
- package/cjs/component/axis/cartesian/util/common.js +2 -14
- package/cjs/component/axis/cartesian/util/common.js.map +1 -1
- package/cjs/component/axis/interface/common.d.ts +1 -0
- package/cjs/component/axis/interface/common.js.map +1 -1
- package/cjs/component/axis/polar/axis.js +3 -1
- package/cjs/component/axis/polar/axis.js.map +1 -1
- package/cjs/component/axis/polar/interface/common.d.ts +2 -3
- package/cjs/component/axis/polar/interface/common.js.map +1 -1
- package/cjs/component/base/base-component.d.ts +2 -7
- package/cjs/component/base/base-component.js +5 -5
- package/cjs/component/base/base-component.js.map +1 -1
- package/cjs/component/brush/brush.d.ts +1 -1
- package/cjs/component/brush/brush.js +1 -1
- package/cjs/component/brush/brush.js.map +1 -1
- package/cjs/component/crosshair/base.d.ts +4 -5
- package/cjs/component/crosshair/base.js +38 -25
- package/cjs/component/crosshair/base.js.map +1 -1
- package/cjs/component/crosshair/cartesian.d.ts +12 -35
- package/cjs/component/crosshair/cartesian.js +119 -110
- package/cjs/component/crosshair/cartesian.js.map +1 -1
- package/cjs/component/crosshair/config.d.ts +6 -0
- package/cjs/component/crosshair/config.js +8 -2
- package/cjs/component/crosshair/config.js.map +1 -1
- package/cjs/component/crosshair/interface/spec.d.ts +7 -3
- package/cjs/component/crosshair/interface/spec.js.map +1 -1
- package/cjs/component/crosshair/polar.d.ts +13 -55
- package/cjs/component/crosshair/polar.js +110 -83
- package/cjs/component/crosshair/polar.js.map +1 -1
- package/cjs/component/custom-mark/custom-mark.d.ts +1 -1
- package/cjs/component/custom-mark/custom-mark.js +1 -1
- package/cjs/component/custom-mark/custom-mark.js.map +1 -1
- package/cjs/component/data-zoom/data-filter-base-component.d.ts +1 -1
- package/cjs/component/data-zoom/data-filter-base-component.js +1 -1
- package/cjs/component/data-zoom/data-filter-base-component.js.map +1 -1
- package/cjs/component/data-zoom/data-zoom/data-zoom.d.ts +1 -1
- package/cjs/component/data-zoom/data-zoom/data-zoom.js +1 -1
- package/cjs/component/data-zoom/data-zoom/data-zoom.js.map +1 -1
- package/cjs/component/data-zoom/scroll-bar/scroll-bar.d.ts +1 -1
- package/cjs/component/data-zoom/scroll-bar/scroll-bar.js +1 -1
- package/cjs/component/data-zoom/scroll-bar/scroll-bar.js.map +1 -1
- package/cjs/component/geo/geo-coordinate.d.ts +1 -1
- package/cjs/component/geo/geo-coordinate.js +1 -1
- package/cjs/component/geo/geo-coordinate.js.map +1 -1
- package/cjs/component/indicator/indicator.d.ts +1 -1
- package/cjs/component/indicator/indicator.js +1 -1
- package/cjs/component/indicator/indicator.js.map +1 -1
- package/cjs/component/label/base-label.d.ts +1 -1
- package/cjs/component/label/base-label.js +1 -1
- package/cjs/component/label/base-label.js.map +1 -1
- package/cjs/component/label/label.d.ts +1 -0
- package/cjs/component/label/label.js +7 -0
- package/cjs/component/label/label.js.map +1 -1
- package/cjs/component/label/totalLabel.d.ts +1 -0
- package/cjs/component/label/totalLabel.js +7 -0
- package/cjs/component/label/totalLabel.js.map +1 -1
- package/cjs/component/legend/base-legend.d.ts +1 -1
- package/cjs/component/legend/base-legend.js +1 -1
- package/cjs/component/legend/base-legend.js.map +1 -1
- package/cjs/component/legend/continuous/interface.d.ts +1 -0
- package/cjs/component/legend/continuous/interface.js.map +1 -1
- package/cjs/component/legend/continuous/legend.js +5 -3
- package/cjs/component/legend/continuous/legend.js.map +1 -1
- package/cjs/component/map-label/component.d.ts +1 -1
- package/cjs/component/map-label/component.js +2 -2
- package/cjs/component/map-label/component.js.map +1 -1
- package/cjs/component/marker/base-marker.d.ts +23 -25
- package/cjs/component/marker/base-marker.js +40 -51
- package/cjs/component/marker/base-marker.js.map +1 -1
- package/cjs/component/marker/interface.d.ts +19 -9
- package/cjs/component/marker/interface.js.map +1 -1
- package/cjs/component/marker/mark-area/interface/spec.d.ts +10 -12
- package/cjs/component/marker/mark-area/interface/spec.js.map +1 -1
- package/cjs/component/marker/mark-area/mark-area.d.ts +3 -2
- package/cjs/component/marker/mark-area/mark-area.js +12 -22
- package/cjs/component/marker/mark-area/mark-area.js.map +1 -1
- package/cjs/component/marker/mark-line/interface/spec.d.ts +20 -9
- package/cjs/component/marker/mark-line/interface/spec.js.map +1 -1
- package/cjs/component/marker/mark-line/mark-line.d.ts +4 -2
- package/cjs/component/marker/mark-line/mark-line.js +60 -60
- package/cjs/component/marker/mark-line/mark-line.js.map +1 -1
- package/cjs/component/marker/mark-point/interface/spec.d.ts +8 -6
- package/cjs/component/marker/mark-point/interface/spec.js.map +1 -1
- package/cjs/component/marker/mark-point/mark-point.d.ts +3 -2
- package/cjs/component/marker/mark-point/mark-point.js +15 -19
- package/cjs/component/marker/mark-point/mark-point.js.map +1 -1
- package/cjs/component/marker/utils.d.ts +13 -2
- package/cjs/component/marker/utils.js +108 -39
- package/cjs/component/marker/utils.js.map +1 -1
- package/cjs/component/player/player.d.ts +1 -1
- package/cjs/component/player/player.js +1 -1
- package/cjs/component/player/player.js.map +1 -1
- package/cjs/component/title/title.d.ts +1 -1
- package/cjs/component/title/title.js +1 -1
- package/cjs/component/title/title.js.map +1 -1
- package/cjs/component/tooltip/tooltip.d.ts +1 -1
- package/cjs/component/tooltip/tooltip.js +4 -3
- package/cjs/component/tooltip/tooltip.js.map +1 -1
- package/cjs/core/index.d.ts +1 -1
- package/cjs/core/index.js +1 -1
- package/cjs/core/index.js.map +1 -1
- package/cjs/core/vchart.js +5 -4
- package/cjs/core/vchart.js.map +1 -1
- package/cjs/data/transforms/aggregation.d.ts +3 -3
- package/cjs/data/transforms/aggregation.js +5 -7
- package/cjs/data/transforms/aggregation.js.map +1 -1
- package/cjs/event/events/dimension/util/polar.js +2 -2
- package/cjs/event/events/dimension/util/polar.js.map +1 -1
- package/cjs/layout/layout3d/index.js +1 -1
- package/cjs/layout/layout3d/index.js.map +1 -1
- package/cjs/mark/base/base-mark.js +2 -5
- package/cjs/mark/base/base-mark.js.map +1 -1
- package/cjs/model/base-model.d.ts +1 -1
- package/cjs/model/base-model.js +6 -38
- package/cjs/model/base-model.js.map +1 -1
- package/cjs/model/interface.d.ts +2 -1
- package/cjs/model/interface.js.map +1 -1
- package/cjs/region/region.js +4 -2
- package/cjs/region/region.js.map +1 -1
- package/cjs/series/bar/bar.js +6 -11
- package/cjs/series/bar/bar.js.map +1 -1
- package/cjs/series/base/base-series.js +12 -9
- package/cjs/series/base/base-series.js.map +1 -1
- package/cjs/series/box-plot/box-plot.js +4 -12
- package/cjs/series/box-plot/box-plot.js.map +1 -1
- package/cjs/series/gauge/gauge-pointer.d.ts +2 -1
- package/cjs/series/gauge/gauge-pointer.js +16 -9
- package/cjs/series/gauge/gauge-pointer.js.map +1 -1
- package/cjs/series/gauge/gauge.js +13 -1
- package/cjs/series/gauge/gauge.js.map +1 -1
- package/cjs/series/gauge/interface.d.ts +2 -0
- package/cjs/series/gauge/interface.js.map +1 -1
- package/cjs/series/heatmap/heatmap.js +4 -9
- package/cjs/series/heatmap/heatmap.js.map +1 -1
- package/cjs/series/pie/pie.js +1 -1
- package/cjs/series/pie/pie.js.map +1 -1
- package/cjs/series/range-column/range-column.js +7 -15
- package/cjs/series/range-column/range-column.js.map +1 -1
- package/cjs/series/util/utils.d.ts +5 -0
- package/cjs/series/util/utils.js +18 -2
- package/cjs/series/util/utils.js.map +1 -1
- package/cjs/series/waterfall/waterfall.js +7 -11
- package/cjs/series/waterfall/waterfall.js.map +1 -1
- package/cjs/theme/builtin/common/component/crosshair.js +0 -8
- package/cjs/theme/builtin/common/component/crosshair.js.map +1 -1
- package/cjs/typings/visual.d.ts +3 -2
- package/cjs/typings/visual.js.map +1 -1
- package/esm/animation/utils.d.ts +1 -0
- package/esm/animation/utils.js +12 -7
- package/esm/animation/utils.js.map +1 -1
- package/esm/chart/bar/bar-3d.d.ts +2 -2
- package/esm/chart/bar/bar-3d.js +3 -3
- package/esm/chart/bar/bar-3d.js.map +1 -1
- package/esm/chart/base-chart.d.ts +2 -5
- package/esm/chart/base-chart.js +8 -46
- package/esm/chart/base-chart.js.map +1 -1
- package/esm/chart/cartesian/interface.d.ts +1 -1
- package/esm/chart/cartesian/interface.js.map +1 -1
- package/esm/chart/index.js +1 -2
- package/esm/chart/interface/chart.d.ts +3 -3
- package/esm/chart/interface/chart.js.map +1 -1
- package/esm/chart/sequence/sequence.js +1 -0
- package/esm/chart/sequence/sequence.js.map +1 -1
- package/esm/compile/compiler.js +2 -1
- package/esm/compile/mark/compilable-mark.js +6 -10
- package/esm/compile/mark/compilable-mark.js.map +1 -1
- package/esm/component/axis/base-axis.d.ts +2 -1
- package/esm/component/axis/base-axis.js +5 -1
- package/esm/component/axis/base-axis.js.map +1 -1
- package/esm/component/axis/cartesian/axis.d.ts +1 -1
- package/esm/component/axis/cartesian/axis.js +5 -3
- package/esm/component/axis/cartesian/axis.js.map +1 -1
- package/esm/component/axis/cartesian/band-axis.js +1 -3
- package/esm/component/axis/cartesian/band-axis.js.map +1 -1
- package/esm/component/axis/cartesian/util/common.d.ts +0 -2
- package/esm/component/axis/cartesian/util/common.js +0 -11
- package/esm/component/axis/cartesian/util/common.js.map +1 -1
- package/esm/component/axis/interface/common.d.ts +1 -0
- package/esm/component/axis/interface/common.js.map +1 -1
- package/esm/component/axis/polar/axis.js +3 -1
- package/esm/component/axis/polar/axis.js.map +1 -1
- package/esm/component/axis/polar/interface/common.d.ts +2 -3
- package/esm/component/axis/polar/interface/common.js.map +1 -1
- package/esm/component/base/base-component.d.ts +2 -7
- package/esm/component/base/base-component.js +5 -5
- package/esm/component/base/base-component.js.map +1 -1
- package/esm/component/brush/brush.d.ts +1 -1
- package/esm/component/brush/brush.js +1 -1
- package/esm/component/brush/brush.js.map +1 -1
- package/esm/component/crosshair/base.d.ts +4 -5
- package/esm/component/crosshair/base.js +37 -25
- package/esm/component/crosshair/base.js.map +1 -1
- package/esm/component/crosshair/cartesian.d.ts +12 -35
- package/esm/component/crosshair/cartesian.js +112 -103
- package/esm/component/crosshair/cartesian.js.map +1 -1
- package/esm/component/crosshair/config.d.ts +6 -0
- package/esm/component/crosshair/config.js +7 -0
- package/esm/component/crosshair/config.js.map +1 -1
- package/esm/component/crosshair/interface/spec.d.ts +7 -3
- package/esm/component/crosshair/interface/spec.js.map +1 -1
- package/esm/component/crosshair/polar.d.ts +13 -55
- package/esm/component/crosshair/polar.js +110 -79
- package/esm/component/crosshair/polar.js.map +1 -1
- package/esm/component/custom-mark/custom-mark.d.ts +1 -1
- package/esm/component/custom-mark/custom-mark.js +1 -1
- package/esm/component/custom-mark/custom-mark.js.map +1 -1
- package/esm/component/data-zoom/data-filter-base-component.d.ts +1 -1
- package/esm/component/data-zoom/data-filter-base-component.js +1 -1
- package/esm/component/data-zoom/data-filter-base-component.js.map +1 -1
- package/esm/component/data-zoom/data-zoom/data-zoom.d.ts +1 -1
- package/esm/component/data-zoom/data-zoom/data-zoom.js +1 -1
- package/esm/component/data-zoom/data-zoom/data-zoom.js.map +1 -1
- package/esm/component/data-zoom/scroll-bar/scroll-bar.d.ts +1 -1
- package/esm/component/data-zoom/scroll-bar/scroll-bar.js +1 -1
- package/esm/component/data-zoom/scroll-bar/scroll-bar.js.map +1 -1
- package/esm/component/geo/geo-coordinate.d.ts +1 -1
- package/esm/component/geo/geo-coordinate.js +1 -1
- package/esm/component/geo/geo-coordinate.js.map +1 -1
- package/esm/component/indicator/indicator.d.ts +1 -1
- package/esm/component/indicator/indicator.js +1 -1
- package/esm/component/indicator/indicator.js.map +1 -1
- package/esm/component/label/base-label.d.ts +1 -1
- package/esm/component/label/base-label.js +1 -1
- package/esm/component/label/base-label.js.map +1 -1
- package/esm/component/label/label.d.ts +1 -0
- package/esm/component/label/label.js +7 -0
- package/esm/component/label/label.js.map +1 -1
- package/esm/component/label/totalLabel.d.ts +1 -0
- package/esm/component/label/totalLabel.js +7 -0
- package/esm/component/label/totalLabel.js.map +1 -1
- package/esm/component/legend/base-legend.d.ts +1 -1
- package/esm/component/legend/base-legend.js +1 -1
- package/esm/component/legend/base-legend.js.map +1 -1
- package/esm/component/legend/continuous/interface.d.ts +1 -0
- package/esm/component/legend/continuous/interface.js.map +1 -1
- package/esm/component/legend/continuous/legend.js +5 -3
- package/esm/component/legend/continuous/legend.js.map +1 -1
- package/esm/component/map-label/component.d.ts +1 -1
- package/esm/component/map-label/component.js +2 -2
- package/esm/component/map-label/component.js.map +1 -1
- package/esm/component/marker/base-marker.d.ts +23 -25
- package/esm/component/marker/base-marker.js +42 -53
- package/esm/component/marker/base-marker.js.map +1 -1
- package/esm/component/marker/interface.d.ts +19 -9
- package/esm/component/marker/interface.js.map +1 -1
- package/esm/component/marker/mark-area/interface/spec.d.ts +10 -12
- package/esm/component/marker/mark-area/interface/spec.js.map +1 -1
- package/esm/component/marker/mark-area/mark-area.d.ts +3 -2
- package/esm/component/marker/mark-area/mark-area.js +10 -22
- package/esm/component/marker/mark-area/mark-area.js.map +1 -1
- package/esm/component/marker/mark-line/interface/spec.d.ts +20 -9
- package/esm/component/marker/mark-line/interface/spec.js.map +1 -1
- package/esm/component/marker/mark-line/mark-line.d.ts +4 -2
- package/esm/component/marker/mark-line/mark-line.js +58 -54
- package/esm/component/marker/mark-line/mark-line.js.map +1 -1
- package/esm/component/marker/mark-point/interface/spec.d.ts +8 -6
- package/esm/component/marker/mark-point/interface/spec.js.map +1 -1
- package/esm/component/marker/mark-point/mark-point.d.ts +3 -2
- package/esm/component/marker/mark-point/mark-point.js +12 -20
- package/esm/component/marker/mark-point/mark-point.js.map +1 -1
- package/esm/component/marker/utils.d.ts +13 -2
- package/esm/component/marker/utils.js +103 -35
- package/esm/component/marker/utils.js.map +1 -1
- package/esm/component/player/player.d.ts +1 -1
- package/esm/component/player/player.js +1 -1
- package/esm/component/player/player.js.map +1 -1
- package/esm/component/title/title.d.ts +1 -1
- package/esm/component/title/title.js +1 -1
- package/esm/component/title/title.js.map +1 -1
- package/esm/component/tooltip/tooltip.d.ts +1 -1
- package/esm/component/tooltip/tooltip.js +4 -2
- package/esm/component/tooltip/tooltip.js.map +1 -1
- package/esm/core/index.d.ts +1 -1
- package/esm/core/index.js +1 -1
- package/esm/core/index.js.map +1 -1
- package/esm/core/vchart.js +5 -4
- package/esm/core/vchart.js.map +1 -1
- package/esm/data/transforms/aggregation.d.ts +3 -3
- package/esm/data/transforms/aggregation.js +6 -8
- package/esm/data/transforms/aggregation.js.map +1 -1
- package/esm/event/events/dimension/util/polar.js +2 -2
- package/esm/event/events/dimension/util/polar.js.map +1 -1
- package/esm/layout/layout3d/index.js +1 -1
- package/esm/layout/layout3d/index.js.map +1 -1
- package/esm/mark/base/base-mark.js +1 -4
- package/esm/mark/base/base-mark.js.map +1 -1
- package/esm/model/base-model.d.ts +1 -1
- package/esm/model/base-model.js +6 -39
- package/esm/model/base-model.js.map +1 -1
- package/esm/model/interface.d.ts +2 -1
- package/esm/model/interface.js.map +1 -1
- package/esm/region/region.js +5 -1
- package/esm/region/region.js.map +1 -1
- package/esm/series/bar/bar.js +5 -9
- package/esm/series/bar/bar.js.map +1 -1
- package/esm/series/base/base-series.js +10 -7
- package/esm/series/base/base-series.js.map +1 -1
- package/esm/series/box-plot/box-plot.js +5 -11
- package/esm/series/box-plot/box-plot.js.map +1 -1
- package/esm/series/gauge/gauge-pointer.d.ts +2 -1
- package/esm/series/gauge/gauge-pointer.js +16 -9
- package/esm/series/gauge/gauge-pointer.js.map +1 -1
- package/esm/series/gauge/gauge.js +13 -1
- package/esm/series/gauge/gauge.js.map +1 -1
- package/esm/series/gauge/interface.d.ts +2 -0
- package/esm/series/gauge/interface.js.map +1 -1
- package/esm/series/heatmap/heatmap.js +4 -8
- package/esm/series/heatmap/heatmap.js.map +1 -1
- package/esm/series/pie/pie.js +1 -1
- package/esm/series/pie/pie.js.map +1 -1
- package/esm/series/range-column/range-column.js +6 -12
- package/esm/series/range-column/range-column.js.map +1 -1
- package/esm/series/util/utils.d.ts +5 -0
- package/esm/series/util/utils.js +15 -0
- package/esm/series/util/utils.js.map +1 -1
- package/esm/series/waterfall/waterfall.js +6 -9
- package/esm/series/waterfall/waterfall.js.map +1 -1
- package/esm/theme/builtin/common/component/crosshair.js +0 -8
- package/esm/theme/builtin/common/component/crosshair.js.map +1 -1
- package/esm/typings/visual.d.ts +3 -2
- package/esm/typings/visual.js.map +1 -1
- package/package.json +15 -15
|
@@ -4,14 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: !0
|
|
5
5
|
}), exports.registerCartesianCrossHair = exports.CartesianCrossHair = void 0;
|
|
6
6
|
|
|
7
|
-
const vutils_1 = require("@visactor/vutils"), type_1 = require("../interface/type"), vscale_1 = require("@visactor/vscale"), vrender_components_1 = require("@visactor/vrender-components"), base_1 = require("./base"), util_1 = require("./util"), util_2 = require("../axis/util"), common_1 = require("../axis/cartesian/util/common"), factory_1 = require("../../core/factory");
|
|
8
|
-
|
|
9
|
-
var LayoutType;
|
|
10
|
-
|
|
11
|
-
!function(LayoutType) {
|
|
12
|
-
LayoutType[LayoutType.ALL = 3] = "ALL", LayoutType[LayoutType.HORIZONTAL = 2] = "HORIZONTAL",
|
|
13
|
-
LayoutType[LayoutType.VERTICAL = 1] = "VERTICAL", LayoutType[LayoutType.NONE = 0] = "NONE";
|
|
14
|
-
}(LayoutType || (LayoutType = {}));
|
|
7
|
+
const vutils_1 = require("@visactor/vutils"), type_1 = require("../interface/type"), vscale_1 = require("@visactor/vscale"), vrender_components_1 = require("@visactor/vrender-components"), base_1 = require("./base"), util_1 = require("./util"), util_2 = require("../axis/util"), common_1 = require("../axis/cartesian/util/common"), factory_1 = require("../../core/factory"), config_1 = require("./config");
|
|
15
8
|
|
|
16
9
|
class CartesianCrossHair extends base_1.BaseCrossHair {
|
|
17
10
|
static createComponent(spec, options) {
|
|
@@ -27,79 +20,81 @@ class CartesianCrossHair extends base_1.BaseCrossHair {
|
|
|
27
20
|
}
|
|
28
21
|
constructor(spec, options) {
|
|
29
22
|
super(spec, options), this.specKey = "crosshair", this.type = type_1.ComponentTypeEnum.cartesianCrosshair,
|
|
30
|
-
this.name = type_1.ComponentTypeEnum.cartesianCrosshair, this.
|
|
31
|
-
this.
|
|
23
|
+
this.name = type_1.ComponentTypeEnum.cartesianCrosshair, this._currValueX = new Map,
|
|
24
|
+
this._currValueY = new Map;
|
|
32
25
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const {xField: xField = {}, yField: yField = {}} = this._spec;
|
|
26
|
+
_showDefaultCrosshairBySpec() {
|
|
27
|
+
const {xField: xField, yField: yField} = this._spec;
|
|
36
28
|
if ((null == xField ? void 0 : xField.visible) && xField.defaultSelect) {
|
|
37
29
|
const {axisIndex: axisIndex, datum: datum} = xField.defaultSelect;
|
|
38
|
-
this.
|
|
30
|
+
this._defaultCrosshair(axisIndex, datum, config_1.LayoutType.VERTICAL);
|
|
39
31
|
}
|
|
40
32
|
if ((null == yField ? void 0 : yField.visible) && yField.defaultSelect) {
|
|
41
33
|
const {axisIndex: axisIndex, datum: datum} = yField.defaultSelect;
|
|
42
|
-
this.
|
|
34
|
+
this._defaultCrosshair(axisIndex, datum, config_1.LayoutType.HORIZONTAL);
|
|
43
35
|
}
|
|
44
36
|
}
|
|
45
|
-
|
|
37
|
+
_defaultCrosshair(axisIndex, datum, tag) {
|
|
46
38
|
const axis = this._option.getComponentsByKey("axes").find((c => c.getSpecIndex() === axisIndex));
|
|
47
|
-
axis && (
|
|
39
|
+
axis && (tag === config_1.LayoutType.VERTICAL ? (this._currValueX.clear(), this._currValueX.set(axisIndex, {
|
|
48
40
|
axis: axis,
|
|
49
41
|
v: datum
|
|
50
|
-
})) : (this.
|
|
42
|
+
})) : (this._currValueY.clear(), this._currValueY.set(axisIndex, {
|
|
51
43
|
axis: axis,
|
|
52
44
|
v: datum
|
|
53
|
-
})));
|
|
45
|
+
})), this.layoutByValue(tag));
|
|
54
46
|
}
|
|
55
|
-
|
|
47
|
+
_findAllAxisContains(relativeX, relativeY) {
|
|
56
48
|
const xAxisMap = this._getAxisInfoByField("x"), yAxisMap = this._getAxisInfoByField("y");
|
|
57
49
|
return {
|
|
58
50
|
xAxisMap: this._filterAxisByPoint(xAxisMap, relativeX, relativeY),
|
|
59
51
|
yAxisMap: this._filterAxisByPoint(yAxisMap, relativeX, relativeY)
|
|
60
52
|
};
|
|
61
53
|
}
|
|
62
|
-
|
|
54
|
+
_getValueAt(axis, p) {
|
|
63
55
|
let value = axis.getScale().invert(p);
|
|
64
56
|
return (0, vscale_1.isContinuous)(axis.getScale().type) && (0, vutils_1.isValidNumber)(+value) && (value = (+value).toFixed(2)),
|
|
65
57
|
value;
|
|
66
58
|
}
|
|
67
59
|
clearAxisValue() {
|
|
68
|
-
this.
|
|
60
|
+
this._currValueX.clear(), this._currValueY.clear();
|
|
69
61
|
}
|
|
70
62
|
setAxisValue(v, axis) {
|
|
71
|
-
(0, common_1.isXAxis)(axis.getOrient())
|
|
63
|
+
(0, common_1.isXAxis)(axis.getOrient()) ? this._currValueX.set(axis.getSpecIndex(), {
|
|
64
|
+
v: v,
|
|
65
|
+
axis: axis
|
|
66
|
+
}) : this._currValueY.set(axis.getSpecIndex(), {
|
|
72
67
|
v: v,
|
|
73
68
|
axis: axis
|
|
74
69
|
});
|
|
75
70
|
}
|
|
76
|
-
|
|
71
|
+
_getAllAxisValues(axisMap, p, currValue, vertical) {
|
|
77
72
|
let discrete = !1;
|
|
78
73
|
return axisMap.forEach((item => {
|
|
79
74
|
(0, vscale_1.isDiscrete)(item.axis.getScale().type) && (discrete ? this.enable = !1 : discrete = !0);
|
|
80
75
|
})), !!this.enable && (axisMap.forEach(((item, id) => {
|
|
81
76
|
const axis = item.axis;
|
|
82
77
|
currValue.set(id, {
|
|
83
|
-
v: this.
|
|
78
|
+
v: this._getValueAt(axis, p - (vertical ? axis.getLayoutStartPoint().x - this.getLayoutStartPoint().x : axis.getLayoutStartPoint().y - this.getLayoutStartPoint().y)),
|
|
84
79
|
axis: axis
|
|
85
80
|
});
|
|
86
81
|
})), !0);
|
|
87
82
|
}
|
|
88
83
|
_layoutCrosshair(relativeX, relativeY) {
|
|
89
|
-
const {xAxisMap: xAxisMap, yAxisMap: yAxisMap} = this.
|
|
84
|
+
const {xAxisMap: xAxisMap, yAxisMap: yAxisMap} = this._findAllAxisContains(relativeX, relativeY);
|
|
90
85
|
if (xAxisMap && 0 === xAxisMap.size && yAxisMap && 0 === yAxisMap.size) {
|
|
91
86
|
if (this.enableRemain) return;
|
|
92
87
|
this.hide();
|
|
93
|
-
} else this.
|
|
94
|
-
yAxisMap && yAxisMap.size && this.
|
|
95
|
-
this.layoutByValue(LayoutType.ALL);
|
|
88
|
+
} else this._currValueX.clear(), this._currValueY.clear(), xAxisMap && xAxisMap.size && this._getAllAxisValues(xAxisMap, relativeX, this._currValueX, !0),
|
|
89
|
+
yAxisMap && yAxisMap.size && this._getAllAxisValues(yAxisMap, relativeY, this._currValueY, !1),
|
|
90
|
+
this.layoutByValue(config_1.LayoutType.ALL);
|
|
96
91
|
}
|
|
97
92
|
hide() {
|
|
98
93
|
this._xCrosshair && this._xCrosshair.hideAll(), this._xTopLabel && this._xTopLabel.hideAll(),
|
|
99
94
|
this._xBottomLabel && this._xBottomLabel.hideAll(), this._yCrosshair && this._yCrosshair.hideAll(),
|
|
100
95
|
this._yLeftLabel && this._yLeftLabel.hideAll(), this._yRightLabel && this._yRightLabel.hideAll();
|
|
101
96
|
}
|
|
102
|
-
layoutByValue(tag = LayoutType.ALL) {
|
|
97
|
+
layoutByValue(tag = config_1.LayoutType.ALL) {
|
|
103
98
|
var _a, _b, _c, _d;
|
|
104
99
|
if (!this.enable) return;
|
|
105
100
|
const series = this._firstSeries();
|
|
@@ -121,7 +116,8 @@ class CartesianCrossHair extends base_1.BaseCrossHair {
|
|
|
121
116
|
dx: 0,
|
|
122
117
|
dy: 0
|
|
123
118
|
},
|
|
124
|
-
visible: !1
|
|
119
|
+
visible: !1,
|
|
120
|
+
axis: null
|
|
125
121
|
}, yCrossHairInfo = {
|
|
126
122
|
width: 0,
|
|
127
123
|
leftPos: 0,
|
|
@@ -139,7 +135,8 @@ class CartesianCrossHair extends base_1.BaseCrossHair {
|
|
|
139
135
|
dx: 0,
|
|
140
136
|
dy: 0
|
|
141
137
|
},
|
|
142
|
-
visible: !1
|
|
138
|
+
visible: !1,
|
|
139
|
+
axis: null
|
|
143
140
|
};
|
|
144
141
|
const getRegionArea = (outRegion, currentValue) => {
|
|
145
142
|
currentValue.forEach((({axis: axis}) => {
|
|
@@ -151,15 +148,17 @@ class CartesianCrossHair extends base_1.BaseCrossHair {
|
|
|
151
148
|
}));
|
|
152
149
|
};
|
|
153
150
|
let x = 0, y = 0;
|
|
154
|
-
if (this.
|
|
155
|
-
const item = Array.from(this.
|
|
156
|
-
x = item.axis.getScale().scale(item.v) + item.axis.getLayoutStartPoint().x - this.getLayoutStartPoint().x
|
|
151
|
+
if (this._currValueX.size) {
|
|
152
|
+
const item = Array.from(this._currValueX.values())[0];
|
|
153
|
+
x = item.axis.getScale().scale(item.v) + item.axis.getLayoutStartPoint().x - this.getLayoutStartPoint().x,
|
|
154
|
+
xCrossHairInfo.axis = item.axis;
|
|
157
155
|
}
|
|
158
|
-
if (this.
|
|
159
|
-
const item = Array.from(this.
|
|
160
|
-
y = item.axis.getScale().scale(item.v) + item.axis.getLayoutStartPoint().y - this.getLayoutStartPoint().y
|
|
156
|
+
if (this._currValueY.size) {
|
|
157
|
+
const item = Array.from(this._currValueY.values())[0];
|
|
158
|
+
y = item.axis.getScale().scale(item.v) + item.axis.getLayoutStartPoint().y - this.getLayoutStartPoint().y,
|
|
159
|
+
yCrossHairInfo.axis = item.axis;
|
|
161
160
|
}
|
|
162
|
-
xCrossHairInfo.visible = !!this.
|
|
161
|
+
xCrossHairInfo.visible = !!this._currValueX.size && Number.isFinite(x), yCrossHairInfo.visible = !!this._currValueY.size && Number.isFinite(y);
|
|
163
162
|
const xRegion = {
|
|
164
163
|
x1: 1 / 0,
|
|
165
164
|
y1: 1 / 0,
|
|
@@ -172,15 +171,13 @@ class CartesianCrossHair extends base_1.BaseCrossHair {
|
|
|
172
171
|
y2: -1 / 0
|
|
173
172
|
};
|
|
174
173
|
let indexWidth, valueHeight;
|
|
175
|
-
if (getRegionArea(xRegion, this.
|
|
176
|
-
this.
|
|
177
|
-
var _a
|
|
174
|
+
if (getRegionArea(xRegion, this._currValueX), getRegionArea(yRegion, this._currValueY),
|
|
175
|
+
this._xHair && this._currValueX.forEach((({axis: axis, v: v}) => {
|
|
176
|
+
var _a;
|
|
178
177
|
v = null != v ? v : "";
|
|
179
178
|
const xScale = axis.getScale();
|
|
180
|
-
if ((0, vscale_1.isDiscrete)(xScale.type))
|
|
181
|
-
|
|
182
|
-
indexWidth = axis ? null === (_b = (_a = series.getXAxisHelper()).getBandwidth) || void 0 === _b ? void 0 : _b.call(_a, 0) : eachBand;
|
|
183
|
-
} else if ((0, vscale_1.isContinuous)(xScale.type)) {
|
|
179
|
+
if ((0, vscale_1.isDiscrete)(xScale.type)) indexWidth = xScale.bandwidth(); else if ((0,
|
|
180
|
+
vscale_1.isContinuous)(xScale.type)) {
|
|
184
181
|
const fieldX = series.fieldX[0], fieldX2 = series.fieldX2, datum = (0, util_1.getDatumByValue)(series.getViewData().latestData, +v, fieldX, fieldX2);
|
|
185
182
|
if (datum) {
|
|
186
183
|
const startX = series.dataToPositionX(datum);
|
|
@@ -188,20 +185,18 @@ class CartesianCrossHair extends base_1.BaseCrossHair {
|
|
|
188
185
|
x = startX;
|
|
189
186
|
}
|
|
190
187
|
}
|
|
191
|
-
if (null === (
|
|
188
|
+
if (null === (_a = this._xHair.label) || void 0 === _a ? void 0 : _a.visible) {
|
|
192
189
|
const labelOffset = (0, util_2.getAxisLabelOffset)(axis.getSpec());
|
|
193
190
|
"bottom" === axis.getOrient() ? (xCrossHairInfo.bottom.visible = !0, xCrossHairInfo.bottom.text = v,
|
|
194
191
|
xCrossHairInfo.bottom.dx = 0, xCrossHairInfo.bottom.dy = labelOffset) : "top" === axis.getOrient() && (xCrossHairInfo.top.visible = !0,
|
|
195
192
|
xCrossHairInfo.top.text = v, xCrossHairInfo.top.dx = 0, xCrossHairInfo.top.dy = -labelOffset);
|
|
196
193
|
}
|
|
197
|
-
})), this.
|
|
198
|
-
var _a
|
|
194
|
+
})), this._yHair && this._currValueY.forEach((({axis: axis, v: v}) => {
|
|
195
|
+
var _a;
|
|
199
196
|
v = null != v ? v : "";
|
|
200
197
|
const yScale = axis.getScale();
|
|
201
|
-
if ((0, vscale_1.isDiscrete)(yScale.type))
|
|
202
|
-
|
|
203
|
-
valueHeight = yScale ? null === (_b = (_a = series.getYAxisHelper()).getBandwidth) || void 0 === _b ? void 0 : _b.call(_a, 0) : eachBand;
|
|
204
|
-
} else if ((0, vscale_1.isContinuous)(yScale.type)) {
|
|
198
|
+
if ((0, vscale_1.isDiscrete)(yScale.type)) valueHeight = yScale.bandwidth(); else if ((0,
|
|
199
|
+
vscale_1.isContinuous)(yScale.type)) {
|
|
205
200
|
const fieldY = series.fieldY[0], fieldY2 = series.fieldY2, datum = (0, util_1.getDatumByValue)(series.getViewData().latestData, +v, fieldY, fieldY2);
|
|
206
201
|
if (datum) {
|
|
207
202
|
const startY = series.dataToPositionY(datum);
|
|
@@ -209,7 +204,7 @@ class CartesianCrossHair extends base_1.BaseCrossHair {
|
|
|
209
204
|
y = startY;
|
|
210
205
|
}
|
|
211
206
|
}
|
|
212
|
-
if (null === (
|
|
207
|
+
if (null === (_a = this._yHair.label) || void 0 === _a ? void 0 : _a.visible) {
|
|
213
208
|
const labelOffset = (0, util_2.getAxisLabelOffset)(axis.getSpec());
|
|
214
209
|
"left" === axis.getOrient() ? (yCrossHairInfo.left.visible = !0, yCrossHairInfo.left.text = v,
|
|
215
210
|
yCrossHairInfo.left.dx = -labelOffset, yCrossHairInfo.left.dy = 0) : "right" === axis.getOrient() && (yCrossHairInfo.right.visible = !0,
|
|
@@ -217,20 +212,20 @@ class CartesianCrossHair extends base_1.BaseCrossHair {
|
|
|
217
212
|
}
|
|
218
213
|
})), this.enableRemain && !xCrossHairInfo.visible && (0, vutils_1.isValid)(this._cacheXCrossHairInfo)) xCrossHairInfo = this._cacheXCrossHairInfo; else if (xCrossHairInfo.leftPos = xRegion.x1,
|
|
219
214
|
xCrossHairInfo.topPos = xRegion.y1, xCrossHairInfo.height = xRegion.y2 - xRegion.y1,
|
|
220
|
-
xCrossHairInfo.x = x + this.getLayoutStartPoint().x, null === (_b = null === (_a = this.
|
|
215
|
+
xCrossHairInfo.x = x + this.getLayoutStartPoint().x, null === (_b = null === (_a = this._xHair) || void 0 === _a ? void 0 : _a.label) || void 0 === _b ? void 0 : _b.formatMethod) {
|
|
221
216
|
const {top: top, bottom: bottom} = xCrossHairInfo;
|
|
222
|
-
bottom.visible && (bottom.text = this.
|
|
223
|
-
top.visible && (top.text = this.
|
|
217
|
+
bottom.visible && (bottom.text = this._xHair.label.formatMethod(bottom.text, "bottom")),
|
|
218
|
+
top.visible && (top.text = this._xHair.label.formatMethod(top.text, "top"));
|
|
224
219
|
}
|
|
225
220
|
if (this.enableRemain && !yCrossHairInfo.visible && (0, vutils_1.isValid)(this._cacheYCrossHairInfo)) yCrossHairInfo = this._cacheYCrossHairInfo; else if (yCrossHairInfo.leftPos = yRegion.x1,
|
|
226
221
|
yCrossHairInfo.topPos = yRegion.y1, yCrossHairInfo.width = yRegion.x2 - yRegion.x1,
|
|
227
|
-
yCrossHairInfo.y = y + this.getLayoutStartPoint().y, null === (_d = null === (_c = this.
|
|
222
|
+
yCrossHairInfo.y = y + this.getLayoutStartPoint().y, null === (_d = null === (_c = this._yHair) || void 0 === _c ? void 0 : _c.label) || void 0 === _d ? void 0 : _d.formatMethod) {
|
|
228
223
|
const {left: left, right: right} = yCrossHairInfo;
|
|
229
|
-
left.visible && (left.text = this.
|
|
230
|
-
right.visible && (right.text = this.
|
|
224
|
+
left.visible && (left.text = this._yHair.label.formatMethod(left.text, "left")),
|
|
225
|
+
right.visible && (right.text = this._yHair.label.formatMethod(right.text, "right"));
|
|
231
226
|
}
|
|
232
|
-
tag && (LayoutType.HORIZONTAL && this._layoutHorizontal(yCrossHairInfo, null != valueHeight ? valueHeight : 0),
|
|
233
|
-
LayoutType.VERTICAL && this._layoutVertical(xCrossHairInfo, null != indexWidth ? indexWidth : 0)),
|
|
227
|
+
tag && (config_1.LayoutType.HORIZONTAL && this._layoutHorizontal(yCrossHairInfo, null != valueHeight ? valueHeight : 0),
|
|
228
|
+
config_1.LayoutType.VERTICAL && this._layoutVertical(xCrossHairInfo, null != indexWidth ? indexWidth : 0)),
|
|
234
229
|
this.enableRemain && (this._cacheXCrossHairInfo = Object.assign(Object.assign({}, xCrossHairInfo), {
|
|
235
230
|
_isCache: !0
|
|
236
231
|
}), this._cacheYCrossHairInfo = Object.assign(Object.assign({}, yCrossHairInfo), {
|
|
@@ -238,38 +233,40 @@ class CartesianCrossHair extends base_1.BaseCrossHair {
|
|
|
238
233
|
}));
|
|
239
234
|
}
|
|
240
235
|
_layoutVertical(crosshairInfo, bandWidth) {
|
|
241
|
-
var _a, _b
|
|
242
|
-
if (crosshairInfo._isCache && this.enableRemain || !this.
|
|
236
|
+
var _a, _b;
|
|
237
|
+
if (crosshairInfo._isCache && this.enableRemain || !this._xHair) return;
|
|
243
238
|
const {x: x, topPos: topPos, height: height, top: top, bottom: bottom, visible: visible} = crosshairInfo;
|
|
244
239
|
if (visible) {
|
|
245
|
-
|
|
246
|
-
(null === (_b = null === (_a = this.xHair) || void 0 === _a ? void 0 : _a.style) || void 0 === _b ? void 0 : _b.sizePercent) ? extend = (this.xHair.style.sizePercent - 1) * bandWidth : "number" == typeof (null === (_d = null === (_c = this.xHair) || void 0 === _c ? void 0 : _c.style) || void 0 === _d ? void 0 : _d.size) && (extend = this.xHair.style.size - bandWidth);
|
|
247
|
-
const type = this.xHair.type;
|
|
240
|
+
const type = this._xHair.type;
|
|
248
241
|
let positionAttribute;
|
|
249
|
-
if ("line" === type
|
|
242
|
+
if ("line" === type) positionAttribute = {
|
|
250
243
|
start: {
|
|
251
|
-
x: x + bandWidth / 2
|
|
252
|
-
y: topPos
|
|
253
|
-
},
|
|
254
|
-
end: {
|
|
255
|
-
x: x + bandWidth / 2 + extend / 2,
|
|
256
|
-
y: topPos + height
|
|
257
|
-
}
|
|
258
|
-
} : "rect" === type && (positionAttribute = {
|
|
259
|
-
start: {
|
|
260
|
-
x: x - extend / 2,
|
|
244
|
+
x: x + bandWidth / 2,
|
|
261
245
|
y: topPos
|
|
262
246
|
},
|
|
263
247
|
end: {
|
|
264
|
-
x: x + bandWidth
|
|
248
|
+
x: x + bandWidth / 2,
|
|
265
249
|
y: topPos + height
|
|
266
250
|
}
|
|
267
|
-
}
|
|
251
|
+
}; else if ("rect" === type) {
|
|
252
|
+
const extend = this._getRectSize(this._xHair, bandWidth, crosshairInfo.axis);
|
|
253
|
+
positionAttribute = {
|
|
254
|
+
start: {
|
|
255
|
+
x: x - extend / 2,
|
|
256
|
+
y: topPos
|
|
257
|
+
},
|
|
258
|
+
end: {
|
|
259
|
+
x: x + bandWidth + extend / 2,
|
|
260
|
+
y: topPos + height
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
if (this._updateCrosshair("x", type, positionAttribute), top.visible) {
|
|
268
265
|
const updateAttrs = Object.assign(Object.assign(Object.assign({
|
|
269
266
|
x: x + bandWidth / 2,
|
|
270
267
|
y: topPos
|
|
271
|
-
}, top), this.
|
|
272
|
-
textStyle: Object.assign(Object.assign({}, null === (
|
|
268
|
+
}, top), this._xHair.label), {
|
|
269
|
+
textStyle: Object.assign(Object.assign({}, null === (_a = this._xHair.label) || void 0 === _a ? void 0 : _a.textStyle), {
|
|
273
270
|
textAlign: "center",
|
|
274
271
|
textBaseline: "bottom"
|
|
275
272
|
}),
|
|
@@ -283,8 +280,8 @@ class CartesianCrossHair extends base_1.BaseCrossHair {
|
|
|
283
280
|
const updateAttrs = Object.assign(Object.assign(Object.assign({
|
|
284
281
|
x: x + bandWidth / 2,
|
|
285
282
|
y: topPos + height
|
|
286
|
-
}, bottom), this.
|
|
287
|
-
textStyle: Object.assign(Object.assign({}, null === (
|
|
283
|
+
}, bottom), this._xHair.label), {
|
|
284
|
+
textStyle: Object.assign(Object.assign({}, null === (_b = this._xHair.label) || void 0 === _b ? void 0 : _b.textStyle), {
|
|
288
285
|
textAlign: "center",
|
|
289
286
|
textBaseline: "top"
|
|
290
287
|
}),
|
|
@@ -297,15 +294,13 @@ class CartesianCrossHair extends base_1.BaseCrossHair {
|
|
|
297
294
|
}
|
|
298
295
|
}
|
|
299
296
|
_layoutHorizontal(crosshairInfo, bandHeight) {
|
|
300
|
-
var _a, _b
|
|
301
|
-
if (crosshairInfo._isCache && this.enableRemain || !this.
|
|
297
|
+
var _a, _b;
|
|
298
|
+
if (crosshairInfo._isCache && this.enableRemain || !this._yHair) return;
|
|
302
299
|
const {leftPos: leftPos, width: width, y: y, left: left, right: right, visible: visible} = crosshairInfo;
|
|
303
300
|
if (visible) {
|
|
304
|
-
|
|
305
|
-
(null === (_b = null === (_a = this.yHair) || void 0 === _a ? void 0 : _a.style) || void 0 === _b ? void 0 : _b.sizePercent) ? extend = (this.yHair.style.sizePercent - 1) * bandHeight : "number" == typeof (null === (_d = null === (_c = this.yHair) || void 0 === _c ? void 0 : _c.style) || void 0 === _d ? void 0 : _d.size) && (extend = this.yHair.style.size - bandHeight);
|
|
306
|
-
const type = this.yHair.type;
|
|
301
|
+
const type = this._yHair.type;
|
|
307
302
|
let positionAttribute;
|
|
308
|
-
if ("line" === type
|
|
303
|
+
if ("line" === type) positionAttribute = {
|
|
309
304
|
start: {
|
|
310
305
|
x: leftPos,
|
|
311
306
|
y: y + bandHeight / 2
|
|
@@ -314,21 +309,25 @@ class CartesianCrossHair extends base_1.BaseCrossHair {
|
|
|
314
309
|
x: leftPos + width,
|
|
315
310
|
y: y + bandHeight / 2
|
|
316
311
|
}
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
312
|
+
}; else if ("rect" === type) {
|
|
313
|
+
const extend = this._getRectSize(this._yHair, bandHeight, crosshairInfo.axis);
|
|
314
|
+
positionAttribute = {
|
|
315
|
+
start: {
|
|
316
|
+
x: leftPos,
|
|
317
|
+
y: y - extend / 2
|
|
318
|
+
},
|
|
319
|
+
end: {
|
|
320
|
+
x: leftPos + width,
|
|
321
|
+
y: y + bandHeight + extend / 2
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
if (this._updateCrosshair("y", type, positionAttribute), left.visible) {
|
|
327
326
|
const updateAttrs = Object.assign(Object.assign(Object.assign({
|
|
328
327
|
x: leftPos,
|
|
329
328
|
y: y + bandHeight / 2
|
|
330
|
-
}, left), this.
|
|
331
|
-
textStyle: Object.assign(Object.assign({}, null === (
|
|
329
|
+
}, left), this._yHair.label), {
|
|
330
|
+
textStyle: Object.assign(Object.assign({}, null === (_a = this._yHair.label) || void 0 === _a ? void 0 : _a.textStyle), {
|
|
332
331
|
textAlign: "right",
|
|
333
332
|
textBaseline: "middle"
|
|
334
333
|
}),
|
|
@@ -342,8 +341,8 @@ class CartesianCrossHair extends base_1.BaseCrossHair {
|
|
|
342
341
|
const updateAttrs = Object.assign(Object.assign(Object.assign({
|
|
343
342
|
x: leftPos + width,
|
|
344
343
|
y: y + bandHeight
|
|
345
|
-
}, right), this.
|
|
346
|
-
textStyle: Object.assign(Object.assign({}, null === (
|
|
344
|
+
}, right), this._yHair.label), {
|
|
345
|
+
textStyle: Object.assign(Object.assign({}, null === (_b = this._yHair.label) || void 0 === _b ? void 0 : _b.textStyle), {
|
|
347
346
|
textAlign: "left",
|
|
348
347
|
textBaseline: "middle"
|
|
349
348
|
}),
|
|
@@ -355,15 +354,25 @@ class CartesianCrossHair extends base_1.BaseCrossHair {
|
|
|
355
354
|
} else this._yRightLabel && this._yRightLabel.hideAll();
|
|
356
355
|
}
|
|
357
356
|
}
|
|
357
|
+
_getRectSize(hair, bandSize, axis) {
|
|
358
|
+
var _a, _b, _c;
|
|
359
|
+
let extend = 0;
|
|
360
|
+
if (null === (_a = hair.style) || void 0 === _a ? void 0 : _a.sizePercent) extend = (hair.style.sizePercent - 1) * bandSize; else if ("number" == typeof (null === (_b = hair.style) || void 0 === _b ? void 0 : _b.size)) extend = hair.style.size - bandSize; else if ("function" == typeof (null === (_c = hair.style) || void 0 === _c ? void 0 : _c.size)) {
|
|
361
|
+
const axisRect = axis.getLayoutRect();
|
|
362
|
+
extend = hair.style.size(axisRect, axis) - bandSize;
|
|
363
|
+
}
|
|
364
|
+
return extend;
|
|
365
|
+
}
|
|
358
366
|
_parseFieldInfo() {
|
|
359
|
-
const {xField: xField, yField: yField} = this.
|
|
360
|
-
xField && xField.visible && (this.
|
|
367
|
+
const {xField: xField, yField: yField} = this._spec;
|
|
368
|
+
xField && xField.visible && (this._xHair = this._parseField(xField, "xField")),
|
|
369
|
+
yField && yField.visible && (this._yHair = this._parseField(yField, "yField"));
|
|
361
370
|
}
|
|
362
371
|
_updateCrosshair(dim, type, attributes) {
|
|
363
372
|
const container = this.getContainer();
|
|
364
373
|
let crosshair, style;
|
|
365
|
-
"x" === dim ? (crosshair = this._xCrosshair, style = this.
|
|
366
|
-
style = this.
|
|
374
|
+
"x" === dim ? (crosshair = this._xCrosshair, style = this._xHair.style) : (crosshair = this._yCrosshair,
|
|
375
|
+
style = this._yHair.style), crosshair ? crosshair.setAttributes(attributes) : ("line" === type ? crosshair = new vrender_components_1.LineCrosshair(Object.assign(Object.assign({}, attributes), {
|
|
367
376
|
lineStyle: style,
|
|
368
377
|
zIndex: this.gridZIndex + 1
|
|
369
378
|
})) : "rect" === type && (crosshair = new vrender_components_1.RectCrosshair(Object.assign(Object.assign({}, attributes), {
|
|
@@ -374,9 +383,9 @@ class CartesianCrossHair extends base_1.BaseCrossHair {
|
|
|
374
383
|
_updateCrosshairLabel(label, attributes, callback) {
|
|
375
384
|
const container = this.getContainer();
|
|
376
385
|
label ? label.setAttributes(attributes) : (callback(label = new vrender_components_1.Tag(attributes)),
|
|
377
|
-
container.add(label)), (0, util_1.limitTagInBounds)(label, this._getLimitBounds());
|
|
386
|
+
null == container || container.add(label)), (0, util_1.limitTagInBounds)(label, this._getLimitBounds());
|
|
378
387
|
}
|
|
379
|
-
|
|
388
|
+
_getNeedClearVRenderComponents() {
|
|
380
389
|
return [ this._xCrosshair, this._xTopLabel, this._xBottomLabel, this._yCrosshair, this._yLeftLabel, this._yRightLabel ];
|
|
381
390
|
}
|
|
382
391
|
}
|