@visactor/vchart
Version:
charts lib based @visactor/VGrammar
35 lines (28 loc) • 1.28 kB
JavaScript
import { Factory } from "./../core/factory";
import { BaseMark } from "./base/base-mark";
import { registerBarBoxplotGlyph, registerBoxplotGlyph } from "@visactor/vgrammar-core";
const BOX_PLOT_GLYPH_TYPE = "boxplot", BAR_BOX_PLOT_GLYPH_TYPE = "barBoxplot";
export class BoxPlotMark extends 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;
}
}
BoxPlotMark.type = "boxPlot";
export const registerBoxPlotMark = () => {
Factory.registerMark(BoxPlotMark.type, BoxPlotMark), registerBoxplotGlyph(), registerBarBoxplotGlyph();
};
//# sourceMappingURL=box-plot.js.map