@visactor/vchart 1.13.24 → 1.13.26
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.es.js +124 -35
- package/build/index.js +124 -35
- package/build/index.min.js +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/series/sankey/tooltip-helper.js +1 -1
- package/cjs/series/sankey/tooltip-helper.js.map +1 -1
- package/cjs/series/word-cloud/base.d.ts +2 -0
- package/cjs/series/word-cloud/base.js +13 -4
- package/cjs/series/word-cloud/base.js.map +1 -1
- package/cjs/series/word-cloud/measure-cache.d.ts +19 -0
- package/cjs/series/word-cloud/measure-cache.js +33 -0
- package/cjs/series/word-cloud/measure-cache.js.map +1 -0
- package/esm/series/sankey/tooltip-helper.js +2 -2
- package/esm/series/sankey/tooltip-helper.js.map +1 -1
- package/esm/series/word-cloud/base.d.ts +2 -0
- package/esm/series/word-cloud/base.js +14 -3
- package/esm/series/word-cloud/base.js.map +1 -1
- package/esm/series/word-cloud/measure-cache.d.ts +19 -0
- package/esm/series/word-cloud/measure-cache.js +25 -0
- package/esm/series/word-cloud/measure-cache.js.map +1 -0
- package/package.json +13 -13
package/build/index.es.js
CHANGED
|
@@ -80516,6 +80516,41 @@ const SHAPE_TYPE = [
|
|
|
80516
80516
|
'rect'
|
|
80517
80517
|
];
|
|
80518
80518
|
|
|
80519
|
+
class WordMeasureCache {
|
|
80520
|
+
constructor(maxSize = 1000) {
|
|
80521
|
+
this._map = new Map();
|
|
80522
|
+
this._maxSize = maxSize;
|
|
80523
|
+
}
|
|
80524
|
+
get(key) {
|
|
80525
|
+
const v = this._map.get(key);
|
|
80526
|
+
if (!v) {
|
|
80527
|
+
return undefined;
|
|
80528
|
+
}
|
|
80529
|
+
this._map.delete(key);
|
|
80530
|
+
this._map.set(key, v);
|
|
80531
|
+
return v;
|
|
80532
|
+
}
|
|
80533
|
+
set(key, value) {
|
|
80534
|
+
if (this._map.has(key)) {
|
|
80535
|
+
this._map.set(key, value);
|
|
80536
|
+
return;
|
|
80537
|
+
}
|
|
80538
|
+
if (this._map.size >= this._maxSize) {
|
|
80539
|
+
const oldest = this._map.keys().next().value;
|
|
80540
|
+
if (oldest !== undefined) {
|
|
80541
|
+
this._map.delete(oldest);
|
|
80542
|
+
}
|
|
80543
|
+
}
|
|
80544
|
+
this._map.set(key, value);
|
|
80545
|
+
}
|
|
80546
|
+
clear() {
|
|
80547
|
+
this._map.clear();
|
|
80548
|
+
}
|
|
80549
|
+
size() {
|
|
80550
|
+
return this._map.size;
|
|
80551
|
+
}
|
|
80552
|
+
}
|
|
80553
|
+
|
|
80519
80554
|
const WORD_CLOUD_TEXT = `${PREFIX}_WORD_CLOUD_TEXT`;
|
|
80520
80555
|
|
|
80521
80556
|
const wordCloudSeriesMark = Object.assign(Object.assign({}, baseSeriesMark), { ["word"]: { name: "word", type: "text" }, ["fillingWord"]: { name: "fillingWord", type: "text" }, ["wordMask"]: { name: "wordMask", type: "rect" } });
|
|
@@ -80592,11 +80627,16 @@ class BaseWordCloudSeries extends BaseSeries {
|
|
|
80592
80627
|
!SHAPE_TYPE.includes(this._maskShape) &&
|
|
80593
80628
|
!['fast', 'grid', 'cloud'].includes(this._wordCloudConfig.layoutMode);
|
|
80594
80629
|
this._defaultFontFamily = this._option.getTheme().fontFamily;
|
|
80630
|
+
if (!this._wordMeasureCache) {
|
|
80631
|
+
this._wordMeasureCache = new WordMeasureCache(1000);
|
|
80632
|
+
}
|
|
80595
80633
|
}
|
|
80596
80634
|
initData() {
|
|
80597
80635
|
var _a, _b;
|
|
80598
80636
|
super.initData();
|
|
80599
80637
|
(_b = (_a = this.getViewData()) === null || _a === void 0 ? void 0 : _a.target) === null || _b === void 0 ? void 0 : _b.addListener('change', () => {
|
|
80638
|
+
var _a;
|
|
80639
|
+
(_a = this._wordMeasureCache) === null || _a === void 0 ? void 0 : _a.clear();
|
|
80600
80640
|
this._dataChange = true;
|
|
80601
80641
|
this.compile();
|
|
80602
80642
|
});
|
|
@@ -80765,7 +80805,7 @@ class BaseWordCloudSeries extends BaseSeries {
|
|
|
80765
80805
|
var _a, _b, _c, _d, _e, _f;
|
|
80766
80806
|
const fillingWordStyleSpec = (_b = (_a = this._spec.fillingWord) === null || _a === void 0 ? void 0 : _a.style) !== null && _b !== void 0 ? _b : {};
|
|
80767
80807
|
const wordCloudShapeConfig = (_c = this._wordCloudShapeConfig) !== null && _c !== void 0 ? _c : {};
|
|
80768
|
-
return Object.assign(Object.assign(Object.assign({}, wordCloudShapeConfig), this._getCommonTransformOptions()), { rotateList: this._rotateAngles, fillingRotateList: wordCloudShapeConfig.fillingRotateAngles, fillingFontFamily: isValid$1(wordCloudShapeConfig.fillingFontFamilyField)
|
|
80808
|
+
return Object.assign(Object.assign(Object.assign({}, wordCloudShapeConfig), this._getCommonTransformOptions()), { measureCache: this._wordMeasureCache, rotateList: this._rotateAngles, fillingRotateList: wordCloudShapeConfig.fillingRotateAngles, fillingFontFamily: isValid$1(wordCloudShapeConfig.fillingFontFamilyField)
|
|
80769
80809
|
? { field: wordCloudShapeConfig.fillingFontFamilyField }
|
|
80770
80810
|
: (_d = fillingWordStyleSpec.fontFamily) !== null && _d !== void 0 ? _d : this._defaultFontFamily, fillingPadding: (_f = (_e = this._spec.fillingWord) === null || _e === void 0 ? void 0 : _e.padding) !== null && _f !== void 0 ? _f : DEFAULT_FONT_PADDING, fillingFontStyle: isValid$1(wordCloudShapeConfig.fillingFontStyleField)
|
|
80771
80811
|
? { field: wordCloudShapeConfig.fillingFontStyleField }
|
|
@@ -80814,6 +80854,7 @@ class BaseWordCloudSeries extends BaseSeries {
|
|
|
80814
80854
|
return [this._wordMark];
|
|
80815
80855
|
}
|
|
80816
80856
|
reInit() {
|
|
80857
|
+
var _a;
|
|
80817
80858
|
super.reInit();
|
|
80818
80859
|
if (this._keyWordColorCallback) {
|
|
80819
80860
|
this._keyWordColorCallback = null;
|
|
@@ -80821,6 +80862,13 @@ class BaseWordCloudSeries extends BaseSeries {
|
|
|
80821
80862
|
if (this._fillingColorCallback) {
|
|
80822
80863
|
this._fillingColorCallback = null;
|
|
80823
80864
|
}
|
|
80865
|
+
(_a = this._wordMeasureCache) === null || _a === void 0 ? void 0 : _a.clear();
|
|
80866
|
+
}
|
|
80867
|
+
release() {
|
|
80868
|
+
var _a;
|
|
80869
|
+
super.release();
|
|
80870
|
+
(_a = this._wordMeasureCache) === null || _a === void 0 ? void 0 : _a.clear();
|
|
80871
|
+
this._wordMeasureCache = undefined;
|
|
80824
80872
|
}
|
|
80825
80873
|
}
|
|
80826
80874
|
BaseWordCloudSeries.mark = wordCloudSeriesMark;
|
|
@@ -81747,6 +81795,30 @@ var WORDCLOUD_SHAPE_HOOK_EVENT;
|
|
|
81747
81795
|
!function (WORDCLOUD_SHAPE_HOOK_EVENT) {
|
|
81748
81796
|
WORDCLOUD_SHAPE_HOOK_EVENT.BEFORE_WORDCLOUD_SHAPE_LAYOUT = "beforeWordcloudShapeLayout", WORDCLOUD_SHAPE_HOOK_EVENT.AFTER_WORDCLOUD_SHAPE_LAYOUT = "afterWordcloudShapeLayout", WORDCLOUD_SHAPE_HOOK_EVENT.AFTER_WORDCLOUD_SHAPE_DRAW = "afterWordcloudShapeDraw";
|
|
81749
81797
|
}(WORDCLOUD_SHAPE_HOOK_EVENT || (WORDCLOUD_SHAPE_HOOK_EVENT = {}));
|
|
81798
|
+
class MapWordMeasureCache {
|
|
81799
|
+
constructor(maxSize = 1e3) {
|
|
81800
|
+
this._map = new Map(), this._maxSize = maxSize;
|
|
81801
|
+
}
|
|
81802
|
+
get(key) {
|
|
81803
|
+
const value = this._map.get(key);
|
|
81804
|
+
if (void 0 !== value) return this._map.delete(key), this._map.set(key, value), value;
|
|
81805
|
+
}
|
|
81806
|
+
set(key, value) {
|
|
81807
|
+
if (this._map.has(key)) this._map.set(key, value);else {
|
|
81808
|
+
if (this._map.size >= this._maxSize) {
|
|
81809
|
+
const firstKey = this._map.keys().next().value;
|
|
81810
|
+
void 0 !== firstKey && this._map.delete(firstKey);
|
|
81811
|
+
}
|
|
81812
|
+
this._map.set(key, value);
|
|
81813
|
+
}
|
|
81814
|
+
}
|
|
81815
|
+
clear() {
|
|
81816
|
+
this._map.clear();
|
|
81817
|
+
}
|
|
81818
|
+
size() {
|
|
81819
|
+
return this._map.size;
|
|
81820
|
+
}
|
|
81821
|
+
}
|
|
81750
81822
|
const colorListEqual = (arr0, arr1) => {
|
|
81751
81823
|
if (1 === arr1.length && "#537EF5" === arr1[0]) return !0;
|
|
81752
81824
|
if (!Array.isArray(arr0) || !Array.isArray(arr1) || arr0.length !== arr1.length) return !1;
|
|
@@ -81986,7 +82058,7 @@ function layout(words, layoutConfig, segmentationOutput) {
|
|
|
81986
82058
|
ratio: ratio
|
|
81987
82059
|
} = region;
|
|
81988
82060
|
for (let i = 0; i < regionWords.length; i++) {
|
|
81989
|
-
measureSprite(canvas, ctx, words, i);
|
|
82061
|
+
measureSprite(canvas, ctx, words, i, layoutConfig.measureCache);
|
|
81990
82062
|
const word = regionWords[i];
|
|
81991
82063
|
word.x = center[0], word.y = center[1], word.hasText && word.sprite && place$1(board, word, maxR, ratio, size, boardSize, stepFactor) && (word.hasPlaced = !0);
|
|
81992
82064
|
}
|
|
@@ -81996,7 +82068,7 @@ function layout(words, layoutConfig, segmentationOutput) {
|
|
|
81996
82068
|
if (0 === failedWords.length) break;
|
|
81997
82069
|
for (let i = 0; i < failedWords.length; i++) {
|
|
81998
82070
|
const word = failedWords[i];
|
|
81999
|
-
measureSprite(canvas, ctx, failedWords, i), word.x = shapeCenter[0], word.y = shapeCenter[1], word.hasText && place$1(board, word, shapeMaxR, shapeRatio, size, boardSize, stepFactor) && (word.hasPlaced = !0);
|
|
82071
|
+
measureSprite(canvas, ctx, failedWords, i, layoutConfig.measureCache), word.x = shapeCenter[0], word.y = shapeCenter[1], word.hasText && place$1(board, word, shapeMaxR, shapeRatio, size, boardSize, stepFactor) && (word.hasPlaced = !0);
|
|
82000
82072
|
}
|
|
82001
82073
|
}
|
|
82002
82074
|
layoutConfig.board = board;
|
|
@@ -82042,7 +82114,7 @@ function layoutGlobalShrink(words, layoutConfig, segmentationOutput) {
|
|
|
82042
82114
|
} = region;
|
|
82043
82115
|
let restartTag = !1;
|
|
82044
82116
|
for (let i = 0; i < regionWords.length; i++) {
|
|
82045
|
-
measureSprite(canvas, ctx, words, i);
|
|
82117
|
+
measureSprite(canvas, ctx, words, i, layoutConfig.measureCache);
|
|
82046
82118
|
const word = regionWords[i];
|
|
82047
82119
|
if (word.x = center[0], word.y = center[1], !word.skip && word.hasText && word.sprite && place$1(board, word, maxR, ratio, size, boardSize, stepFactor)) word.hasPlaced = !0;else {
|
|
82048
82120
|
if (!word.skip && word.weight > weightStd && globalShinkFactor > globalShinkLimit) {
|
|
@@ -82067,7 +82139,7 @@ function layoutGlobalShrink(words, layoutConfig, segmentationOutput) {
|
|
|
82067
82139
|
if (0 === failedWords.length) break;
|
|
82068
82140
|
for (let i = 0; i < failedWords.length; i++) {
|
|
82069
82141
|
const word = failedWords[i];
|
|
82070
|
-
measureSprite(canvas, ctx, failedWords, i), word.x = shapeCenter[0], word.y = shapeCenter[1], word.hasText && place$1(board, word, shapeMaxR, shapeRatio, size, boardSize, stepFactor) && (word.hasPlaced = !0);
|
|
82142
|
+
measureSprite(canvas, ctx, failedWords, i, layoutConfig.measureCache), word.x = shapeCenter[0], word.y = shapeCenter[1], word.hasText && place$1(board, word, shapeMaxR, shapeRatio, size, boardSize, stepFactor) && (word.hasPlaced = !0);
|
|
82071
82143
|
}
|
|
82072
82144
|
}
|
|
82073
82145
|
layoutConfig.board = board;
|
|
@@ -82112,7 +82184,7 @@ function layoutSelfEnlarge(words, layoutConfig, segmentationOutput) {
|
|
|
82112
82184
|
} = region;
|
|
82113
82185
|
let restartTag = !1;
|
|
82114
82186
|
for (let i = 0; i < regionWords.length; i++) {
|
|
82115
|
-
measureSprite(canvas, ctx, words, i);
|
|
82187
|
+
measureSprite(canvas, ctx, words, i, layoutConfig.measureCache);
|
|
82116
82188
|
const word = regionWords[i];
|
|
82117
82189
|
if (word.x = center[0], word.y = center[1], word.hasText && word.sprite && place$1(board, word, maxR, ratio, size, boardSize, stepFactor)) {
|
|
82118
82190
|
if (word.hasPlaced = !0, word.weight >= weightStd && importantWordSuccessedNum++, importantWordSuccessedNum >= importantCount && !layoutFinish) {
|
|
@@ -82138,7 +82210,7 @@ function layoutSelfEnlarge(words, layoutConfig, segmentationOutput) {
|
|
|
82138
82210
|
if (0 === failedWords.length) break;
|
|
82139
82211
|
for (let i = 0; i < failedWords.length; i++) {
|
|
82140
82212
|
const word = failedWords[i];
|
|
82141
|
-
measureSprite(canvas, ctx, failedWords, i), word.x = shapeCenter[0], word.y = shapeCenter[1], word.hasText && place$1(board, word, shapeMaxR, shapeRatio, size, boardSize, stepFactor) && (word.hasPlaced = !0);
|
|
82213
|
+
measureSprite(canvas, ctx, failedWords, i, layoutConfig.measureCache), word.x = shapeCenter[0], word.y = shapeCenter[1], word.hasText && place$1(board, word, shapeMaxR, shapeRatio, size, boardSize, stepFactor) && (word.hasPlaced = !0);
|
|
82142
82214
|
}
|
|
82143
82215
|
}
|
|
82144
82216
|
layoutConfig.board = board;
|
|
@@ -82217,8 +82289,13 @@ function archimedeanSpiral(ratio) {
|
|
|
82217
82289
|
return [ratio * (t *= .1) * Math.cos(t), t * Math.sin(t)];
|
|
82218
82290
|
};
|
|
82219
82291
|
}
|
|
82220
|
-
function measureSprite(canvas, ctx, words, wi) {
|
|
82221
|
-
|
|
82292
|
+
function measureSprite(canvas, ctx, words, wi, cache) {
|
|
82293
|
+
const targetWord = words[wi];
|
|
82294
|
+
if (targetWord.sprite || 0 === targetWord.fontSize) return;
|
|
82295
|
+
if (cache) {
|
|
82296
|
+
const cached = cache.get(getWordMeasureKey(targetWord));
|
|
82297
|
+
if (cached) return targetWord.sprite = cached.sprite, targetWord.bounds = cached.bounds, targetWord.wordSize = cached.wordSize, void (targetWord.hasText = !0);
|
|
82298
|
+
}
|
|
82222
82299
|
const cw = 2048,
|
|
82223
82300
|
radians = Math.PI / 180,
|
|
82224
82301
|
n = words.length;
|
|
@@ -82281,14 +82358,25 @@ function measureSprite(canvas, ctx, words, wi) {
|
|
|
82281
82358
|
}
|
|
82282
82359
|
seen && (j < dTop && (dTop = j), j > dBottom && (dBottom = j));
|
|
82283
82360
|
}
|
|
82284
|
-
word.bounds = {
|
|
82361
|
+
if (word.bounds = {
|
|
82285
82362
|
dTop: (wordSize[1] >> 1) - dTop,
|
|
82286
82363
|
dBottom: dBottom - (wordSize[1] >> 1),
|
|
82287
82364
|
dLeft: (wordSize[0] >> 1) - dLeft,
|
|
82288
82365
|
dRight: dRight - (wordSize[0] >> 1)
|
|
82289
|
-
}, word.sprite = sprite,
|
|
82366
|
+
}, word.sprite = sprite, cache) {
|
|
82367
|
+
const key = getWordMeasureKey(word);
|
|
82368
|
+
cache.set(key, {
|
|
82369
|
+
sprite: sprite,
|
|
82370
|
+
bounds: word.bounds,
|
|
82371
|
+
wordSize: wordSize
|
|
82372
|
+
});
|
|
82373
|
+
}
|
|
82374
|
+
delete word.LT;
|
|
82290
82375
|
}
|
|
82291
82376
|
}
|
|
82377
|
+
function getWordMeasureKey(word) {
|
|
82378
|
+
return String(word.text) + "|" + String(word.fontFamily) + "|" + String(word.fontStyle) + "|" + String(word.fontWeight) + "|" + String(word.fontSize) + "|" + String(word.rotate) + "|" + String(word.padding);
|
|
82379
|
+
}
|
|
82292
82380
|
function initBoardWithShape(segmentationOutput) {
|
|
82293
82381
|
const {
|
|
82294
82382
|
segmentation: {
|
|
@@ -82385,7 +82473,7 @@ function filling(words, layoutConfig, segmentationOutput) {
|
|
|
82385
82473
|
} = shapeBounds,
|
|
82386
82474
|
[startX, startY] = [x1 + ~~(randomGenerator() * fillingXStep * 2), y1 + ~~(randomGenerator() * fillingYStep * 2)];
|
|
82387
82475
|
for (let y = startY; y <= y2; y += fillingYStep) for (let x = startX; x <= x2; x += fillingXStep) {
|
|
82388
|
-
measureSprite(canvas, ctx, fillingWords, wi);
|
|
82476
|
+
measureSprite(canvas, ctx, fillingWords, wi, layoutConfig.measureCache);
|
|
82389
82477
|
const word = fillingWords[wi];
|
|
82390
82478
|
word.x = x, word.y = y;
|
|
82391
82479
|
const {
|
|
@@ -82502,7 +82590,7 @@ class Layout {
|
|
|
82502
82590
|
return this.progressiveResult;
|
|
82503
82591
|
}
|
|
82504
82592
|
doLayout() {
|
|
82505
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
82593
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
82506
82594
|
const segmentationInput = this.segmentationInput,
|
|
82507
82595
|
segmentationOutput = segmentation(segmentationInput);
|
|
82508
82596
|
if (!segmentationOutput.segmentation.regions.length) return;
|
|
@@ -82529,35 +82617,36 @@ class Layout {
|
|
|
82529
82617
|
const layoutConfig = {
|
|
82530
82618
|
size: options.size,
|
|
82531
82619
|
ratio: options.ratio || .8,
|
|
82620
|
+
measureCache: null !== (_a = options.measureCache) && void 0 !== _a ? _a : new MapWordMeasureCache(),
|
|
82532
82621
|
shapeUrl: options.shape,
|
|
82533
82622
|
random: void 0 === options.random || options.random,
|
|
82534
|
-
textLayoutTimes: null !== (
|
|
82623
|
+
textLayoutTimes: null !== (_b = options.textLayoutTimes) && void 0 !== _b ? _b : 3,
|
|
82535
82624
|
removeWhiteBorder: options.removeWhiteBorder,
|
|
82536
|
-
layoutMode: null !== (
|
|
82537
|
-
fontSizeShrinkFactor: null !== (
|
|
82538
|
-
stepFactor: null !== (
|
|
82539
|
-
importantWordCount: null !== (
|
|
82625
|
+
layoutMode: null !== (_c = options.layoutMode) && void 0 !== _c ? _c : "default",
|
|
82626
|
+
fontSizeShrinkFactor: null !== (_d = options.fontSizeShrinkFactor) && void 0 !== _d ? _d : .8,
|
|
82627
|
+
stepFactor: null !== (_e = options.stepFactor) && void 0 !== _e ? _e : 1,
|
|
82628
|
+
importantWordCount: null !== (_f = options.importantWordCount) && void 0 !== _f ? _f : 10,
|
|
82540
82629
|
globalShinkLimit: options.globalShinkLimit || .2,
|
|
82541
|
-
fontSizeEnlargeFactor: null !== (
|
|
82542
|
-
fillingRatio: null !== (
|
|
82543
|
-
fillingTimes: null !== (
|
|
82544
|
-
fillingXStep: options.fillingXRatioStep ? Math.max(Math.floor(options.size[0] * options.fillingXRatioStep), 1) : null !== (
|
|
82545
|
-
fillingYStep: options.fillingYRatioStep ? Math.max(Math.floor(options.size[1] * options.fillingYRatioStep), 1) : null !== (
|
|
82630
|
+
fontSizeEnlargeFactor: null !== (_g = options.fontSizeEnlargeFactor) && void 0 !== _g ? _g : 1.5,
|
|
82631
|
+
fillingRatio: null !== (_h = options.fillingRatio) && void 0 !== _h ? _h : .7,
|
|
82632
|
+
fillingTimes: null !== (_j = options.fillingTimes) && void 0 !== _j ? _j : 4,
|
|
82633
|
+
fillingXStep: options.fillingXRatioStep ? Math.max(Math.floor(options.size[0] * options.fillingXRatioStep), 1) : null !== (_k = options.fillingXStep) && void 0 !== _k ? _k : 4,
|
|
82634
|
+
fillingYStep: options.fillingYRatioStep ? Math.max(Math.floor(options.size[1] * options.fillingYRatioStep), 1) : null !== (_l = options.fillingYStep) && void 0 !== _l ? _l : 4,
|
|
82546
82635
|
fillingInitialFontSize: options.fillingInitialFontSize,
|
|
82547
82636
|
fillingDeltaFontSize: options.fillingDeltaFontSize,
|
|
82548
|
-
fillingInitialOpacity: null !== (
|
|
82549
|
-
fillingDeltaOpacity: null !== (
|
|
82637
|
+
fillingInitialOpacity: null !== (_m = options.fillingInitialOpacity) && void 0 !== _m ? _m : .8,
|
|
82638
|
+
fillingDeltaOpacity: null !== (_o = options.fillingDeltaOpacity) && void 0 !== _o ? _o : .05,
|
|
82550
82639
|
getFillingFontFamily: field(options.fillingFontFamily || "sans-serif"),
|
|
82551
82640
|
getFillingFontStyle: field(options.fillingFontStyle || "normal"),
|
|
82552
82641
|
getFillingFontWeight: field(options.fillingFontWeight || "normal"),
|
|
82553
|
-
getFillingPadding: field(null !== (
|
|
82554
|
-
fillingRotateList: null !== (
|
|
82555
|
-
fillingDeltaFontSizeFactor: null !== (
|
|
82642
|
+
getFillingPadding: field(null !== (_p = options.fillingPadding) && void 0 !== _p ? _p : .4),
|
|
82643
|
+
fillingRotateList: null !== (_q = options.fillingRotateList) && void 0 !== _q ? _q : [0, 90],
|
|
82644
|
+
fillingDeltaFontSizeFactor: null !== (_r = options.fillingDeltaFontSizeFactor) && void 0 !== _r ? _r : .2,
|
|
82556
82645
|
fillingColorList: options.fillingColorList || ["#537EF5"],
|
|
82557
82646
|
sameColorList: !1,
|
|
82558
|
-
minInitFontSize: null !== (
|
|
82559
|
-
minFontSize: null !== (
|
|
82560
|
-
minFillFontSize: null !== (
|
|
82647
|
+
minInitFontSize: null !== (_s = options.minInitFontSize) && void 0 !== _s ? _s : 10,
|
|
82648
|
+
minFontSize: null !== (_t = options.minFontSize) && void 0 !== _t ? _t : 4,
|
|
82649
|
+
minFillFontSize: null !== (_u = options.minFillFontSize) && void 0 !== _u ? _u : 2
|
|
82561
82650
|
},
|
|
82562
82651
|
sameColorList = colorListEqual(wordsConfig.colorList, layoutConfig.fillingColorList);
|
|
82563
82652
|
layoutConfig.sameColorList = sameColorList, initColorScale(data, wordsConfig, layoutConfig, options), initFillingWordsFontSize(data, wordsConfig, layoutConfig, segmentationOutput);
|
|
@@ -82604,8 +82693,8 @@ class Layout {
|
|
|
82604
82693
|
successedWords: successedWords,
|
|
82605
82694
|
failedWords: failedWords
|
|
82606
82695
|
} = cloud(words, layoutConfig, segmentationOutput),
|
|
82607
|
-
textKey = null !== (
|
|
82608
|
-
dataIndexKey = null !== (
|
|
82696
|
+
textKey = null !== (_w = null === (_v = options.text) || void 0 === _v ? void 0 : _v.field) && void 0 !== _w ? _w : "textKey",
|
|
82697
|
+
dataIndexKey = null !== (_x = options.dataIndexKey) && void 0 !== _x ? _x : "defaultDataIndexKey",
|
|
82609
82698
|
as = options.as ? Object.assign(Object.assign({}, OUTPUT), options.as) : OUTPUT;
|
|
82610
82699
|
let w, t;
|
|
82611
82700
|
const modKeywords = [];
|
|
@@ -82620,7 +82709,7 @@ class Layout {
|
|
|
82620
82709
|
successedWords: successedWords,
|
|
82621
82710
|
failedWords: failedWords
|
|
82622
82711
|
});
|
|
82623
|
-
const stage = null === (
|
|
82712
|
+
const stage = null === (_y = this.view.renderer) || void 0 === _y ? void 0 : _y.stage();
|
|
82624
82713
|
stage && stage.hooks.afterRender.tap(WORDCLOUD_SHAPE_HOOK_EVENT.AFTER_WORDCLOUD_SHAPE_DRAW, () => {
|
|
82625
82714
|
this.view.emit(WORDCLOUD_SHAPE_HOOK_EVENT.AFTER_WORDCLOUD_SHAPE_DRAW, {
|
|
82626
82715
|
successedWords: successedWords,
|
|
@@ -86015,7 +86104,7 @@ class SankeySeriesTooltipHelper extends BaseSeriesTooltipHelper {
|
|
|
86015
86104
|
constructor() {
|
|
86016
86105
|
super(...arguments);
|
|
86017
86106
|
this._getDimensionData = (datum) => {
|
|
86018
|
-
if (datum.source) {
|
|
86107
|
+
if (!isNil$1(datum === null || datum === void 0 ? void 0 : datum.source) && !isNil$1(datum === null || datum === void 0 ? void 0 : datum.target)) {
|
|
86019
86108
|
if (isNumber$1(datum.source)) {
|
|
86020
86109
|
const seriesKeys = this.series.getSeriesKeys();
|
|
86021
86110
|
return seriesKeys[datum.source] + ' => ' + seriesKeys[datum.target];
|
package/build/index.js
CHANGED
|
@@ -80522,6 +80522,41 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
80522
80522
|
'rect'
|
|
80523
80523
|
];
|
|
80524
80524
|
|
|
80525
|
+
class WordMeasureCache {
|
|
80526
|
+
constructor(maxSize = 1000) {
|
|
80527
|
+
this._map = new Map();
|
|
80528
|
+
this._maxSize = maxSize;
|
|
80529
|
+
}
|
|
80530
|
+
get(key) {
|
|
80531
|
+
const v = this._map.get(key);
|
|
80532
|
+
if (!v) {
|
|
80533
|
+
return undefined;
|
|
80534
|
+
}
|
|
80535
|
+
this._map.delete(key);
|
|
80536
|
+
this._map.set(key, v);
|
|
80537
|
+
return v;
|
|
80538
|
+
}
|
|
80539
|
+
set(key, value) {
|
|
80540
|
+
if (this._map.has(key)) {
|
|
80541
|
+
this._map.set(key, value);
|
|
80542
|
+
return;
|
|
80543
|
+
}
|
|
80544
|
+
if (this._map.size >= this._maxSize) {
|
|
80545
|
+
const oldest = this._map.keys().next().value;
|
|
80546
|
+
if (oldest !== undefined) {
|
|
80547
|
+
this._map.delete(oldest);
|
|
80548
|
+
}
|
|
80549
|
+
}
|
|
80550
|
+
this._map.set(key, value);
|
|
80551
|
+
}
|
|
80552
|
+
clear() {
|
|
80553
|
+
this._map.clear();
|
|
80554
|
+
}
|
|
80555
|
+
size() {
|
|
80556
|
+
return this._map.size;
|
|
80557
|
+
}
|
|
80558
|
+
}
|
|
80559
|
+
|
|
80525
80560
|
const WORD_CLOUD_TEXT = `${PREFIX}_WORD_CLOUD_TEXT`;
|
|
80526
80561
|
|
|
80527
80562
|
const wordCloudSeriesMark = Object.assign(Object.assign({}, baseSeriesMark), { ["word"]: { name: "word", type: "text" }, ["fillingWord"]: { name: "fillingWord", type: "text" }, ["wordMask"]: { name: "wordMask", type: "rect" } });
|
|
@@ -80598,11 +80633,16 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
80598
80633
|
!SHAPE_TYPE.includes(this._maskShape) &&
|
|
80599
80634
|
!['fast', 'grid', 'cloud'].includes(this._wordCloudConfig.layoutMode);
|
|
80600
80635
|
this._defaultFontFamily = this._option.getTheme().fontFamily;
|
|
80636
|
+
if (!this._wordMeasureCache) {
|
|
80637
|
+
this._wordMeasureCache = new WordMeasureCache(1000);
|
|
80638
|
+
}
|
|
80601
80639
|
}
|
|
80602
80640
|
initData() {
|
|
80603
80641
|
var _a, _b;
|
|
80604
80642
|
super.initData();
|
|
80605
80643
|
(_b = (_a = this.getViewData()) === null || _a === void 0 ? void 0 : _a.target) === null || _b === void 0 ? void 0 : _b.addListener('change', () => {
|
|
80644
|
+
var _a;
|
|
80645
|
+
(_a = this._wordMeasureCache) === null || _a === void 0 ? void 0 : _a.clear();
|
|
80606
80646
|
this._dataChange = true;
|
|
80607
80647
|
this.compile();
|
|
80608
80648
|
});
|
|
@@ -80771,7 +80811,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
80771
80811
|
var _a, _b, _c, _d, _e, _f;
|
|
80772
80812
|
const fillingWordStyleSpec = (_b = (_a = this._spec.fillingWord) === null || _a === void 0 ? void 0 : _a.style) !== null && _b !== void 0 ? _b : {};
|
|
80773
80813
|
const wordCloudShapeConfig = (_c = this._wordCloudShapeConfig) !== null && _c !== void 0 ? _c : {};
|
|
80774
|
-
return Object.assign(Object.assign(Object.assign({}, wordCloudShapeConfig), this._getCommonTransformOptions()), { rotateList: this._rotateAngles, fillingRotateList: wordCloudShapeConfig.fillingRotateAngles, fillingFontFamily: isValid$1(wordCloudShapeConfig.fillingFontFamilyField)
|
|
80814
|
+
return Object.assign(Object.assign(Object.assign({}, wordCloudShapeConfig), this._getCommonTransformOptions()), { measureCache: this._wordMeasureCache, rotateList: this._rotateAngles, fillingRotateList: wordCloudShapeConfig.fillingRotateAngles, fillingFontFamily: isValid$1(wordCloudShapeConfig.fillingFontFamilyField)
|
|
80775
80815
|
? { field: wordCloudShapeConfig.fillingFontFamilyField }
|
|
80776
80816
|
: (_d = fillingWordStyleSpec.fontFamily) !== null && _d !== void 0 ? _d : this._defaultFontFamily, fillingPadding: (_f = (_e = this._spec.fillingWord) === null || _e === void 0 ? void 0 : _e.padding) !== null && _f !== void 0 ? _f : DEFAULT_FONT_PADDING, fillingFontStyle: isValid$1(wordCloudShapeConfig.fillingFontStyleField)
|
|
80777
80817
|
? { field: wordCloudShapeConfig.fillingFontStyleField }
|
|
@@ -80820,6 +80860,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
80820
80860
|
return [this._wordMark];
|
|
80821
80861
|
}
|
|
80822
80862
|
reInit() {
|
|
80863
|
+
var _a;
|
|
80823
80864
|
super.reInit();
|
|
80824
80865
|
if (this._keyWordColorCallback) {
|
|
80825
80866
|
this._keyWordColorCallback = null;
|
|
@@ -80827,6 +80868,13 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
80827
80868
|
if (this._fillingColorCallback) {
|
|
80828
80869
|
this._fillingColorCallback = null;
|
|
80829
80870
|
}
|
|
80871
|
+
(_a = this._wordMeasureCache) === null || _a === void 0 ? void 0 : _a.clear();
|
|
80872
|
+
}
|
|
80873
|
+
release() {
|
|
80874
|
+
var _a;
|
|
80875
|
+
super.release();
|
|
80876
|
+
(_a = this._wordMeasureCache) === null || _a === void 0 ? void 0 : _a.clear();
|
|
80877
|
+
this._wordMeasureCache = undefined;
|
|
80830
80878
|
}
|
|
80831
80879
|
}
|
|
80832
80880
|
BaseWordCloudSeries.mark = wordCloudSeriesMark;
|
|
@@ -81753,6 +81801,30 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
81753
81801
|
!function (WORDCLOUD_SHAPE_HOOK_EVENT) {
|
|
81754
81802
|
WORDCLOUD_SHAPE_HOOK_EVENT.BEFORE_WORDCLOUD_SHAPE_LAYOUT = "beforeWordcloudShapeLayout", WORDCLOUD_SHAPE_HOOK_EVENT.AFTER_WORDCLOUD_SHAPE_LAYOUT = "afterWordcloudShapeLayout", WORDCLOUD_SHAPE_HOOK_EVENT.AFTER_WORDCLOUD_SHAPE_DRAW = "afterWordcloudShapeDraw";
|
|
81755
81803
|
}(WORDCLOUD_SHAPE_HOOK_EVENT || (WORDCLOUD_SHAPE_HOOK_EVENT = {}));
|
|
81804
|
+
class MapWordMeasureCache {
|
|
81805
|
+
constructor(maxSize = 1e3) {
|
|
81806
|
+
this._map = new Map(), this._maxSize = maxSize;
|
|
81807
|
+
}
|
|
81808
|
+
get(key) {
|
|
81809
|
+
const value = this._map.get(key);
|
|
81810
|
+
if (void 0 !== value) return this._map.delete(key), this._map.set(key, value), value;
|
|
81811
|
+
}
|
|
81812
|
+
set(key, value) {
|
|
81813
|
+
if (this._map.has(key)) this._map.set(key, value);else {
|
|
81814
|
+
if (this._map.size >= this._maxSize) {
|
|
81815
|
+
const firstKey = this._map.keys().next().value;
|
|
81816
|
+
void 0 !== firstKey && this._map.delete(firstKey);
|
|
81817
|
+
}
|
|
81818
|
+
this._map.set(key, value);
|
|
81819
|
+
}
|
|
81820
|
+
}
|
|
81821
|
+
clear() {
|
|
81822
|
+
this._map.clear();
|
|
81823
|
+
}
|
|
81824
|
+
size() {
|
|
81825
|
+
return this._map.size;
|
|
81826
|
+
}
|
|
81827
|
+
}
|
|
81756
81828
|
const colorListEqual = (arr0, arr1) => {
|
|
81757
81829
|
if (1 === arr1.length && "#537EF5" === arr1[0]) return !0;
|
|
81758
81830
|
if (!Array.isArray(arr0) || !Array.isArray(arr1) || arr0.length !== arr1.length) return !1;
|
|
@@ -81992,7 +82064,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
81992
82064
|
ratio: ratio
|
|
81993
82065
|
} = region;
|
|
81994
82066
|
for (let i = 0; i < regionWords.length; i++) {
|
|
81995
|
-
measureSprite(canvas, ctx, words, i);
|
|
82067
|
+
measureSprite(canvas, ctx, words, i, layoutConfig.measureCache);
|
|
81996
82068
|
const word = regionWords[i];
|
|
81997
82069
|
word.x = center[0], word.y = center[1], word.hasText && word.sprite && place$1(board, word, maxR, ratio, size, boardSize, stepFactor) && (word.hasPlaced = !0);
|
|
81998
82070
|
}
|
|
@@ -82002,7 +82074,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
82002
82074
|
if (0 === failedWords.length) break;
|
|
82003
82075
|
for (let i = 0; i < failedWords.length; i++) {
|
|
82004
82076
|
const word = failedWords[i];
|
|
82005
|
-
measureSprite(canvas, ctx, failedWords, i), word.x = shapeCenter[0], word.y = shapeCenter[1], word.hasText && place$1(board, word, shapeMaxR, shapeRatio, size, boardSize, stepFactor) && (word.hasPlaced = !0);
|
|
82077
|
+
measureSprite(canvas, ctx, failedWords, i, layoutConfig.measureCache), word.x = shapeCenter[0], word.y = shapeCenter[1], word.hasText && place$1(board, word, shapeMaxR, shapeRatio, size, boardSize, stepFactor) && (word.hasPlaced = !0);
|
|
82006
82078
|
}
|
|
82007
82079
|
}
|
|
82008
82080
|
layoutConfig.board = board;
|
|
@@ -82048,7 +82120,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
82048
82120
|
} = region;
|
|
82049
82121
|
let restartTag = !1;
|
|
82050
82122
|
for (let i = 0; i < regionWords.length; i++) {
|
|
82051
|
-
measureSprite(canvas, ctx, words, i);
|
|
82123
|
+
measureSprite(canvas, ctx, words, i, layoutConfig.measureCache);
|
|
82052
82124
|
const word = regionWords[i];
|
|
82053
82125
|
if (word.x = center[0], word.y = center[1], !word.skip && word.hasText && word.sprite && place$1(board, word, maxR, ratio, size, boardSize, stepFactor)) word.hasPlaced = !0;else {
|
|
82054
82126
|
if (!word.skip && word.weight > weightStd && globalShinkFactor > globalShinkLimit) {
|
|
@@ -82073,7 +82145,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
82073
82145
|
if (0 === failedWords.length) break;
|
|
82074
82146
|
for (let i = 0; i < failedWords.length; i++) {
|
|
82075
82147
|
const word = failedWords[i];
|
|
82076
|
-
measureSprite(canvas, ctx, failedWords, i), word.x = shapeCenter[0], word.y = shapeCenter[1], word.hasText && place$1(board, word, shapeMaxR, shapeRatio, size, boardSize, stepFactor) && (word.hasPlaced = !0);
|
|
82148
|
+
measureSprite(canvas, ctx, failedWords, i, layoutConfig.measureCache), word.x = shapeCenter[0], word.y = shapeCenter[1], word.hasText && place$1(board, word, shapeMaxR, shapeRatio, size, boardSize, stepFactor) && (word.hasPlaced = !0);
|
|
82077
82149
|
}
|
|
82078
82150
|
}
|
|
82079
82151
|
layoutConfig.board = board;
|
|
@@ -82118,7 +82190,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
82118
82190
|
} = region;
|
|
82119
82191
|
let restartTag = !1;
|
|
82120
82192
|
for (let i = 0; i < regionWords.length; i++) {
|
|
82121
|
-
measureSprite(canvas, ctx, words, i);
|
|
82193
|
+
measureSprite(canvas, ctx, words, i, layoutConfig.measureCache);
|
|
82122
82194
|
const word = regionWords[i];
|
|
82123
82195
|
if (word.x = center[0], word.y = center[1], word.hasText && word.sprite && place$1(board, word, maxR, ratio, size, boardSize, stepFactor)) {
|
|
82124
82196
|
if (word.hasPlaced = !0, word.weight >= weightStd && importantWordSuccessedNum++, importantWordSuccessedNum >= importantCount && !layoutFinish) {
|
|
@@ -82144,7 +82216,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
82144
82216
|
if (0 === failedWords.length) break;
|
|
82145
82217
|
for (let i = 0; i < failedWords.length; i++) {
|
|
82146
82218
|
const word = failedWords[i];
|
|
82147
|
-
measureSprite(canvas, ctx, failedWords, i), word.x = shapeCenter[0], word.y = shapeCenter[1], word.hasText && place$1(board, word, shapeMaxR, shapeRatio, size, boardSize, stepFactor) && (word.hasPlaced = !0);
|
|
82219
|
+
measureSprite(canvas, ctx, failedWords, i, layoutConfig.measureCache), word.x = shapeCenter[0], word.y = shapeCenter[1], word.hasText && place$1(board, word, shapeMaxR, shapeRatio, size, boardSize, stepFactor) && (word.hasPlaced = !0);
|
|
82148
82220
|
}
|
|
82149
82221
|
}
|
|
82150
82222
|
layoutConfig.board = board;
|
|
@@ -82223,8 +82295,13 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
82223
82295
|
return [ratio * (t *= .1) * Math.cos(t), t * Math.sin(t)];
|
|
82224
82296
|
};
|
|
82225
82297
|
}
|
|
82226
|
-
function measureSprite(canvas, ctx, words, wi) {
|
|
82227
|
-
|
|
82298
|
+
function measureSprite(canvas, ctx, words, wi, cache) {
|
|
82299
|
+
const targetWord = words[wi];
|
|
82300
|
+
if (targetWord.sprite || 0 === targetWord.fontSize) return;
|
|
82301
|
+
if (cache) {
|
|
82302
|
+
const cached = cache.get(getWordMeasureKey(targetWord));
|
|
82303
|
+
if (cached) return targetWord.sprite = cached.sprite, targetWord.bounds = cached.bounds, targetWord.wordSize = cached.wordSize, void (targetWord.hasText = !0);
|
|
82304
|
+
}
|
|
82228
82305
|
const cw = 2048,
|
|
82229
82306
|
radians = Math.PI / 180,
|
|
82230
82307
|
n = words.length;
|
|
@@ -82287,14 +82364,25 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
82287
82364
|
}
|
|
82288
82365
|
seen && (j < dTop && (dTop = j), j > dBottom && (dBottom = j));
|
|
82289
82366
|
}
|
|
82290
|
-
word.bounds = {
|
|
82367
|
+
if (word.bounds = {
|
|
82291
82368
|
dTop: (wordSize[1] >> 1) - dTop,
|
|
82292
82369
|
dBottom: dBottom - (wordSize[1] >> 1),
|
|
82293
82370
|
dLeft: (wordSize[0] >> 1) - dLeft,
|
|
82294
82371
|
dRight: dRight - (wordSize[0] >> 1)
|
|
82295
|
-
}, word.sprite = sprite,
|
|
82372
|
+
}, word.sprite = sprite, cache) {
|
|
82373
|
+
const key = getWordMeasureKey(word);
|
|
82374
|
+
cache.set(key, {
|
|
82375
|
+
sprite: sprite,
|
|
82376
|
+
bounds: word.bounds,
|
|
82377
|
+
wordSize: wordSize
|
|
82378
|
+
});
|
|
82379
|
+
}
|
|
82380
|
+
delete word.LT;
|
|
82296
82381
|
}
|
|
82297
82382
|
}
|
|
82383
|
+
function getWordMeasureKey(word) {
|
|
82384
|
+
return String(word.text) + "|" + String(word.fontFamily) + "|" + String(word.fontStyle) + "|" + String(word.fontWeight) + "|" + String(word.fontSize) + "|" + String(word.rotate) + "|" + String(word.padding);
|
|
82385
|
+
}
|
|
82298
82386
|
function initBoardWithShape(segmentationOutput) {
|
|
82299
82387
|
const {
|
|
82300
82388
|
segmentation: {
|
|
@@ -82391,7 +82479,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
82391
82479
|
} = shapeBounds,
|
|
82392
82480
|
[startX, startY] = [x1 + ~~(randomGenerator() * fillingXStep * 2), y1 + ~~(randomGenerator() * fillingYStep * 2)];
|
|
82393
82481
|
for (let y = startY; y <= y2; y += fillingYStep) for (let x = startX; x <= x2; x += fillingXStep) {
|
|
82394
|
-
measureSprite(canvas, ctx, fillingWords, wi);
|
|
82482
|
+
measureSprite(canvas, ctx, fillingWords, wi, layoutConfig.measureCache);
|
|
82395
82483
|
const word = fillingWords[wi];
|
|
82396
82484
|
word.x = x, word.y = y;
|
|
82397
82485
|
const {
|
|
@@ -82508,7 +82596,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
82508
82596
|
return this.progressiveResult;
|
|
82509
82597
|
}
|
|
82510
82598
|
doLayout() {
|
|
82511
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
82599
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
82512
82600
|
const segmentationInput = this.segmentationInput,
|
|
82513
82601
|
segmentationOutput = segmentation(segmentationInput);
|
|
82514
82602
|
if (!segmentationOutput.segmentation.regions.length) return;
|
|
@@ -82535,35 +82623,36 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
82535
82623
|
const layoutConfig = {
|
|
82536
82624
|
size: options.size,
|
|
82537
82625
|
ratio: options.ratio || .8,
|
|
82626
|
+
measureCache: null !== (_a = options.measureCache) && void 0 !== _a ? _a : new MapWordMeasureCache(),
|
|
82538
82627
|
shapeUrl: options.shape,
|
|
82539
82628
|
random: void 0 === options.random || options.random,
|
|
82540
|
-
textLayoutTimes: null !== (
|
|
82629
|
+
textLayoutTimes: null !== (_b = options.textLayoutTimes) && void 0 !== _b ? _b : 3,
|
|
82541
82630
|
removeWhiteBorder: options.removeWhiteBorder,
|
|
82542
|
-
layoutMode: null !== (
|
|
82543
|
-
fontSizeShrinkFactor: null !== (
|
|
82544
|
-
stepFactor: null !== (
|
|
82545
|
-
importantWordCount: null !== (
|
|
82631
|
+
layoutMode: null !== (_c = options.layoutMode) && void 0 !== _c ? _c : "default",
|
|
82632
|
+
fontSizeShrinkFactor: null !== (_d = options.fontSizeShrinkFactor) && void 0 !== _d ? _d : .8,
|
|
82633
|
+
stepFactor: null !== (_e = options.stepFactor) && void 0 !== _e ? _e : 1,
|
|
82634
|
+
importantWordCount: null !== (_f = options.importantWordCount) && void 0 !== _f ? _f : 10,
|
|
82546
82635
|
globalShinkLimit: options.globalShinkLimit || .2,
|
|
82547
|
-
fontSizeEnlargeFactor: null !== (
|
|
82548
|
-
fillingRatio: null !== (
|
|
82549
|
-
fillingTimes: null !== (
|
|
82550
|
-
fillingXStep: options.fillingXRatioStep ? Math.max(Math.floor(options.size[0] * options.fillingXRatioStep), 1) : null !== (
|
|
82551
|
-
fillingYStep: options.fillingYRatioStep ? Math.max(Math.floor(options.size[1] * options.fillingYRatioStep), 1) : null !== (
|
|
82636
|
+
fontSizeEnlargeFactor: null !== (_g = options.fontSizeEnlargeFactor) && void 0 !== _g ? _g : 1.5,
|
|
82637
|
+
fillingRatio: null !== (_h = options.fillingRatio) && void 0 !== _h ? _h : .7,
|
|
82638
|
+
fillingTimes: null !== (_j = options.fillingTimes) && void 0 !== _j ? _j : 4,
|
|
82639
|
+
fillingXStep: options.fillingXRatioStep ? Math.max(Math.floor(options.size[0] * options.fillingXRatioStep), 1) : null !== (_k = options.fillingXStep) && void 0 !== _k ? _k : 4,
|
|
82640
|
+
fillingYStep: options.fillingYRatioStep ? Math.max(Math.floor(options.size[1] * options.fillingYRatioStep), 1) : null !== (_l = options.fillingYStep) && void 0 !== _l ? _l : 4,
|
|
82552
82641
|
fillingInitialFontSize: options.fillingInitialFontSize,
|
|
82553
82642
|
fillingDeltaFontSize: options.fillingDeltaFontSize,
|
|
82554
|
-
fillingInitialOpacity: null !== (
|
|
82555
|
-
fillingDeltaOpacity: null !== (
|
|
82643
|
+
fillingInitialOpacity: null !== (_m = options.fillingInitialOpacity) && void 0 !== _m ? _m : .8,
|
|
82644
|
+
fillingDeltaOpacity: null !== (_o = options.fillingDeltaOpacity) && void 0 !== _o ? _o : .05,
|
|
82556
82645
|
getFillingFontFamily: field(options.fillingFontFamily || "sans-serif"),
|
|
82557
82646
|
getFillingFontStyle: field(options.fillingFontStyle || "normal"),
|
|
82558
82647
|
getFillingFontWeight: field(options.fillingFontWeight || "normal"),
|
|
82559
|
-
getFillingPadding: field(null !== (
|
|
82560
|
-
fillingRotateList: null !== (
|
|
82561
|
-
fillingDeltaFontSizeFactor: null !== (
|
|
82648
|
+
getFillingPadding: field(null !== (_p = options.fillingPadding) && void 0 !== _p ? _p : .4),
|
|
82649
|
+
fillingRotateList: null !== (_q = options.fillingRotateList) && void 0 !== _q ? _q : [0, 90],
|
|
82650
|
+
fillingDeltaFontSizeFactor: null !== (_r = options.fillingDeltaFontSizeFactor) && void 0 !== _r ? _r : .2,
|
|
82562
82651
|
fillingColorList: options.fillingColorList || ["#537EF5"],
|
|
82563
82652
|
sameColorList: !1,
|
|
82564
|
-
minInitFontSize: null !== (
|
|
82565
|
-
minFontSize: null !== (
|
|
82566
|
-
minFillFontSize: null !== (
|
|
82653
|
+
minInitFontSize: null !== (_s = options.minInitFontSize) && void 0 !== _s ? _s : 10,
|
|
82654
|
+
minFontSize: null !== (_t = options.minFontSize) && void 0 !== _t ? _t : 4,
|
|
82655
|
+
minFillFontSize: null !== (_u = options.minFillFontSize) && void 0 !== _u ? _u : 2
|
|
82567
82656
|
},
|
|
82568
82657
|
sameColorList = colorListEqual(wordsConfig.colorList, layoutConfig.fillingColorList);
|
|
82569
82658
|
layoutConfig.sameColorList = sameColorList, initColorScale(data, wordsConfig, layoutConfig, options), initFillingWordsFontSize(data, wordsConfig, layoutConfig, segmentationOutput);
|
|
@@ -82610,8 +82699,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
82610
82699
|
successedWords: successedWords,
|
|
82611
82700
|
failedWords: failedWords
|
|
82612
82701
|
} = cloud(words, layoutConfig, segmentationOutput),
|
|
82613
|
-
textKey = null !== (
|
|
82614
|
-
dataIndexKey = null !== (
|
|
82702
|
+
textKey = null !== (_w = null === (_v = options.text) || void 0 === _v ? void 0 : _v.field) && void 0 !== _w ? _w : "textKey",
|
|
82703
|
+
dataIndexKey = null !== (_x = options.dataIndexKey) && void 0 !== _x ? _x : "defaultDataIndexKey",
|
|
82615
82704
|
as = options.as ? Object.assign(Object.assign({}, OUTPUT), options.as) : OUTPUT;
|
|
82616
82705
|
let w, t;
|
|
82617
82706
|
const modKeywords = [];
|
|
@@ -82626,7 +82715,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
82626
82715
|
successedWords: successedWords,
|
|
82627
82716
|
failedWords: failedWords
|
|
82628
82717
|
});
|
|
82629
|
-
const stage = null === (
|
|
82718
|
+
const stage = null === (_y = this.view.renderer) || void 0 === _y ? void 0 : _y.stage();
|
|
82630
82719
|
stage && stage.hooks.afterRender.tap(WORDCLOUD_SHAPE_HOOK_EVENT.AFTER_WORDCLOUD_SHAPE_DRAW, () => {
|
|
82631
82720
|
this.view.emit(WORDCLOUD_SHAPE_HOOK_EVENT.AFTER_WORDCLOUD_SHAPE_DRAW, {
|
|
82632
82721
|
successedWords: successedWords,
|
|
@@ -86021,7 +86110,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
86021
86110
|
constructor() {
|
|
86022
86111
|
super(...arguments);
|
|
86023
86112
|
this._getDimensionData = (datum) => {
|
|
86024
|
-
if (datum.source) {
|
|
86113
|
+
if (!isNil$1(datum === null || datum === void 0 ? void 0 : datum.source) && !isNil$1(datum === null || datum === void 0 ? void 0 : datum.target)) {
|
|
86025
86114
|
if (isNumber$1(datum.source)) {
|
|
86026
86115
|
const seriesKeys = this.series.getSeriesKeys();
|
|
86027
86116
|
return seriesKeys[datum.source] + ' => ' + seriesKeys[datum.target];
|