UNPKG

@visactor/vchart

Version:

charts lib based @visactor/VGrammar

55 lines (48 loc) 3.13 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: !0 }), exports.registerPolarBandAxis = exports.PolarBandAxis = void 0; const vscale_1 = require("@visactor/vscale"), type_1 = require("../../interface/type"), axis_1 = require("./axis"), vutils_1 = require("@visactor/vutils"), band_axis_mixin_1 = require("../mixin/band-axis-mixin"), factory_1 = require("../../../core/factory"), base_axis_1 = require("../base-axis"), register_1 = require("../../../data/register"), vrender_components_1 = require("@visactor/vrender-components"), interface_1 = require("../interface"), common_axis_1 = require("../../../theme/builtin/common/component/axis/common-axis"), band_axis_1 = require("../../../theme/builtin/common/component/axis/band-axis"), polar_axis_1 = require("../../../theme/builtin/common/component/axis/polar-axis"); class PolarBandAxis extends axis_1.PolarAxis { constructor() { super(...arguments), this.type = type_1.ComponentTypeEnum.polarBandAxis, this._scale = new vscale_1.BandScale; } computeDomain(data) { return this.computeBandDomain(data); } updateScaleRange() { const isChanged = super.updateScaleRange(); return this.updateGroupScaleRange(), isChanged; } axisHelper() { const helper = super.axisHelper(); return Object.assign(Object.assign({}, helper), { getBandwidth: depth => helper.getScale(depth).bandwidth() }); } initScales() { super.initScales(), this.calcScales(this._defaultBandInnerPadding, this._defaultBandOuterPadding); } registerTicksTransform() { const name = `${this.type}-ticks`; return (0, register_1.registerDataSetInstanceTransform)(this._option.dataSet, name, vrender_components_1.polarAngleAxisDiscreteTicks), name; } transformScaleDomain() {} } exports.PolarBandAxis = PolarBandAxis, PolarBandAxis.type = type_1.ComponentTypeEnum.polarBandAxis, PolarBandAxis.specKey = "axes", PolarBandAxis.builtInTheme = { axis: common_axis_1.commonAxis, axisBand: band_axis_1.axisBand, axisAngle: polar_axis_1.axisAngle, axisRadius: polar_axis_1.axisRadius }, (0, vutils_1.mixin)(PolarBandAxis, band_axis_mixin_1.BandAxisMixin); const registerPolarBandAxis = () => { factory_1.Factory.registerGraphicComponent(interface_1.AxisEnum.lineAxis, ((attrs, options) => new vrender_components_1.LineAxis(attrs, options))), factory_1.Factory.registerGraphicComponent(interface_1.GridEnum.lineAxisGrid, ((attrs, options) => new vrender_components_1.LineAxisGrid(attrs, options))), factory_1.Factory.registerGraphicComponent(interface_1.AxisEnum.circleAxis, ((attrs, options) => new vrender_components_1.CircleAxis(attrs, options))), factory_1.Factory.registerGraphicComponent(interface_1.GridEnum.circleAxisGrid, ((attrs, options) => new vrender_components_1.CircleAxisGrid(attrs, options))), (0, base_axis_1.registerAxis)(), factory_1.Factory.registerComponent(PolarBandAxis.type, PolarBandAxis); }; exports.registerPolarBandAxis = registerPolarBandAxis; //# sourceMappingURL=band-axis.js.map