UNPKG

@visactor/vchart

Version:

charts lib based @visactor/VGrammar

83 lines (76 loc) 4.88 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: !0 }), exports.registerFunnel3dSeries = exports.Funnel3dSeries = void 0; const attribute_1 = require("../../../constant/attribute"), type_1 = require("../../interface/type"), funnel_1 = require("../funnel"), pyramid_3d_1 = require("../../../mark/polygon/pyramid-3d"), text_1 = require("../../../mark/text"), rule_1 = require("../../../mark/rule"), constant_1 = require("../constant"), factory_1 = require("../../../core/factory"), funnel_3d_transformer_1 = require("./funnel-3d-transformer"); class Funnel3dSeries extends funnel_1.FunnelSeries { constructor() { super(...arguments), this.type = type_1.SeriesTypeEnum.funnel3d, this._funnelMarkName = "funnel3d", this._funnelMarkType = "pyramid3d", this._transformMarkName = "transform3d", this._transformMarkType = "pyramid3d", this.transformerConstructor = funnel_3d_transformer_1.Funnel3dSeriesSpecTransformer; } initMark() { var _a, _b, _c, _d, _e, _f, _g, _h; if (this._funnelMark = this._createMark(Object.assign(Object.assign({}, Funnel3dSeries.mark.funnel3d), { name: this._funnelMarkName, type: this._funnelMarkType }), { themeSpec: null === (_a = this._theme) || void 0 === _a ? void 0 : _a.funnel3d, key: this._seriesField, isSeriesMark: !0 }, { support3d: !0 }), this._spec.isTransform && (this._funnelTransformMark = this._createMark(Object.assign(Object.assign({}, Funnel3dSeries.mark.transform3d), { name: this._transformMarkName, type: this._transformMarkType }), { themeSpec: null === (_b = this._theme) || void 0 === _b ? void 0 : _b.transform3d, key: this._seriesField, skipBeforeLayouted: !1, dataView: this._viewDataTransform.getDataView(), dataProductId: this._viewDataTransform.getProductId() })), null === (_d = null === (_c = this._spec) || void 0 === _c ? void 0 : _c.outerLabel) || void 0 === _d ? void 0 : _d.visible) { const {line: line} = null !== (_e = this._spec.outerLabel) && void 0 !== _e ? _e : {}, {line: lineTheme} = null !== (_g = null === (_f = this._theme) || void 0 === _f ? void 0 : _f.outerLabel) && void 0 !== _g ? _g : {}; this._funnelOuterLabelMark.label = this._createMark(Funnel3dSeries.mark.outerLabel, { themeSpec: null === (_h = this._theme) || void 0 === _h ? void 0 : _h.outerLabel, key: this._seriesField, markSpec: this._spec.outerLabel }), this._funnelOuterLabelMark.line = this._createMark(Funnel3dSeries.mark.outerLabelLine, { themeSpec: lineTheme, key: this._seriesField, markSpec: line, depend: [ this._funnelOuterLabelMark.label ] }); } } initMarkStyle() { super.initMarkStyle(); const funnelMark = this._funnelMark; funnelMark && this.setMarkStyle(funnelMark, { z: _ => { if (this._isHorizontal()) return 0; const points = this.getPoints(_), width = Math.max(Math.abs(points[0].x - points[1].x), Math.abs(points[2].x - points[3].x)); return (this._computeMaxSize() - width) / 2; } }, "normal", attribute_1.AttributeLevel.Series); } initLabelMarkStyle(labelMark) { var _a, _b; super.initLabelMarkStyle(labelMark), this.setMarkStyle(labelMark, { z: _ => { if (this._isHorizontal()) return 0; const points = this.getPoints(_), width = Math.max(Math.abs(points[0].x - points[1].x), Math.abs(points[2].x - points[3].x)); return (this._computeMaxSize() - width) / 2; } }, "normal", attribute_1.AttributeLevel.Series), this._labelMark = labelMark, (null === (_a = this._funnelOuterLabelMark) || void 0 === _a ? void 0 : _a.label) && this._funnelOuterLabelMark.label.setDepend(labelMark.getComponent()), (null === (_b = this._funnelOuterLabelMark) || void 0 === _b ? void 0 : _b.line) && this._funnelOuterLabelMark.line.setDepend(...this._funnelOuterLabelMark.line.getDepend()); } } exports.Funnel3dSeries = Funnel3dSeries, Funnel3dSeries.type = type_1.SeriesTypeEnum.funnel3d, Funnel3dSeries.mark = constant_1.funnel3dSeriesMark, Funnel3dSeries.transformerConstructor = funnel_3d_transformer_1.Funnel3dSeriesSpecTransformer; const registerFunnel3dSeries = () => { (0, pyramid_3d_1.registerPyramid3dMark)(), (0, text_1.registerTextMark)(), (0, rule_1.registerRuleMark)(), factory_1.Factory.registerSeries(Funnel3dSeries.type, Funnel3dSeries); }; exports.registerFunnel3dSeries = registerFunnel3dSeries; //# sourceMappingURL=funnel-3d.js.map