@visactor/vchart 1.2.1-alpha.1 → 1.2.1-alpha.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 +101 -32
- package/build/index.min.js +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/animation/animate-manager.js +2 -2
- package/cjs/animation/animate-manager.js.map +1 -1
- package/cjs/chart/base-chart.d.ts +2 -2
- package/cjs/chart/base-chart.js +5 -5
- package/cjs/chart/base-chart.js.map +1 -1
- package/cjs/chart/interface/chart.d.ts +1 -1
- package/cjs/chart/interface/chart.js.map +1 -1
- package/cjs/component/axis/cartesian/axis.d.ts +8 -0
- package/cjs/component/axis/cartesian/axis.js +33 -3
- package/cjs/component/axis/cartesian/axis.js.map +1 -1
- package/cjs/component/axis/cartesian/interface/theme.d.ts +3 -3
- package/cjs/component/axis/cartesian/interface/theme.js.map +1 -1
- package/cjs/constant/event.d.ts +1 -0
- package/cjs/constant/event.js +3 -2
- package/cjs/constant/event.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.d.ts +6 -1
- package/cjs/core/vchart.js +16 -3
- package/cjs/core/vchart.js.map +1 -1
- package/cjs/data/initialize.js +2 -1
- package/cjs/data/initialize.js.map +1 -1
- package/cjs/layout/base-layout.js +2 -2
- package/cjs/layout/base-layout.js.map +1 -1
- package/cjs/model/interface.d.ts +1 -0
- package/cjs/model/interface.js.map +1 -1
- package/cjs/model/layout-item.d.ts +5 -1
- package/cjs/model/layout-item.js +4 -0
- package/cjs/model/layout-item.js.map +1 -1
- package/cjs/series/progress/linear/linear.js +3 -2
- package/cjs/series/progress/linear/linear.js.map +1 -1
- package/cjs/series/radar/interface.js.map +1 -1
- package/cjs/series/word-cloud/base.js +4 -2
- package/cjs/series/word-cloud/base.js.map +1 -1
- package/cjs/theme/buildin-theme/light/component/axis/cartesian-axis.js +2 -1
- package/cjs/theme/buildin-theme/light/component/axis/cartesian-axis.js.map +1 -1
- package/esm/animation/animate-manager.js +2 -2
- package/esm/animation/animate-manager.js.map +1 -1
- package/esm/chart/base-chart.d.ts +2 -2
- package/esm/chart/base-chart.js +5 -5
- package/esm/chart/base-chart.js.map +1 -1
- package/esm/chart/interface/chart.d.ts +1 -1
- package/esm/chart/interface/chart.js.map +1 -1
- package/esm/component/axis/cartesian/axis.d.ts +8 -0
- package/esm/component/axis/cartesian/axis.js +33 -3
- package/esm/component/axis/cartesian/axis.js.map +1 -1
- package/esm/component/axis/cartesian/interface/theme.d.ts +3 -3
- package/esm/component/axis/cartesian/interface/theme.js.map +1 -1
- package/esm/constant/event.d.ts +1 -0
- package/esm/constant/event.js +3 -2
- package/esm/constant/event.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.d.ts +6 -1
- package/esm/core/vchart.js +16 -3
- package/esm/core/vchart.js.map +1 -1
- package/esm/data/initialize.js +2 -2
- package/esm/data/initialize.js.map +1 -1
- package/esm/layout/base-layout.js +2 -2
- package/esm/layout/base-layout.js.map +1 -1
- package/esm/model/interface.d.ts +1 -0
- package/esm/model/interface.js.map +1 -1
- package/esm/model/layout-item.d.ts +5 -1
- package/esm/model/layout-item.js +4 -0
- package/esm/model/layout-item.js.map +1 -1
- package/esm/series/progress/linear/linear.js +3 -2
- package/esm/series/progress/linear/linear.js.map +1 -1
- package/esm/series/radar/interface.js.map +1 -1
- package/esm/series/word-cloud/base.js +5 -3
- package/esm/series/word-cloud/base.js.map +1 -1
- package/esm/theme/buildin-theme/light/component/axis/cartesian-axis.js +2 -1
- package/esm/theme/buildin-theme/light/component/axis/cartesian-axis.js.map +1 -1
- package/package.json +12 -12
package/build/index.js
CHANGED
|
@@ -51704,6 +51704,7 @@
|
|
|
51704
51704
|
ChartEvent["drill"] = "drill";
|
|
51705
51705
|
ChartEvent["layoutStart"] = "layoutStart";
|
|
51706
51706
|
ChartEvent["layoutEnd"] = "layoutEnd";
|
|
51707
|
+
ChartEvent["layoutRectUpdate"] = "layoutRectUpdate";
|
|
51707
51708
|
ChartEvent["playerPlay"] = "playerPlay";
|
|
51708
51709
|
ChartEvent["playerPause"] = "playerPause";
|
|
51709
51710
|
ChartEvent["playerEnd"] = "playerEnd";
|
|
@@ -52072,7 +52073,8 @@
|
|
|
52072
52073
|
};
|
|
52073
52074
|
const axisY = {
|
|
52074
52075
|
label: {
|
|
52075
|
-
space: 20
|
|
52076
|
+
space: 20,
|
|
52077
|
+
autoLimit: true
|
|
52076
52078
|
},
|
|
52077
52079
|
title: {
|
|
52078
52080
|
space: 20,
|
|
@@ -54384,7 +54386,7 @@
|
|
|
54384
54386
|
});
|
|
54385
54387
|
}
|
|
54386
54388
|
else if (Array.isArray(values)) {
|
|
54387
|
-
dataView.parse(values);
|
|
54389
|
+
dataView.parse(cloneDeep(values));
|
|
54388
54390
|
}
|
|
54389
54391
|
else if (isString(values) &&
|
|
54390
54392
|
(!parser || parser.type === 'csv' || parser.type === 'dsv' || parser.type === 'tsv')) {
|
|
@@ -55227,6 +55229,28 @@
|
|
|
55227
55229
|
}
|
|
55228
55230
|
return this;
|
|
55229
55231
|
}
|
|
55232
|
+
updateDataInBatchesSync(list) {
|
|
55233
|
+
if (this._chart) {
|
|
55234
|
+
list.forEach(({ id, data, options }) => {
|
|
55235
|
+
this._chart.updateData(id, data, false, options);
|
|
55236
|
+
});
|
|
55237
|
+
this._chart.updateGlobalScaleDomain();
|
|
55238
|
+
this._compiler.renderSync();
|
|
55239
|
+
return this;
|
|
55240
|
+
}
|
|
55241
|
+
list.forEach(({ id, data, options }) => {
|
|
55242
|
+
const preDV = this._spec.data.find(dv => dv.name === id);
|
|
55243
|
+
if (preDV) {
|
|
55244
|
+
preDV.parse(data, options);
|
|
55245
|
+
}
|
|
55246
|
+
else {
|
|
55247
|
+
const dataView = new DataView(this._dataSet, { name: id });
|
|
55248
|
+
dataView.parse(data, options);
|
|
55249
|
+
this._spec.data.push(dataView);
|
|
55250
|
+
}
|
|
55251
|
+
});
|
|
55252
|
+
return this;
|
|
55253
|
+
}
|
|
55230
55254
|
async updateSpec(spec, forceMerge = false, morphConfig) {
|
|
55231
55255
|
if (!spec) {
|
|
55232
55256
|
return this;
|
|
@@ -55279,14 +55303,16 @@
|
|
|
55279
55303
|
await this._compiler.resize?.(width, height);
|
|
55280
55304
|
return this;
|
|
55281
55305
|
}
|
|
55282
|
-
updateViewBox(viewBox, reRender = true) {
|
|
55306
|
+
updateViewBox(viewBox, reRender = true, reLayout = true) {
|
|
55283
55307
|
if (!this._chart || !this._compiler) {
|
|
55284
55308
|
return this;
|
|
55285
55309
|
}
|
|
55286
55310
|
this._viewBox = viewBox;
|
|
55287
|
-
this._chart.updateViewBox(viewBox);
|
|
55288
|
-
|
|
55289
|
-
|
|
55311
|
+
this._chart.updateViewBox(viewBox, reLayout);
|
|
55312
|
+
if (reLayout) {
|
|
55313
|
+
this._compiler.renderSync();
|
|
55314
|
+
this._chart?.onEvaluateEnd();
|
|
55315
|
+
}
|
|
55290
55316
|
this._compiler.updateViewBox(viewBox, reRender);
|
|
55291
55317
|
return this;
|
|
55292
55318
|
}
|
|
@@ -55883,6 +55909,9 @@
|
|
|
55883
55909
|
layoutLevel = LayoutLevel.Region;
|
|
55884
55910
|
layoutZIndex = 0;
|
|
55885
55911
|
chartLayoutRect;
|
|
55912
|
+
getVisible() {
|
|
55913
|
+
return this._spec?.visible !== false;
|
|
55914
|
+
}
|
|
55886
55915
|
_setLayoutAttributeFromSpec(spec, chartViewRect) {
|
|
55887
55916
|
if (this._spec.visible !== false) {
|
|
55888
55917
|
const padding = normalizeLayoutPaddingSpec(spec.padding);
|
|
@@ -56724,9 +56753,7 @@
|
|
|
56724
56753
|
this.updateState({
|
|
56725
56754
|
animationState: {
|
|
56726
56755
|
callback: (datum, element) => {
|
|
56727
|
-
return element.diffState === AnimationStateEnum.
|
|
56728
|
-
? AnimationStateEnum.appear
|
|
56729
|
-
: AnimationStateEnum.none;
|
|
56756
|
+
return element.diffState === 'exit' ? AnimationStateEnum.none : AnimationStateEnum.appear;
|
|
56730
56757
|
}
|
|
56731
56758
|
}
|
|
56732
56759
|
}, noRender);
|
|
@@ -56743,7 +56770,7 @@
|
|
|
56743
56770
|
return {
|
|
56744
56771
|
animationState: {
|
|
56745
56772
|
callback: (datum, element) => {
|
|
56746
|
-
return element.diffState ===
|
|
56773
|
+
return element.diffState === 'exit' ? AnimationStateEnum.none : AnimationStateEnum.appear;
|
|
56747
56774
|
}
|
|
56748
56775
|
}
|
|
56749
56776
|
};
|
|
@@ -57270,9 +57297,8 @@
|
|
|
57270
57297
|
};
|
|
57271
57298
|
const rightCurrent = this._chartViewBox.x2 - this._chartViewBox.x1 - this._rightCurrent;
|
|
57272
57299
|
const bottomCurrent = this._chartViewBox.y2 - this._chartViewBox.y1 - this._bottomCurrent;
|
|
57273
|
-
items.filter;
|
|
57274
57300
|
items.forEach(i => {
|
|
57275
|
-
if (!i.getAutoIndent()) {
|
|
57301
|
+
if (!i.getVisible() || !i.getAutoIndent()) {
|
|
57276
57302
|
return;
|
|
57277
57303
|
}
|
|
57278
57304
|
const vOrH = i.layoutOrient === 'left' || i.layoutOrient === 'right';
|
|
@@ -58344,7 +58370,7 @@
|
|
|
58344
58370
|
VChart.useMark([ComponentMark, GroupMark, ImageMark]);
|
|
58345
58371
|
Factory.registerRegion('region', Region);
|
|
58346
58372
|
Factory.registerLayout('base', Layout);
|
|
58347
|
-
const version = "1.2.1-alpha.
|
|
58373
|
+
const version = "1.2.1-alpha.3";
|
|
58348
58374
|
Logger.getInstance(LoggerLevel.Error);
|
|
58349
58375
|
|
|
58350
58376
|
var SeriesMarkNameEnum;
|
|
@@ -58875,11 +58901,11 @@
|
|
|
58875
58901
|
getLayoutTag() {
|
|
58876
58902
|
return this._layoutTag;
|
|
58877
58903
|
}
|
|
58878
|
-
setLayoutTag(tag, morphConfig) {
|
|
58904
|
+
setLayoutTag(tag, morphConfig, reLayout = true) {
|
|
58879
58905
|
this._layoutTag = tag;
|
|
58880
58906
|
if (this.getCompiler()?.getVGrammarView()) {
|
|
58881
58907
|
this.getCompiler().getVGrammarView().updateLayoutTag();
|
|
58882
|
-
tag && this.getCompiler().reRenderAsync(morphConfig);
|
|
58908
|
+
tag && reLayout && this.getCompiler().reRenderAsync(morphConfig);
|
|
58883
58909
|
}
|
|
58884
58910
|
return this._layoutTag;
|
|
58885
58911
|
}
|
|
@@ -58946,9 +58972,9 @@
|
|
|
58946
58972
|
this._updateLayoutRect(this._option.viewBox);
|
|
58947
58973
|
this.setLayoutTag(true);
|
|
58948
58974
|
}
|
|
58949
|
-
updateViewBox(viewBox) {
|
|
58975
|
+
updateViewBox(viewBox, reLayout) {
|
|
58950
58976
|
this._updateLayoutRect(viewBox);
|
|
58951
|
-
this.setLayoutTag(true);
|
|
58977
|
+
this.setLayoutTag(true, null, reLayout);
|
|
58952
58978
|
}
|
|
58953
58979
|
createBackground(bg) {
|
|
58954
58980
|
if (!bg) {
|
|
@@ -59579,6 +59605,7 @@
|
|
|
59579
59605
|
this._layoutRect.height = viewRect.height - this.padding.top - this.padding.bottom;
|
|
59580
59606
|
this._layoutRect.x = this.padding.left;
|
|
59581
59607
|
this._layoutRect.y = this.padding.top;
|
|
59608
|
+
this._event.emit(ChartEvent.layoutRectUpdate, {});
|
|
59582
59609
|
}
|
|
59583
59610
|
getCurrentTheme() {
|
|
59584
59611
|
return this._theme;
|
|
@@ -68874,7 +68901,9 @@
|
|
|
68874
68901
|
}
|
|
68875
68902
|
}
|
|
68876
68903
|
initProgressGroupMark() {
|
|
68877
|
-
this._progressGroupMark = this._createMark(LinearProgressSeries.mark.group
|
|
68904
|
+
this._progressGroupMark = this._createMark(LinearProgressSeries.mark.group, {
|
|
68905
|
+
skipBeforeLayouted: false
|
|
68906
|
+
});
|
|
68878
68907
|
return this._progressGroupMark;
|
|
68879
68908
|
}
|
|
68880
68909
|
initProgressGroupMarkStyle() {
|
|
@@ -69161,7 +69190,7 @@
|
|
|
69161
69190
|
class CloudLayout extends BaseLayout {
|
|
69162
69191
|
constructor(options) {
|
|
69163
69192
|
var _a;
|
|
69164
|
-
super(Object.assign({}, CloudLayout.defaultOptions, options)), this.cw = 64, this.ch = 2048, this._size = [256, 256], this._isBoardExpandCompleted = !1, this._placeStatus = 0, this._tTemp = null, this._dtTemp = null, this._dy = 0, this.cacheMap = new Map(), this.spiral = isString(this.options.spiral) ? null !== (_a = spirals[this.options.spiral]) && void 0 !== _a ? _a : spirals.archimedean : this.options.spiral, this.random = this.options.random ? Math.random : () => 1, this.getTextPadding = functor$1(this.options.padding);
|
|
69193
|
+
super(Object.assign({}, CloudLayout.defaultOptions, options)), this.cw = 64, this.ch = 2048, this._size = [256, 256], this._isBoardExpandCompleted = !1, this._placeStatus = 0, this._tTemp = null, this._dtTemp = null, this._dy = 0, this.cacheMap = new Map(), this.options.minFontSize <= CloudLayout.defaultOptions.minFontSize && (this.options.minFontSize = CloudLayout.defaultOptions.minFontSize), this.spiral = isString(this.options.spiral) ? null !== (_a = spirals[this.options.spiral]) && void 0 !== _a ? _a : spirals.archimedean : this.options.spiral, this.random = this.options.random ? Math.random : () => 1, this.getTextPadding = functor$1(this.options.padding);
|
|
69165
69194
|
}
|
|
69166
69195
|
zoomRatio() {
|
|
69167
69196
|
return this._originSize[0] / this._size[0];
|
|
@@ -69183,7 +69212,7 @@
|
|
|
69183
69212
|
x: d.x + d.x1,
|
|
69184
69213
|
y: d.y + d.y1
|
|
69185
69214
|
}], d.x -= this._size[0] >> 1, d.y -= this._size[1] >> 1, this._tTemp = null, this._dtTemp = null, !0;
|
|
69186
|
-
if (this.updateBoardExpandStatus(d.fontSize
|
|
69215
|
+
if (this.updateBoardExpandStatus(d.fontSize), d.hasText && this.shouldShrinkContinue()) {
|
|
69187
69216
|
if (1 === this._placeStatus) {
|
|
69188
69217
|
const maxSize0 = d.fontSize * this._originSize[0] / this.options.minFontSize,
|
|
69189
69218
|
distSize0 = Math.max(d.width, d.height);
|
|
@@ -69192,7 +69221,7 @@
|
|
|
69192
69221
|
this.expandBoard(this._board, maxSize0 / this._size[0]);
|
|
69193
69222
|
}
|
|
69194
69223
|
} else this._placeStatus, this.expandBoard(this._board);
|
|
69195
|
-
return this.updateBoardExpandStatus(d.fontSize
|
|
69224
|
+
return this.updateBoardExpandStatus(d.fontSize), !1;
|
|
69196
69225
|
}
|
|
69197
69226
|
return this._tTemp = null, this._dtTemp = null, !0;
|
|
69198
69227
|
}
|
|
@@ -69230,8 +69259,10 @@
|
|
|
69230
69259
|
})).sort(function (a, b) {
|
|
69231
69260
|
return b.fontSize - a.fontSize;
|
|
69232
69261
|
});
|
|
69233
|
-
|
|
69234
|
-
|
|
69262
|
+
this.data = data;
|
|
69263
|
+
let curWordTryCount = 0;
|
|
69264
|
+
for (; i < n;) {
|
|
69265
|
+
if (this.layoutWord(i) || curWordTryCount >= 2 ? (i++, curWordTryCount = 0) : curWordTryCount++, this.progressiveIndex = i, this.exceedTime()) break;
|
|
69235
69266
|
}
|
|
69236
69267
|
if (!this.options.clip && this.options.enlarge && this._bounds && this.shrinkBoard(this._bounds), this._bounds && ["cardioid", "triangle", "triangle-upright"].includes(this.options.shape)) {
|
|
69237
69268
|
const currentCenterY = (this._bounds[0].y + this._bounds[1].y) / 2;
|
|
@@ -69257,8 +69288,8 @@
|
|
|
69257
69288
|
progressiveOutput() {
|
|
69258
69289
|
return this.outputCallback ? this.outputCallback(this.formatTagItem(this.progressiveResult)) : this.formatTagItem(this.progressiveResult);
|
|
69259
69290
|
}
|
|
69260
|
-
updateBoardExpandStatus(
|
|
69261
|
-
this._isBoardExpandCompleted =
|
|
69291
|
+
updateBoardExpandStatus(fontSize) {
|
|
69292
|
+
this._isBoardExpandCompleted = fontSize * (this._originSize[0] / this._size[0]) < this.options.minFontSize;
|
|
69262
69293
|
}
|
|
69263
69294
|
shouldShrinkContinue() {
|
|
69264
69295
|
return !this.options.clip && this.options.shrink && !this._isBoardExpandCompleted;
|
|
@@ -69465,7 +69496,8 @@
|
|
|
69465
69496
|
return a.x + a.x1 > b[0].x && a.x + a.x0 < b[1].x && a.y + a.y1 > b[0].y && a.y + a.y0 < b[1].y;
|
|
69466
69497
|
}
|
|
69467
69498
|
CloudLayout.defaultOptions = {
|
|
69468
|
-
enlarge: !1
|
|
69499
|
+
enlarge: !1,
|
|
69500
|
+
minFontSize: 2
|
|
69469
69501
|
};
|
|
69470
69502
|
const isFullOutside = (tag, size) => tag.x + tag.x0 > size[0] || tag.y + tag.y0 > size[0] || tag.x + tag.x1 < 0 || tag.y + tag.y1 < 0,
|
|
69471
69503
|
isPartOutside = (tag, size) => tag.x + tag.x0 < 0 || tag.y + tag.y0 < 0 || tag.x + tag.x1 > size[0] || tag.y + tag.y1 > size[1];
|
|
@@ -69755,8 +69787,10 @@
|
|
|
69755
69787
|
angle: "angle"
|
|
69756
69788
|
};
|
|
69757
69789
|
const transform$2 = (options, upstreamData) => {
|
|
69758
|
-
var _a, _b, _c, _d, _e, _f
|
|
69759
|
-
if (options.size && (
|
|
69790
|
+
var _a, _b, _c, _d, _e, _f;
|
|
69791
|
+
if (options.size && (options.size[0] <= 0 || options.size[1] <= 0)) {
|
|
69792
|
+
return Logger.getInstance().info("Wordcloud size dimensions must be greater than 0"), [];
|
|
69793
|
+
}
|
|
69760
69794
|
const data = upstreamData,
|
|
69761
69795
|
canvasSize = (null !== (_a = options.size) && void 0 !== _a ? _a : [500, 500]).slice();
|
|
69762
69796
|
canvasSize[0] = Math.floor(canvasSize[0]), canvasSize[1] = Math.floor(canvasSize[1]);
|
|
@@ -69771,7 +69805,7 @@
|
|
|
69771
69805
|
shrink = null !== (_d = options.shrink) && void 0 !== _d && _d,
|
|
69772
69806
|
enlarge = null !== (_e = options.enlarge) && void 0 !== _e && _e,
|
|
69773
69807
|
clip = null !== (_f = options.clip) && void 0 !== _f && _f,
|
|
69774
|
-
minFontSize =
|
|
69808
|
+
minFontSize = options.minFontSize,
|
|
69775
69809
|
randomVisible = options.randomVisible,
|
|
69776
69810
|
as = options.as || OUTPUT$1,
|
|
69777
69811
|
depth_3d = options.depth_3d,
|
|
@@ -71072,6 +71106,10 @@
|
|
|
71072
71106
|
}
|
|
71073
71107
|
compile() {
|
|
71074
71108
|
super.compile();
|
|
71109
|
+
const { width, height } = this._region.getLayoutRect();
|
|
71110
|
+
if (!isValidNumber(width) || !isValidNumber(height) || !(height > 0 && width > 0)) {
|
|
71111
|
+
return;
|
|
71112
|
+
}
|
|
71075
71113
|
const wordCloudTransforms = [];
|
|
71076
71114
|
const valueField = this._valueField;
|
|
71077
71115
|
const valueScale = new LinearScale();
|
|
@@ -71119,7 +71157,7 @@
|
|
|
71119
71157
|
wordCloudTransforms.push({
|
|
71120
71158
|
type: 'wordcloud',
|
|
71121
71159
|
layoutType: !isTrueBrowser(this._option.mode) ? 'fast' : this._wordCloudConfig.layoutMode,
|
|
71122
|
-
size: [
|
|
71160
|
+
size: [width, height],
|
|
71123
71161
|
shape: this._maskShape,
|
|
71124
71162
|
dataIndexKey: DEFAULT_DATA_KEY,
|
|
71125
71163
|
text: { field: textField },
|
|
@@ -71144,7 +71182,7 @@
|
|
|
71144
71182
|
wordCloudTransforms.push({
|
|
71145
71183
|
type: 'wordcloudShape',
|
|
71146
71184
|
dataIndexKey: DEFAULT_DATA_KEY,
|
|
71147
|
-
size: [
|
|
71185
|
+
size: [width, height],
|
|
71148
71186
|
shape: this._maskShape,
|
|
71149
71187
|
text: { field: this._spec.word?.formatMethod ? WORD_CLOUD_TEXT : this._nameField },
|
|
71150
71188
|
fontSize: valueField ? { field: valueField } : this._fontSizeRange[0],
|
|
@@ -81068,6 +81106,7 @@
|
|
|
81068
81106
|
_axisStyle;
|
|
81069
81107
|
_latestBounds;
|
|
81070
81108
|
_verticalLimitSize;
|
|
81109
|
+
_layoutCache = { width: 0, height: 0, _lastComputeOutBounds: { x1: 0, x2: 0, y1: 0, y2: 0 } };
|
|
81071
81110
|
constructor(spec, options) {
|
|
81072
81111
|
super(spec, {
|
|
81073
81112
|
...options
|
|
@@ -81422,7 +81461,7 @@
|
|
|
81422
81461
|
}
|
|
81423
81462
|
result.width = Math.ceil(result.width);
|
|
81424
81463
|
result.height = Math.ceil(result.height);
|
|
81425
|
-
return result;
|
|
81464
|
+
return this._setRectInSpec(this._layoutCacheProcessing(result));
|
|
81426
81465
|
}
|
|
81427
81466
|
boundsInRect(rect) {
|
|
81428
81467
|
let result = { x1: 0, y1: 0, x2: 0, y2: 0 };
|
|
@@ -81574,6 +81613,9 @@
|
|
|
81574
81613
|
super.initEvent();
|
|
81575
81614
|
if (this.visible) {
|
|
81576
81615
|
this.event.on(ChartEvent.layoutEnd, this._fixAxisOnZero);
|
|
81616
|
+
this.event.on(ChartEvent.layoutRectUpdate, () => {
|
|
81617
|
+
this._clearLayoutCache();
|
|
81618
|
+
});
|
|
81577
81619
|
}
|
|
81578
81620
|
}
|
|
81579
81621
|
_fixAxisOnZero = () => {
|
|
@@ -81625,6 +81667,33 @@
|
|
|
81625
81667
|
}
|
|
81626
81668
|
}
|
|
81627
81669
|
};
|
|
81670
|
+
_layoutCacheProcessing(rect) {
|
|
81671
|
+
['width', 'height'].forEach(key => {
|
|
81672
|
+
if (rect[key] < this._layoutCache[key]) {
|
|
81673
|
+
rect[key] = this._layoutCache[key];
|
|
81674
|
+
}
|
|
81675
|
+
else {
|
|
81676
|
+
this._layoutCache[key] = rect[key];
|
|
81677
|
+
}
|
|
81678
|
+
});
|
|
81679
|
+
['x1', 'x2', 'y1', 'y2'].forEach(key => {
|
|
81680
|
+
if (this._lastComputeOutBounds[key] < this._layoutCache._lastComputeOutBounds[key]) {
|
|
81681
|
+
this._lastComputeOutBounds[key] = this._layoutCache._lastComputeOutBounds[key];
|
|
81682
|
+
}
|
|
81683
|
+
else {
|
|
81684
|
+
this._layoutCache._lastComputeOutBounds[key] = this._lastComputeOutBounds[key];
|
|
81685
|
+
}
|
|
81686
|
+
});
|
|
81687
|
+
return rect;
|
|
81688
|
+
}
|
|
81689
|
+
_clearLayoutCache() {
|
|
81690
|
+
this._layoutCache.width = 0;
|
|
81691
|
+
this._layoutCache.height = 0;
|
|
81692
|
+
this._layoutCache._lastComputeOutBounds = { x1: 0, x2: 0, y1: 0, y2: 0 };
|
|
81693
|
+
}
|
|
81694
|
+
onDataUpdate() {
|
|
81695
|
+
this._clearLayoutCache();
|
|
81696
|
+
}
|
|
81628
81697
|
}
|
|
81629
81698
|
|
|
81630
81699
|
const e10 = Math.sqrt(50);
|