@visactor/vchart 2.1.0-alpha.2 → 2.1.0-alpha.20
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 +3 -3
- package/build/index.es.js +19187 -25472
- package/build/index.js +19189 -25474
- package/build/index.min.js +2 -2
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/chart/base/base-chart-transformer.d.ts +0 -3
- package/cjs/chart/base/base-chart-transformer.js +1 -21
- package/cjs/chart/base/base-chart-transformer.js.map +1 -1
- package/cjs/chart/base/base-chart.d.ts +9 -15
- package/cjs/chart/base/base-chart.js +24 -115
- package/cjs/chart/base/base-chart.js.map +1 -1
- package/cjs/chart/interface/chart.d.ts +0 -1
- package/cjs/chart/interface/chart.js.map +1 -1
- package/cjs/chart/pie/base/pie-transformer.js +2 -2
- package/cjs/chart/pie/base/pie-transformer.js.map +1 -1
- package/cjs/chart/progress/circular/circular-progress-transformer.js +2 -2
- package/cjs/chart/progress/circular/circular-progress-transformer.js.map +1 -1
- package/cjs/chart/util.d.ts +1 -4
- package/cjs/chart/util.js +4 -40
- package/cjs/chart/util.js.map +1 -1
- package/cjs/chart/waterfall/waterfall-transformer.js +1 -2
- package/cjs/chart/waterfall/waterfall-transformer.js.map +1 -1
- package/cjs/compile/compiler.d.ts +0 -2
- package/cjs/compile/compiler.js +40 -53
- package/cjs/compile/compiler.js.map +1 -1
- package/cjs/compile/data/compilable-data.d.ts +1 -1
- package/cjs/compile/data/compilable-data.js +1 -1
- package/cjs/compile/data/compilable-data.js.map +1 -1
- package/cjs/compile/grammar-item.d.ts +1 -1
- package/cjs/compile/grammar-item.js.map +1 -1
- package/cjs/compile/interface/compilable-item.d.ts +1 -1
- package/cjs/compile/interface/compilable-item.js.map +1 -1
- package/cjs/compile/interface/compiler.d.ts +1 -2
- package/cjs/compile/interface/compiler.js.map +1 -1
- package/cjs/component/axis/base-axis.d.ts +7 -2
- package/cjs/component/axis/base-axis.js +3 -25
- package/cjs/component/axis/base-axis.js.map +1 -1
- package/cjs/component/axis/cartesian/band-axis.d.ts +7 -1
- package/cjs/component/base/base-component.d.ts +7 -7
- package/cjs/component/base/base-component.js +6 -41
- package/cjs/component/base/base-component.js.map +1 -1
- package/cjs/component/brush/brush.d.ts +7 -2
- package/cjs/component/brush/brush.js +12 -16
- package/cjs/component/brush/brush.js.map +1 -1
- package/cjs/component/crosshair/base.d.ts +7 -1
- package/cjs/component/custom-mark/custom-mark.d.ts +7 -1
- package/cjs/component/data-zoom/data-filter-base-component.d.ts +7 -1
- package/cjs/component/geo/geo-coordinate.d.ts +7 -1
- package/cjs/component/index.js +2 -1
- package/cjs/component/label/base-label.d.ts +7 -1
- package/cjs/component/label/label.js +1 -1
- package/cjs/component/label/label.js.map +1 -1
- package/cjs/component/legend/base-legend.d.ts +7 -2
- package/cjs/component/legend/base-legend.js +4 -21
- package/cjs/component/legend/base-legend.js.map +1 -1
- package/cjs/component/marker/base-marker.d.ts +7 -7
- package/cjs/component/marker/base-marker.js +6 -23
- package/cjs/component/marker/base-marker.js.map +1 -1
- package/cjs/component/marker/mark-line/base-mark-line.js +4 -2
- package/cjs/component/marker/mark-line/base-mark-line.js.map +1 -1
- package/cjs/component/marker/mark-line/cartesian-mark-line.js +18 -7
- package/cjs/component/marker/mark-line/cartesian-mark-line.js.map +1 -1
- package/cjs/component/marker/mark-line/interface/spec.d.ts +9 -2
- package/cjs/component/marker/mark-line/interface/spec.js.map +1 -1
- package/cjs/component/title/title.d.ts +7 -1
- package/cjs/component/title/title.js +2 -6
- package/cjs/component/title/title.js.map +1 -1
- package/cjs/component/util.js +1 -2
- package/cjs/constant/scatter.js +2 -1
- package/cjs/constant/scroll-bar.js +1 -2
- package/cjs/core/instance-manager.js +1 -1
- package/cjs/core/vchart.d.ts +1 -5
- package/cjs/core/vchart.js +12 -28
- package/cjs/core/vchart.js.map +1 -1
- package/cjs/interaction/interaction.js +8 -11
- package/cjs/interaction/interaction.js.map +1 -1
- package/cjs/interaction/triggers/element-active-by-legend.js +2 -3
- package/cjs/interaction/triggers/element-active-by-legend.js.map +1 -1
- package/cjs/interaction/triggers/element-active.js +3 -4
- package/cjs/interaction/triggers/element-active.js.map +1 -1
- package/cjs/interaction/triggers/element-highlight-by-group.js +2 -3
- package/cjs/interaction/triggers/element-highlight-by-group.js.map +1 -1
- package/cjs/interaction/triggers/element-highlight-by-legend.js +2 -2
- package/cjs/interaction/triggers/element-highlight-by-legend.js.map +1 -1
- package/cjs/interaction/triggers/element-highlight-by-name.js +2 -2
- package/cjs/interaction/triggers/element-highlight-by-name.js.map +1 -1
- package/cjs/interaction/triggers/element-highlight.js +2 -2
- package/cjs/interaction/triggers/element-highlight.js.map +1 -1
- package/cjs/interaction/triggers/element-select.js +3 -3
- package/cjs/interaction/triggers/element-select.js.map +1 -1
- package/cjs/mark/base/base-line.js +2 -2
- package/cjs/mark/base/base-line.js.map +1 -1
- package/cjs/mark/base/base-mark.d.ts +2 -13
- package/cjs/mark/base/base-mark.js +23 -101
- package/cjs/mark/base/base-mark.js.map +1 -1
- package/cjs/mark/component.d.ts +0 -9
- package/cjs/mark/component.js +3 -51
- package/cjs/mark/component.js.map +1 -1
- package/cjs/mark/group.js +1 -1
- package/cjs/mark/group.js.map +1 -1
- package/cjs/mark/interface/mark.d.ts +0 -2
- package/cjs/mark/interface/mark.js.map +1 -1
- package/cjs/mark/utils/glyph.js +2 -3
- package/cjs/mark/utils/glyph.js.map +1 -1
- package/cjs/model/base-model.d.ts +15 -3
- package/cjs/model/base-model.js.map +1 -1
- package/cjs/model/interface.d.ts +0 -13
- package/cjs/model/interface.js.map +1 -1
- package/cjs/region/region.d.ts +7 -1
- package/cjs/series/area/area.d.ts +0 -2
- package/cjs/series/area/area.js +0 -6
- package/cjs/series/area/area.js.map +1 -1
- package/cjs/series/bar/bar.d.ts +0 -3
- package/cjs/series/bar/bar.js +4 -30
- package/cjs/series/bar/bar.js.map +1 -1
- package/cjs/series/base/base-series.d.ts +7 -8
- package/cjs/series/base/base-series.js +13 -54
- package/cjs/series/base/base-series.js.map +1 -1
- package/cjs/series/base/constant.d.ts +0 -3
- package/cjs/series/base/constant.js +1 -9
- package/cjs/series/base/constant.js.map +1 -1
- package/cjs/series/box-plot/box-plot.d.ts +0 -2
- package/cjs/series/box-plot/box-plot.js +2 -14
- package/cjs/series/box-plot/box-plot.js.map +1 -1
- package/cjs/series/heatmap/heatmap.d.ts +0 -2
- package/cjs/series/heatmap/heatmap.js +0 -10
- package/cjs/series/heatmap/heatmap.js.map +1 -1
- package/cjs/series/line/line.d.ts +0 -2
- package/cjs/series/line/line.js +0 -6
- package/cjs/series/line/line.js.map +1 -1
- package/cjs/series/mixin/line-mixin.d.ts +0 -1
- package/cjs/series/mixin/line-mixin.js +1 -6
- package/cjs/series/mixin/line-mixin.js.map +1 -1
- package/cjs/series/pie/pie.d.ts +7 -3
- package/cjs/series/pie/pie.js +1 -16
- package/cjs/series/pie/pie.js.map +1 -1
- package/cjs/series/progress/circular/circular.d.ts +0 -2
- package/cjs/series/progress/circular/circular.js +1 -9
- package/cjs/series/progress/circular/circular.js.map +1 -1
- package/cjs/series/progress/linear/linear.d.ts +0 -2
- package/cjs/series/progress/linear/linear.js +1 -17
- package/cjs/series/progress/linear/linear.js.map +1 -1
- package/cjs/series/sankey/sankey.js +24 -32
- package/cjs/series/sankey/sankey.js.map +1 -1
- package/cjs/series/scatter/scatter.d.ts +0 -2
- package/cjs/series/scatter/scatter.js +1 -9
- package/cjs/series/scatter/scatter.js.map +1 -1
- package/cjs/series/waterfall/waterfall.d.ts +2 -2
- package/cjs/series/waterfall/waterfall.js +12 -14
- package/cjs/series/waterfall/waterfall.js.map +1 -1
- package/esm/chart/base/base-chart-transformer.d.ts +0 -3
- package/esm/chart/base/base-chart-transformer.js +0 -22
- package/esm/chart/base/base-chart-transformer.js.map +1 -1
- package/esm/chart/base/base-chart.d.ts +9 -15
- package/esm/chart/base/base-chart.js +23 -111
- package/esm/chart/base/base-chart.js.map +1 -1
- package/esm/chart/interface/chart.d.ts +0 -1
- package/esm/chart/interface/chart.js.map +1 -1
- package/esm/chart/pie/base/pie-transformer.js +2 -2
- package/esm/chart/pie/base/pie-transformer.js.map +1 -1
- package/esm/chart/progress/circular/circular-progress-transformer.js +2 -2
- package/esm/chart/progress/circular/circular-progress-transformer.js.map +1 -1
- package/esm/chart/util.d.ts +1 -4
- package/esm/chart/util.js +1 -34
- package/esm/chart/util.js.map +1 -1
- package/esm/chart/waterfall/waterfall-transformer.js +1 -2
- package/esm/chart/waterfall/waterfall-transformer.js.map +1 -1
- package/esm/compile/compiler.d.ts +0 -2
- package/esm/compile/compiler.js +39 -55
- package/esm/compile/compiler.js.map +1 -1
- package/esm/compile/data/compilable-data.d.ts +1 -1
- package/esm/compile/data/compilable-data.js +1 -1
- package/esm/compile/data/compilable-data.js.map +1 -1
- package/esm/compile/grammar-item.d.ts +1 -1
- package/esm/compile/grammar-item.js.map +1 -1
- package/esm/compile/interface/compilable-item.d.ts +1 -1
- package/esm/compile/interface/compilable-item.js.map +1 -1
- package/esm/compile/interface/compiler.d.ts +1 -2
- package/esm/compile/interface/compiler.js.map +1 -1
- package/esm/component/axis/base-axis.d.ts +7 -2
- package/esm/component/axis/base-axis.js +2 -25
- package/esm/component/axis/base-axis.js.map +1 -1
- package/esm/component/axis/cartesian/band-axis.d.ts +7 -1
- package/esm/component/base/base-component.d.ts +7 -7
- package/esm/component/base/base-component.js +5 -41
- package/esm/component/base/base-component.js.map +1 -1
- package/esm/component/brush/brush.d.ts +7 -2
- package/esm/component/brush/brush.js +7 -12
- package/esm/component/brush/brush.js.map +1 -1
- package/esm/component/crosshair/base.d.ts +7 -1
- package/esm/component/custom-mark/custom-mark.d.ts +7 -1
- package/esm/component/data-zoom/data-filter-base-component.d.ts +7 -1
- package/esm/component/geo/geo-coordinate.d.ts +7 -1
- package/esm/component/index.js +2 -1
- package/esm/component/label/base-label.d.ts +7 -1
- package/esm/component/label/label.js +1 -1
- package/esm/component/label/label.js.map +1 -1
- package/esm/component/legend/base-legend.d.ts +7 -2
- package/esm/component/legend/base-legend.js +3 -21
- package/esm/component/legend/base-legend.js.map +1 -1
- package/esm/component/marker/base-marker.d.ts +7 -7
- package/esm/component/marker/base-marker.js +5 -24
- package/esm/component/marker/base-marker.js.map +1 -1
- package/esm/component/marker/mark-line/base-mark-line.js +4 -2
- package/esm/component/marker/mark-line/base-mark-line.js.map +1 -1
- package/esm/component/marker/mark-line/cartesian-mark-line.js +18 -8
- package/esm/component/marker/mark-line/cartesian-mark-line.js.map +1 -1
- package/esm/component/marker/mark-line/interface/spec.d.ts +9 -2
- package/esm/component/marker/mark-line/interface/spec.js.map +1 -1
- package/esm/component/title/title.d.ts +7 -1
- package/esm/component/title/title.js +2 -6
- package/esm/component/title/title.js.map +1 -1
- package/esm/component/util.js +1 -2
- package/esm/constant/scatter.js +2 -1
- package/esm/constant/scroll-bar.js +1 -2
- package/esm/core/instance-manager.js +1 -1
- package/esm/core/vchart.d.ts +1 -5
- package/esm/core/vchart.js +12 -29
- package/esm/core/vchart.js.map +1 -1
- package/esm/interaction/interaction.js +8 -10
- package/esm/interaction/interaction.js.map +1 -1
- package/esm/interaction/triggers/element-active-by-legend.js +1 -3
- package/esm/interaction/triggers/element-active-by-legend.js.map +1 -1
- package/esm/interaction/triggers/element-active.js +2 -4
- package/esm/interaction/triggers/element-active.js.map +1 -1
- package/esm/interaction/triggers/element-highlight-by-group.js +1 -4
- package/esm/interaction/triggers/element-highlight-by-group.js.map +1 -1
- package/esm/interaction/triggers/element-highlight-by-legend.js +1 -3
- package/esm/interaction/triggers/element-highlight-by-legend.js.map +1 -1
- package/esm/interaction/triggers/element-highlight-by-name.js +1 -3
- package/esm/interaction/triggers/element-highlight-by-name.js.map +1 -1
- package/esm/interaction/triggers/element-highlight.js +1 -3
- package/esm/interaction/triggers/element-highlight.js.map +1 -1
- package/esm/interaction/triggers/element-select.js +2 -4
- package/esm/interaction/triggers/element-select.js.map +1 -1
- package/esm/mark/base/base-line.js +2 -2
- package/esm/mark/base/base-line.js.map +1 -1
- package/esm/mark/base/base-mark.d.ts +2 -13
- package/esm/mark/base/base-mark.js +22 -102
- package/esm/mark/base/base-mark.js.map +1 -1
- package/esm/mark/component.d.ts +0 -9
- package/esm/mark/component.js +2 -51
- package/esm/mark/component.js.map +1 -1
- package/esm/mark/group.js +1 -1
- package/esm/mark/group.js.map +1 -1
- package/esm/mark/interface/mark.d.ts +0 -2
- package/esm/mark/interface/mark.js.map +1 -1
- package/esm/mark/utils/glyph.js +1 -3
- package/esm/mark/utils/glyph.js.map +1 -1
- package/esm/model/base-model.d.ts +15 -3
- package/esm/model/base-model.js.map +1 -1
- package/esm/model/interface.d.ts +0 -13
- package/esm/model/interface.js.map +1 -1
- package/esm/region/region.d.ts +7 -1
- package/esm/series/area/area.d.ts +0 -2
- package/esm/series/area/area.js +1 -7
- package/esm/series/area/area.js.map +1 -1
- package/esm/series/bar/bar.d.ts +0 -3
- package/esm/series/bar/bar.js +4 -30
- package/esm/series/bar/bar.js.map +1 -1
- package/esm/series/base/base-series.d.ts +7 -8
- package/esm/series/base/base-series.js +11 -50
- package/esm/series/base/base-series.js.map +1 -1
- package/esm/series/base/constant.d.ts +0 -3
- package/esm/series/base/constant.js +0 -10
- package/esm/series/base/constant.js.map +1 -1
- package/esm/series/box-plot/box-plot.d.ts +0 -2
- package/esm/series/box-plot/box-plot.js +2 -13
- package/esm/series/box-plot/box-plot.js.map +1 -1
- package/esm/series/heatmap/heatmap.d.ts +0 -2
- package/esm/series/heatmap/heatmap.js +0 -10
- package/esm/series/heatmap/heatmap.js.map +1 -1
- package/esm/series/line/line.d.ts +0 -2
- package/esm/series/line/line.js +1 -7
- package/esm/series/line/line.js.map +1 -1
- package/esm/series/mixin/line-mixin.d.ts +0 -1
- package/esm/series/mixin/line-mixin.js +0 -5
- package/esm/series/mixin/line-mixin.js.map +1 -1
- package/esm/series/pie/pie.d.ts +7 -3
- package/esm/series/pie/pie.js +0 -17
- package/esm/series/pie/pie.js.map +1 -1
- package/esm/series/progress/circular/circular.d.ts +0 -2
- package/esm/series/progress/circular/circular.js +0 -10
- package/esm/series/progress/circular/circular.js.map +1 -1
- package/esm/series/progress/linear/linear.d.ts +0 -2
- package/esm/series/progress/linear/linear.js +0 -18
- package/esm/series/progress/linear/linear.js.map +1 -1
- package/esm/series/sankey/sankey.js +21 -25
- package/esm/series/sankey/sankey.js.map +1 -1
- package/esm/series/scatter/scatter.d.ts +0 -2
- package/esm/series/scatter/scatter.js +0 -10
- package/esm/series/scatter/scatter.js.map +1 -1
- package/esm/series/waterfall/waterfall.d.ts +2 -2
- package/esm/series/waterfall/waterfall.js +12 -14
- package/esm/series/waterfall/waterfall.js.map +1 -1
- package/package.json +8 -10
- package/cjs/compile/stage-app.d.ts +0 -9
- package/cjs/compile/stage-app.js +0 -39
- package/cjs/compile/stage-app.js.map +0 -1
- package/cjs/component/base/release-vrender-component.d.ts +0 -10
- package/cjs/component/base/release-vrender-component.js +0 -37
- package/cjs/component/base/release-vrender-component.js.map +0 -1
- package/cjs/data/data-view-utils.d.ts +0 -5
- package/cjs/data/data-view-utils.js +0 -58
- package/cjs/data/data-view-utils.js.map +0 -1
- package/cjs/util/graphic-state.d.ts +0 -4
- package/cjs/util/graphic-state.js +0 -40
- package/cjs/util/graphic-state.js.map +0 -1
- package/esm/compile/stage-app.d.ts +0 -9
- package/esm/compile/stage-app.js +0 -35
- package/esm/compile/stage-app.js.map +0 -1
- package/esm/component/base/release-vrender-component.d.ts +0 -10
- package/esm/component/base/release-vrender-component.js +0 -24
- package/esm/component/base/release-vrender-component.js.map +0 -1
- package/esm/data/data-view-utils.d.ts +0 -5
- package/esm/data/data-view-utils.js +0 -46
- package/esm/data/data-view-utils.js.map +0 -1
- package/esm/util/graphic-state.d.ts +0 -4
- package/esm/util/graphic-state.js +0 -30
- package/esm/util/graphic-state.js.map +0 -1
|
@@ -38,7 +38,7 @@ import { ChartEvent, HOOK_EVENT } from "../../constant/event";
|
|
|
38
38
|
|
|
39
39
|
import { DimensionEventEnum } from "../../event/events/dimension/interface";
|
|
40
40
|
|
|
41
|
-
import { calculateChartSize,
|
|
41
|
+
import { calculateChartSize, mergeUpdateResult } from "../util";
|
|
42
42
|
|
|
43
43
|
import { isDiscrete } from "@visactor/vscale";
|
|
44
44
|
|
|
@@ -50,12 +50,6 @@ import { Interaction } from "../../interaction/interaction";
|
|
|
50
50
|
|
|
51
51
|
import { animationConfig, userAnimationConfig } from "../../animation/utils";
|
|
52
52
|
|
|
53
|
-
const MARKER_COMPONENT_SPEC_KEYS = {
|
|
54
|
-
[ComponentTypeEnum.markPoint]: !0,
|
|
55
|
-
[ComponentTypeEnum.markLine]: !0,
|
|
56
|
-
[ComponentTypeEnum.markArea]: !0
|
|
57
|
-
};
|
|
58
|
-
|
|
59
53
|
export class BaseChart extends CompilableBase {
|
|
60
54
|
getSpec() {
|
|
61
55
|
return this._spec;
|
|
@@ -100,7 +94,7 @@ export class BaseChart extends CompilableBase {
|
|
|
100
94
|
constructor(spec, option) {
|
|
101
95
|
var _a, _b, _c, _d;
|
|
102
96
|
super(option), this.type = "chart", this.id = createID(), this._regions = [], this._series = [],
|
|
103
|
-
this._components = [], this.
|
|
97
|
+
this._components = [], this._layoutRect = {
|
|
104
98
|
x: 0,
|
|
105
99
|
y: 0,
|
|
106
100
|
width: DEFAULT_CHART_WIDTH,
|
|
@@ -159,8 +153,8 @@ export class BaseChart extends CompilableBase {
|
|
|
159
153
|
}), this._setModelOption && this._setModelOption(), this._spec = spec;
|
|
160
154
|
}
|
|
161
155
|
created(transformer) {
|
|
162
|
-
this.
|
|
163
|
-
this.
|
|
156
|
+
this._chartData.parseData(this._spec.data), this._createGlobalScale(), this._createBackground(),
|
|
157
|
+
this._createLayout(), transformer.forEachRegionInSpec(this._spec, this._createRegion.bind(this)),
|
|
164
158
|
transformer.forEachSeriesInSpec(this._spec, this._createSeries.bind(this)), transformer.forEachComponentInSpec(this._spec, this._createComponent.bind(this), this._option.getSpecInfo());
|
|
165
159
|
}
|
|
166
160
|
_initInteractions() {
|
|
@@ -452,14 +446,11 @@ export class BaseChart extends CompilableBase {
|
|
|
452
446
|
_getSpecKeys(spec) {
|
|
453
447
|
const ignoreKeys = {
|
|
454
448
|
width: !0,
|
|
455
|
-
height: !0
|
|
456
|
-
xField: !0,
|
|
457
|
-
yField: !0
|
|
449
|
+
height: !0
|
|
458
450
|
};
|
|
459
451
|
return Object.keys(spec).filter((key => !ignoreKeys[key])).sort();
|
|
460
452
|
}
|
|
461
453
|
updateSpec(spec) {
|
|
462
|
-
var _a;
|
|
463
454
|
const result = {
|
|
464
455
|
change: !1,
|
|
465
456
|
reMake: !1,
|
|
@@ -467,32 +458,20 @@ export class BaseChart extends CompilableBase {
|
|
|
467
458
|
reSize: !1,
|
|
468
459
|
reCompile: !1
|
|
469
460
|
};
|
|
470
|
-
if (spec.type !== this.type) return result.reMake = !0,
|
|
461
|
+
if (this.setLayoutTag(!0, null, !1), spec.type !== this.type) return result.reMake = !0,
|
|
471
462
|
result;
|
|
472
463
|
const currentKeys = this._getSpecKeys(this._spec), nextKeys = this._getSpecKeys(spec);
|
|
473
|
-
if (!isEqual(currentKeys, nextKeys)) return result.reMake = !0,
|
|
474
|
-
result;
|
|
464
|
+
if (!isEqual(currentKeys, nextKeys)) return result.reMake = !0, result;
|
|
475
465
|
for (let i = 0; i < currentKeys.length; i++) {
|
|
476
|
-
const key = currentKeys[i]
|
|
477
|
-
if (isArray(
|
|
478
|
-
|
|
466
|
+
const key = currentKeys[i];
|
|
467
|
+
if (isArray(this._spec[key]) && this._spec[key].length !== array(spec[key]).length) return result.reMake = !0,
|
|
468
|
+
result;
|
|
479
469
|
}
|
|
480
|
-
const oldSpec = this._spec
|
|
481
|
-
|
|
482
|
-
result
|
|
483
|
-
|
|
484
|
-
result;
|
|
485
|
-
if (this.updateGlobalScale(result), result.reMake) return this.setLayoutTag(!0, null, !1),
|
|
486
|
-
result;
|
|
487
|
-
if (this.updateRegionSpec(result), result.reMake) return this.setLayoutTag(!0, null, !1),
|
|
488
|
-
result;
|
|
489
|
-
const componentUpdateResult = this.updateComponentSpec(result);
|
|
490
|
-
return result.reMake ? (this.setLayoutTag(!0, null, !1), result) : isUpdateSpecResultLocalOnly(result) ? result : onlyComponentSpecsChanged && !componentUpdateResult.hasNonComponentOnlyUpdate && isUpdateSpecResultComponentOnly(result) ? (componentUpdateResult.componentOnlyUpdatedComponents.forEach((component => {
|
|
491
|
-
component.reInit(component.getSpec());
|
|
492
|
-
})), (null === (_a = result.effects) || void 0 === _a ? void 0 : _a.layout) && this.setLayoutTag(!0, null, !1),
|
|
493
|
-
result) : (this.setLayoutTag(!0, null, !1), this.updateSeriesSpec(result), result.reMake || (this.reInit(),
|
|
494
|
-
onlySeriesSpecsChanged && this._canSkipChartDataStages(result) || (this.updateDataSpec(),
|
|
495
|
-
this.updateGlobalScaleDomain())), result);
|
|
470
|
+
const oldSpec = this._spec;
|
|
471
|
+
return this._spec = spec, this.updateChartConfig(result, oldSpec), result.reMake ? result : (this.updateGlobalScale(result),
|
|
472
|
+
result.reMake ? result : (this.updateRegionSpec(result), result.reMake ? result : (this.updateComponentSpec(result),
|
|
473
|
+
result.reMake ? result : (this.updateSeriesSpec(result), result.reMake || (this.reInit(),
|
|
474
|
+
this.updateDataSpec(), this.updateGlobalScaleDomain()), result))));
|
|
496
475
|
}
|
|
497
476
|
updateChartConfig(result, oldSpec) {
|
|
498
477
|
var _a, _b;
|
|
@@ -509,99 +488,32 @@ export class BaseChart extends CompilableBase {
|
|
|
509
488
|
})) : result.reMake = !0);
|
|
510
489
|
}
|
|
511
490
|
updateComponentSpec(result) {
|
|
512
|
-
const componentOnlyUpdatedComponents = [];
|
|
513
|
-
let hasNonComponentOnlyUpdate = !1;
|
|
514
491
|
const componentCache = {}, checkVisibleComponents = {
|
|
515
492
|
[ComponentTypeEnum.title]: !0,
|
|
516
493
|
[ComponentTypeEnum.brush]: !0,
|
|
517
494
|
[ComponentTypeEnum.indicator]: !0
|
|
518
|
-
}
|
|
495
|
+
};
|
|
519
496
|
this._components.forEach((c => {
|
|
520
497
|
var _a, _b;
|
|
521
498
|
if (c.type === ComponentTypeEnum.label || c.type === ComponentTypeEnum.totalLabel) return;
|
|
522
499
|
checkVisibleComponents[c.type] && (checkVisibleComponents[c.type] = !1);
|
|
523
500
|
const compSpecKey = c.specKey || c.type, cmpSpec = null !== (_a = this._spec[compSpecKey]) && void 0 !== _a ? _a : {};
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
}, this._canRemoveMarkerComponentsWithoutRemake(compSpecKey, [ c.getSpec() ], cmpSpec)) return void removedComponents.push(c);
|
|
529
|
-
componentCache[compSpecKey].componentCount++;
|
|
530
|
-
const componentSpec = null !== (_b = cmpSpec[c.getSpecIndex()]) && void 0 !== _b ? _b : {}, previousComponentSpec = c.getSpec(), componentResult = c.updateSpec(componentSpec, cmpSpec);
|
|
531
|
-
isUpdateSpecResultComponentOnly(componentResult) ? componentOnlyUpdatedComponents.push(c) : isEqual(previousComponentSpec, componentSpec) || (hasNonComponentOnlyUpdate = !0),
|
|
532
|
-
mergeUpdateResult(result, componentResult);
|
|
533
|
-
} else {
|
|
534
|
-
const previousComponentSpec = c.getSpec(), componentResult = c.updateSpec(cmpSpec);
|
|
535
|
-
isUpdateSpecResultComponentOnly(componentResult) ? componentOnlyUpdatedComponents.push(c) : isEqual(previousComponentSpec, cmpSpec) || (hasNonComponentOnlyUpdate = !0),
|
|
536
|
-
mergeUpdateResult(result, componentResult);
|
|
537
|
-
}
|
|
501
|
+
isArray(cmpSpec) ? (componentCache[compSpecKey] = componentCache[compSpecKey] || {
|
|
502
|
+
specCount: cmpSpec.length,
|
|
503
|
+
componentCount: 0
|
|
504
|
+
}, componentCache[compSpecKey].componentCount++, mergeUpdateResult(result, c.updateSpec(null !== (_b = cmpSpec[c.getSpecIndex()]) && void 0 !== _b ? _b : {}, cmpSpec))) : mergeUpdateResult(result, c.updateSpec(cmpSpec));
|
|
538
505
|
}));
|
|
539
506
|
for (const key in componentCache) if (Object.prototype.hasOwnProperty.call(componentCache, key)) {
|
|
540
507
|
const element = componentCache[key];
|
|
541
508
|
element.componentCount !== element.specCount && (result.reMake = !0);
|
|
542
509
|
}
|
|
543
|
-
removedComponents.length && (removedComponents.forEach((component => {
|
|
544
|
-
this._removeComponent(component);
|
|
545
|
-
})), result.change = !0, result.effects = Object.assign(Object.assign({}, result.effects), {
|
|
546
|
-
component: !0,
|
|
547
|
-
localOnly: !0
|
|
548
|
-
}));
|
|
549
510
|
const isVisible = compSpec => compSpec && !1 !== compSpec.visible;
|
|
550
|
-
|
|
511
|
+
Object.keys(checkVisibleComponents).forEach((type => {
|
|
551
512
|
if (checkVisibleComponents[type]) {
|
|
552
513
|
const compSpec = this._spec[type];
|
|
553
514
|
(isArray(compSpec) ? compSpec.some(isVisible) : isVisible(compSpec)) && (result.reMake = !0);
|
|
554
515
|
}
|
|
555
|
-
})), {
|
|
556
|
-
componentOnlyUpdatedComponents: componentOnlyUpdatedComponents,
|
|
557
|
-
hasNonComponentOnlyUpdate: hasNonComponentOnlyUpdate
|
|
558
|
-
};
|
|
559
|
-
}
|
|
560
|
-
_canRemoveMarkerComponentsWithoutRemake(key, currentSpec, nextSpec) {
|
|
561
|
-
return MARKER_COMPONENT_SPEC_KEYS[key] && isArray(currentSpec) && currentSpec.length > 0 && isArray(nextSpec) && 0 === nextSpec.length;
|
|
562
|
-
}
|
|
563
|
-
_isOnlyMarkerComponentsRemoved(currentSpec, nextSpec, specKeys) {
|
|
564
|
-
let hasMarkerRemoval = !1;
|
|
565
|
-
const onlyMarkerRemoval = specKeys.every((key => this._canRemoveMarkerComponentsWithoutRemake(key, currentSpec[key], nextSpec[key]) ? (hasMarkerRemoval = !0,
|
|
566
|
-
!0) : isEqual(currentSpec[key], nextSpec[key])));
|
|
567
|
-
return hasMarkerRemoval && onlyMarkerRemoval;
|
|
568
|
-
}
|
|
569
|
-
_isComponentSpecKey(key) {
|
|
570
|
-
return this._components.some((component => (component.specKey || component.type) === key));
|
|
571
|
-
}
|
|
572
|
-
_isOnlyComponentSpecsChanged(currentSpec, nextSpec, specKeys) {
|
|
573
|
-
let hasComponentSpecChange = !1;
|
|
574
|
-
const currentSpecRecord = currentSpec, nextSpecRecord = nextSpec, onlyComponentSpecChange = specKeys.every((key => !!isEqual(currentSpecRecord[key], nextSpecRecord[key]) || !!this._isComponentSpecKey(key) && (hasComponentSpecChange = !0,
|
|
575
|
-
!0)));
|
|
576
|
-
return hasComponentSpecChange && onlyComponentSpecChange;
|
|
577
|
-
}
|
|
578
|
-
_isOnlySeriesSpecsChanged(currentSpec, nextSpec, specKeys) {
|
|
579
|
-
var _a, _b;
|
|
580
|
-
let hasSeriesSpecChange = !1;
|
|
581
|
-
const currentSpecRecord = currentSpec, nextSpecRecord = nextSpec, seriesRelatedSpecKeys = null !== (_b = null === (_a = this._specTransformer) || void 0 === _a ? void 0 : _a.getSeriesRelatedSpecKeys()) && void 0 !== _b ? _b : {}, onlySeriesSpecChange = specKeys.every((key => !!isEqual(currentSpecRecord[key], nextSpecRecord[key]) || !!seriesRelatedSpecKeys[key] && (hasSeriesSpecChange = !0,
|
|
582
|
-
!0)));
|
|
583
|
-
return hasSeriesSpecChange && onlySeriesSpecChange;
|
|
584
|
-
}
|
|
585
|
-
_canSkipChartDataStages(result) {
|
|
586
|
-
const effects = result.effects;
|
|
587
|
-
return !(!(null == effects ? void 0 : effects.series) || effects.remake || effects.data || effects.scaleDomain || result.reMake);
|
|
588
|
-
}
|
|
589
|
-
_removeMarkerComponentsForEmptySpecs(result) {
|
|
590
|
-
const removedComponents = this._components.filter((component => {
|
|
591
|
-
var _a;
|
|
592
|
-
const compSpecKey = component.specKey || component.type, cmpSpec = null !== (_a = this._spec[compSpecKey]) && void 0 !== _a ? _a : {};
|
|
593
|
-
return this._canRemoveMarkerComponentsWithoutRemake(compSpecKey, [ component.getSpec() ], cmpSpec);
|
|
594
516
|
}));
|
|
595
|
-
removedComponents.length && (removedComponents.forEach((component => {
|
|
596
|
-
this._removeComponent(component);
|
|
597
|
-
})), result.change = !0, result.effects = Object.assign(Object.assign({}, result.effects), {
|
|
598
|
-
component: !0,
|
|
599
|
-
localOnly: !0
|
|
600
|
-
}));
|
|
601
|
-
}
|
|
602
|
-
_removeComponent(component) {
|
|
603
|
-
this._components = this._components.filter((c => c !== component)), this._idMap.delete(component.id),
|
|
604
|
-
component.release();
|
|
605
517
|
}
|
|
606
518
|
updateSeriesSpec(result) {
|
|
607
519
|
this._spec.series.length === this._series.length ? this._series.forEach((s => {
|
|
@@ -698,8 +610,8 @@ export class BaseChart extends CompilableBase {
|
|
|
698
610
|
c.compile();
|
|
699
611
|
})), null === (_d = null === (_c = this._option.performanceHook) || void 0 === _c ? void 0 : _c.afterComponentCompile) || void 0 === _d || _d.call(_c, this._option.globalInstance);
|
|
700
612
|
}
|
|
701
|
-
release(
|
|
702
|
-
|
|
613
|
+
release() {
|
|
614
|
+
[ ...this._components, ...this._regions, ...this._series ].forEach((m => {
|
|
703
615
|
m.beforeRelease();
|
|
704
616
|
})), super.release(), this.clear(), [ ...this._components, ...this._regions, ...this._series ].forEach((m => {
|
|
705
617
|
m.release();
|