UNPKG

1.73 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var tslib_1 = require("tslib");
4var coordinate_1 = require("../util/coordinate");
5var base_1 = tslib_1.__importDefault(require("./base"));
6/** 引入对应的 ShapeFactory */
7require("./shape/schema");
8var shape_size_1 = require("./util/shape-size");
9/**
10 * Schema 几何标记,用于一些自定义图形的绘制,比如箱型图、股票图等。
11 */
12var Schema = /** @class */ (function (_super) {
13 tslib_1.__extends(Schema, _super);
14 function Schema() {
15 var _this = _super !== null && _super.apply(this, arguments) || this;
16 _this.type = 'schema';
17 _this.shapeType = 'schema';
18 _this.generatePoints = true;
19 return _this;
20 }
21 /**
22 * 获取 Shape 的关键点数据。
23 * @param record
24 * @returns
25 */
26 Schema.prototype.createShapePointsCfg = function (record) {
27 var cfg = _super.prototype.createShapePointsCfg.call(this, record);
28 // 计算每个 shape 的 size
29 var size;
30 var sizeAttr = this.getAttribute('size');
31 if (sizeAttr) {
32 size = this.getAttributeValues(sizeAttr, record)[0];
33 // 归一化
34 var coordinate = this.coordinate;
35 var coordinateWidth = (0, coordinate_1.getXDimensionLength)(coordinate);
36 size = size / coordinateWidth;
37 }
38 else {
39 if (!this.defaultSize) {
40 this.defaultSize = (0, shape_size_1.getDefaultSize)(this);
41 }
42 size = this.defaultSize;
43 }
44 cfg.size = size;
45 return cfg;
46 };
47 return Schema;
48}(base_1.default));
49exports.default = Schema;
50//# sourceMappingURL=schema.js.map
\No newline at end of file