@pie-lib/plot 2.27.3-next.0 → 2.27.3-next.155
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 +10 -84
- package/esm/package.json +3 -0
- package/lib/draggable.js +12 -33
- package/lib/draggable.js.map +1 -1
- package/lib/graph-props.js +4 -11
- package/lib/graph-props.js.map +1 -1
- package/lib/grid-draggable.js +67 -141
- package/lib/grid-draggable.js.map +1 -1
- package/lib/index.js +1 -16
- package/lib/index.js.map +1 -1
- package/lib/label.js +81 -107
- package/lib/label.js.map +1 -1
- package/lib/root.js +189 -214
- package/lib/root.js.map +1 -1
- package/lib/trig.js +14 -61
- package/lib/trig.js.map +1 -1
- package/lib/types.js +9 -37
- package/lib/types.js.map +1 -1
- package/lib/utils.js +22 -86
- package/lib/utils.js.map +1 -1
- package/package.json +19 -14
- package/src/__tests__/draggable.test.jsx +33 -15
- package/src/__tests__/grid-draggable.test.jsx +377 -224
- package/src/__tests__/root.test.jsx +213 -57
- package/src/grid-draggable.jsx +13 -4
- package/src/label.jsx +101 -69
- package/src/root.jsx +175 -129
- package/src/__tests__/__snapshots__/grid-draggable.test.jsx.snap +0 -185
- package/src/__tests__/__snapshots__/root.test.jsx.snap +0 -18
package/CHANGELOG.md
CHANGED
|
@@ -7,165 +7,91 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @pie-lib/plot
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
10
|
## [2.27.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/plot@2.23.2...@pie-lib/plot@2.27.1) (2025-10-22)
|
|
15
11
|
|
|
16
12
|
**Note:** Version bump only for package @pie-lib/plot
|
|
17
13
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
14
|
# [2.27.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/plot@2.26.0...@pie-lib/plot@2.27.0) (2025-10-16)
|
|
23
15
|
|
|
24
16
|
**Note:** Version bump only for package @pie-lib/plot
|
|
25
17
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
18
|
# [2.26.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/plot@2.23.0...@pie-lib/plot@2.26.0) (2025-10-16)
|
|
31
19
|
|
|
32
|
-
|
|
33
20
|
### Bug Fixes
|
|
34
21
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
22
|
+
- **plot/graphing:** add title height calculations through observer PD-5208 ([f993541](https://github.com/pie-framework/pie-lib/commit/f99354174b23dcd6a1f3524a15f9b64c4041d7e2))
|
|
40
23
|
|
|
41
24
|
# [2.25.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/plot@2.23.0...@pie-lib/plot@2.25.0) (2025-10-16)
|
|
42
25
|
|
|
43
|
-
|
|
44
26
|
### Bug Fixes
|
|
45
27
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
28
|
+
- **plot/graphing:** add title height calculations through observer PD-5208 ([f993541](https://github.com/pie-framework/pie-lib/commit/f99354174b23dcd6a1f3524a15f9b64c4041d7e2))
|
|
51
29
|
|
|
52
30
|
# [2.24.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/plot@2.23.0...@pie-lib/plot@2.24.0) (2025-10-16)
|
|
53
31
|
|
|
54
|
-
|
|
55
32
|
### Bug Fixes
|
|
56
33
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
34
|
+
- **plot/graphing:** add title height calculations through observer PD-5208 ([f993541](https://github.com/pie-framework/pie-lib/commit/f99354174b23dcd6a1f3524a15f9b64c4041d7e2))
|
|
62
35
|
|
|
63
36
|
## [2.23.2](https://github.com/pie-framework/pie-lib/compare/@pie-lib/plot@2.23.1...@pie-lib/plot@2.23.2) (2025-10-14)
|
|
64
37
|
|
|
65
38
|
**Note:** Version bump only for package @pie-lib/plot
|
|
66
39
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
40
|
## [2.23.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/plot@2.23.0...@pie-lib/plot@2.23.1) (2025-10-09)
|
|
72
41
|
|
|
73
|
-
|
|
74
42
|
### Bug Fixes
|
|
75
43
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
44
|
+
- **plot/graphing:** add title height calculations through observer PD-5208 ([f993541](https://github.com/pie-framework/pie-lib/commit/f99354174b23dcd6a1f3524a15f9b64c4041d7e2))
|
|
81
45
|
|
|
82
46
|
# [2.23.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/plot@2.7.3...@pie-lib/plot@2.23.0) (2025-09-25)
|
|
83
47
|
|
|
84
|
-
|
|
85
48
|
### Bug Fixes
|
|
86
49
|
|
|
87
|
-
|
|
88
|
-
|
|
50
|
+
- fixed pie-lib/icons import [PD-5126](<[dcb506c](https://github.com/pie-framework/pie-lib/commit/dcb506c914a177f6d88bf73247a023bfe71dac1f)>)
|
|
89
51
|
|
|
90
52
|
### Features
|
|
91
53
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
54
|
+
- split pie-toolbox into multiple packages [PD-5126](<[7d55a25](https://github.com/pie-framework/pie-lib/commit/7d55a2552d084cd3d0d5c00dc77411b2ced2f5e2)>)
|
|
97
55
|
|
|
98
56
|
# [2.22.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/plot@2.21.0...@pie-lib/plot@2.22.0) (2025-09-18)
|
|
99
57
|
|
|
100
58
|
**Note:** Version bump only for package @pie-lib/plot
|
|
101
59
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
60
|
# [2.21.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/plot@2.20.0...@pie-lib/plot@2.21.0) (2025-09-18)
|
|
107
61
|
|
|
108
62
|
**Note:** Version bump only for package @pie-lib/plot
|
|
109
63
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
64
|
# [2.20.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/plot@2.7.3...@pie-lib/plot@2.20.0) (2025-09-18)
|
|
115
65
|
|
|
116
|
-
|
|
117
66
|
### Bug Fixes
|
|
118
67
|
|
|
119
|
-
|
|
120
|
-
|
|
68
|
+
- fixed pie-lib/icons import [PD-5126](<[dcb506c](https://github.com/pie-framework/pie-lib/commit/dcb506c914a177f6d88bf73247a023bfe71dac1f)>)
|
|
121
69
|
|
|
122
70
|
### Features
|
|
123
71
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
72
|
+
- split pie-toolbox into multiple packages [PD-5126](<[7d55a25](https://github.com/pie-framework/pie-lib/commit/7d55a2552d084cd3d0d5c00dc77411b2ced2f5e2)>)
|
|
129
73
|
|
|
130
74
|
# [2.19.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/plot@2.18.0...@pie-lib/plot@2.19.0) (2025-09-17)
|
|
131
75
|
|
|
132
76
|
**Note:** Version bump only for package @pie-lib/plot
|
|
133
77
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
78
|
# [2.18.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/plot@2.17.0...@pie-lib/plot@2.18.0) (2025-09-17)
|
|
139
79
|
|
|
140
80
|
**Note:** Version bump only for package @pie-lib/plot
|
|
141
81
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
82
|
# [2.17.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/plot@2.16.1...@pie-lib/plot@2.17.0) (2025-09-17)
|
|
147
83
|
|
|
148
84
|
**Note:** Version bump only for package @pie-lib/plot
|
|
149
85
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
86
|
## [2.16.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/plot@2.7.3...@pie-lib/plot@2.16.1) (2025-08-11)
|
|
155
87
|
|
|
156
|
-
|
|
157
88
|
### Bug Fixes
|
|
158
89
|
|
|
159
|
-
|
|
160
|
-
|
|
90
|
+
- fixed pie-lib/icons import [PD-5126](<[dcb506c](https://github.com/pie-framework/pie-lib/commit/dcb506c914a177f6d88bf73247a023bfe71dac1f)>)
|
|
161
91
|
|
|
162
92
|
### Features
|
|
163
93
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
94
|
+
- split pie-toolbox into multiple packages [PD-5126](<[7d55a25](https://github.com/pie-framework/pie-lib/commit/7d55a2552d084cd3d0d5c00dc77411b2ced2f5e2)>)
|
|
169
95
|
|
|
170
96
|
# [2.16.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/plot@2.7.3...@pie-lib/plot@2.16.0) (2025-08-07)
|
|
171
97
|
|
package/esm/package.json
ADDED
package/lib/draggable.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
@@ -14,52 +12,33 @@ Object.defineProperty(exports, "DraggableCore", {
|
|
|
14
12
|
}
|
|
15
13
|
});
|
|
16
14
|
exports["default"] = void 0;
|
|
17
|
-
|
|
18
15
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
19
|
-
|
|
20
16
|
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
17
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
27
|
-
|
|
28
18
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
29
|
-
|
|
19
|
+
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
20
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
30
21
|
var _reactDraggable = _interopRequireWildcard(require("react-draggable"));
|
|
31
|
-
|
|
32
|
-
function
|
|
33
|
-
|
|
34
|
-
function
|
|
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
|
-
|
|
22
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
23
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
24
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
25
|
+
function _superPropGet(t, o, e, r) { var p = (0, _get2["default"])((0, _getPrototypeOf2["default"])(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
|
|
26
|
+
var LocalDraggable = exports["default"] = /*#__PURE__*/function (_Draggable) {
|
|
45
27
|
function LocalDraggable() {
|
|
46
28
|
(0, _classCallCheck2["default"])(this, LocalDraggable);
|
|
47
|
-
return
|
|
29
|
+
return _callSuper(this, LocalDraggable, arguments);
|
|
48
30
|
}
|
|
49
|
-
|
|
50
|
-
(0, _createClass2["default"])(LocalDraggable, [{
|
|
31
|
+
(0, _inherits2["default"])(LocalDraggable, _Draggable);
|
|
32
|
+
return (0, _createClass2["default"])(LocalDraggable, [{
|
|
51
33
|
key: "componentWillReceiveProps",
|
|
52
34
|
value: function componentWillReceiveProps(next) {
|
|
53
|
-
(
|
|
54
|
-
|
|
35
|
+
_superPropGet(LocalDraggable, "componentWillReceiveProps", this, 3)([next]);
|
|
36
|
+
//Remove the x/y state as these values have now been updated and will come through as props.
|
|
55
37
|
this.setState({
|
|
56
38
|
x: 0,
|
|
57
39
|
y: 0
|
|
58
40
|
});
|
|
59
41
|
}
|
|
60
42
|
}]);
|
|
61
|
-
return LocalDraggable;
|
|
62
43
|
}(_reactDraggable["default"]);
|
|
63
|
-
|
|
64
|
-
exports["default"] = LocalDraggable;
|
|
65
44
|
//# sourceMappingURL=draggable.js.map
|
package/lib/draggable.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"draggable.js","names":["_reactDraggable","_interopRequireWildcard","require","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_callSuper","_getPrototypeOf2","_possibleConstructorReturn2","_isNativeReflectConstruct","Reflect","construct","constructor","apply","Boolean","prototype","valueOf","_superPropGet","p","_get2","LocalDraggable","exports","_Draggable","_classCallCheck2","arguments","_inherits2","_createClass2","key","value","componentWillReceiveProps","next","setState","x","y","Draggable"],"sources":["../src/draggable.jsx"],"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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,eAAA,GAAAC,uBAAA,CAAAC,OAAA;AAA2D,SAAAD,wBAAAE,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAJ,uBAAA,YAAAA,wBAAAE,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,S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,QAAA6B,CAAA,OAAAC,KAAA,iBAAAZ,gBAAA,iBAAAlB,CAAA,GAAAF,CAAA,CAAA4B,SAAA,GAAA5B,CAAA,GAAAK,CAAA,EAAAN,CAAA,cAAAG,CAAA,yBAAA6B,CAAA,aAAA/B,CAAA,WAAA+B,CAAA,CAAAL,KAAA,CAAA3B,CAAA,EAAAC,CAAA,OAAA+B,CAAA;AAAA,IAEtCE,cAAc,GAAAC,OAAA,qCAAAC,UAAA;EAAA,SAAAF,eAAA;IAAA,IAAAG,gBAAA,mBAAAH,cAAA;IAAA,OAAAd,UAAA,OAAAc,cAAA,EAAAI,SAAA;EAAA;EAAA,IAAAC,UAAA,aAAAL,cAAA,EAAAE,UAAA;EAAA,WAAAI,aAAA,aAAAN,cAAA;IAAAO,GAAA;IAAAC,KAAA,EACjC,SAAAC,yBAAyBA,CAACC,IAAI,EAAE;MAC9Bb,aAAA,CAAAG,cAAA,yCAAgCU,IAAI;MACpC;MACA,IAAI,CAACC,QAAQ,CAAC;QAAEC,CAAC,EAAE,CAAC;QAAEC,CAAC,EAAE;MAAE,CAAC,CAAC;IAC/B;EAAC;AAAA,EALyCC,0BAAS","ignoreList":[]}
|
package/lib/graph-props.js
CHANGED
|
@@ -1,32 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.create = void 0;
|
|
9
|
-
|
|
10
8
|
var _invariant = _interopRequireDefault(require("invariant"));
|
|
11
|
-
|
|
12
9
|
var _utils = require("./utils");
|
|
13
|
-
|
|
14
10
|
var _d3Scale = require("d3-scale");
|
|
15
|
-
|
|
16
11
|
var createSnapMinAndMax = function createSnapMinAndMax(_ref) {
|
|
17
12
|
var min = _ref.min,
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
max = _ref.max,
|
|
14
|
+
step = _ref.step;
|
|
20
15
|
// 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
16
|
// 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
|
|
17
|
+
|
|
22
18
|
return {
|
|
23
19
|
step: step,
|
|
24
20
|
min: parseInt(min / step) * step,
|
|
25
21
|
max: parseInt(max / step) * step
|
|
26
22
|
};
|
|
27
23
|
};
|
|
28
|
-
|
|
29
|
-
var create = function create(domain, range, size, getRootNode) {
|
|
24
|
+
var create = exports.create = function create(domain, range, size, getRootNode) {
|
|
30
25
|
(0, _invariant["default"])(domain.min < domain.max, 'domain: min must be less than max');
|
|
31
26
|
(0, _invariant["default"])(range.min < range.max, 'range: min must be less than max');
|
|
32
27
|
var domainMinMax = createSnapMinAndMax(domain);
|
|
@@ -48,6 +43,4 @@ var create = function create(domain, range, size, getRootNode) {
|
|
|
48
43
|
getRootNode: getRootNode
|
|
49
44
|
};
|
|
50
45
|
};
|
|
51
|
-
|
|
52
|
-
exports.create = create;
|
|
53
46
|
//# sourceMappingURL=graph-props.js.map
|
package/lib/graph-props.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"graph-props.js","names":["_invariant","_interopRequireDefault","require","_utils","_d3Scale","createSnapMinAndMax","_ref","min","max","step","parseInt","create","exports","domain","range","size","getRootNode","invariant","domainMinMax","rangeMinMax","scale","x","scaleLinear","width","y","height","snap","snapTo","bind"],"sources":["../src/graph-props.js"],"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"],"mappings":";;;;;;;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAEA,IAAMG,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAAC,IAAA,EAA2B;EAAA,IAArBC,GAAG,GAAAD,IAAA,CAAHC,GAAG;IAAEC,GAAG,GAAAF,IAAA,CAAHE,GAAG;IAAEC,IAAI,GAAAH,IAAA,CAAJG,IAAI;EAC3C;EACA;;EAEA,OAAO;IACLA,IAAI,EAAJA,IAAI;IACJF,GAAG,EAAEG,QAAQ,CAACH,GAAG,GAAGE,IAAI,CAAC,GAAGA,IAAI;IAChCD,GAAG,EAAEE,QAAQ,CAACF,GAAG,GAAGC,IAAI,CAAC,GAAGA;EAC9B,CAAC;AACH,CAAC;AAEM,IAAME,MAAM,GAAAC,OAAA,CAAAD,MAAA,GAAG,SAATA,MAAMA,CAAIE,MAAM,EAAEC,KAAK,EAAEC,IAAI,EAAEC,WAAW,EAAK;EAC1D,IAAAC,qBAAS,EAACJ,MAAM,CAACN,GAAG,GAAGM,MAAM,CAACL,GAAG,EAAE,mCAAmC,CAAC;EACvE,IAAAS,qBAAS,EA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