1 | import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
2 | import _createClass from "@babel/runtime/helpers/esm/createClass";
|
3 | import _get from "@babel/runtime/helpers/esm/get";
|
4 | import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
5 | import _inherits from "@babel/runtime/helpers/esm/inherits";
|
6 | import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
7 | import withLine from '../line/withLine';
|
8 | export default (function (View) {
|
9 | return function (_withLine) {
|
10 | _inherits(Area, _withLine);
|
11 |
|
12 | var _super = _createSuper(Area);
|
13 |
|
14 | function Area() {
|
15 | _classCallCheck(this, Area);
|
16 |
|
17 | return _super.apply(this, arguments);
|
18 | }
|
19 |
|
20 | _createClass(Area, [{
|
21 | key: "getDefaultCfg",
|
22 | value: function getDefaultCfg() {
|
23 | return {
|
24 | geomType: 'area',
|
25 |
|
26 | startOnZero: true,
|
27 |
|
28 | sortable: true
|
29 | };
|
30 | }
|
31 | }, {
|
32 | key: "mapping",
|
33 | value: function mapping() {
|
34 | var records = _get(_getPrototypeOf(Area.prototype), "mapping", this).call(this);
|
35 |
|
36 |
|
37 | var y0 = this.getY0Value();
|
38 | var props = this.props,
|
39 | defaultStartOnZero = this.startOnZero;
|
40 | var coord = props.coord,
|
41 | _props$startOnZero = props.startOnZero,
|
42 | startOnZero = _props$startOnZero === void 0 ? defaultStartOnZero : _props$startOnZero;
|
43 | var baseY = coord.y[0];
|
44 |
|
45 | if (startOnZero) {
|
46 |
|
47 | var originCoord = coord.convertPoint({
|
48 | x: 0,
|
49 | y: y0
|
50 | });
|
51 | baseY = originCoord.y;
|
52 | }
|
53 |
|
54 | for (var i = 0, len = records.length; i < len; i++) {
|
55 | var record = records[i];
|
56 | var children = record.children;
|
57 |
|
58 | for (var j = 0, _len = children.length; j < _len; j++) {
|
59 | var child = children[j];
|
60 | var points = child.points,
|
61 | bottomPoints = child.bottomPoints;
|
62 |
|
63 | if (bottomPoints && bottomPoints.length) {
|
64 | bottomPoints.reverse();
|
65 | child.points = points.concat(bottomPoints);
|
66 | } else {
|
67 | points.push({
|
68 | x: points[points.length - 1].x,
|
69 | y: baseY
|
70 | });
|
71 | points.push({
|
72 | x: points[0].x,
|
73 | y: baseY
|
74 | });
|
75 | }
|
76 | }
|
77 | }
|
78 |
|
79 | return records;
|
80 | }
|
81 | }]);
|
82 |
|
83 | return Area;
|
84 | }(withLine(View));
|
85 | }); |
\ | No newline at end of file |