@visactor/vchart
Version:
charts lib based @visactor/VGrammar
55 lines (48 loc) • 2.73 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.registerMarkPoint = exports.CartesianMarkPoint = void 0;
const type_1 = require("../../interface/type"), utils_1 = require("../utils"), vrender_components_1 = require("@visactor/vrender-components"), vutils_1 = require("@visactor/vutils"), factory_1 = require("../../../core/factory"), base_mark_point_1 = require("./base-mark-point"), mark_point_1 = require("../../../theme/builtin/common/component/mark-point");
class CartesianMarkPoint extends base_mark_point_1.BaseMarkPoint {
constructor() {
super(...arguments), this.type = type_1.ComponentTypeEnum.markPoint, this.name = type_1.ComponentTypeEnum.markPoint,
this.coordinateType = "cartesian";
}
_computePointsAttr() {
var _a;
const spec = this._spec, data = this._markerData, relativeSeries = this._relativeSeries, isXYLayout = (0,
vutils_1.isValid)(spec.x) && (0, vutils_1.isValid)(spec.y), isCoordinateLayout = (0,
vutils_1.isValid)(spec.coordinate), isPositionLayout = (0, vutils_1.isValid)(spec.position), autoRange = null !== (_a = null == spec ? void 0 : spec.autoRange) && void 0 !== _a && _a;
let point;
return isXYLayout ? point = (0, utils_1.xyLayout)(data, relativeSeries, relativeSeries, relativeSeries, autoRange)[0][0] : isCoordinateLayout ? point = (0,
utils_1.cartesianCoordinateLayout)(data, relativeSeries, autoRange, spec.coordinatesOffset)[0] : isPositionLayout && (point = (0,
utils_1.positionLayout)(spec.position, relativeSeries, spec.regionRelative)[0]),
{
point: point
};
}
_computeOptions() {
const spec = this._spec, {doXYProcess: doXYProcess} = (0, utils_1.getMarkPointProcessInfo)(spec), isCoordinateProcess = (0,
vutils_1.isValid)(spec.coordinate);
let options;
return doXYProcess ? options = [ this._processSpecByDims([ {
dim: "x",
specValue: spec.x
}, {
dim: "y",
specValue: spec.y
} ]) ] : isCoordinateProcess && (options = this._processSpecCoo(spec)), {
options: options
};
}
}
exports.CartesianMarkPoint = CartesianMarkPoint, CartesianMarkPoint.type = type_1.ComponentTypeEnum.markPoint,
CartesianMarkPoint.coordinateType = "cartesian", CartesianMarkPoint.builtInTheme = {
markPoint: mark_point_1.markPoint
};
const registerMarkPoint = () => {
factory_1.Factory.registerComponent(CartesianMarkPoint.type, CartesianMarkPoint),
(0, vrender_components_1.registerMarkPointAnimate)();
};
exports.registerMarkPoint = registerMarkPoint;
//# sourceMappingURL=cartesian-mark-point.js.map