@visactor/vchart
Version:
charts lib based @visactor/VGrammar
78 lines (69 loc) • 3.63 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.registerWordCloudShape3dSeries = exports.registerWordCloud3dSeries = exports.WordCloud3dSeries = void 0;
const attribute_1 = require("../../constant/attribute"), text_1 = require("../../mark/text"), type_1 = require("../interface/type"), utils_1 = require("../../animation/utils"), base_1 = require("./base"), factory_1 = require("../../core/factory"), animation_1 = require("./animation"), vgrammar_wordcloud_1 = require("@visactor/vgrammar-wordcloud"), vgrammar_wordcloud_shape_1 = require("@visactor/vgrammar-wordcloud-shape");
class WordCloud3dSeries extends base_1.BaseWordCloudSeries {
constructor() {
super(...arguments), this.type = type_1.SeriesTypeEnum.wordCloud3d;
}
_wordCloudTransformOption() {
var _a;
return Object.assign(Object.assign({}, super._wordCloudTransformOption()), {
postProjection: null !== (_a = this._spec.postProjection) && void 0 !== _a ? _a : "StereographicProjection",
depth_3d: this._spec.depth_3d
});
}
_wordCloudShapeTransformOption() {
var _a;
return Object.assign(Object.assign({}, super._wordCloudShapeTransformOption()), {
postProjection: null !== (_a = this._spec.postProjection) && void 0 !== _a ? _a : "StereographicProjection",
depth_3d: this._spec.depth_3d
});
}
initMark() {
this._wordMark = this._createMark(base_1.BaseWordCloudSeries.mark.word, {
groupKey: this._seriesField,
isSeriesMark: !0
}, {
support3d: !0
});
}
initMarkStyle() {
super.initMarkStyle();
const wordMark = this._wordMark;
wordMark && this.setMarkStyle(wordMark, {
z: datum => {
var _a;
return null !== (_a = datum.z) && void 0 !== _a ? _a : 0;
}
}, "normal", attribute_1.AttributeLevel.Series);
}
initAnimation() {
var _a, _b;
const padding = null !== (_a = this._padding) && void 0 !== _a ? _a : {};
this._wordMark && this._wordMark.setAnimationConfig((0, utils_1.animationConfig)(null === (_b = factory_1.Factory.getAnimationInKey("wordCloud3d")) || void 0 === _b ? void 0 : _b((() => {
var _a;
const srView = this.getCompiler().getVGrammarView(), width = srView.width() - padding.left || 0 - padding.right || 0, height = srView.height() - padding.top || 0 - padding.bottom || 0, r = Math.max(width, height) / 2;
return {
center: {
x: r,
y: r,
z: null !== (_a = this._spec.depth_3d) && void 0 !== _a ? _a : r
},
r: r
};
})), (0, utils_1.userAnimationConfig)("word", this._spec, this._markAttributeContext)));
}
}
exports.WordCloud3dSeries = WordCloud3dSeries, WordCloud3dSeries.type = type_1.SeriesTypeEnum.wordCloud3d;
const registerWordCloud3dSeries = () => {
(0, vgrammar_wordcloud_1.registerWordCloudTransforms)(), (0, text_1.registerTextMark)(),
(0, animation_1.registerWordCloud3dAnimation)(), factory_1.Factory.registerSeries(WordCloud3dSeries.type, WordCloud3dSeries);
};
exports.registerWordCloud3dSeries = registerWordCloud3dSeries;
const registerWordCloudShape3dSeries = () => {
(0, vgrammar_wordcloud_shape_1.registerWordCloudShapeTransforms)(), (0, exports.registerWordCloud3dSeries)();
};
exports.registerWordCloudShape3dSeries = registerWordCloudShape3dSeries;
//# sourceMappingURL=word-cloud-3d.js.map