UNPKG

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