@visactor/vchart 1.1.3 → 1.1.4-beta.1
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/index.js +58 -53
- package/build/index.min.js +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/series/radar/radar.js +2 -2
- package/cjs/series/radar/radar.js.map +1 -1
- package/cjs/series/word-cloud/base.d.ts +1 -0
- package/cjs/series/word-cloud/base.js +35 -32
- package/cjs/series/word-cloud/base.js.map +1 -1
- package/cjs/series/word-cloud/word-cloud-3d.js +33 -33
- package/cjs/series/word-cloud/word-cloud-3d.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/series/radar/radar.js +2 -2
- package/esm/series/radar/radar.js.map +1 -1
- package/esm/series/word-cloud/base.d.ts +1 -0
- package/esm/series/word-cloud/base.js +35 -32
- package/esm/series/word-cloud/base.js.map +1 -1
- package/esm/series/word-cloud/word-cloud-3d.js +33 -33
- package/esm/series/word-cloud/word-cloud-3d.js.map +1 -1
- package/package.json +1 -1
package/cjs/core/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { VChart } from './vchart';
|
|
2
2
|
import { Factory } from './factory';
|
|
3
3
|
export { VChart, Factory };
|
|
4
|
-
export declare const version = "1.1.
|
|
4
|
+
export declare const version = "1.1.4-beta.1";
|
|
5
5
|
export type { IVChart } from './interface';
|
|
6
6
|
export * from '../event/interface';
|
|
7
7
|
export * from '../typings/spec/common';
|
package/cjs/core/index.js
CHANGED
|
@@ -41,7 +41,7 @@ const region_1 = require("../region/region"), base_layout_1 = require("../layout
|
|
|
41
41
|
|
|
42
42
|
vchart_1.VChart.useMark([ component_1.ComponentMark, group_1.GroupMark, image_1.ImageMark ]),
|
|
43
43
|
factory_1.Factory.registerRegion("region", region_1.Region), factory_1.Factory.registerLayout("base", base_layout_1.Layout),
|
|
44
|
-
exports.version = "1.1.
|
|
44
|
+
exports.version = "1.1.4-beta.1", __exportStar(require("../event/interface"), exports),
|
|
45
45
|
__exportStar(require("../typings/spec/common"), exports), __exportStar(require("../theme/interface"), exports),
|
|
46
46
|
vutils_1.Logger.getInstance(vutils_1.LoggerLevel.Error);
|
|
47
47
|
//# sourceMappingURL=index.js.map
|
package/cjs/core/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,6CAAuD;AAKvD,qCAAkC;AAiBzB,uFAjBA,eAAM,OAiBA;AAhBf,uCAAoC;AAgBnB,wFAhBR,iBAAO,OAgBQ;AAfxB,6CAA0C;AAC1C,uDAA+C;AAC/C,yCAA0C;AAC1C,iDAAkD;AAClD,2CAA4C;AAG5C,eAAM,CAAC,OAAO,CAAC,CAAC,yBAAa,EAAE,iBAAS,EAAE,iBAAS,CAAC,CAAC,CAAC;AAGtD,iBAAO,CAAC,cAAc,CAAC,QAAQ,EAAE,eAAa,CAAC,CAAC;AAGhD,iBAAO,CAAC,cAAc,CAAC,MAAM,EAAE,oBAAa,CAAC,CAAC;AAKjC,QAAA,OAAO,GAAG,
|
|
1
|
+
{"version":3,"sources":["../src/core/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,6CAAuD;AAKvD,qCAAkC;AAiBzB,uFAjBA,eAAM,OAiBA;AAhBf,uCAAoC;AAgBnB,wFAhBR,iBAAO,OAgBQ;AAfxB,6CAA0C;AAC1C,uDAA+C;AAC/C,yCAA0C;AAC1C,iDAAkD;AAClD,2CAA4C;AAG5C,eAAM,CAAC,OAAO,CAAC,CAAC,yBAAa,EAAE,iBAAS,EAAE,iBAAS,CAAC,CAAC,CAAC;AAGtD,iBAAO,CAAC,cAAc,CAAC,QAAQ,EAAE,eAAa,CAAC,CAAC;AAGhD,iBAAO,CAAC,cAAc,CAAC,MAAM,EAAE,oBAAa,CAAC,CAAC;AAKjC,QAAA,OAAO,GAAG,cAAc,CAAC;AAKtC,qDAAmC;AACnC,yDAAuC;AAEvC,qDAAmC;AAGnC,eAAM,CAAC,WAAW,CAAC,oBAAW,CAAC,KAAK,CAAC,CAAC","file":"index.js","sourcesContent":["import { Logger, LoggerLevel } from '@visactor/vutils';\n/**\n * @description The core module of VChart, containing the necessary interfaces for using VChart.\n */\n\nimport { VChart } from './vchart';\nimport { Factory } from './factory';\nimport { Region } from '../region/region';\nimport { Layout } from '../layout/base-layout';\nimport { GroupMark } from '../mark/group';\nimport { ComponentMark } from '../mark/component';\nimport { ImageMark } from './../mark/image';\n\n// register groupMark and componentMark\nVChart.useMark([ComponentMark, GroupMark, ImageMark]);\n\n// install region module\nFactory.registerRegion('region', Region as any);\n\n// install layout module\nFactory.registerLayout('base', Layout as any);\n\nexport { VChart, Factory };\n\n// export the version\nexport const version = \"1.1.4-beta.1\";\n\n// export necessary types\nexport type { IVChart } from './interface';\n// the event types\nexport * from '../event/interface';\nexport * from '../typings/spec/common';\nexport type { IStateSpec, StateValueType } from '../compile/mark';\nexport * from '../theme/interface';\n\n// set default logger level to Level.error\nLogger.getInstance(LoggerLevel.Error);\n"]}
|
|
@@ -39,10 +39,10 @@ class RadarSeries extends rose_like_1.RoseLikeSeries {
|
|
|
39
39
|
areaMark && (this.setMarkStyle(areaMark, {
|
|
40
40
|
x: this.dataToPositionX.bind(this),
|
|
41
41
|
y: this.dataToPositionY.bind(this),
|
|
42
|
-
x1: datum => datum && this.angleAxisHelper && this.radiusAxisHelper ? this.valueToPosition(this.getDatumPositionValues(datum, this._angleField), this._stack ? this.getDatumPositionValues(datum, this._innerRadiusField) : 0).x : Number.NaN,
|
|
42
|
+
x1: datum => datum && this.angleAxisHelper && this.radiusAxisHelper ? this.valueToPosition(this.getDatumPositionValues(datum, this._angleField), this._stack ? this.getDatumPositionValues(datum, this._innerRadiusField) : this.radiusScale.domain()[0]).x : Number.NaN,
|
|
43
43
|
y1: datum => {
|
|
44
44
|
if (!datum || !this.angleAxisHelper || !this.radiusAxisHelper) return Number.NaN;
|
|
45
|
-
return this.valueToPosition(this.getDatumPositionValues(datum, this._angleField), this._stack ? this.getDatumPositionValues(datum, this._innerRadiusField) : 0).y;
|
|
45
|
+
return this.valueToPosition(this.getDatumPositionValues(datum, this._angleField), this._stack ? this.getDatumPositionValues(datum, this._innerRadiusField) : this.radiusScale.domain()[0]).y;
|
|
46
46
|
},
|
|
47
47
|
fill: this.getColorAttribute(),
|
|
48
48
|
curveType: typings_1.DEFAULT_LINEAR_CLOSED_INTERPOLATE
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/series/radar/radar.ts"],"names":[],"mappings":";;;AACA,oDAAiF;AAGjF,oDAAoD;AACpD,6CAAoE;AACpE,2CAAkE;AAElE,qCAA8C;AAE9C,4CAAkE;AAClE,6CAAyC;AAEzC,iDAA6E;AAC7E,mDAAgE;AAEhE,kDAAoD;AAGpD,qDAAiD;AACjD,8CAA2C;AAC3C,0CAA2C;AAC3C,0CAA2C;AAC3C,8CAA+C;AAC/C,0CAA2C;AAE3C,eAAM,CAAC,OAAO,CAAC,CAAC,eAAQ,EAAE,eAAQ,EAAE,mBAAU,EAAE,eAAQ,CAAC,CAAC,CAAC;AAe3D,MAAa,WAAY,SAAQ,0BAAgC;IAAjE;;QAEE,SAAI,GAAG,0BAAc,CAAC,KAAK,CAAC;IA2H9B,CAAC;IA/GC,UAAU;IAEV,CAAC;IAED,QAAQ;;QACN,MAAM,WAAW,GAAG;YAClB,eAAe,EAAE,IAAI,CAAC,KAAK,CAAC,eAAe;YAC3C,oBAAoB,EAAE,IAAI,CAAC,KAAK,CAAC,oBAAoB;YACrD,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK;YACvB,cAAc,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc;SAC1C,CAAC;QAEF,MAAM,aAAa,GAAG,CAAA,MAAA,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AAA,2BAAmB,EAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CACzG,CAAC;aACH;QACH,CAAC,CAAC,CAAC;IACL,CAAC;;AA5HH,kCA6HC;AA5HiB,gBAAI,GAAW,0BAAc,CAAC,KAAK,CAAC;AAGpC,gBAAI,iDACf,wBAAU,CAAC,IAAI,GACf,kCAAqB,KACxB,CAAC,8BAAkB,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,8BAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,wBAAY,CAAC,IAAI,EAAE,IACrF;AAuHJ,IAAA,cAAK,EAAC,WAAW,EAAE,gCAAmB,CAAC,CAAC","file":"radar.js","sourcesContent":["/* eslint-disable no-duplicate-imports */\nimport { LineLikeSeriesMixin, lineLikeSeriesMarkMap } from '../mixin/line-mixin';\nimport type { ILineMark } from '../../mark/line';\nimport type { IMark, IMarkProgressiveConfig } from '../../mark/interface';\nimport { MarkTypeEnum } from '../../mark/interface';\nimport { AttributeLevel, POLAR_START_RADIAN } from '../../constant';\nimport { DEFAULT_LINEAR_CLOSED_INTERPOLATE } from '../../typings';\nimport type { Datum, IPoint, IPolarPoint, Maybe } from '../../typings';\nimport { isValid, radians } from '../../util';\nimport type { SeriesMarkMap } from '../interface';\nimport { SeriesMarkNameEnum, SeriesTypeEnum } from '../interface';\nimport { mixin } from '@visactor/vutils';\nimport type { IRadarSeriesSpec, IRadarSeriesTheme } from './interface';\nimport { animationConfig, userAnimationConfig } from '../../animation/utils';\nimport { DEFAULT_MARK_ANIMATION } from '../../animation/config';\nimport type { IRadarAnimationParams, RadarAppearPreset } from './animation';\nimport { RoseLikeSeries } from '../polar/rose-like';\nimport type { IStateAnimateSpec } from '../../animation/spec';\nimport type { IAreaMark } from '../../mark/area';\nimport { BaseSeries } from '../base/base-series';\nimport { VChart } from '../../core/vchart';\nimport { AreaMark } from '../../mark/area';\nimport { LineMark } from '../../mark/line';\nimport { SymbolMark } from '../../mark/symbol';\nimport { TextMark } from '../../mark/text';\n\nVChart.useMark([AreaMark, LineMark, SymbolMark, TextMark]);\n\nexport interface RadarSeries\n extends Pick<\n LineLikeSeriesMixin,\n | 'initLineMark'\n | 'initSymbolMark'\n | 'initLabelMarkStyle'\n | 'initLineMarkStyle'\n | 'initSymbolMarkStyle'\n | '_lineMark'\n | '_symbolMark'\n >,\n RoseLikeSeries<IRadarSeriesSpec> {}\n\nexport class RadarSeries extends RoseLikeSeries<IRadarSeriesSpec> {\n static readonly type: string = SeriesTypeEnum.radar;\n type = SeriesTypeEnum.radar;\n\n static readonly mark: SeriesMarkMap = {\n ...BaseSeries.mark,\n ...lineLikeSeriesMarkMap,\n [SeriesMarkNameEnum.area]: { name: SeriesMarkNameEnum.area, type: MarkTypeEnum.area }\n };\n\n protected declare _theme: Maybe<IRadarSeriesTheme>;\n\n private _areaMark: ILineMark;\n\n initGroups() {\n // do nothing\n }\n\n initMark(): void {\n const progressive = {\n progressiveStep: this._spec.progressiveStep,\n progressiveThreshold: this._spec.progressiveThreshold,\n large: this._spec.large,\n largeThreshold: this._spec.largeThreshold\n };\n\n const isAreaVisible = this._spec.area?.visible !== false && this._spec.area?.style?.visible !== false;\n this.initAreaMark(progressive, isAreaVisible);\n this.initLineMark(progressive, !isAreaVisible);\n this.initSymbolMark(progressive);\n }\n\n initMarkStyle(): void {\n this.initAreaMarkStyle();\n this.initLineMarkStyle();\n this.initSymbolMarkStyle();\n }\n\n initAreaMark(progressive: IMarkProgressiveConfig, isSeriesMark: boolean) {\n this._areaMark = this._createMark(RadarSeries.mark.area, {\n progressive,\n isSeriesMark\n }) as IAreaMark;\n }\n\n initAreaMarkStyle() {\n const areaMark = this._areaMark;\n if (areaMark) {\n this.setMarkStyle(\n areaMark,\n {\n x: this.dataToPositionX.bind(this),\n y: this.dataToPositionY.bind(this),\n x1: (datum: Datum) => {\n if (!datum || !this.angleAxisHelper || !this.radiusAxisHelper) {\n return Number.NaN;\n }\n\n return this.valueToPosition(\n this.getDatumPositionValues(datum, this._angleField),\n this._stack ? this.getDatumPositionValues(datum, this._innerRadiusField) : 0\n ).x;\n },\n y1: (datum: Datum) => {\n if (!datum || !this.angleAxisHelper || !this.radiusAxisHelper) {\n return Number.NaN;\n }\n const value = this.valueToPosition(\n this.getDatumPositionValues(datum, this._angleField),\n this._stack ? this.getDatumPositionValues(datum, this._innerRadiusField) : 0\n ).y;\n return value;\n },\n fill: this.getColorAttribute(),\n curveType: DEFAULT_LINEAR_CLOSED_INTERPOLATE\n },\n 'normal',\n AttributeLevel.Series\n );\n this._trigger.registerMark(areaMark);\n this._tooltipHelper?.activeTriggerSet.dimension.add(areaMark);\n }\n }\n\n initAnimation() {\n const animationParams: IRadarAnimationParams = {\n center: () => this.angleAxisHelper?.center(),\n radius: () => {\n const rect = this.getLayoutRect();\n return Math.min(rect.width, rect.height);\n },\n startAngle: radians(this._spec.startAngle) ?? POLAR_START_RADIAN,\n pointToCoord: (point: IPoint) => this.angleAxisHelper?.pointToCoord(point),\n coordToPoint: (coord: IPolarPoint) => this.angleAxisHelper.coordToPoint(coord)\n };\n const appearPreset = ((this._spec?.animationAppear as IStateAnimateSpec<RadarAppearPreset>)?.preset ??\n 'clipIn') as RadarAppearPreset;\n\n if (appearPreset === 'clipIn') {\n if (this._rootMark) {\n this._rootMark.setAnimationConfig(\n animationConfig(\n DEFAULT_MARK_ANIMATION.radarGroup(animationParams, appearPreset),\n userAnimationConfig(SeriesMarkNameEnum.group, this._spec)\n )\n );\n }\n }\n\n const markAnimationMap: [IMark, keyof typeof DEFAULT_MARK_ANIMATION][] = [\n [this._areaMark, 'radar'],\n [this._lineMark, 'radar'],\n [this._symbolMark, 'radarSymbol']\n ];\n\n // 为 mark 添加动画\n markAnimationMap.forEach(([mark, animation]) => {\n if (isValid(mark)) {\n const getAnimation = DEFAULT_MARK_ANIMATION[animation];\n mark.setAnimationConfig(\n animationConfig(getAnimation(animationParams, appearPreset), userAnimationConfig(mark.name, this._spec))\n );\n }\n });\n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EAAE,EAAE,IAAI,EAAE,8BAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,wBAAY,CAAC,IAAI,EAAE,IACrF;AAuHJ,IAAA,cAAK,EAAC,WAAW,EAAE,gCAAmB,CAAC,CAAC","file":"radar.js","sourcesContent":["/* eslint-disable no-duplicate-imports */\nimport { LineLikeSeriesMixin, lineLikeSeriesMarkMap } from '../mixin/line-mixin';\nimport type { ILineMark } from '../../mark/line';\nimport type { IMark, IMarkProgressiveConfig } from '../../mark/interface';\nimport { MarkTypeEnum } from '../../mark/interface';\nimport { AttributeLevel, POLAR_START_RADIAN } from '../../constant';\nimport { DEFAULT_LINEAR_CLOSED_INTERPOLATE } from '../../typings';\nimport type { Datum, IPoint, IPolarPoint, Maybe } from '../../typings';\nimport { isValid, radians } from '../../util';\nimport type { SeriesMarkMap } from '../interface';\nimport { SeriesMarkNameEnum, SeriesTypeEnum } from '../interface';\nimport { mixin } from '@visactor/vutils';\nimport type { IRadarSeriesSpec, IRadarSeriesTheme } from './interface';\nimport { animationConfig, userAnimationConfig } from '../../animation/utils';\nimport { DEFAULT_MARK_ANIMATION } from '../../animation/config';\nimport type { IRadarAnimationParams, RadarAppearPreset } from './animation';\nimport { RoseLikeSeries } from '../polar/rose-like';\nimport type { IStateAnimateSpec } from '../../animation/spec';\nimport type { IAreaMark } from '../../mark/area';\nimport { BaseSeries } from '../base/base-series';\nimport { VChart } from '../../core/vchart';\nimport { AreaMark } from '../../mark/area';\nimport { LineMark } from '../../mark/line';\nimport { SymbolMark } from '../../mark/symbol';\nimport { TextMark } from '../../mark/text';\n\nVChart.useMark([AreaMark, LineMark, SymbolMark, TextMark]);\n\nexport interface RadarSeries\n extends Pick<\n LineLikeSeriesMixin,\n | 'initLineMark'\n | 'initSymbolMark'\n | 'initLabelMarkStyle'\n | 'initLineMarkStyle'\n | 'initSymbolMarkStyle'\n | '_lineMark'\n | '_symbolMark'\n >,\n RoseLikeSeries<IRadarSeriesSpec> {}\n\nexport class RadarSeries extends RoseLikeSeries<IRadarSeriesSpec> {\n static readonly type: string = SeriesTypeEnum.radar;\n type = SeriesTypeEnum.radar;\n\n static readonly mark: SeriesMarkMap = {\n ...BaseSeries.mark,\n ...lineLikeSeriesMarkMap,\n [SeriesMarkNameEnum.area]: { name: SeriesMarkNameEnum.area, type: MarkTypeEnum.area }\n };\n\n protected declare _theme: Maybe<IRadarSeriesTheme>;\n\n private _areaMark: ILineMark;\n\n initGroups() {\n // do nothing\n }\n\n initMark(): void {\n const progressive = {\n progressiveStep: this._spec.progressiveStep,\n progressiveThreshold: this._spec.progressiveThreshold,\n large: this._spec.large,\n largeThreshold: this._spec.largeThreshold\n };\n\n const isAreaVisible = this._spec.area?.visible !== false && this._spec.area?.style?.visible !== false;\n this.initAreaMark(progressive, isAreaVisible);\n this.initLineMark(progressive, !isAreaVisible);\n this.initSymbolMark(progressive);\n }\n\n initMarkStyle(): void {\n this.initAreaMarkStyle();\n this.initLineMarkStyle();\n this.initSymbolMarkStyle();\n }\n\n initAreaMark(progressive: IMarkProgressiveConfig, isSeriesMark: boolean) {\n this._areaMark = this._createMark(RadarSeries.mark.area, {\n progressive,\n isSeriesMark\n }) as IAreaMark;\n }\n\n initAreaMarkStyle() {\n const areaMark = this._areaMark;\n if (areaMark) {\n this.setMarkStyle(\n areaMark,\n {\n x: this.dataToPositionX.bind(this),\n y: this.dataToPositionY.bind(this),\n x1: (datum: Datum) => {\n if (!datum || !this.angleAxisHelper || !this.radiusAxisHelper) {\n return Number.NaN;\n }\n return this.valueToPosition(\n this.getDatumPositionValues(datum, this._angleField),\n this._stack ? this.getDatumPositionValues(datum, this._innerRadiusField) : this.radiusScale.domain()[0]\n ).x;\n },\n y1: (datum: Datum) => {\n if (!datum || !this.angleAxisHelper || !this.radiusAxisHelper) {\n return Number.NaN;\n }\n\n const value = this.valueToPosition(\n this.getDatumPositionValues(datum, this._angleField),\n this._stack ? this.getDatumPositionValues(datum, this._innerRadiusField) : this.radiusScale.domain()[0]\n ).y;\n return value;\n },\n fill: this.getColorAttribute(),\n curveType: DEFAULT_LINEAR_CLOSED_INTERPOLATE\n },\n 'normal',\n AttributeLevel.Series\n );\n this._trigger.registerMark(areaMark);\n this._tooltipHelper?.activeTriggerSet.dimension.add(areaMark);\n }\n }\n\n initAnimation() {\n const animationParams: IRadarAnimationParams = {\n center: () => this.angleAxisHelper?.center(),\n radius: () => {\n const rect = this.getLayoutRect();\n return Math.min(rect.width, rect.height);\n },\n startAngle: radians(this._spec.startAngle) ?? POLAR_START_RADIAN,\n pointToCoord: (point: IPoint) => this.angleAxisHelper?.pointToCoord(point),\n coordToPoint: (coord: IPolarPoint) => this.angleAxisHelper.coordToPoint(coord)\n };\n const appearPreset = ((this._spec?.animationAppear as IStateAnimateSpec<RadarAppearPreset>)?.preset ??\n 'clipIn') as RadarAppearPreset;\n\n if (appearPreset === 'clipIn') {\n if (this._rootMark) {\n this._rootMark.setAnimationConfig(\n animationConfig(\n DEFAULT_MARK_ANIMATION.radarGroup(animationParams, appearPreset),\n userAnimationConfig(SeriesMarkNameEnum.group, this._spec)\n )\n );\n }\n }\n\n const markAnimationMap: [IMark, keyof typeof DEFAULT_MARK_ANIMATION][] = [\n [this._areaMark, 'radar'],\n [this._lineMark, 'radar'],\n [this._symbolMark, 'radarSymbol']\n ];\n\n // 为 mark 添加动画\n markAnimationMap.forEach(([mark, animation]) => {\n if (isValid(mark)) {\n const getAnimation = DEFAULT_MARK_ANIMATION[animation];\n mark.setAnimationConfig(\n animationConfig(getAnimation(animationParams, appearPreset), userAnimationConfig(mark.name, this._spec))\n );\n }\n });\n }\n}\n\nmixin(RadarSeries, LineLikeSeriesMixin);\n"]}
|
|
@@ -58,6 +58,7 @@ export declare class BaseWordCloudSeries<T extends IBaseWordCloudSeriesSpec = IB
|
|
|
58
58
|
getStackValueField(): string;
|
|
59
59
|
setValueFieldToStack(): void;
|
|
60
60
|
setValueFieldToPercent(): void;
|
|
61
|
+
onLayoutEnd(ctx: any): void;
|
|
61
62
|
updateSpec(spec: any): {
|
|
62
63
|
change: boolean;
|
|
63
64
|
reMake: boolean;
|
|
@@ -100,7 +100,7 @@ class BaseWordCloudSeries extends base_series_1.BaseSeries {
|
|
|
100
100
|
return 1 === colorList.length && (colorList = [ colorList[0], colorList[0] ]), datum => colorList[0];
|
|
101
101
|
}
|
|
102
102
|
compile() {
|
|
103
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23
|
|
103
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23;
|
|
104
104
|
super.compile();
|
|
105
105
|
const wordCloudTransforms = [], valueField = this._valueField, valueScale = new vscale_1.LinearScale, fontWeightRange = this._fontWeightRange, rotateAngles = this._rotateAngles, fontWeightField = this._fontWeightField, fillingRotateAngles = this._wordCloudShapeConfig.fillingRotateAngles;
|
|
106
106
|
if (valueField) {
|
|
@@ -124,14 +124,14 @@ class BaseWordCloudSeries extends base_series_1.BaseSeries {
|
|
|
124
124
|
as: word_cloud_1.WORD_CLOUD_TEXT,
|
|
125
125
|
callback: this._spec.word.formatMethod
|
|
126
126
|
});
|
|
127
|
-
const textField = (null === (_c = this._spec.word) || void 0 === _c ? void 0 : _c.formatMethod) ? word_cloud_1.WORD_CLOUD_TEXT : this._nameField
|
|
127
|
+
const textField = (null === (_c = this._spec.word) || void 0 === _c ? void 0 : _c.formatMethod) ? word_cloud_1.WORD_CLOUD_TEXT : this._nameField;
|
|
128
128
|
this._isWordCloudShape ? wordCloudTransforms.push({
|
|
129
129
|
type: "wordcloudShape",
|
|
130
130
|
dataIndexKey: constant_1.DEFAULT_DATA_KEY,
|
|
131
|
-
size: [
|
|
131
|
+
size: [ this._region.getLayoutRect().width, this._region.getLayoutRect().height ],
|
|
132
132
|
shape: this._maskShape,
|
|
133
133
|
text: {
|
|
134
|
-
field: (null === (
|
|
134
|
+
field: (null === (_k = this._spec.word) || void 0 === _k ? void 0 : _k.formatMethod) ? word_cloud_1.WORD_CLOUD_TEXT : this._nameField
|
|
135
135
|
},
|
|
136
136
|
fontSize: valueField ? {
|
|
137
137
|
field: valueField
|
|
@@ -139,42 +139,42 @@ class BaseWordCloudSeries extends base_series_1.BaseSeries {
|
|
|
139
139
|
fontSizeRange: this._fontSizeRange,
|
|
140
140
|
padding: this._fontPadding,
|
|
141
141
|
rotateList: rotateAngles,
|
|
142
|
-
fontFamily: null !== (
|
|
142
|
+
fontFamily: null !== (_l = this._fontFamilyField) && void 0 !== _l ? _l : null === (_o = null === (_m = this._spec.word) || void 0 === _m ? void 0 : _m.style) || void 0 === _o ? void 0 : _o.fontFamily,
|
|
143
143
|
fontWeight: fontWeightField ? {
|
|
144
144
|
field: fontWeightField
|
|
145
145
|
} : valueField ? {
|
|
146
146
|
field: word_cloud_1.WORD_CLOUD_WEIGHT
|
|
147
147
|
} : null,
|
|
148
|
-
fontStyle: null !== (
|
|
149
|
-
fillingFontFamily: null !== (
|
|
148
|
+
fontStyle: null !== (_p = this._fontStyleField) && void 0 !== _p ? _p : null === (_r = null === (_q = this._spec.word) || void 0 === _q ? void 0 : _q.style) || void 0 === _r ? void 0 : _r.fontStyle,
|
|
149
|
+
fillingFontFamily: null !== (_t = null === (_s = this._wordCloudShapeConfig) || void 0 === _s ? void 0 : _s.fillingFontFamilyField) && void 0 !== _t ? _t : null === (_v = null === (_u = this._spec.word) || void 0 === _u ? void 0 : _u.style) || void 0 === _v ? void 0 : _v.fontFamily,
|
|
150
150
|
fillingPadding: this._fillingFontPadding,
|
|
151
|
-
fillingFontStyle: null !== (
|
|
152
|
-
fillingFontWeight: null !== (
|
|
151
|
+
fillingFontStyle: null !== (_x = null === (_w = this._wordCloudShapeConfig) || void 0 === _w ? void 0 : _w.fillingFontStyleField) && void 0 !== _x ? _x : null === (_z = null === (_y = this._spec.word) || void 0 === _y ? void 0 : _y.style) || void 0 === _z ? void 0 : _z.fontStyle,
|
|
152
|
+
fillingFontWeight: null !== (_1 = null === (_0 = this._wordCloudShapeConfig) || void 0 === _0 ? void 0 : _0.fillingFontWeightField) && void 0 !== _1 ? _1 : null === (_3 = null === (_2 = this._spec.word) || void 0 === _2 ? void 0 : _2.style) || void 0 === _3 ? void 0 : _3.fontWeight,
|
|
153
153
|
fillingRotateList: fillingRotateAngles,
|
|
154
|
-
fillingTimes: null === (
|
|
155
|
-
fillingXStep: null === (
|
|
156
|
-
fillingYStep: null === (
|
|
157
|
-
fillingXRatioStep: null === (
|
|
158
|
-
fillingYRatioStep: null === (
|
|
159
|
-
fillingInitialOpacity: null === (
|
|
160
|
-
fillingDeltaOpacity: null === (
|
|
161
|
-
fillingInitialFontSize: null === (
|
|
162
|
-
fillingDeltaFontSize: null === (
|
|
163
|
-
ratio: null === (
|
|
164
|
-
fillingRatio: null === (
|
|
165
|
-
removeWhiteBorder: null === (
|
|
166
|
-
textLayoutTimes: null === (
|
|
167
|
-
fontSizeShrinkFactor: null === (
|
|
168
|
-
stepFactor: null === (
|
|
169
|
-
layoutMode: null === (
|
|
170
|
-
importantWordCount: null === (
|
|
171
|
-
globalShinkLimit: null === (
|
|
172
|
-
fontSizeEnlargeFactor: null === (
|
|
173
|
-
fillingDeltaFontSizeFactor: null === (
|
|
154
|
+
fillingTimes: null === (_4 = this._wordCloudShapeConfig) || void 0 === _4 ? void 0 : _4.fillingTimes,
|
|
155
|
+
fillingXStep: null === (_5 = this._wordCloudShapeConfig) || void 0 === _5 ? void 0 : _5.fillingXStep,
|
|
156
|
+
fillingYStep: null === (_6 = this._wordCloudShapeConfig) || void 0 === _6 ? void 0 : _6.fillingYStep,
|
|
157
|
+
fillingXRatioStep: null === (_7 = this._wordCloudShapeConfig) || void 0 === _7 ? void 0 : _7.fillingXRatioStep,
|
|
158
|
+
fillingYRatioStep: null === (_8 = this._wordCloudShapeConfig) || void 0 === _8 ? void 0 : _8.fillingYRatioStep,
|
|
159
|
+
fillingInitialOpacity: null === (_9 = this._wordCloudShapeConfig) || void 0 === _9 ? void 0 : _9.fillingInitialOpacity,
|
|
160
|
+
fillingDeltaOpacity: null === (_10 = this._wordCloudShapeConfig) || void 0 === _10 ? void 0 : _10.fillingDeltaOpacity,
|
|
161
|
+
fillingInitialFontSize: null === (_11 = this._wordCloudShapeConfig) || void 0 === _11 ? void 0 : _11.fillingInitialFontSize,
|
|
162
|
+
fillingDeltaFontSize: null === (_12 = this._wordCloudShapeConfig) || void 0 === _12 ? void 0 : _12.fillingDeltaFontSize,
|
|
163
|
+
ratio: null === (_13 = this._wordCloudShapeConfig) || void 0 === _13 ? void 0 : _13.ratio,
|
|
164
|
+
fillingRatio: null === (_14 = this._wordCloudShapeConfig) || void 0 === _14 ? void 0 : _14.fillingRatio,
|
|
165
|
+
removeWhiteBorder: null === (_15 = this._wordCloudShapeConfig) || void 0 === _15 ? void 0 : _15.removeWhiteBorder,
|
|
166
|
+
textLayoutTimes: null === (_16 = this._wordCloudShapeConfig) || void 0 === _16 ? void 0 : _16.textLayoutTimes,
|
|
167
|
+
fontSizeShrinkFactor: null === (_17 = this._wordCloudShapeConfig) || void 0 === _17 ? void 0 : _17.fontSizeShrinkFactor,
|
|
168
|
+
stepFactor: null === (_18 = this._wordCloudShapeConfig) || void 0 === _18 ? void 0 : _18.stepFactor,
|
|
169
|
+
layoutMode: null === (_19 = this._wordCloudShapeConfig) || void 0 === _19 ? void 0 : _19.layoutMode,
|
|
170
|
+
importantWordCount: null === (_20 = this._wordCloudShapeConfig) || void 0 === _20 ? void 0 : _20.importantWordCount,
|
|
171
|
+
globalShinkLimit: null === (_21 = this._wordCloudShapeConfig) || void 0 === _21 ? void 0 : _21.globalShinkLimit,
|
|
172
|
+
fontSizeEnlargeFactor: null === (_22 = this._wordCloudShapeConfig) || void 0 === _22 ? void 0 : _22.fontSizeEnlargeFactor,
|
|
173
|
+
fillingDeltaFontSizeFactor: null === (_23 = this._wordCloudShapeConfig) || void 0 === _23 ? void 0 : _23.fillingDeltaFontSizeFactor
|
|
174
174
|
}) : (wordCloudTransforms.push({
|
|
175
175
|
type: "wordcloud",
|
|
176
176
|
layoutType: (0, util_1.isTrueBrowser)(this._option.mode) ? this._wordCloudConfig.layoutMode : "fast",
|
|
177
|
-
size: [
|
|
177
|
+
size: [ this._region.getLayoutRect().width, this._region.getLayoutRect().height ],
|
|
178
178
|
shape: this._maskShape,
|
|
179
179
|
dataIndexKey: constant_1.DEFAULT_DATA_KEY,
|
|
180
180
|
text: {
|
|
@@ -188,13 +188,13 @@ class BaseWordCloudSeries extends base_series_1.BaseSeries {
|
|
|
188
188
|
rotate: {
|
|
189
189
|
field: word_cloud_1.WORD_CLOUD_ANGLE
|
|
190
190
|
},
|
|
191
|
-
fontFamily: null !== (
|
|
191
|
+
fontFamily: null !== (_d = this._fontFamilyField) && void 0 !== _d ? _d : null === (_f = null === (_e = this._spec.word) || void 0 === _e ? void 0 : _e.style) || void 0 === _f ? void 0 : _f.fontFamily,
|
|
192
192
|
fontWeight: fontWeightField ? {
|
|
193
193
|
field: fontWeightField
|
|
194
194
|
} : valueField ? {
|
|
195
195
|
field: word_cloud_1.WORD_CLOUD_WEIGHT
|
|
196
196
|
} : null,
|
|
197
|
-
fontStyle: null !== (
|
|
197
|
+
fontStyle: null !== (_g = this._fontStyleField) && void 0 !== _g ? _g : null === (_j = null === (_h = this._spec.word) || void 0 === _h ? void 0 : _h.style) || void 0 === _j ? void 0 : _j.fontStyle,
|
|
198
198
|
randomVisible: this._random,
|
|
199
199
|
clip: "clip" === this._wordCloudConfig.drawOutOfBound,
|
|
200
200
|
shrink: this._wordCloudConfig.zoomToFit.shrink,
|
|
@@ -241,6 +241,9 @@ class BaseWordCloudSeries extends base_series_1.BaseSeries {
|
|
|
241
241
|
}
|
|
242
242
|
setValueFieldToStack() {}
|
|
243
243
|
setValueFieldToPercent() {}
|
|
244
|
+
onLayoutEnd(ctx) {
|
|
245
|
+
super.onLayoutEnd(ctx), this.compile();
|
|
246
|
+
}
|
|
244
247
|
updateSpec(spec) {
|
|
245
248
|
const originalSpec = this._originalSpec, result = super.updateSpec(spec);
|
|
246
249
|
return (0, vutils_1.isEqual)(originalSpec, spec) || (result.reMake = !0, result.reCompile = !0),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/series/word-cloud/base.ts"],"names":[],"mappings":";;;AAEA,6CAA2C;AAC3C,6CAA2C;AAC3C,6CAA6F;AAC7F,oDAAoD;AAGpD,4CAAkD;AAClD,qCAA2C;AAC3C,qCAWkB;AAOlB,qEAA2E;AAC3E,iFAAsF;AAEtF,mDAAgE;AAChE,iDAA6E;AAC7E,6CAA+C;AAC/C,2DAAiD;AACjD,0DAKmC;AACnC,wDAA8D;AAE9D,qDAAiD;AACjD,yEAAoE;AACpE,8CAA2C;AAC3C,0CAA2C;AAE3C,eAAM,CAAC,OAAO,CAAC,CAAC,eAAQ,CAAC,CAAC,CAAC;AAE3B,IAAA,gDAA2B,GAAE,CAAC;AAC9B,IAAA,2DAAgC,GAAE,CAAC;AAInC,MAAa,mBAAmF,SAAQ,wBAAa;IAArH;;QAyBY,mBAAc,GAAsB,CAAC,8BAAqB,EAAE,8BAAqB,CAAC,CAAC;QAQnF,sBAAiB,GAAY,KAAK,CAAC;IAwW/C,CAAC;IAhYC,aAAa,CAAC,KAAa;QACzB,IAAI,IAAA,gBAAO,EAAC,KAAK,CAAC,EAAE;YAClB,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;YACzB,IAAI,CAAC,gBAAgB,CAAC,+BAAsB,CAAC,CAAC;SAC/C;IACH,CAAC;IAYD,gBAAgB,CAAC,aAA+B;QAC9C,IAAI,IAAA,gBAAO,EAAC,aAAa,CAAC,IAAI,IAAA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,GAAG,IAAI,CAAC;YACxB,OAAO,MAAM,CAAC;SACf;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;;AAxYH,kDAyYC;AAxYiB,wBAAI,mCACf,wBAAU,CAAC,IAAI,KAClB,CAAC,8BAAkB,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,8BAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,wBAAY,CAAC,IAAI,EAAE,EACrF,CAAC,8BAAkB,CAAC,WAAW,CAAC,EAAE,EAAE,IAAI,EAAE,8BAAkB,CAAC,WAAW,EAAE,IAAI,EAAE,wBAAY,CAAC,IAAI,EAAE,IACnG","file":"base.js","sourcesContent":["/* eslint-disable no-duplicate-imports */\nimport type { IPadding } from '@visactor/vutils';\nimport { isEqual } from '@visactor/vutils';\nimport { isValid } from '@visactor/vutils';\nimport { AttributeLevel, DEFAULT_DATA_KEY, DEFAULT_DATA_SERIES_FIELD } from '../../constant';\nimport { MarkTypeEnum } from '../../mark/interface';\nimport type { ITextMark } from '../../mark/text';\nimport type { SeriesMarkMap } from '../interface';\nimport { SeriesMarkNameEnum } from '../interface';\nimport { isTrueBrowser } from '../../util';\nimport {\n DEFAULT_DRAW_OUT_OF_BOUND,\n DEFAULT_FONTSIZE_RANGE,\n DEFAULT_FONT_PADDING,\n DEFAULT_FONT_WEIGHT_RANGE,\n DEFAULT_MASK_SHAPE,\n DEFAULT_MIN_FONT_SIZE,\n DEFAULT_RANDOM,\n DEFAULT_ROTATE_ANGLES,\n DEFAULT_ZOOM_TO_FIT,\n SHAPE_TYPE\n} from './config';\nimport type {\n IWordCloudSeriesSpec,\n WordCloudConfigType,\n WordCloudShapeConfigType,\n WordCloudShapeType\n} from './interface';\nimport { registerWordCloudTransforms } from '@visactor/vgrammar-wordcloud';\nimport { registerWordCloudShapeTransforms } from '@visactor/vgrammar-wordcloud-shape';\nimport type { Datum, IPoint } from '../../typings';\nimport { DEFAULT_MARK_ANIMATION } from '../../animation/config';\nimport { animationConfig, userAnimationConfig } from '../../animation/utils';\nimport { LinearScale } from '@visactor/vscale';\nimport { extent } from '@visactor/vgrammar-util';\nimport {\n WORD_CLOUD_ANGLE,\n WORD_CLOUD_FILLING_ANGLE,\n WORD_CLOUD_TEXT,\n WORD_CLOUD_WEIGHT\n} from '../../constant/word-cloud';\nimport { getDataScheme } from '../../theme/color-scheme/util';\nimport type { ICompilableMark } from '../../compile/mark';\nimport { BaseSeries } from '../base/base-series';\nimport { ColorOrdinalScale } from '../../scale/color-ordinal-scale';\nimport { VChart } from '../../core/vchart';\nimport { TextMark } from '../../mark/text';\n\nVChart.useMark([TextMark]);\n\nregisterWordCloudTransforms();\nregisterWordCloudShapeTransforms();\n\nexport type IBaseWordCloudSeriesSpec = Omit<IWordCloudSeriesSpec, 'type'> & { type: string };\n\nexport class BaseWordCloudSeries<T extends IBaseWordCloudSeriesSpec = IBaseWordCloudSeriesSpec> extends BaseSeries<T> {\n static readonly mark: SeriesMarkMap = {\n ...BaseSeries.mark,\n [SeriesMarkNameEnum.word]: { name: SeriesMarkNameEnum.word, type: MarkTypeEnum.text },\n [SeriesMarkNameEnum.fillingWord]: { name: SeriesMarkNameEnum.fillingWord, type: MarkTypeEnum.text }\n };\n\n protected _nameField: string;\n protected _valueField?: string;\n setValueField(field: string) {\n if (isValid(field)) {\n this._valueField = field;\n this.setFontSizeRange(DEFAULT_FONTSIZE_RANGE);\n }\n }\n\n protected _fontFamilyField: string;\n protected _fontWeightField: string;\n protected _fontStyleField: string;\n protected _colorHexField: string;\n protected _colorMode: 'linear' | 'ordinal';\n protected _colorList: string[];\n protected _rotateAngles?: number[];\n protected _fontWeightRange?: [number, number];\n\n protected _fontSizeRange?: [number, number] = [DEFAULT_MIN_FONT_SIZE, DEFAULT_MIN_FONT_SIZE];\n setFontSizeRange(fontSizeRange: [number, number]) {\n if (isValid(fontSizeRange) && isValid(this._spec.valueField)) {\n this._fontSizeRange = fontSizeRange;\n }\n }\n\n protected _maskShape?: string | WordCloudShapeType;\n protected _isWordCloudShape: boolean = false;\n\n protected _keepAspect?: boolean;\n protected _random?: boolean;\n protected _fontPadding?: number;\n protected _fillingFontPadding?: number;\n protected _wordCloudConfig?: WordCloudConfigType;\n protected _wordCloudShapeConfig?: WordCloudShapeConfigType;\n\n protected _padding?: IPadding;\n\n /**\n * @override\n */\n setAttrFromSpec() {\n super.setAttrFromSpec();\n // series布局相关\n this._padding = this._option.getChart().padding;\n\n // 普通词云 & 形状词云 共有spec相关\n this._nameField = this._spec.nameField;\n this._fontFamilyField = this._spec.fontFamilyField;\n this._fontWeightField = this._spec.fontWeightField;\n this._fontStyleField = this._spec.fontStyleField;\n this._colorHexField = this._spec.colorHexField;\n this._colorMode = this._spec.colorMode ?? 'ordinal';\n this._colorList = this._spec.colorList;\n this.setValueField(this._spec.valueField);\n this._fontWeightRange = this._spec.fontWeightRange ?? DEFAULT_FONT_WEIGHT_RANGE;\n this._rotateAngles = this._spec.rotateAngles ?? DEFAULT_ROTATE_ANGLES;\n this.setFontSizeRange(this._spec.fontSizeRange);\n this._maskShape = this._spec.maskShape ?? DEFAULT_MASK_SHAPE;\n this._keepAspect = this._spec.keepAspect;\n this._random = this._spec.random ?? DEFAULT_RANDOM;\n this._fontPadding = this._spec?.word?.padding ?? this._theme?.wordCloud?.word?.padding ?? DEFAULT_FONT_PADDING;\n\n // 普通词云spec相关\n this._wordCloudConfig = {\n drawOutOfBound: DEFAULT_DRAW_OUT_OF_BOUND,\n layoutMode: 'default',\n zoomToFit: DEFAULT_ZOOM_TO_FIT,\n ...this._spec.wordCloudConfig\n };\n\n // 形状词云spec相关\n this._wordCloudShapeConfig = {\n fillingSeriesField: this.getSeriesField(),\n fillingRotateAngles: DEFAULT_ROTATE_ANGLES,\n layoutMode: 'default',\n ...this._spec?.wordCloudShapeConfig\n };\n this._fillingFontPadding =\n this._spec?.fillingWord?.padding ?? this._theme?.wordCloud?.fillingWord?.padding ?? DEFAULT_FONT_PADDING;\n\n this._isWordCloudShape = !SHAPE_TYPE.includes(this._maskShape);\n }\n\n protected _wordMark: ITextMark;\n protected _fillingWordMark: ITextMark;\n initMark(): void {\n this._wordMark = this._createMark(BaseWordCloudSeries.mark.word, {\n defaultMorphElementKey: this._seriesField,\n groupKey: this._seriesField,\n isSeriesMark: true\n }) as ITextMark;\n if (this._isWordCloudShape) {\n this._fillingWordMark = this._createMark(BaseWordCloudSeries.mark.fillingWord) as ITextMark;\n }\n }\n\n initMarkStyle() {\n const wordMark = this._wordMark;\n const fillingWordMark = this._fillingWordMark;\n const textField = this._spec.word?.formatMethod ? WORD_CLOUD_TEXT : this._nameField;\n if (wordMark) {\n this.setMarkStyle(\n wordMark,\n {\n fill: this._colorHexField\n ? (datum: Datum) => datum[this._colorHexField]\n : this.getWordColorAttribute(this._seriesField, false),\n text: (datum: Datum) => datum[textField],\n x: (datum: Datum) => datum.x,\n y: (datum: Datum) => datum.y,\n fontFamily: (datum: Datum) => datum.fontFamily,\n fontSize: (datum: Datum) => datum.fontSize,\n fontStyle: (datum: Datum) => datum.fontStyle,\n fontWeight: (datum: Datum) => datum.fontWeight,\n angle: (datum: Datum) => datum.angle,\n visible: (datum: Datum) => !datum.isFillingWord\n },\n 'normal',\n AttributeLevel.Series\n );\n }\n if (fillingWordMark) {\n this.setMarkStyle(\n fillingWordMark,\n {\n fill: this._wordCloudShapeConfig.fillingColorHexField\n ? (datum: Datum) => datum[this._wordCloudShapeConfig.fillingColorHexField]\n : this.getWordColorAttribute(this._wordCloudShapeConfig.fillingSeriesField, true),\n text: (datum: Datum) => datum[textField],\n x: (datum: Datum) => datum.x,\n y: (datum: Datum) => datum.y,\n fontFamily: (datum: Datum) => datum.fontFamily,\n fontSize: (datum: Datum) => datum.fontSize,\n fontStyle: (datum: Datum) => datum.fontStyle,\n fontWeight: (datum: Datum) => datum.fontWeight,\n angle: (datum: Datum) => datum.angle,\n visible: (datum: Datum) => datum.isFillingWord\n },\n 'normal',\n AttributeLevel.Series\n );\n }\n this._trigger.registerMark(wordMark);\n this._tooltipHelper?.activeTriggerSet.mark.add(wordMark);\n this._trigger.registerMark(fillingWordMark);\n this._tooltipHelper?.activeTriggerSet.mark.add(fillingWordMark);\n }\n\n initAnimation() {\n if (this._wordMark) {\n this._wordMark.setAnimationConfig(\n animationConfig(DEFAULT_MARK_ANIMATION.wordCloud(), userAnimationConfig(SeriesMarkNameEnum.word, this._spec))\n );\n }\n }\n\n protected getWordOrdinalColorScale(field: string, isFillingWord: boolean) {\n const colorList = isFillingWord ? this._wordCloudShapeConfig.fillingColorList : this._colorList;\n const colorDomain = field ? this.getViewData()?.latestData.map((datum: Datum) => datum[field]) : [];\n const colorRange =\n colorList ??\n this._option.globalScale.getScale('color')?.range() ??\n getDataScheme(this._option.getTheme().colorScheme, this.type as any);\n return new ColorOrdinalScale().domain(colorDomain).range?.(colorRange);\n }\n\n getWordColorAttribute(field: string, isFillingWord: boolean) {\n if (this._colorMode === 'ordinal') {\n return {\n scale: this.getWordOrdinalColorScale(field, isFillingWord),\n field: this._seriesField ?? DEFAULT_DATA_SERIES_FIELD\n };\n }\n // const valueScale = new LinearScale()\n // .domain(extent(this.getViewData()?.latestData.map((datum: Datum) => datum[field])), true)\n // .range([0, 1]);\n let colorList =\n (isFillingWord ? this._colorList : this._wordCloudShapeConfig.fillingColorList) ??\n this._option.globalScale.getScale('color').range();\n // 如果用户只输入了一个 color,无法构成 colorRange,则进行兜底\n if (colorList.length === 1) {\n colorList = [colorList[0], colorList[0]];\n }\n // 颜色插值 todo@chensiji\n // const interpolate = interpolateColors(colorList)\n // return (datum: Datum) => interpolate(valueScale.scale(datum[field]))\n return (datum: Datum) => colorList[0];\n }\n\n compile(): void {\n super.compile();\n\n const wordCloudTransforms: any[] = [];\n const valueField = this._valueField;\n const valueScale = new LinearScale();\n const fontWeightRange = this._fontWeightRange;\n const rotateAngles = this._rotateAngles;\n const fontWeightField = this._fontWeightField;\n const fillingRotateAngles = this._wordCloudShapeConfig.fillingRotateAngles;\n\n // fontWeight处理\n if (valueField) {\n const [minValue, maxValue] = extent(this.getViewData()?.latestData.map((datum: any) => datum[valueField]));\n valueScale.domain([minValue, maxValue], true).range(fontWeightRange);\n wordCloudTransforms.push({\n type: 'map',\n as: WORD_CLOUD_WEIGHT,\n callback: (datum: any) => {\n if (minValue === maxValue) {\n return valueScale.scale(maxValue);\n }\n return valueScale.scale(datum[valueField]);\n }\n });\n }\n\n // rotateAngles处理\n wordCloudTransforms.push({\n type: 'map',\n as: WORD_CLOUD_ANGLE,\n callback: () => {\n return rotateAngles[Math.floor(Math.random() * rotateAngles.length)];\n }\n });\n wordCloudTransforms.push({\n type: 'map',\n as: WORD_CLOUD_FILLING_ANGLE,\n callback: () => {\n return fillingRotateAngles[Math.floor(Math.random() * fillingRotateAngles.length)];\n }\n });\n\n // text fromat method 处理\n if (this._spec.word?.formatMethod) {\n wordCloudTransforms.push({\n type: 'map',\n as: WORD_CLOUD_TEXT,\n callback: this._spec.word.formatMethod\n });\n }\n\n const textField = this._spec.word?.formatMethod ? WORD_CLOUD_TEXT : this._nameField;\n\n const srView = this.getCompiler().getVGrammarView();\n // 词云 transform\n if (!this._isWordCloudShape) {\n wordCloudTransforms.push({\n type: 'wordcloud',\n // TIP: 非浏览器环境下,使用 fast 布局,否则会出现兼容问题\n layoutType: !isTrueBrowser(this._option.mode) ? 'fast' : this._wordCloudConfig.layoutMode,\n size: [\n srView.width() - this._padding?.left || 0 - this._padding?.right || 0,\n srView.height() - this._padding?.top || 0 - this._padding?.bottom || 0\n ],\n shape: this._maskShape,\n dataIndexKey: DEFAULT_DATA_KEY,\n text: { field: textField },\n fontSize: valueField ? { field: valueField } : this._fontSizeRange[0],\n fontSizeRange: this._fontSizeRange,\n padding: this._fontPadding,\n rotate: { field: WORD_CLOUD_ANGLE },\n fontFamily: this._fontFamilyField ?? this._spec.word?.style?.fontFamily,\n fontWeight: fontWeightField ? { field: fontWeightField } : valueField ? { field: WORD_CLOUD_WEIGHT } : null,\n fontStyle: this._fontStyleField ?? this._spec.word?.style?.fontStyle,\n\n randomVisible: this._random,\n clip: this._wordCloudConfig.drawOutOfBound === 'clip',\n shrink: this._wordCloudConfig.zoomToFit.shrink,\n enlarge: this._wordCloudConfig.zoomToFit.enlarge,\n minFontSize: this._wordCloudConfig.zoomToFit.fontSizeLimitMin,\n progressiveTime: this._wordCloudConfig.progressiveTime,\n progressiveStep: this._wordCloudConfig.progressiveStep\n });\n // 挂到mark的transform上\n (this._wordMark as ICompilableMark).getProduct().transform(wordCloudTransforms);\n }\n // 形状词云 transform\n else {\n wordCloudTransforms.push({\n type: 'wordcloudShape',\n // 形状词云中必须要传入dataIndexKey, 否则填充词无法绘制\n dataIndexKey: DEFAULT_DATA_KEY,\n\n size: [srView.width(), srView.height()],\n shape: this._maskShape,\n\n text: { field: this._spec.word?.formatMethod ? WORD_CLOUD_TEXT : this._nameField },\n fontSize: valueField ? { field: valueField } : this._fontSizeRange[0],\n fontSizeRange: this._fontSizeRange,\n padding: this._fontPadding,\n rotateList: rotateAngles,\n fontFamily: this._fontFamilyField ?? this._spec.word?.style?.fontFamily,\n fontWeight: fontWeightField ? { field: fontWeightField } : valueField ? { field: WORD_CLOUD_WEIGHT } : null,\n fontStyle: this._fontStyleField ?? this._spec.word?.style?.fontStyle,\n\n fillingFontFamily: this._wordCloudShapeConfig?.fillingFontFamilyField ?? this._spec.word?.style?.fontFamily,\n fillingPadding: this._fillingFontPadding,\n fillingFontStyle: this._wordCloudShapeConfig?.fillingFontStyleField ?? this._spec.word?.style?.fontStyle,\n fillingFontWeight: this._wordCloudShapeConfig?.fillingFontWeightField ?? this._spec.word?.style?.fontWeight, // 填充词fontWeight默认不跟随valueField\n fillingRotateList: fillingRotateAngles,\n\n fillingTimes: this._wordCloudShapeConfig?.fillingTimes,\n fillingXStep: this._wordCloudShapeConfig?.fillingXStep,\n fillingYStep: this._wordCloudShapeConfig?.fillingYStep,\n fillingXRatioStep: this._wordCloudShapeConfig?.fillingXRatioStep,\n fillingYRatioStep: this._wordCloudShapeConfig?.fillingYRatioStep,\n fillingInitialOpacity: this._wordCloudShapeConfig?.fillingInitialOpacity,\n fillingDeltaOpacity: this._wordCloudShapeConfig?.fillingDeltaOpacity,\n fillingInitialFontSize: this._wordCloudShapeConfig?.fillingInitialFontSize,\n fillingDeltaFontSize: this._wordCloudShapeConfig?.fillingDeltaFontSize,\n\n ratio: this._wordCloudShapeConfig?.ratio,\n fillingRatio: this._wordCloudShapeConfig?.fillingRatio,\n removeWhiteBorder: this._wordCloudShapeConfig?.removeWhiteBorder,\n textLayoutTimes: this._wordCloudShapeConfig?.textLayoutTimes,\n fontSizeShrinkFactor: this._wordCloudShapeConfig?.fontSizeShrinkFactor,\n stepFactor: this._wordCloudShapeConfig?.stepFactor,\n layoutMode: this._wordCloudShapeConfig?.layoutMode,\n importantWordCount: this._wordCloudShapeConfig?.importantWordCount,\n globalShinkLimit: this._wordCloudShapeConfig?.globalShinkLimit,\n fontSizeEnlargeFactor: this._wordCloudShapeConfig?.fontSizeEnlargeFactor,\n fillingDeltaFontSizeFactor: this._wordCloudShapeConfig?.fillingDeltaFontSizeFactor\n });\n }\n // 把transform挂载到data的product上\n this._data.getProduct().transform(wordCloudTransforms);\n }\n\n getStatisticFields() {\n const fields: { key: string; operations: Array<'max' | 'min' | 'values'> }[] = [];\n fields.push({ key: this._nameField, operations: ['values'] });\n fields.push({ key: this._valueField, operations: ['max', 'min'] });\n return fields;\n }\n dataToPosition(data: Datum): IPoint {\n return null;\n }\n dataToPositionX(data: any): number {\n return null;\n }\n dataToPositionY(data: any): number {\n return null;\n }\n dataToPositionZ(data: any): number {\n return null;\n }\n valueToPosition(value1: any, value2?: any): IPoint {\n return null;\n }\n setValueFieldToStackOffsetSilhouette(): void {\n // do nothing\n }\n\n getGroupFields(): string[] {\n // do nothing\n return [];\n }\n\n getStackGroupFields(): string[] {\n // do nothing\n return [];\n }\n\n getStackValueField(): string {\n // do nothing\n return '';\n }\n\n setValueFieldToStack(): void {\n // do nothing\n }\n\n setValueFieldToPercent(): void {\n //do nothing\n }\n\n updateSpec(spec: any) {\n const originalSpec = this._originalSpec;\n const result = super.updateSpec(spec);\n if (!isEqual(originalSpec, spec)) {\n result.reMake = true;\n result.reCompile = true;\n return result;\n }\n return result;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/series/word-cloud/base.ts"],"names":[],"mappings":";;;AAEA,6CAA2C;AAC3C,6CAA2C;AAC3C,6CAA6F;AAC7F,oDAAoD;AAGpD,4CAAkD;AAClD,qCAA2C;AAC3C,qCAWkB;AAOlB,qEAA2E;AAC3E,iFAAsF;AAEtF,mDAAgE;AAChE,iDAA6E;AAC7E,6CAA+C;AAC/C,2DAAiD;AACjD,0DAKmC;AACnC,wDAA8D;AAE9D,qDAAiD;AACjD,yEAAoE;AACpE,8CAA2C;AAC3C,0CAA2C;AAE3C,eAAM,CAAC,OAAO,CAAC,CAAC,eAAQ,CAAC,CAAC,CAAC;AAE3B,IAAA,gDAA2B,GAAE,CAAC;AAC9B,IAAA,2DAAgC,GAAE,CAAC;AAInC,MAAa,mBAAmF,SAAQ,wBAAa;IAArH;;QAyBY,mBAAc,GAAsB,CAAC,8BAAqB,EAAE,8BAAqB,CAAC,CAAC;QAQnF,sBAAiB,GAAY,KAAK,CAAC;IAwW/C,CAAC;IAhYC,aAAa,CAAC,KAAa;QACzB,IAAI,IAAA,gBAAO,EAAC,KAAK,CAAC,EAAE;YAClB,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;YACzB,IAAI,CAAC,gBAAgB,CAAC,+BAAsB,CAAC,CAAC;SAC/C;IACH,CAAC;IAYD,gBAAgB,CAAC,aAA+B;QAC9C,IAAI,IAAA,gBAAO,EAAC,aAAa,CAAC,IAAI,IAAA,gBAAO,EAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE;YAC5D,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;SACrC;IACH,CAAC;IAiBD,eAAe;;QACb,KAAK,CAAC,eAAe,EAAE,CAAC;QAExB,IAA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kB,CAAC,WAAW,CAAC,EAAE,EAAE,IAAI,EAAE,8BAAkB,CAAC,WAAW,EAAE,IAAI,EAAE,wBAAY,CAAC,IAAI,EAAE,IACnG","file":"base.js","sourcesContent":["/* eslint-disable no-duplicate-imports */\nimport type { IPadding } from '@visactor/vutils';\nimport { isEqual } from '@visactor/vutils';\nimport { isValid } from '@visactor/vutils';\nimport { AttributeLevel, DEFAULT_DATA_KEY, DEFAULT_DATA_SERIES_FIELD } from '../../constant';\nimport { MarkTypeEnum } from '../../mark/interface';\nimport type { ITextMark } from '../../mark/text';\nimport type { SeriesMarkMap } from '../interface';\nimport { SeriesMarkNameEnum } from '../interface';\nimport { isTrueBrowser } from '../../util';\nimport {\n DEFAULT_DRAW_OUT_OF_BOUND,\n DEFAULT_FONTSIZE_RANGE,\n DEFAULT_FONT_PADDING,\n DEFAULT_FONT_WEIGHT_RANGE,\n DEFAULT_MASK_SHAPE,\n DEFAULT_MIN_FONT_SIZE,\n DEFAULT_RANDOM,\n DEFAULT_ROTATE_ANGLES,\n DEFAULT_ZOOM_TO_FIT,\n SHAPE_TYPE\n} from './config';\nimport type {\n IWordCloudSeriesSpec,\n WordCloudConfigType,\n WordCloudShapeConfigType,\n WordCloudShapeType\n} from './interface';\nimport { registerWordCloudTransforms } from '@visactor/vgrammar-wordcloud';\nimport { registerWordCloudShapeTransforms } from '@visactor/vgrammar-wordcloud-shape';\nimport type { Datum, IPoint } from '../../typings';\nimport { DEFAULT_MARK_ANIMATION } from '../../animation/config';\nimport { animationConfig, userAnimationConfig } from '../../animation/utils';\nimport { LinearScale } from '@visactor/vscale';\nimport { extent } from '@visactor/vgrammar-util';\nimport {\n WORD_CLOUD_ANGLE,\n WORD_CLOUD_FILLING_ANGLE,\n WORD_CLOUD_TEXT,\n WORD_CLOUD_WEIGHT\n} from '../../constant/word-cloud';\nimport { getDataScheme } from '../../theme/color-scheme/util';\nimport type { ICompilableMark } from '../../compile/mark';\nimport { BaseSeries } from '../base/base-series';\nimport { ColorOrdinalScale } from '../../scale/color-ordinal-scale';\nimport { VChart } from '../../core/vchart';\nimport { TextMark } from '../../mark/text';\n\nVChart.useMark([TextMark]);\n\nregisterWordCloudTransforms();\nregisterWordCloudShapeTransforms();\n\nexport type IBaseWordCloudSeriesSpec = Omit<IWordCloudSeriesSpec, 'type'> & { type: string };\n\nexport class BaseWordCloudSeries<T extends IBaseWordCloudSeriesSpec = IBaseWordCloudSeriesSpec> extends BaseSeries<T> {\n static readonly mark: SeriesMarkMap = {\n ...BaseSeries.mark,\n [SeriesMarkNameEnum.word]: { name: SeriesMarkNameEnum.word, type: MarkTypeEnum.text },\n [SeriesMarkNameEnum.fillingWord]: { name: SeriesMarkNameEnum.fillingWord, type: MarkTypeEnum.text }\n };\n\n protected _nameField: string;\n protected _valueField?: string;\n setValueField(field: string) {\n if (isValid(field)) {\n this._valueField = field;\n this.setFontSizeRange(DEFAULT_FONTSIZE_RANGE);\n }\n }\n\n protected _fontFamilyField: string;\n protected _fontWeightField: string;\n protected _fontStyleField: string;\n protected _colorHexField: string;\n protected _colorMode: 'linear' | 'ordinal';\n protected _colorList: string[];\n protected _rotateAngles?: number[];\n protected _fontWeightRange?: [number, number];\n\n protected _fontSizeRange?: [number, number] = [DEFAULT_MIN_FONT_SIZE, DEFAULT_MIN_FONT_SIZE];\n setFontSizeRange(fontSizeRange: [number, number]) {\n if (isValid(fontSizeRange) && isValid(this._spec.valueField)) {\n this._fontSizeRange = fontSizeRange;\n }\n }\n\n protected _maskShape?: string | WordCloudShapeType;\n protected _isWordCloudShape: boolean = false;\n\n protected _keepAspect?: boolean;\n protected _random?: boolean;\n protected _fontPadding?: number;\n protected _fillingFontPadding?: number;\n protected _wordCloudConfig?: WordCloudConfigType;\n protected _wordCloudShapeConfig?: WordCloudShapeConfigType;\n\n protected _padding?: IPadding;\n\n /**\n * @override\n */\n setAttrFromSpec() {\n super.setAttrFromSpec();\n // series布局相关\n this._padding = this._option.getChart().padding;\n\n // 普通词云 & 形状词云 共有spec相关\n this._nameField = this._spec.nameField;\n this._fontFamilyField = this._spec.fontFamilyField;\n this._fontWeightField = this._spec.fontWeightField;\n this._fontStyleField = this._spec.fontStyleField;\n this._colorHexField = this._spec.colorHexField;\n this._colorMode = this._spec.colorMode ?? 'ordinal';\n this._colorList = this._spec.colorList;\n this.setValueField(this._spec.valueField);\n this._fontWeightRange = this._spec.fontWeightRange ?? DEFAULT_FONT_WEIGHT_RANGE;\n this._rotateAngles = this._spec.rotateAngles ?? DEFAULT_ROTATE_ANGLES;\n this.setFontSizeRange(this._spec.fontSizeRange);\n this._maskShape = this._spec.maskShape ?? DEFAULT_MASK_SHAPE;\n this._keepAspect = this._spec.keepAspect;\n this._random = this._spec.random ?? DEFAULT_RANDOM;\n this._fontPadding = this._spec?.word?.padding ?? this._theme?.wordCloud?.word?.padding ?? DEFAULT_FONT_PADDING;\n\n // 普通词云spec相关\n this._wordCloudConfig = {\n drawOutOfBound: DEFAULT_DRAW_OUT_OF_BOUND,\n layoutMode: 'default',\n zoomToFit: DEFAULT_ZOOM_TO_FIT,\n ...this._spec.wordCloudConfig\n };\n\n // 形状词云spec相关\n this._wordCloudShapeConfig = {\n fillingSeriesField: this.getSeriesField(),\n fillingRotateAngles: DEFAULT_ROTATE_ANGLES,\n layoutMode: 'default',\n ...this._spec?.wordCloudShapeConfig\n };\n this._fillingFontPadding =\n this._spec?.fillingWord?.padding ?? this._theme?.wordCloud?.fillingWord?.padding ?? DEFAULT_FONT_PADDING;\n\n this._isWordCloudShape = !SHAPE_TYPE.includes(this._maskShape);\n }\n\n protected _wordMark: ITextMark;\n protected _fillingWordMark: ITextMark;\n initMark(): void {\n this._wordMark = this._createMark(BaseWordCloudSeries.mark.word, {\n defaultMorphElementKey: this._seriesField,\n groupKey: this._seriesField,\n isSeriesMark: true\n }) as ITextMark;\n if (this._isWordCloudShape) {\n this._fillingWordMark = this._createMark(BaseWordCloudSeries.mark.fillingWord) as ITextMark;\n }\n }\n\n initMarkStyle() {\n const wordMark = this._wordMark;\n const fillingWordMark = this._fillingWordMark;\n const textField = this._spec.word?.formatMethod ? WORD_CLOUD_TEXT : this._nameField;\n if (wordMark) {\n this.setMarkStyle(\n wordMark,\n {\n fill: this._colorHexField\n ? (datum: Datum) => datum[this._colorHexField]\n : this.getWordColorAttribute(this._seriesField, false),\n text: (datum: Datum) => datum[textField],\n x: (datum: Datum) => datum.x,\n y: (datum: Datum) => datum.y,\n fontFamily: (datum: Datum) => datum.fontFamily,\n fontSize: (datum: Datum) => datum.fontSize,\n fontStyle: (datum: Datum) => datum.fontStyle,\n fontWeight: (datum: Datum) => datum.fontWeight,\n angle: (datum: Datum) => datum.angle,\n visible: (datum: Datum) => !datum.isFillingWord\n },\n 'normal',\n AttributeLevel.Series\n );\n }\n if (fillingWordMark) {\n this.setMarkStyle(\n fillingWordMark,\n {\n fill: this._wordCloudShapeConfig.fillingColorHexField\n ? (datum: Datum) => datum[this._wordCloudShapeConfig.fillingColorHexField]\n : this.getWordColorAttribute(this._wordCloudShapeConfig.fillingSeriesField, true),\n text: (datum: Datum) => datum[textField],\n x: (datum: Datum) => datum.x,\n y: (datum: Datum) => datum.y,\n fontFamily: (datum: Datum) => datum.fontFamily,\n fontSize: (datum: Datum) => datum.fontSize,\n fontStyle: (datum: Datum) => datum.fontStyle,\n fontWeight: (datum: Datum) => datum.fontWeight,\n angle: (datum: Datum) => datum.angle,\n visible: (datum: Datum) => datum.isFillingWord\n },\n 'normal',\n AttributeLevel.Series\n );\n }\n this._trigger.registerMark(wordMark);\n this._tooltipHelper?.activeTriggerSet.mark.add(wordMark);\n this._trigger.registerMark(fillingWordMark);\n this._tooltipHelper?.activeTriggerSet.mark.add(fillingWordMark);\n }\n\n initAnimation() {\n if (this._wordMark) {\n this._wordMark.setAnimationConfig(\n animationConfig(DEFAULT_MARK_ANIMATION.wordCloud(), userAnimationConfig(SeriesMarkNameEnum.word, this._spec))\n );\n }\n }\n\n protected getWordOrdinalColorScale(field: string, isFillingWord: boolean) {\n const colorList = isFillingWord ? this._wordCloudShapeConfig.fillingColorList : this._colorList;\n const colorDomain = field ? this.getViewData()?.latestData.map((datum: Datum) => datum[field]) : [];\n const colorRange =\n colorList ??\n this._option.globalScale.getScale('color')?.range() ??\n getDataScheme(this._option.getTheme().colorScheme, this.type as any);\n return new ColorOrdinalScale().domain(colorDomain).range?.(colorRange);\n }\n\n getWordColorAttribute(field: string, isFillingWord: boolean) {\n if (this._colorMode === 'ordinal') {\n return {\n scale: this.getWordOrdinalColorScale(field, isFillingWord),\n field: this._seriesField ?? DEFAULT_DATA_SERIES_FIELD\n };\n }\n // const valueScale = new LinearScale()\n // .domain(extent(this.getViewData()?.latestData.map((datum: Datum) => datum[field])), true)\n // .range([0, 1]);\n let colorList =\n (isFillingWord ? this._colorList : this._wordCloudShapeConfig.fillingColorList) ??\n this._option.globalScale.getScale('color').range();\n // 如果用户只输入了一个 color,无法构成 colorRange,则进行兜底\n if (colorList.length === 1) {\n colorList = [colorList[0], colorList[0]];\n }\n // 颜色插值 todo@chensiji\n // const interpolate = interpolateColors(colorList)\n // return (datum: Datum) => interpolate(valueScale.scale(datum[field]))\n return (datum: Datum) => colorList[0];\n }\n\n compile(): void {\n super.compile();\n const wordCloudTransforms: any[] = [];\n const valueField = this._valueField;\n const valueScale = new LinearScale();\n const fontWeightRange = this._fontWeightRange;\n const rotateAngles = this._rotateAngles;\n const fontWeightField = this._fontWeightField;\n const fillingRotateAngles = this._wordCloudShapeConfig.fillingRotateAngles;\n\n // fontWeight处理\n if (valueField) {\n const [minValue, maxValue] = extent(this.getViewData()?.latestData.map((datum: any) => datum[valueField]));\n valueScale.domain([minValue, maxValue], true).range(fontWeightRange);\n wordCloudTransforms.push({\n type: 'map',\n as: WORD_CLOUD_WEIGHT,\n callback: (datum: any) => {\n if (minValue === maxValue) {\n return valueScale.scale(maxValue);\n }\n return valueScale.scale(datum[valueField]);\n }\n });\n }\n\n // rotateAngles处理\n wordCloudTransforms.push({\n type: 'map',\n as: WORD_CLOUD_ANGLE,\n callback: () => {\n return rotateAngles[Math.floor(Math.random() * rotateAngles.length)];\n }\n });\n wordCloudTransforms.push({\n type: 'map',\n as: WORD_CLOUD_FILLING_ANGLE,\n callback: () => {\n return fillingRotateAngles[Math.floor(Math.random() * fillingRotateAngles.length)];\n }\n });\n\n // text fromat method 处理\n if (this._spec.word?.formatMethod) {\n wordCloudTransforms.push({\n type: 'map',\n as: WORD_CLOUD_TEXT,\n callback: this._spec.word.formatMethod\n });\n }\n\n const textField = this._spec.word?.formatMethod ? WORD_CLOUD_TEXT : this._nameField;\n\n // 词云 transform\n if (!this._isWordCloudShape) {\n wordCloudTransforms.push({\n type: 'wordcloud',\n // TIP: 非浏览器环境下,使用 fast 布局,否则会出现兼容问题\n layoutType: !isTrueBrowser(this._option.mode) ? 'fast' : this._wordCloudConfig.layoutMode,\n size: [this._region.getLayoutRect().width, this._region.getLayoutRect().height],\n shape: this._maskShape,\n dataIndexKey: DEFAULT_DATA_KEY,\n text: { field: textField },\n fontSize: valueField ? { field: valueField } : this._fontSizeRange[0],\n fontSizeRange: this._fontSizeRange,\n padding: this._fontPadding,\n rotate: { field: WORD_CLOUD_ANGLE },\n fontFamily: this._fontFamilyField ?? this._spec.word?.style?.fontFamily,\n fontWeight: fontWeightField ? { field: fontWeightField } : valueField ? { field: WORD_CLOUD_WEIGHT } : null,\n fontStyle: this._fontStyleField ?? this._spec.word?.style?.fontStyle,\n\n randomVisible: this._random,\n clip: this._wordCloudConfig.drawOutOfBound === 'clip',\n shrink: this._wordCloudConfig.zoomToFit.shrink,\n enlarge: this._wordCloudConfig.zoomToFit.enlarge,\n minFontSize: this._wordCloudConfig.zoomToFit.fontSizeLimitMin,\n progressiveTime: this._wordCloudConfig.progressiveTime,\n progressiveStep: this._wordCloudConfig.progressiveStep\n });\n // 挂到mark的transform上\n (this._wordMark as ICompilableMark).getProduct().transform(wordCloudTransforms);\n }\n // 形状词云 transform\n else {\n wordCloudTransforms.push({\n type: 'wordcloudShape',\n // 形状词云中必须要传入dataIndexKey, 否则填充词无法绘制\n dataIndexKey: DEFAULT_DATA_KEY,\n\n size: [this._region.getLayoutRect().width, this._region.getLayoutRect().height],\n shape: this._maskShape,\n\n text: { field: this._spec.word?.formatMethod ? WORD_CLOUD_TEXT : this._nameField },\n fontSize: valueField ? { field: valueField } : this._fontSizeRange[0],\n fontSizeRange: this._fontSizeRange,\n padding: this._fontPadding,\n rotateList: rotateAngles,\n fontFamily: this._fontFamilyField ?? this._spec.word?.style?.fontFamily,\n fontWeight: fontWeightField ? { field: fontWeightField } : valueField ? { field: WORD_CLOUD_WEIGHT } : null,\n fontStyle: this._fontStyleField ?? this._spec.word?.style?.fontStyle,\n\n fillingFontFamily: this._wordCloudShapeConfig?.fillingFontFamilyField ?? this._spec.word?.style?.fontFamily,\n fillingPadding: this._fillingFontPadding,\n fillingFontStyle: this._wordCloudShapeConfig?.fillingFontStyleField ?? this._spec.word?.style?.fontStyle,\n fillingFontWeight: this._wordCloudShapeConfig?.fillingFontWeightField ?? this._spec.word?.style?.fontWeight, // 填充词fontWeight默认不跟随valueField\n fillingRotateList: fillingRotateAngles,\n\n fillingTimes: this._wordCloudShapeConfig?.fillingTimes,\n fillingXStep: this._wordCloudShapeConfig?.fillingXStep,\n fillingYStep: this._wordCloudShapeConfig?.fillingYStep,\n fillingXRatioStep: this._wordCloudShapeConfig?.fillingXRatioStep,\n fillingYRatioStep: this._wordCloudShapeConfig?.fillingYRatioStep,\n fillingInitialOpacity: this._wordCloudShapeConfig?.fillingInitialOpacity,\n fillingDeltaOpacity: this._wordCloudShapeConfig?.fillingDeltaOpacity,\n fillingInitialFontSize: this._wordCloudShapeConfig?.fillingInitialFontSize,\n fillingDeltaFontSize: this._wordCloudShapeConfig?.fillingDeltaFontSize,\n\n ratio: this._wordCloudShapeConfig?.ratio,\n fillingRatio: this._wordCloudShapeConfig?.fillingRatio,\n removeWhiteBorder: this._wordCloudShapeConfig?.removeWhiteBorder,\n textLayoutTimes: this._wordCloudShapeConfig?.textLayoutTimes,\n fontSizeShrinkFactor: this._wordCloudShapeConfig?.fontSizeShrinkFactor,\n stepFactor: this._wordCloudShapeConfig?.stepFactor,\n layoutMode: this._wordCloudShapeConfig?.layoutMode,\n importantWordCount: this._wordCloudShapeConfig?.importantWordCount,\n globalShinkLimit: this._wordCloudShapeConfig?.globalShinkLimit,\n fontSizeEnlargeFactor: this._wordCloudShapeConfig?.fontSizeEnlargeFactor,\n fillingDeltaFontSizeFactor: this._wordCloudShapeConfig?.fillingDeltaFontSizeFactor\n });\n }\n // 把transform挂载到data的product上\n this._data.getProduct().transform(wordCloudTransforms);\n }\n\n getStatisticFields() {\n const fields: { key: string; operations: Array<'max' | 'min' | 'values'> }[] = [];\n fields.push({ key: this._nameField, operations: ['values'] });\n fields.push({ key: this._valueField, operations: ['max', 'min'] });\n return fields;\n }\n dataToPosition(data: Datum): IPoint {\n return null;\n }\n dataToPositionX(data: any): number {\n return null;\n }\n dataToPositionY(data: any): number {\n return null;\n }\n dataToPositionZ(data: any): number {\n return null;\n }\n valueToPosition(value1: any, value2?: any): IPoint {\n return null;\n }\n setValueFieldToStackOffsetSilhouette(): void {\n // do nothing\n }\n\n getGroupFields(): string[] {\n // do nothing\n return [];\n }\n\n getStackGroupFields(): string[] {\n // do nothing\n return [];\n }\n\n getStackValueField(): string {\n // do nothing\n return '';\n }\n\n setValueFieldToStack(): void {\n // do nothing\n }\n\n setValueFieldToPercent(): void {\n //do nothing\n }\n\n onLayoutEnd(ctx: any): void {\n super.onLayoutEnd(ctx);\n this.compile();\n }\n\n updateSpec(spec: any) {\n const originalSpec = this._originalSpec;\n const result = super.updateSpec(spec);\n if (!isEqual(originalSpec, spec)) {\n result.reMake = true;\n result.reCompile = true;\n return result;\n }\n return result;\n }\n}\n"]}
|
|
@@ -11,7 +11,7 @@ class WordCloud3dSeries extends base_1.BaseWordCloudSeries {
|
|
|
11
11
|
super(...arguments), this.type = interface_1.SeriesTypeEnum.wordCloud3d;
|
|
12
12
|
}
|
|
13
13
|
compile() {
|
|
14
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24
|
|
14
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24;
|
|
15
15
|
super.compile();
|
|
16
16
|
const wordCloudTransforms = [], valueField = this._valueField, valueScale = new vscale_1.LinearScale, fontWeightRange = this._fontWeightRange, rotateAngles = this._rotateAngles, fontWeightField = this._fontWeightField, fillingRotateAngles = this._wordCloudShapeConfig.fillingRotateAngles;
|
|
17
17
|
if (valueField) {
|
|
@@ -35,12 +35,12 @@ class WordCloud3dSeries extends base_1.BaseWordCloudSeries {
|
|
|
35
35
|
as: word_cloud_1.WORD_CLOUD_TEXT,
|
|
36
36
|
callback: this._spec.word.formatMethod
|
|
37
37
|
});
|
|
38
|
-
const textField = (null === (_c = this._spec.word) || void 0 === _c ? void 0 : _c.formatMethod) ? word_cloud_1.WORD_CLOUD_TEXT : this._nameField
|
|
38
|
+
const textField = (null === (_c = this._spec.word) || void 0 === _c ? void 0 : _c.formatMethod) ? word_cloud_1.WORD_CLOUD_TEXT : this._nameField;
|
|
39
39
|
this._isWordCloudShape ? wordCloudTransforms.push({
|
|
40
40
|
type: "wordcloudShape",
|
|
41
|
-
size: [
|
|
41
|
+
size: [ this._region.getLayoutRect().width, this._region.getLayoutRect().height ],
|
|
42
42
|
shape: this._maskShape,
|
|
43
|
-
postProjection: null !== (
|
|
43
|
+
postProjection: null !== (_l = this._spec.postProjection) && void 0 !== _l ? _l : "StereographicProjection",
|
|
44
44
|
dataIndexKey: constant_1.DEFAULT_DATA_KEY,
|
|
45
45
|
text: {
|
|
46
46
|
field: textField
|
|
@@ -51,45 +51,45 @@ class WordCloud3dSeries extends base_1.BaseWordCloudSeries {
|
|
|
51
51
|
fontSizeRange: this._fontSizeRange,
|
|
52
52
|
padding: this._fontPadding,
|
|
53
53
|
rotateList: rotateAngles,
|
|
54
|
-
fontFamily: null !== (
|
|
54
|
+
fontFamily: null !== (_m = this._fontFamilyField) && void 0 !== _m ? _m : null === (_p = null === (_o = this._spec.word) || void 0 === _o ? void 0 : _o.style) || void 0 === _p ? void 0 : _p.fontFamily,
|
|
55
55
|
fontWeight: fontWeightField ? {
|
|
56
56
|
field: fontWeightField
|
|
57
57
|
} : valueField ? {
|
|
58
58
|
field: word_cloud_1.WORD_CLOUD_WEIGHT
|
|
59
59
|
} : null,
|
|
60
|
-
fontStyle: null !== (
|
|
60
|
+
fontStyle: null !== (_q = this._fontStyleField) && void 0 !== _q ? _q : null === (_s = null === (_r = this._spec.word) || void 0 === _r ? void 0 : _r.style) || void 0 === _s ? void 0 : _s.fontStyle,
|
|
61
61
|
depth_3d: this._spec.depth_3d,
|
|
62
|
-
fillingFontFamily: null !== (
|
|
62
|
+
fillingFontFamily: null !== (_u = null === (_t = this._wordCloudShapeConfig) || void 0 === _t ? void 0 : _t.fillingFontFamilyField) && void 0 !== _u ? _u : null === (_w = null === (_v = this._spec.word) || void 0 === _v ? void 0 : _v.style) || void 0 === _w ? void 0 : _w.fontFamily,
|
|
63
63
|
fillingPadding: this._fillingFontPadding,
|
|
64
|
-
fillingFontStyle: null !== (
|
|
65
|
-
fillingFontWeight: null !== (
|
|
64
|
+
fillingFontStyle: null !== (_y = null === (_x = this._wordCloudShapeConfig) || void 0 === _x ? void 0 : _x.fillingFontStyleField) && void 0 !== _y ? _y : null === (_0 = null === (_z = this._spec.word) || void 0 === _z ? void 0 : _z.style) || void 0 === _0 ? void 0 : _0.fontStyle,
|
|
65
|
+
fillingFontWeight: null !== (_2 = null === (_1 = this._wordCloudShapeConfig) || void 0 === _1 ? void 0 : _1.fillingFontWeightField) && void 0 !== _2 ? _2 : null === (_4 = null === (_3 = this._spec.word) || void 0 === _3 ? void 0 : _3.style) || void 0 === _4 ? void 0 : _4.fontWeight,
|
|
66
66
|
fillingRotateList: fillingRotateAngles,
|
|
67
|
-
fillingTimes: null === (
|
|
68
|
-
fillingXStep: null === (
|
|
69
|
-
fillingYStep: null === (
|
|
70
|
-
fillingXRatioStep: null === (
|
|
71
|
-
fillingYRatioStep: null === (
|
|
72
|
-
fillingInitialOpacity: null === (
|
|
73
|
-
fillingDeltaOpacity: null === (
|
|
74
|
-
fillingInitialFontSize: null === (
|
|
75
|
-
fillingDeltaFontSize: null === (
|
|
76
|
-
ratio: null === (
|
|
77
|
-
fillingRatio: null === (
|
|
78
|
-
removeWhiteBorder: null === (
|
|
79
|
-
textLayoutTimes: null === (
|
|
80
|
-
fontSizeShrinkFactor: null === (
|
|
81
|
-
stepFactor: null === (
|
|
82
|
-
layoutMode: null === (
|
|
83
|
-
importantWordCount: null === (
|
|
84
|
-
globalShinkLimit: null === (
|
|
85
|
-
fontSizeEnlargeFactor: null === (
|
|
86
|
-
fillingDeltaFontSizeFactor: null === (
|
|
67
|
+
fillingTimes: null === (_5 = this._wordCloudShapeConfig) || void 0 === _5 ? void 0 : _5.fillingTimes,
|
|
68
|
+
fillingXStep: null === (_6 = this._wordCloudShapeConfig) || void 0 === _6 ? void 0 : _6.fillingXStep,
|
|
69
|
+
fillingYStep: null === (_7 = this._wordCloudShapeConfig) || void 0 === _7 ? void 0 : _7.fillingYStep,
|
|
70
|
+
fillingXRatioStep: null === (_8 = this._wordCloudShapeConfig) || void 0 === _8 ? void 0 : _8.fillingXRatioStep,
|
|
71
|
+
fillingYRatioStep: null === (_9 = this._wordCloudShapeConfig) || void 0 === _9 ? void 0 : _9.fillingYRatioStep,
|
|
72
|
+
fillingInitialOpacity: null === (_10 = this._wordCloudShapeConfig) || void 0 === _10 ? void 0 : _10.fillingInitialOpacity,
|
|
73
|
+
fillingDeltaOpacity: null === (_11 = this._wordCloudShapeConfig) || void 0 === _11 ? void 0 : _11.fillingDeltaOpacity,
|
|
74
|
+
fillingInitialFontSize: null === (_12 = this._wordCloudShapeConfig) || void 0 === _12 ? void 0 : _12.fillingInitialFontSize,
|
|
75
|
+
fillingDeltaFontSize: null === (_13 = this._wordCloudShapeConfig) || void 0 === _13 ? void 0 : _13.fillingDeltaFontSize,
|
|
76
|
+
ratio: null === (_14 = this._wordCloudShapeConfig) || void 0 === _14 ? void 0 : _14.ratio,
|
|
77
|
+
fillingRatio: null === (_15 = this._wordCloudShapeConfig) || void 0 === _15 ? void 0 : _15.fillingRatio,
|
|
78
|
+
removeWhiteBorder: null === (_16 = this._wordCloudShapeConfig) || void 0 === _16 ? void 0 : _16.removeWhiteBorder,
|
|
79
|
+
textLayoutTimes: null === (_17 = this._wordCloudShapeConfig) || void 0 === _17 ? void 0 : _17.textLayoutTimes,
|
|
80
|
+
fontSizeShrinkFactor: null === (_18 = this._wordCloudShapeConfig) || void 0 === _18 ? void 0 : _18.fontSizeShrinkFactor,
|
|
81
|
+
stepFactor: null === (_19 = this._wordCloudShapeConfig) || void 0 === _19 ? void 0 : _19.stepFactor,
|
|
82
|
+
layoutMode: null === (_20 = this._wordCloudShapeConfig) || void 0 === _20 ? void 0 : _20.layoutMode,
|
|
83
|
+
importantWordCount: null === (_21 = this._wordCloudShapeConfig) || void 0 === _21 ? void 0 : _21.importantWordCount,
|
|
84
|
+
globalShinkLimit: null === (_22 = this._wordCloudShapeConfig) || void 0 === _22 ? void 0 : _22.globalShinkLimit,
|
|
85
|
+
fontSizeEnlargeFactor: null === (_23 = this._wordCloudShapeConfig) || void 0 === _23 ? void 0 : _23.fontSizeEnlargeFactor,
|
|
86
|
+
fillingDeltaFontSizeFactor: null === (_24 = this._wordCloudShapeConfig) || void 0 === _24 ? void 0 : _24.fillingDeltaFontSizeFactor
|
|
87
87
|
}) : (wordCloudTransforms.push({
|
|
88
88
|
type: "wordcloud",
|
|
89
89
|
layoutType: this._wordCloudConfig.layoutMode,
|
|
90
|
-
size: [
|
|
90
|
+
size: [ this._region.getLayoutRect().width, this._region.getLayoutRect().height ],
|
|
91
91
|
shape: this._maskShape,
|
|
92
|
-
postProjection: null !== (
|
|
92
|
+
postProjection: null !== (_d = this._spec.postProjection) && void 0 !== _d ? _d : "StereographicProjection",
|
|
93
93
|
dataIndexKey: constant_1.DEFAULT_DATA_KEY,
|
|
94
94
|
text: {
|
|
95
95
|
field: textField
|
|
@@ -102,13 +102,13 @@ class WordCloud3dSeries extends base_1.BaseWordCloudSeries {
|
|
|
102
102
|
rotate: {
|
|
103
103
|
field: word_cloud_1.WORD_CLOUD_ANGLE
|
|
104
104
|
},
|
|
105
|
-
fontFamily: null !== (
|
|
105
|
+
fontFamily: null !== (_e = this._fontFamilyField) && void 0 !== _e ? _e : null === (_g = null === (_f = this._spec.word) || void 0 === _f ? void 0 : _f.style) || void 0 === _g ? void 0 : _g.fontFamily,
|
|
106
106
|
fontWeight: fontWeightField ? {
|
|
107
107
|
field: fontWeightField
|
|
108
108
|
} : valueField ? {
|
|
109
109
|
field: word_cloud_1.WORD_CLOUD_WEIGHT
|
|
110
110
|
} : null,
|
|
111
|
-
fontStyle: null !== (
|
|
111
|
+
fontStyle: null !== (_h = this._fontStyleField) && void 0 !== _h ? _h : null === (_k = null === (_j = this._spec.word) || void 0 === _j ? void 0 : _j.style) || void 0 === _k ? void 0 : _k.fontStyle,
|
|
112
112
|
depth_3d: this._spec.depth_3d,
|
|
113
113
|
randomVisible: this._random,
|
|
114
114
|
clip: "clip" === this._wordCloudConfig.drawOutOfBound,
|