UNPKG

@visactor/vchart

Version:

charts lib based @visactor/VGrammar

38 lines (31 loc) 1.52 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: !0 }), exports.registerBoxPlotMark = exports.BoxPlotMark = void 0; const factory_1 = require("./../core/factory"), base_mark_1 = require("./base/base-mark"), vgrammar_core_1 = require("@visactor/vgrammar-core"), BOX_PLOT_GLYPH_TYPE = "boxplot", BAR_BOX_PLOT_GLYPH_TYPE = "barBoxplot"; class BoxPlotMark extends base_mark_1.BaseMark { constructor() { super(...arguments), this.type = BoxPlotMark.type; } _getDefaultStyle() { return Object.assign(Object.assign({}, super._getDefaultStyle()), { lineWidth: 2, boxWidth: 30, shaftWidth: 20, shaftShape: "line" }); } _initProduct(group) { const shaftShape = this.getStyle("shaftShape"), view = this.getVGrammarView(), id = this.getProductId(), glyphType = "bar" === shaftShape ? "barBoxplot" : "boxplot", direction = this.getStyle("direction"); this._product = view.glyph(glyphType, null != group ? group : view.rootMark).id(id).configureGlyph({ direction: direction }), this._compiledProductId = id; } } exports.BoxPlotMark = BoxPlotMark, BoxPlotMark.type = "boxPlot"; const registerBoxPlotMark = () => { factory_1.Factory.registerMark(BoxPlotMark.type, BoxPlotMark), (0, vgrammar_core_1.registerBoxplotGlyph)(), (0, vgrammar_core_1.registerBarBoxplotGlyph)(); }; exports.registerBoxPlotMark = registerBoxPlotMark; //# sourceMappingURL=box-plot.js.map