@pie-lib/plot 2.10.0 → 2.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -65
- package/package.json +4 -4
- package/lib/draggable.js +0 -65
- package/lib/draggable.js.map +0 -1
- package/lib/graph-props.js +0 -53
- package/lib/graph-props.js.map +0 -1
- package/lib/grid-draggable.js +0 -381
- package/lib/grid-draggable.js.map +0 -1
- package/lib/index.js +0 -59
- package/lib/index.js.map +0 -1
- package/lib/label.js +0 -176
- package/lib/label.js.map +0 -1
- package/lib/root.js +0 -422
- package/lib/root.js.map +0 -1
- package/lib/trig.js +0 -196
- package/lib/trig.js.map +0 -1
- package/lib/types.js +0 -68
- package/lib/types.js.map +0 -1
- package/lib/utils.js +0 -232
- package/lib/utils.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
# [2.
|
|
6
|
+
# [2.11.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/plot@2.7.3...@pie-lib/plot@2.11.0) (2025-07-31)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @pie-lib/plot
|
|
9
9
|
|
|
@@ -11,7 +11,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
# [2.
|
|
14
|
+
# [2.10.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/plot@2.7.3...@pie-lib/plot@2.10.0) (2025-07-31)
|
|
15
15
|
|
|
16
16
|
**Note:** Version bump only for package @pie-lib/plot
|
|
17
17
|
|
|
@@ -19,7 +19,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
# [2.
|
|
22
|
+
# [2.9.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/plot@2.7.3...@pie-lib/plot@2.9.0) (2025-07-31)
|
|
23
23
|
|
|
24
24
|
**Note:** Version bump only for package @pie-lib/plot
|
|
25
25
|
|
|
@@ -27,142 +27,90 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
# [2.
|
|
30
|
+
# [2.9.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/plot@2.7.3...@pie-lib/plot@2.9.0) (2025-07-31)
|
|
31
31
|
|
|
32
32
|
**Note:** Version bump only for package @pie-lib/plot
|
|
33
33
|
|
|
34
|
+
# [2.10.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/plot@2.7.3...@pie-lib/plot@2.10.0) (2025-07-31)
|
|
34
35
|
|
|
36
|
+
**Note:** Version bump only for package @pie-lib/plot
|
|
35
37
|
|
|
38
|
+
# [2.9.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/plot@2.7.3...@pie-lib/plot@2.9.0) (2025-07-31)
|
|
36
39
|
|
|
40
|
+
**Note:** Version bump only for package @pie-lib/plot
|
|
37
41
|
|
|
38
|
-
# [2.8.0-beta.
|
|
42
|
+
# [2.8.0-beta.8](https://github.com/pie-framework/pie-lib/compare/@pie-lib/plot@2.7.3...@pie-lib/plot@2.8.0-beta.8) (2025-07-25)
|
|
39
43
|
|
|
40
44
|
**Note:** Version bump only for package @pie-lib/plot
|
|
41
45
|
|
|
46
|
+
# [2.8.0-beta.7](https://github.com/pie-framework/pie-lib/compare/@pie-lib/plot@2.7.3...@pie-lib/plot@2.8.0-beta.7) (2025-07-25)
|
|
42
47
|
|
|
48
|
+
**Note:** Version bump only for package @pie-lib/plot
|
|
43
49
|
|
|
50
|
+
# [2.8.0-beta.7](https://github.com/pie-framework/pie-lib/compare/@pie-lib/plot@2.7.3...@pie-lib/plot@2.8.0-beta.7) (2025-07-25)
|
|
44
51
|
|
|
52
|
+
**Note:** Version bump only for package @pie-lib/plot
|
|
45
53
|
|
|
46
54
|
# [2.8.0-beta.6](https://github.com/pie-framework/pie-lib/compare/@pie-lib/plot@2.7.3...@pie-lib/plot@2.8.0-beta.6) (2025-07-25)
|
|
47
55
|
|
|
48
56
|
**Note:** Version bump only for package @pie-lib/plot
|
|
49
57
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
58
|
# [2.8.0-beta.6](https://github.com/pie-framework/pie-lib/compare/@pie-lib/plot@2.7.3...@pie-lib/plot@2.8.0-beta.6) (2025-07-25)
|
|
55
59
|
|
|
56
60
|
**Note:** Version bump only for package @pie-lib/plot
|
|
57
61
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
62
|
# [2.8.0-beta.5](https://github.com/pie-framework/pie-lib/compare/@pie-lib/plot@2.7.3...@pie-lib/plot@2.8.0-beta.5) (2025-07-25)
|
|
63
63
|
|
|
64
64
|
**Note:** Version bump only for package @pie-lib/plot
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
66
|
# [2.8.0-beta.5](https://github.com/pie-framework/pie-lib/compare/@pie-lib/plot@2.7.3...@pie-lib/plot@2.8.0-beta.5) (2025-07-25)
|
|
71
67
|
|
|
72
68
|
**Note:** Version bump only for package @pie-lib/plot
|
|
73
69
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
70
|
# [2.8.0-beta.4](https://github.com/pie-framework/pie-lib/compare/@pie-lib/plot@2.7.3...@pie-lib/plot@2.8.0-beta.4) (2025-07-25)
|
|
79
71
|
|
|
80
72
|
**Note:** Version bump only for package @pie-lib/plot
|
|
81
73
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
74
|
# [2.8.0-beta.3](https://github.com/pie-framework/pie-lib/compare/@pie-lib/plot@2.7.3...@pie-lib/plot@2.8.0-beta.3) (2025-07-25)
|
|
87
75
|
|
|
88
76
|
**Note:** Version bump only for package @pie-lib/plot
|
|
89
77
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
78
|
# [2.8.0-beta.4](https://github.com/pie-framework/pie-lib/compare/@pie-lib/plot@2.7.3...@pie-lib/plot@2.8.0-beta.4) (2025-07-23)
|
|
95
79
|
|
|
96
80
|
**Note:** Version bump only for package @pie-lib/plot
|
|
97
81
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
82
|
# [2.8.0-beta.3](https://github.com/pie-framework/pie-lib/compare/@pie-lib/plot@2.7.3...@pie-lib/plot@2.8.0-beta.3) (2025-07-23)
|
|
103
83
|
|
|
104
84
|
**Note:** Version bump only for package @pie-lib/plot
|
|
105
85
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
86
|
# [2.8.0-beta.3](https://github.com/pie-framework/pie-lib/compare/@pie-lib/plot@2.7.3...@pie-lib/plot@2.8.0-beta.3) (2025-07-20)
|
|
111
87
|
|
|
112
88
|
**Note:** Version bump only for package @pie-lib/plot
|
|
113
89
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
90
|
# [2.8.0-beta.2](https://github.com/pie-framework/pie-lib/compare/@pie-lib/plot@2.7.3...@pie-lib/plot@2.8.0-beta.2) (2025-07-20)
|
|
119
91
|
|
|
120
92
|
**Note:** Version bump only for package @pie-lib/plot
|
|
121
93
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
94
|
# [2.8.0-beta.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/plot@2.7.3...@pie-lib/plot@2.8.0-beta.1) (2025-07-20)
|
|
127
95
|
|
|
128
96
|
**Note:** Version bump only for package @pie-lib/plot
|
|
129
97
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
98
|
# [2.8.0-beta.2](https://github.com/pie-framework/pie-lib/compare/@pie-lib/plot@2.7.3...@pie-lib/plot@2.8.0-beta.2) (2025-07-20)
|
|
135
99
|
|
|
136
100
|
**Note:** Version bump only for package @pie-lib/plot
|
|
137
101
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
102
|
# [2.8.0-beta.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/plot@2.7.3...@pie-lib/plot@2.8.0-beta.1) (2025-07-20)
|
|
143
103
|
|
|
144
104
|
**Note:** Version bump only for package @pie-lib/plot
|
|
145
105
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
106
|
# [2.8.0-beta.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/plot@2.7.3...@pie-lib/plot@2.8.0-beta.1) (2025-07-20)
|
|
151
107
|
|
|
152
108
|
**Note:** Version bump only for package @pie-lib/plot
|
|
153
109
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
110
|
# [2.8.0-beta.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/plot@2.7.3...@pie-lib/plot@2.8.0-beta.0) (2025-07-20)
|
|
159
111
|
|
|
160
112
|
**Note:** Version bump only for package @pie-lib/plot
|
|
161
113
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
114
|
# [2.9.0-beta.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/plot@2.7.3...@pie-lib/plot@2.9.0-beta.0) (2025-07-15)
|
|
167
115
|
|
|
168
116
|
**Note:** Version bump only for package @pie-lib/plot
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "2.
|
|
6
|
+
"version": "2.11.0",
|
|
7
7
|
"description": "Some underlying components for building charts/graphs",
|
|
8
8
|
"keywords": [
|
|
9
9
|
"react",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@mapbox/point-geometry": "^0.1.0",
|
|
20
20
|
"@material-ui/core": "^3.8.3",
|
|
21
|
-
"@pie-lib/editable-html": "
|
|
22
|
-
"@pie-lib/render-ui": "
|
|
21
|
+
"@pie-lib/editable-html": "^11.5.0",
|
|
22
|
+
"@pie-lib/render-ui": "^4.19.0",
|
|
23
23
|
"@vx/axis": "^0.0.183",
|
|
24
24
|
"@vx/event": "^0.0.182",
|
|
25
25
|
"@vx/grid": "^0.0.183",
|
|
@@ -41,6 +41,6 @@
|
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"react": "^16.8.1"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "889a13bfea2c768b8a3a6eabfc6fe7b7725aa832",
|
|
45
45
|
"scripts": {}
|
|
46
46
|
}
|
package/lib/draggable.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "__esModule", {
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
Object.defineProperty(exports, "DraggableCore", {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function get() {
|
|
13
|
-
return _reactDraggable.DraggableCore;
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
exports["default"] = void 0;
|
|
17
|
-
|
|
18
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
19
|
-
|
|
20
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
21
|
-
|
|
22
|
-
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
23
|
-
|
|
24
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
25
|
-
|
|
26
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
27
|
-
|
|
28
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
29
|
-
|
|
30
|
-
var _reactDraggable = _interopRequireWildcard(require("react-draggable"));
|
|
31
|
-
|
|
32
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
33
|
-
|
|
34
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
35
|
-
|
|
36
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
37
|
-
|
|
38
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
39
|
-
|
|
40
|
-
var LocalDraggable = /*#__PURE__*/function (_Draggable) {
|
|
41
|
-
(0, _inherits2["default"])(LocalDraggable, _Draggable);
|
|
42
|
-
|
|
43
|
-
var _super = _createSuper(LocalDraggable);
|
|
44
|
-
|
|
45
|
-
function LocalDraggable() {
|
|
46
|
-
(0, _classCallCheck2["default"])(this, LocalDraggable);
|
|
47
|
-
return _super.apply(this, arguments);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
(0, _createClass2["default"])(LocalDraggable, [{
|
|
51
|
-
key: "componentWillReceiveProps",
|
|
52
|
-
value: function componentWillReceiveProps(next) {
|
|
53
|
-
(0, _get2["default"])((0, _getPrototypeOf2["default"])(LocalDraggable.prototype), "componentWillReceiveProps", this).call(this, next); //Remove the x/y state as these values have now been updated and will come through as props.
|
|
54
|
-
|
|
55
|
-
this.setState({
|
|
56
|
-
x: 0,
|
|
57
|
-
y: 0
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
}]);
|
|
61
|
-
return LocalDraggable;
|
|
62
|
-
}(_reactDraggable["default"]);
|
|
63
|
-
|
|
64
|
-
exports["default"] = LocalDraggable;
|
|
65
|
-
//# sourceMappingURL=draggable.js.map
|
package/lib/draggable.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/draggable.jsx"],"names":["LocalDraggable","next","setState","x","y","Draggable"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;IAEqBA,c;;;;;;;;;;;;WACnB,mCAA0BC,IAA1B,EAAgC;AAC9B,sIAAgCA,IAAhC,EAD8B,CAE9B;;AACA,WAAKC,QAAL,CAAc;AAAEC,QAAAA,CAAC,EAAE,CAAL;AAAQC,QAAAA,CAAC,EAAE;AAAX,OAAd;AACD;;;EALyCC,0B","sourcesContent":["import Draggable, { DraggableCore } from 'react-draggable';\n\nexport default class LocalDraggable extends Draggable {\n componentWillReceiveProps(next) {\n super.componentWillReceiveProps(next);\n //Remove the x/y state as these values have now been updated and will come through as props.\n this.setState({ x: 0, y: 0 });\n }\n}\n\nexport { DraggableCore };\n"],"file":"draggable.js"}
|
package/lib/graph-props.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.create = void 0;
|
|
9
|
-
|
|
10
|
-
var _invariant = _interopRequireDefault(require("invariant"));
|
|
11
|
-
|
|
12
|
-
var _utils = require("./utils");
|
|
13
|
-
|
|
14
|
-
var _d3Scale = require("d3-scale");
|
|
15
|
-
|
|
16
|
-
var createSnapMinAndMax = function createSnapMinAndMax(_ref) {
|
|
17
|
-
var min = _ref.min,
|
|
18
|
-
max = _ref.max,
|
|
19
|
-
step = _ref.step;
|
|
20
|
-
// for graphing, if step is a value with decimals, we have to calculate the min & max for the grid taking in consideration that 0 has to be exactly in the middle
|
|
21
|
-
// for example, if min: -5 & max: 5 & step: 0.75, in order to keep 0 in the middle we have to set min: -4.5 & max: 4.5
|
|
22
|
-
return {
|
|
23
|
-
step: step,
|
|
24
|
-
min: parseInt(min / step) * step,
|
|
25
|
-
max: parseInt(max / step) * step
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
var create = function create(domain, range, size, getRootNode) {
|
|
30
|
-
(0, _invariant["default"])(domain.min < domain.max, 'domain: min must be less than max');
|
|
31
|
-
(0, _invariant["default"])(range.min < range.max, 'range: min must be less than max');
|
|
32
|
-
var domainMinMax = createSnapMinAndMax(domain);
|
|
33
|
-
var rangeMinMax = createSnapMinAndMax(range);
|
|
34
|
-
var scale = {
|
|
35
|
-
x: (0, _d3Scale.scaleLinear)().domain([domain.min, domain.max]).range([0, size.width]),
|
|
36
|
-
y: (0, _d3Scale.scaleLinear)().domain([range.max, range.min]).range([0, size.height])
|
|
37
|
-
};
|
|
38
|
-
var snap = {
|
|
39
|
-
x: _utils.snapTo.bind(null, domainMinMax.min, domainMinMax.max, domainMinMax.step),
|
|
40
|
-
y: _utils.snapTo.bind(null, rangeMinMax.min, rangeMinMax.max, rangeMinMax.step)
|
|
41
|
-
};
|
|
42
|
-
return {
|
|
43
|
-
scale: scale,
|
|
44
|
-
snap: snap,
|
|
45
|
-
domain: domain,
|
|
46
|
-
range: range,
|
|
47
|
-
size: size,
|
|
48
|
-
getRootNode: getRootNode
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
exports.create = create;
|
|
53
|
-
//# sourceMappingURL=graph-props.js.map
|
package/lib/graph-props.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graph-props.js"],"names":["createSnapMinAndMax","min","max","step","parseInt","create","domain","range","size","getRootNode","domainMinMax","rangeMinMax","scale","x","width","y","height","snap","snapTo","bind"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AAEA,IAAMA,mBAAmB,GAAG,SAAtBA,mBAAsB,OAAwB;AAAA,MAArBC,GAAqB,QAArBA,GAAqB;AAAA,MAAhBC,GAAgB,QAAhBA,GAAgB;AAAA,MAAXC,IAAW,QAAXA,IAAW;AAClD;AACA;AAEA,SAAO;AACLA,IAAAA,IAAI,EAAJA,IADK;AAELF,IAAAA,GAAG,EAAEG,QAAQ,CAACH,GAAG,GAAGE,IAAP,CAAR,GAAuBA,IAFvB;AAGLD,IAAAA,GAAG,EAAEE,QAAQ,CAACF,GAAG,GAAGC,IAAP,CAAR,GAAuBA;AAHvB,GAAP;AAKD,CATD;;AAWO,IAAME,MAAM,GAAG,SAATA,MAAS,CAACC,MAAD,EAASC,KAAT,EAAgBC,IAAhB,EAAsBC,WAAtB,EAAsC;AAC1D,6BAAUH,MAAM,CAACL,GAAP,GAAaK,MAAM,CAACJ,GAA9B,EAAmC,mCAAnC;AACA,6BAAUK,KAAK,CAACN,GAAN,GAAYM,KAAK,CAACL,GAA5B,EAAiC,kCAAjC;AAEA,MAAMQ,YAAY,GAAGV,mBAAmB,CAACM,MAAD,CAAxC;AACA,MAAMK,WAAW,GAAGX,mBAAmB,CAACO,KAAD,CAAvC;AAEA,MAAMK,KAAK,GAAG;AACZC,IAAAA,CAAC,EAAE,4BACAP,MADA,CACO,CAACA,MAAM,CAACL,GAAR,EAAaK,MAAM,CAACJ,GAApB,CADP,EAEAK,KAFA,CAEM,CAAC,CAAD,EAAIC,IAAI,CAACM,KAAT,CAFN,CADS;AAIZC,IAAAA,CAAC,EAAE,4BACAT,MADA,CACO,CAACC,KAAK,CAACL,GAAP,EAAYK,KAAK,CAACN,GAAlB,CADP,EAEAM,KAFA,CAEM,CAAC,CAAD,EAAIC,IAAI,CAACQ,MAAT,CAFN;AAJS,GAAd;AASA,MAAMC,IAAI,GAAG;AACXJ,IAAAA,CAAC,EAAEK,cAAOC,IAAP,CAAY,IAAZ,EAAkBT,YAAY,CAACT,GAA/B,EAAoCS,YAAY,CAACR,GAAjD,EAAsDQ,YAAY,CAACP,IAAnE,CADQ;AAEXY,IAAAA,CAAC,EAAEG,cAAOC,IAAP,CAAY,IAAZ,EAAkBR,WAAW,CAACV,GAA9B,EAAmCU,WAAW,CAACT,GAA/C,EAAoDS,WAAW,CAACR,IAAhE;AAFQ,GAAb;AAKA,SAAO;AAAES,IAAAA,KAAK,EAALA,KAAF;AAASK,IAAAA,IAAI,EAAJA,IAAT;AAAeX,IAAAA,MAAM,EAANA,MAAf;AAAuBC,IAAAA,KAAK,EAALA,KAAvB;AAA8BC,IAAAA,IAAI,EAAJA,IAA9B;AAAoCC,IAAAA,WAAW,EAAXA;AAApC,GAAP;AACD,CAtBM","sourcesContent":["import invariant from 'invariant';\nimport { snapTo } from './utils';\nimport { scaleLinear } from 'd3-scale';\n\nconst createSnapMinAndMax = ({ min, max, step }) => {\n // for graphing, if step is a value with decimals, we have to calculate the min & max for the grid taking in consideration that 0 has to be exactly in the middle\n // for example, if min: -5 & max: 5 & step: 0.75, in order to keep 0 in the middle we have to set min: -4.5 & max: 4.5\n\n return {\n step,\n min: parseInt(min / step) * step,\n max: parseInt(max / step) * step,\n };\n};\n\nexport const create = (domain, range, size, getRootNode) => {\n invariant(domain.min < domain.max, 'domain: min must be less than max');\n invariant(range.min < range.max, 'range: min must be less than max');\n\n const domainMinMax = createSnapMinAndMax(domain);\n const rangeMinMax = createSnapMinAndMax(range);\n\n const scale = {\n x: scaleLinear()\n .domain([domain.min, domain.max])\n .range([0, size.width]),\n y: scaleLinear()\n .domain([range.max, range.min])\n .range([0, size.height]),\n };\n\n const snap = {\n x: snapTo.bind(null, domainMinMax.min, domainMinMax.max, domainMinMax.step),\n y: snapTo.bind(null, rangeMinMax.min, rangeMinMax.max, rangeMinMax.step),\n };\n\n return { scale, snap, domain, range, size, getRootNode };\n};\n"],"file":"graph-props.js"}
|