@hitachivantara/uikit-react-viz 4.0.2 → 4.0.4
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/dist/Barchart/Barchart.js +45 -72
- package/dist/Barchart/Barchart.js.map +1 -1
- package/dist/Barchart/barchartPlotlyOverrides.js +1 -13
- package/dist/Barchart/barchartPlotlyOverrides.js.map +1 -1
- package/dist/Barchart/index.js +0 -2
- package/dist/Barchart/index.js.map +1 -1
- package/dist/Barchart/styles.js.map +1 -1
- package/dist/Chart/Chart.d.ts +1 -1
- package/dist/Chart/Chart.js +28 -75
- package/dist/Chart/Chart.js.map +1 -1
- package/dist/Chart/Plot/Plot.js +10 -47
- package/dist/Chart/Plot/Plot.js.map +1 -1
- package/dist/Chart/Plot/index.js +0 -2
- package/dist/Chart/Plot/index.js.map +1 -1
- package/dist/Chart/Plot/styles.js.map +1 -1
- package/dist/Chart/Tooltip/MultiTooltip/MultiTooltip.js +1 -36
- package/dist/Chart/Tooltip/MultiTooltip/MultiTooltip.js.map +1 -1
- package/dist/Chart/Tooltip/MultiTooltip/index.js +0 -2
- package/dist/Chart/Tooltip/MultiTooltip/index.js.map +1 -1
- package/dist/Chart/Tooltip/MultiTooltip/styles.js +0 -2
- package/dist/Chart/Tooltip/MultiTooltip/styles.js.map +1 -1
- package/dist/Chart/Tooltip/SingleTooltip/SingleTooltip.js +2 -26
- package/dist/Chart/Tooltip/SingleTooltip/SingleTooltip.js.map +1 -1
- package/dist/Chart/Tooltip/SingleTooltip/index.js +0 -2
- package/dist/Chart/Tooltip/SingleTooltip/index.js.map +1 -1
- package/dist/Chart/Tooltip/SingleTooltip/styles.js +0 -2
- package/dist/Chart/Tooltip/SingleTooltip/styles.js.map +1 -1
- package/dist/Chart/Tooltip/Tooltip.js +16 -51
- package/dist/Chart/Tooltip/Tooltip.js.map +1 -1
- package/dist/Chart/Tooltip/index.js +0 -2
- package/dist/Chart/Tooltip/index.js.map +1 -1
- package/dist/Chart/Tooltip/styles.js.map +1 -1
- package/dist/Chart/chartPlotlyOverrides.js +9 -33
- package/dist/Chart/chartPlotlyOverrides.js.map +1 -1
- package/dist/Chart/index.js +0 -2
- package/dist/Chart/index.js.map +1 -1
- package/dist/Chart/styles.js +0 -13
- package/dist/Chart/styles.js.map +1 -1
- package/dist/Donutchart/Donutchart.js +10 -47
- package/dist/Donutchart/Donutchart.js.map +1 -1
- package/dist/Donutchart/donutchartPlotlyOverrides.js +1 -13
- package/dist/Donutchart/donutchartPlotlyOverrides.js.map +1 -1
- package/dist/Donutchart/index.js +0 -2
- package/dist/Donutchart/index.js.map +1 -1
- package/dist/Donutchart/styles.js.map +1 -1
- package/dist/Linechart/Linechart.js +12 -50
- package/dist/Linechart/Linechart.js.map +1 -1
- package/dist/Linechart/index.js +0 -2
- package/dist/Linechart/index.js.map +1 -1
- package/dist/Linechart/lineChartPlotlyOverrides.js +1 -17
- package/dist/Linechart/lineChartPlotlyOverrides.js.map +1 -1
- package/dist/Linechart/styles.js.map +1 -1
- package/dist/index.js +0 -4
- package/dist/index.js.map +1 -1
- package/dist/legacy/Barchart/Barchart.js +45 -43
- package/dist/legacy/Barchart/Barchart.js.map +1 -1
- package/dist/legacy/Barchart/barchartPlotlyOverrides.js +1 -6
- package/dist/legacy/Barchart/barchartPlotlyOverrides.js.map +1 -1
- package/dist/legacy/Barchart/index.js.map +1 -1
- package/dist/legacy/Barchart/styles.js.map +1 -1
- package/dist/legacy/Chart/Chart.d.ts +1 -1
- package/dist/legacy/Chart/Chart.js +28 -46
- package/dist/legacy/Chart/Chart.js.map +1 -1
- package/dist/legacy/Chart/Plot/Plot.js +10 -21
- package/dist/legacy/Chart/Plot/Plot.js.map +1 -1
- package/dist/legacy/Chart/Plot/index.js.map +1 -1
- package/dist/legacy/Chart/Plot/styles.js.map +1 -1
- package/dist/legacy/Chart/Tooltip/MultiTooltip/MultiTooltip.js +1 -17
- package/dist/legacy/Chart/Tooltip/MultiTooltip/MultiTooltip.js.map +1 -1
- package/dist/legacy/Chart/Tooltip/MultiTooltip/index.js.map +1 -1
- package/dist/legacy/Chart/Tooltip/MultiTooltip/styles.js +0 -1
- package/dist/legacy/Chart/Tooltip/MultiTooltip/styles.js.map +1 -1
- package/dist/legacy/Chart/Tooltip/SingleTooltip/SingleTooltip.js +2 -9
- package/dist/legacy/Chart/Tooltip/SingleTooltip/SingleTooltip.js.map +1 -1
- package/dist/legacy/Chart/Tooltip/SingleTooltip/index.js.map +1 -1
- package/dist/legacy/Chart/Tooltip/SingleTooltip/styles.js +0 -1
- package/dist/legacy/Chart/Tooltip/SingleTooltip/styles.js.map +1 -1
- package/dist/legacy/Chart/Tooltip/Tooltip.js +16 -30
- package/dist/legacy/Chart/Tooltip/Tooltip.js.map +1 -1
- package/dist/legacy/Chart/Tooltip/index.js.map +1 -1
- package/dist/legacy/Chart/Tooltip/styles.js.map +1 -1
- package/dist/legacy/Chart/chartPlotlyOverrides.js +9 -20
- package/dist/legacy/Chart/chartPlotlyOverrides.js.map +1 -1
- package/dist/legacy/Chart/index.js.map +1 -1
- package/dist/legacy/Chart/styles.js +0 -4
- package/dist/legacy/Chart/styles.js.map +1 -1
- package/dist/legacy/Donutchart/Donutchart.js +11 -22
- package/dist/legacy/Donutchart/Donutchart.js.map +1 -1
- package/dist/legacy/Donutchart/donutchartPlotlyOverrides.js +1 -6
- package/dist/legacy/Donutchart/donutchartPlotlyOverrides.js.map +1 -1
- package/dist/legacy/Donutchart/index.js.map +1 -1
- package/dist/legacy/Donutchart/styles.js.map +1 -1
- package/dist/legacy/Linechart/Linechart.js +13 -25
- package/dist/legacy/Linechart/Linechart.js.map +1 -1
- package/dist/legacy/Linechart/index.js.map +1 -1
- package/dist/legacy/Linechart/lineChartPlotlyOverrides.js +1 -10
- package/dist/legacy/Linechart/lineChartPlotlyOverrides.js.map +1 -1
- package/dist/legacy/Linechart/styles.js.map +1 -1
- package/dist/legacy/index.js.map +1 -1
- package/dist/modern/Barchart/Barchart.js +38 -31
- package/dist/modern/Barchart/Barchart.js.map +1 -1
- package/dist/modern/Barchart/barchartPlotlyOverrides.js +1 -6
- package/dist/modern/Barchart/barchartPlotlyOverrides.js.map +1 -1
- package/dist/modern/Barchart/index.js.map +1 -1
- package/dist/modern/Barchart/styles.js.map +1 -1
- package/dist/modern/Chart/Chart.d.ts +1 -1
- package/dist/modern/Chart/Chart.js +17 -33
- package/dist/modern/Chart/Chart.js.map +1 -1
- package/dist/modern/Chart/Plot/Plot.js +11 -22
- package/dist/modern/Chart/Plot/Plot.js.map +1 -1
- package/dist/modern/Chart/Plot/index.js.map +1 -1
- package/dist/modern/Chart/Plot/styles.js.map +1 -1
- package/dist/modern/Chart/Tooltip/MultiTooltip/MultiTooltip.js +0 -17
- package/dist/modern/Chart/Tooltip/MultiTooltip/MultiTooltip.js.map +1 -1
- package/dist/modern/Chart/Tooltip/MultiTooltip/index.js.map +1 -1
- package/dist/modern/Chart/Tooltip/MultiTooltip/styles.js +0 -1
- package/dist/modern/Chart/Tooltip/MultiTooltip/styles.js.map +1 -1
- package/dist/modern/Chart/Tooltip/SingleTooltip/SingleTooltip.js +0 -7
- package/dist/modern/Chart/Tooltip/SingleTooltip/SingleTooltip.js.map +1 -1
- package/dist/modern/Chart/Tooltip/SingleTooltip/index.js.map +1 -1
- package/dist/modern/Chart/Tooltip/SingleTooltip/styles.js +0 -1
- package/dist/modern/Chart/Tooltip/SingleTooltip/styles.js.map +1 -1
- package/dist/modern/Chart/Tooltip/Tooltip.js +2 -13
- package/dist/modern/Chart/Tooltip/Tooltip.js.map +1 -1
- package/dist/modern/Chart/Tooltip/index.js.map +1 -1
- package/dist/modern/Chart/Tooltip/styles.js.map +1 -1
- package/dist/modern/Chart/chartPlotlyOverrides.js +9 -20
- package/dist/modern/Chart/chartPlotlyOverrides.js.map +1 -1
- package/dist/modern/Chart/index.js.map +1 -1
- package/dist/modern/Chart/styles.js +0 -4
- package/dist/modern/Chart/styles.js.map +1 -1
- package/dist/modern/Donutchart/Donutchart.js +11 -22
- package/dist/modern/Donutchart/Donutchart.js.map +1 -1
- package/dist/modern/Donutchart/donutchartPlotlyOverrides.js +1 -6
- package/dist/modern/Donutchart/donutchartPlotlyOverrides.js.map +1 -1
- package/dist/modern/Donutchart/index.js.map +1 -1
- package/dist/modern/Donutchart/styles.js.map +1 -1
- package/dist/modern/Linechart/Linechart.js +12 -24
- package/dist/modern/Linechart/Linechart.js.map +1 -1
- package/dist/modern/Linechart/index.js.map +1 -1
- package/dist/modern/Linechart/lineChartPlotlyOverrides.js +1 -10
- package/dist/modern/Linechart/lineChartPlotlyOverrides.js.map +1 -1
- package/dist/modern/Linechart/styles.js.map +1 -1
- package/dist/modern/index.js.map +1 -1
- package/package.json +3 -3
package/dist/Chart/Chart.js
CHANGED
|
@@ -1,92 +1,60 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
require("core-js/modules/es.object.keys.js");
|
|
4
|
-
|
|
5
4
|
require("core-js/modules/es.symbol.js");
|
|
6
|
-
|
|
7
5
|
require("core-js/modules/es.array.filter.js");
|
|
8
|
-
|
|
9
6
|
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
10
|
-
|
|
11
7
|
require("core-js/modules/es.object.get-own-property-descriptors.js");
|
|
12
|
-
|
|
13
8
|
require("core-js/modules/es.array.iterator.js");
|
|
14
|
-
|
|
15
9
|
require("core-js/modules/es.string.iterator.js");
|
|
16
|
-
|
|
17
10
|
require("core-js/modules/es.weak-map.js");
|
|
18
|
-
|
|
19
11
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
20
|
-
|
|
21
12
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
22
|
-
|
|
23
13
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
24
|
-
|
|
25
14
|
Object.defineProperty(exports, "__esModule", {
|
|
26
15
|
value: true
|
|
27
16
|
});
|
|
28
17
|
exports.default = void 0;
|
|
29
|
-
|
|
30
18
|
require("core-js/modules/es.object.to-string.js");
|
|
31
|
-
|
|
32
19
|
require("core-js/modules/web.dom-collections.for-each.js");
|
|
33
|
-
|
|
34
20
|
require("core-js/modules/es.function.name.js");
|
|
35
|
-
|
|
36
21
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
37
|
-
|
|
38
22
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
39
|
-
|
|
40
23
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
41
|
-
|
|
42
24
|
var _react = _interopRequireWildcard(require("react"));
|
|
43
|
-
|
|
44
25
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
45
|
-
|
|
46
26
|
var _isNil = _interopRequireDefault(require("lodash/isNil"));
|
|
47
|
-
|
|
48
27
|
var _styles = require("@mui/styles");
|
|
49
|
-
|
|
50
28
|
var _Tooltip = _interopRequireDefault(require("./Tooltip"));
|
|
51
|
-
|
|
52
29
|
var _chartPlotlyOverrides = require("./chartPlotlyOverrides");
|
|
53
|
-
|
|
54
30
|
var _Plot = _interopRequireDefault(require("./Plot"));
|
|
55
|
-
|
|
56
31
|
var _styles2 = _interopRequireDefault(require("./styles"));
|
|
57
|
-
|
|
58
32
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
59
|
-
|
|
60
33
|
var _excluded = ["id", "classes", "data", "layout", "config", "tooltipType", "tooltip", "afterPlot", "xAxisTitle", "yAxisTitle"];
|
|
61
|
-
|
|
62
34
|
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); }
|
|
63
|
-
|
|
64
35
|
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; }
|
|
65
|
-
|
|
66
36
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
67
|
-
|
|
68
37
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
69
|
-
|
|
70
38
|
var Chart = function Chart(_ref) {
|
|
71
39
|
var id = _ref.id,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
40
|
+
classes = _ref.classes,
|
|
41
|
+
data = _ref.data,
|
|
42
|
+
layout = _ref.layout,
|
|
43
|
+
config = _ref.config,
|
|
44
|
+
_ref$tooltipType = _ref.tooltipType,
|
|
45
|
+
tooltipType = _ref$tooltipType === void 0 ? "multiple" : _ref$tooltipType,
|
|
46
|
+
tooltip = _ref.tooltip,
|
|
47
|
+
afterPlot = _ref.afterPlot,
|
|
48
|
+
xAxisTitle = _ref.xAxisTitle,
|
|
49
|
+
yAxisTitle = _ref.yAxisTitle,
|
|
50
|
+
others = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
83
51
|
var theme = (0, _styles.useTheme)();
|
|
52
|
+
|
|
84
53
|
/* Values derived from props */
|
|
85
|
-
// Check if the barchart is horizontal or vertical.
|
|
86
54
|
|
|
55
|
+
// Check if the barchart is horizontal or vertical.
|
|
87
56
|
var isHorizontal = (0, _react.useMemo)(function () {
|
|
88
57
|
var _data$;
|
|
89
|
-
|
|
90
58
|
return !(0, _isNil.default)((_data$ = data[0]) === null || _data$ === void 0 ? void 0 : _data$.orientation) ? data[0].orientation.toUpperCase() === "H" : false;
|
|
91
59
|
}, [data]);
|
|
92
60
|
var chartLayout = (0, _react.useMemo)(function () {
|
|
@@ -96,29 +64,28 @@ var Chart = function Chart(_ref) {
|
|
|
96
64
|
return (0, _chartPlotlyOverrides.applyConfigDefaults)(config);
|
|
97
65
|
}, [config]);
|
|
98
66
|
var useSingle = tooltipType === "single";
|
|
67
|
+
|
|
99
68
|
/* State */
|
|
100
69
|
|
|
101
70
|
var _useState = (0, _react.useState)(false),
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
71
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
72
|
+
isHover = _useState2[0],
|
|
73
|
+
setIsHover = _useState2[1];
|
|
106
74
|
var _useState3 = (0, _react.useState)({
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
75
|
+
x: 0,
|
|
76
|
+
y: 0
|
|
77
|
+
}),
|
|
78
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
79
|
+
coordinates = _useState4[0],
|
|
80
|
+
setCoordinates = _useState4[1];
|
|
114
81
|
var _useState5 = (0, _react.useState)(),
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
/* Callbacks */
|
|
119
|
-
// Extract data from the plotly onHover event to be used to create the tooltip.
|
|
82
|
+
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
83
|
+
dataTooltip = _useState6[0],
|
|
84
|
+
setDataTooltip = _useState6[1];
|
|
120
85
|
|
|
86
|
+
/* Callbacks */
|
|
121
87
|
|
|
88
|
+
// Extract data from the plotly onHover event to be used to create the tooltip.
|
|
122
89
|
var onHover = (0, _react.useCallback)(function (event) {
|
|
123
90
|
var points = event.points;
|
|
124
91
|
var dataFromPoints = {
|
|
@@ -127,7 +94,6 @@ var Chart = function Chart(_ref) {
|
|
|
127
94
|
};
|
|
128
95
|
points.forEach(function (p, i) {
|
|
129
96
|
var _fData$marker, _fData$line, _fData$labels;
|
|
130
|
-
|
|
131
97
|
var fData = p.fullData;
|
|
132
98
|
var pNumber = p.pointNumber;
|
|
133
99
|
if (i === 0) dataFromPoints.title = isHorizontal ? p.y : p.x || fData.name;
|
|
@@ -172,69 +138,56 @@ var Chart = function Chart(_ref) {
|
|
|
172
138
|
})]
|
|
173
139
|
});
|
|
174
140
|
};
|
|
175
|
-
|
|
176
141
|
process.env.NODE_ENV !== "production" ? Chart.propTypes = {
|
|
177
142
|
/**
|
|
178
143
|
* An Id passed on to the component
|
|
179
144
|
*/
|
|
180
145
|
id: _propTypes.default.string,
|
|
181
|
-
|
|
182
146
|
/**
|
|
183
147
|
* A Jss Object used to override or extend the styles applied.
|
|
184
148
|
*/
|
|
185
149
|
classes: _propTypes.default.shape({
|
|
186
150
|
root: _propTypes.default.string
|
|
187
151
|
}),
|
|
188
|
-
|
|
189
152
|
/**
|
|
190
153
|
* Plotly data object (see https://plot.ly/javascript/reference/).
|
|
191
154
|
*/
|
|
192
155
|
data: _propTypes.default.arrayOf(_propTypes.default.instanceOf(Object)).isRequired,
|
|
193
|
-
|
|
194
156
|
/**
|
|
195
157
|
* Plotly layout object (see https://plot.ly/javascript/reference/#layout).
|
|
196
158
|
*/
|
|
197
159
|
layout: _propTypes.default.instanceOf(Object).isRequired,
|
|
198
|
-
|
|
199
160
|
/**
|
|
200
161
|
* Plotly config object (see https://plot.ly/javascript/configuration-options/).
|
|
201
162
|
*/
|
|
202
163
|
config: _propTypes.default.instanceOf(Object),
|
|
203
|
-
|
|
204
164
|
/**
|
|
205
165
|
* Defines if should use a single or multiline tooltip.
|
|
206
166
|
*/
|
|
207
167
|
tooltipType: _propTypes.default.oneOf(["single", "multiple"]),
|
|
208
|
-
|
|
209
168
|
/**
|
|
210
169
|
* Custom tooltip element to be displayed
|
|
211
170
|
*/
|
|
212
171
|
tooltip: _propTypes.default.func,
|
|
213
|
-
|
|
214
172
|
/**
|
|
215
173
|
* Function to be called after plot render.
|
|
216
174
|
*/
|
|
217
175
|
afterPlot: _propTypes.default.func,
|
|
218
|
-
|
|
219
176
|
/**
|
|
220
177
|
* Defines the X axis title.
|
|
221
178
|
*/
|
|
222
179
|
xAxisTitle: _propTypes.default.string,
|
|
223
|
-
|
|
224
180
|
/**
|
|
225
181
|
* Defines the Y axis title.
|
|
226
182
|
*/
|
|
227
183
|
yAxisTitle: _propTypes.default.string,
|
|
228
|
-
|
|
229
184
|
/**
|
|
230
185
|
* Defines the chart subtitle.
|
|
231
186
|
*/
|
|
232
187
|
subtitle: _propTypes.default.string
|
|
233
188
|
} : void 0;
|
|
234
|
-
|
|
235
189
|
var _default = (0, _styles.withStyles)(_styles2.default, {
|
|
236
190
|
name: "HvChart"
|
|
237
191
|
})(Chart);
|
|
238
|
-
|
|
239
192
|
exports.default = _default;
|
|
240
193
|
//# sourceMappingURL=Chart.js.map
|
package/dist/Chart/Chart.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chart.js","names":["Chart","id","classes","data","layout","config","tooltipType","tooltip","afterPlot","xAxisTitle","yAxisTitle","others","theme","useTheme","isHorizontal","useMemo","isNil","orientation","toUpperCase","chartLayout","applyLayoutDefaults","chartConfig","applyConfigDefaults","useSingle","useState","isHover","setIsHover","x","y","coordinates","setCoordinates","dataTooltip","setDataTooltip","onHover","useCallback","event","points","dataFromPoints","title","elements","forEach","p","i","fData","fullData","pNumber","pointNumber","name","push","color","marker","line","labels","value","onUnHover","onMouseMove","clientX","clientY","root","propTypes","PropTypes","string","shape","arrayOf","instanceOf","Object","isRequired","oneOf","func","subtitle","withStyles","styles"],"sources":["../../src/Chart/Chart.js"],"sourcesContent":["import React, { useState, useMemo, useCallback } from \"react\";\nimport PropTypes from \"prop-types\";\nimport isNil from \"lodash/isNil\";\nimport { withStyles, useTheme } from \"@mui/styles\";\n\nimport Tooltip from \"./Tooltip\";\nimport { applyLayoutDefaults, applyConfigDefaults } from \"./chartPlotlyOverrides\";\n\nimport Plot from \"./Plot\";\nimport styles from \"./styles\";\n\nconst Chart = ({\n id,\n classes,\n data,\n layout,\n config,\n tooltipType = \"multiple\",\n tooltip,\n afterPlot,\n xAxisTitle,\n yAxisTitle,\n ...others\n}) => {\n const theme = useTheme();\n\n /* Values derived from props */\n\n // Check if the barchart is horizontal or vertical.\n const isHorizontal = useMemo(\n () => (!isNil(data[0]?.orientation) ? data[0].orientation.toUpperCase() === \"H\" : false),\n [data]\n );\n\n const chartLayout = useMemo(\n () => applyLayoutDefaults(layout, theme, isHorizontal, xAxisTitle, yAxisTitle),\n [isHorizontal, layout, theme, xAxisTitle, yAxisTitle]\n );\n\n const chartConfig = useMemo(() => applyConfigDefaults(config), [config]);\n\n const useSingle = tooltipType === \"single\";\n\n /* State */\n\n const [isHover, setIsHover] = useState(false);\n const [coordinates, setCoordinates] = useState({ x: 0, y: 0 });\n const [dataTooltip, setDataTooltip] = useState();\n\n /* Callbacks */\n\n // Extract data from the plotly onHover event to be used to create the tooltip.\n const onHover = useCallback(\n (event) => {\n const { points } = event;\n\n const dataFromPoints = {\n title: \"\",\n elements: [],\n };\n\n points.forEach((p, i) => {\n const fData = p.fullData;\n const pNumber = p.pointNumber;\n\n if (i === 0) dataFromPoints.title = isHorizontal ? p.y : p.x || fData.name;\n\n dataFromPoints.elements.push({\n color: fData.marker?.color || fData.line?.color || p.color,\n name: fData.labels?.[pNumber] || fData.name,\n value: isHorizontal ? p.x : p.y || p.value,\n });\n });\n\n setDataTooltip(dataFromPoints);\n setIsHover(true);\n },\n [isHorizontal]\n );\n\n const onUnHover = useCallback(() => {\n setIsHover(false);\n }, []);\n\n const onMouseMove = useCallback((event) => {\n setCoordinates({\n x: event.clientX,\n y: event.clientY,\n });\n }, []);\n\n return (\n <>\n {isHover && (\n <Tooltip\n coordinates={coordinates}\n data={dataTooltip}\n useSingle={useSingle}\n tooltip={tooltip}\n />\n )}\n <div id={id} className={classes.root}>\n <div onMouseMove={onMouseMove}>\n <Plot\n data={data}\n layout={chartLayout}\n config={chartConfig}\n onHover={onHover}\n onUnHover={onUnHover}\n afterPlot={afterPlot}\n {...others}\n />\n </div>\n </div>\n </>\n );\n};\n\nChart.propTypes = {\n /**\n * An Id passed on to the component\n */\n id: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.shape({\n root: PropTypes.string,\n }),\n\n /**\n * Plotly data object (see https://plot.ly/javascript/reference/).\n */\n data: PropTypes.arrayOf(PropTypes.instanceOf(Object)).isRequired,\n /**\n * Plotly layout object (see https://plot.ly/javascript/reference/#layout).\n */\n layout: PropTypes.instanceOf(Object).isRequired,\n /**\n * Plotly config object (see https://plot.ly/javascript/configuration-options/).\n */\n config: PropTypes.instanceOf(Object),\n /**\n * Defines if should use a single or multiline tooltip.\n */\n tooltipType: PropTypes.oneOf([\"single\", \"multiple\"]),\n /**\n * Custom tooltip element to be displayed\n */\n tooltip: PropTypes.func,\n /**\n * Function to be called after plot render.\n */\n afterPlot: PropTypes.func,\n /**\n * Defines the X axis title.\n */\n xAxisTitle: PropTypes.string,\n /**\n * Defines the Y axis title.\n */\n yAxisTitle: PropTypes.string,\n /**\n * Defines the chart subtitle.\n */\n subtitle: PropTypes.string,\n};\n\nexport default withStyles(styles, { name: \"HvChart\" })(Chart);\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Chart.js","names":["Chart","id","classes","data","layout","config","tooltipType","tooltip","afterPlot","xAxisTitle","yAxisTitle","others","theme","useTheme","isHorizontal","useMemo","isNil","orientation","toUpperCase","chartLayout","applyLayoutDefaults","chartConfig","applyConfigDefaults","useSingle","useState","isHover","setIsHover","x","y","coordinates","setCoordinates","dataTooltip","setDataTooltip","onHover","useCallback","event","points","dataFromPoints","title","elements","forEach","p","i","fData","fullData","pNumber","pointNumber","name","push","color","marker","line","labels","value","onUnHover","onMouseMove","clientX","clientY","root","propTypes","PropTypes","string","shape","arrayOf","instanceOf","Object","isRequired","oneOf","func","subtitle","withStyles","styles"],"sources":["../../src/Chart/Chart.js"],"sourcesContent":["import React, { useState, useMemo, useCallback } from \"react\";\nimport PropTypes from \"prop-types\";\nimport isNil from \"lodash/isNil\";\nimport { withStyles, useTheme } from \"@mui/styles\";\n\nimport Tooltip from \"./Tooltip\";\nimport { applyLayoutDefaults, applyConfigDefaults } from \"./chartPlotlyOverrides\";\n\nimport Plot from \"./Plot\";\nimport styles from \"./styles\";\n\nconst Chart = ({\n id,\n classes,\n data,\n layout,\n config,\n tooltipType = \"multiple\",\n tooltip,\n afterPlot,\n xAxisTitle,\n yAxisTitle,\n ...others\n}) => {\n const theme = useTheme();\n\n /* Values derived from props */\n\n // Check if the barchart is horizontal or vertical.\n const isHorizontal = useMemo(\n () => (!isNil(data[0]?.orientation) ? data[0].orientation.toUpperCase() === \"H\" : false),\n [data]\n );\n\n const chartLayout = useMemo(\n () => applyLayoutDefaults(layout, theme, isHorizontal, xAxisTitle, yAxisTitle),\n [isHorizontal, layout, theme, xAxisTitle, yAxisTitle]\n );\n\n const chartConfig = useMemo(() => applyConfigDefaults(config), [config]);\n\n const useSingle = tooltipType === \"single\";\n\n /* State */\n\n const [isHover, setIsHover] = useState(false);\n const [coordinates, setCoordinates] = useState({ x: 0, y: 0 });\n const [dataTooltip, setDataTooltip] = useState();\n\n /* Callbacks */\n\n // Extract data from the plotly onHover event to be used to create the tooltip.\n const onHover = useCallback(\n (event) => {\n const { points } = event;\n\n const dataFromPoints = {\n title: \"\",\n elements: [],\n };\n\n points.forEach((p, i) => {\n const fData = p.fullData;\n const pNumber = p.pointNumber;\n\n if (i === 0) dataFromPoints.title = isHorizontal ? p.y : p.x || fData.name;\n\n dataFromPoints.elements.push({\n color: fData.marker?.color || fData.line?.color || p.color,\n name: fData.labels?.[pNumber] || fData.name,\n value: isHorizontal ? p.x : p.y || p.value,\n });\n });\n\n setDataTooltip(dataFromPoints);\n setIsHover(true);\n },\n [isHorizontal]\n );\n\n const onUnHover = useCallback(() => {\n setIsHover(false);\n }, []);\n\n const onMouseMove = useCallback((event) => {\n setCoordinates({\n x: event.clientX,\n y: event.clientY,\n });\n }, []);\n\n return (\n <>\n {isHover && (\n <Tooltip\n coordinates={coordinates}\n data={dataTooltip}\n useSingle={useSingle}\n tooltip={tooltip}\n />\n )}\n <div id={id} className={classes.root}>\n <div onMouseMove={onMouseMove}>\n <Plot\n data={data}\n layout={chartLayout}\n config={chartConfig}\n onHover={onHover}\n onUnHover={onUnHover}\n afterPlot={afterPlot}\n {...others}\n />\n </div>\n </div>\n </>\n );\n};\n\nChart.propTypes = {\n /**\n * An Id passed on to the component\n */\n id: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.shape({\n root: PropTypes.string,\n }),\n\n /**\n * Plotly data object (see https://plot.ly/javascript/reference/).\n */\n data: PropTypes.arrayOf(PropTypes.instanceOf(Object)).isRequired,\n /**\n * Plotly layout object (see https://plot.ly/javascript/reference/#layout).\n */\n layout: PropTypes.instanceOf(Object).isRequired,\n /**\n * Plotly config object (see https://plot.ly/javascript/configuration-options/).\n */\n config: PropTypes.instanceOf(Object),\n /**\n * Defines if should use a single or multiline tooltip.\n */\n tooltipType: PropTypes.oneOf([\"single\", \"multiple\"]),\n /**\n * Custom tooltip element to be displayed\n */\n tooltip: PropTypes.func,\n /**\n * Function to be called after plot render.\n */\n afterPlot: PropTypes.func,\n /**\n * Defines the X axis title.\n */\n xAxisTitle: PropTypes.string,\n /**\n * Defines the Y axis title.\n */\n yAxisTitle: PropTypes.string,\n /**\n * Defines the chart subtitle.\n */\n subtitle: PropTypes.string,\n};\n\nexport default withStyles(styles, { name: \"HvChart\" })(Chart);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AAA8B;AAAA;AAAA;AAAA;AAAA;AAAA;AAE9B,IAAMA,KAAK,GAAG,SAARA,KAAK,OAYL;EAAA,IAXJC,EAAE,QAAFA,EAAE;IACFC,OAAO,QAAPA,OAAO;IACPC,IAAI,QAAJA,IAAI;IACJC,MAAM,QAANA,MAAM;IACNC,MAAM,QAANA,MAAM;IAAA,wBACNC,WAAW;IAAXA,WAAW,iCAAG,UAAU;IACxBC,OAAO,QAAPA,OAAO;IACPC,SAAS,QAATA,SAAS;IACTC,UAAU,QAAVA,UAAU;IACVC,UAAU,QAAVA,UAAU;IACPC,MAAM;EAET,IAAMC,KAAK,GAAG,IAAAC,gBAAQ,GAAE;;EAExB;;EAEA;EACA,IAAMC,YAAY,GAAG,IAAAC,cAAO,EAC1B;IAAA;IAAA,OAAO,CAAC,IAAAC,cAAK,YAACb,IAAI,CAAC,CAAC,CAAC,2CAAP,OAASc,WAAW,CAAC,GAAGd,IAAI,CAAC,CAAC,CAAC,CAACc,WAAW,CAACC,WAAW,EAAE,KAAK,GAAG,GAAG,KAAK;EAAA,CAAC,EACxF,CAACf,IAAI,CAAC,CACP;EAED,IAAMgB,WAAW,GAAG,IAAAJ,cAAO,EACzB;IAAA,OAAM,IAAAK,yCAAmB,EAAChB,MAAM,EAAEQ,KAAK,EAAEE,YAAY,EAAEL,UAAU,EAAEC,UAAU,CAAC;EAA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ChB;AACF;AACA;EACE1D,EAAE,EAAE2D,kBAAS,CAACC,MAAM;EACpB;AACF;AACA;EACE3D,OAAO,EAAE0D,kBAAS,CAACE,KAAK,CAAC;IACvBJ,IAAI,EAAEE,kBAAS,CAACC;EAClB,CAAC,CAAC;EAEF;AACF;AACA;EACE1D,IAAI,EAAEyD,kBAAS,CAACG,OAAO,CAACH,kBAAS,CAACI,UAAU,CAACC,MAAM,CAAC,CAAC,CAACC,UAAU;EAChE;AACF;AACA;EACE9D,MAAM,EAAEwD,kBAAS,CAACI,UAAU,CAACC,MAAM,CAAC,CAACC,UAAU;EAC/C;AACF;AACA;EACE7D,MAAM,EAAEuD,kBAAS,CAACI,UAAU,CAACC,MAAM,CAAC;EACpC;AACF;AACA;EACE3D,WAAW,EAAEsD,kBAAS,CAACO,KAAK,CAAC,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;EACpD;AACF;AACA;EACE5D,OAAO,EAAEqD,kBAAS,CAACQ,IAAI;EACvB;AACF;AACA;EACE5D,SAAS,EAAEoD,kBAAS,CAACQ,IAAI;EACzB;AACF;AACA;EACE3D,UAAU,EAAEmD,kBAAS,CAACC,MAAM;EAC5B;AACF;AACA;EACEnD,UAAU,EAAEkD,kBAAS,CAACC,MAAM;EAC5B;AACF;AACA;EACEQ,QAAQ,EAAET,kBAAS,CAACC;AACtB,CAAC;AAAC,eAEa,IAAAS,kBAAU,EAACC,gBAAM,EAAE;EAAExB,IAAI,EAAE;AAAU,CAAC,CAAC,CAAC/C,KAAK,CAAC;AAAA"}
|
package/dist/Chart/Plot/Plot.js
CHANGED
|
@@ -1,85 +1,58 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
require("core-js/modules/es.object.keys.js");
|
|
4
|
-
|
|
5
4
|
require("core-js/modules/es.symbol.js");
|
|
6
|
-
|
|
7
5
|
require("core-js/modules/es.array.filter.js");
|
|
8
|
-
|
|
9
6
|
require("core-js/modules/es.object.to-string.js");
|
|
10
|
-
|
|
11
7
|
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
12
|
-
|
|
13
8
|
require("core-js/modules/web.dom-collections.for-each.js");
|
|
14
|
-
|
|
15
9
|
require("core-js/modules/es.object.get-own-property-descriptors.js");
|
|
16
|
-
|
|
17
10
|
require("core-js/modules/es.array.iterator.js");
|
|
18
|
-
|
|
19
11
|
require("core-js/modules/es.string.iterator.js");
|
|
20
|
-
|
|
21
12
|
require("core-js/modules/es.weak-map.js");
|
|
22
|
-
|
|
23
13
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
24
|
-
|
|
25
14
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
26
|
-
|
|
27
15
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
28
|
-
|
|
29
16
|
Object.defineProperty(exports, "__esModule", {
|
|
30
17
|
value: true
|
|
31
18
|
});
|
|
32
19
|
exports.default = void 0;
|
|
33
|
-
|
|
34
20
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
35
|
-
|
|
36
21
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
37
|
-
|
|
38
22
|
var _react = _interopRequireWildcard(require("react"));
|
|
39
|
-
|
|
40
23
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
41
|
-
|
|
42
24
|
var _plotly = _interopRequireDefault(require("plotly.js-basic-dist"));
|
|
43
|
-
|
|
44
25
|
var _factory = _interopRequireDefault(require("react-plotly.js/factory"));
|
|
45
|
-
|
|
46
26
|
var _styles = require("@mui/styles");
|
|
47
|
-
|
|
48
27
|
var _styles2 = _interopRequireDefault(require("./styles"));
|
|
49
|
-
|
|
50
28
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
51
|
-
|
|
52
29
|
var _excluded = ["data", "layout", "config", "revision", "onHover", "onUnHover", "afterPlot"];
|
|
53
|
-
|
|
54
30
|
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); }
|
|
55
|
-
|
|
56
31
|
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; }
|
|
57
|
-
|
|
58
32
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
59
|
-
|
|
60
33
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
61
|
-
|
|
62
34
|
var PlotGraph = (0, _factory.default)(_plotly.default);
|
|
63
35
|
var plotGraphStyle = {
|
|
64
36
|
position: "relative"
|
|
65
37
|
};
|
|
66
|
-
|
|
67
38
|
var Plot = function Plot(_ref) {
|
|
68
39
|
var data = _ref.data,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
40
|
+
layout = _ref.layout,
|
|
41
|
+
config = _ref.config,
|
|
42
|
+
_ref$revision = _ref.revision,
|
|
43
|
+
revision = _ref$revision === void 0 ? 0 : _ref$revision,
|
|
44
|
+
onHover = _ref.onHover,
|
|
45
|
+
onUnHover = _ref.onUnHover,
|
|
46
|
+
afterPlot = _ref.afterPlot,
|
|
47
|
+
others = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
77
48
|
var ref = (0, _react.useRef)(null);
|
|
49
|
+
|
|
78
50
|
/* Callbacks */
|
|
79
51
|
|
|
80
52
|
var afterPlotInternal = (0, _react.useCallback)(function () {
|
|
81
53
|
afterPlot === null || afterPlot === void 0 ? void 0 : afterPlot(ref);
|
|
82
54
|
}, [afterPlot]);
|
|
55
|
+
|
|
83
56
|
/* Effects */
|
|
84
57
|
|
|
85
58
|
/**
|
|
@@ -87,7 +60,6 @@ var Plot = function Plot(_ref) {
|
|
|
87
60
|
* (https://github.com/plotly/react-plotly.js/blob/bd15ca98be12b159633fb57c4ea762cb7a64c3a7/src/factory.js#L88)
|
|
88
61
|
*/
|
|
89
62
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
90
|
-
|
|
91
63
|
(0, _react.useLayoutEffect)(afterPlotInternal, []);
|
|
92
64
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(PlotGraph, _objectSpread({
|
|
93
65
|
ref: ref,
|
|
@@ -101,47 +73,38 @@ var Plot = function Plot(_ref) {
|
|
|
101
73
|
style: plotGraphStyle
|
|
102
74
|
}, others));
|
|
103
75
|
};
|
|
104
|
-
|
|
105
76
|
process.env.NODE_ENV !== "production" ? Plot.propTypes = {
|
|
106
77
|
/**
|
|
107
78
|
* Plotly data object.
|
|
108
79
|
*/
|
|
109
80
|
data: _propTypes.default.arrayOf(_propTypes.default.instanceOf(Object)).isRequired,
|
|
110
|
-
|
|
111
81
|
/**
|
|
112
82
|
* Plotly layout object.
|
|
113
83
|
*/
|
|
114
84
|
layout: _propTypes.default.instanceOf(Object).isRequired,
|
|
115
|
-
|
|
116
85
|
/**
|
|
117
86
|
* Plotly config object.
|
|
118
87
|
*/
|
|
119
88
|
config: _propTypes.default.instanceOf(Object).isRequired,
|
|
120
|
-
|
|
121
89
|
/**
|
|
122
90
|
* OnHover function.
|
|
123
91
|
*/
|
|
124
92
|
onHover: _propTypes.default.func,
|
|
125
|
-
|
|
126
93
|
/**
|
|
127
94
|
* OnUnHover function.
|
|
128
95
|
*/
|
|
129
96
|
onUnHover: _propTypes.default.func,
|
|
130
|
-
|
|
131
97
|
/**
|
|
132
98
|
* Function to be call after plot render.
|
|
133
99
|
*/
|
|
134
100
|
afterPlot: _propTypes.default.func,
|
|
135
|
-
|
|
136
101
|
/**
|
|
137
102
|
* Plot revision.
|
|
138
103
|
*/
|
|
139
104
|
revision: _propTypes.default.number
|
|
140
105
|
} : void 0;
|
|
141
|
-
|
|
142
106
|
var _default = (0, _styles.withStyles)(_styles2.default, {
|
|
143
107
|
name: "HvChartPlot"
|
|
144
108
|
})(Plot);
|
|
145
|
-
|
|
146
109
|
exports.default = _default;
|
|
147
110
|
//# sourceMappingURL=Plot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Plot.js","names":["PlotGraph","createPlotlyComponent","Plotly","plotGraphStyle","position","Plot","data","layout","config","revision","onHover","onUnHover","afterPlot","others","ref","useRef","afterPlotInternal","useCallback","useLayoutEffect","propTypes","PropTypes","arrayOf","instanceOf","Object","isRequired","func","number","withStyles","styles","name"],"sources":["../../../src/Chart/Plot/Plot.js"],"sourcesContent":["import React, { useLayoutEffect, useRef, useCallback } from \"react\";\nimport PropTypes from \"prop-types\";\nimport Plotly from \"plotly.js-basic-dist\";\nimport createPlotlyComponent from \"react-plotly.js/factory\";\nimport { withStyles } from \"@mui/styles\";\nimport styles from \"./styles\";\n\nconst PlotGraph = createPlotlyComponent(Plotly);\n\nconst plotGraphStyle = { position: \"relative\" };\n\nconst Plot = ({ data, layout, config, revision = 0, onHover, onUnHover, afterPlot, ...others }) => {\n const ref = useRef(null);\n\n /* Callbacks */\n\n const afterPlotInternal = useCallback(() => {\n afterPlot?.(ref);\n }, [afterPlot]);\n\n /* Effects */\n\n /**\n * Call in the first render because react-plotly.js won't do so.\n * (https://github.com/plotly/react-plotly.js/blob/bd15ca98be12b159633fb57c4ea762cb7a64c3a7/src/factory.js#L88)\n */\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useLayoutEffect(afterPlotInternal, []);\n\n return (\n <PlotGraph\n ref={ref}\n data={data}\n layout={layout}\n config={config}\n revision={revision}\n onHover={onHover}\n onUnhover={onUnHover}\n onAfterPlot={afterPlot != null ? afterPlotInternal : null}\n style={plotGraphStyle}\n {...others}\n />\n );\n};\n\nPlot.propTypes = {\n /**\n * Plotly data object.\n */\n data: PropTypes.arrayOf(PropTypes.instanceOf(Object)).isRequired,\n /**\n * Plotly layout object.\n */\n layout: PropTypes.instanceOf(Object).isRequired,\n /**\n * Plotly config object.\n */\n config: PropTypes.instanceOf(Object).isRequired,\n /**\n * OnHover function.\n */\n onHover: PropTypes.func,\n /**\n * OnUnHover function.\n */\n onUnHover: PropTypes.func,\n /**\n * Function to be call after plot render.\n */\n afterPlot: PropTypes.func,\n /**\n * Plot revision.\n */\n revision: PropTypes.number,\n};\n\nexport default withStyles(styles, { name: \"HvChartPlot\" })(Plot);\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Plot.js","names":["PlotGraph","createPlotlyComponent","Plotly","plotGraphStyle","position","Plot","data","layout","config","revision","onHover","onUnHover","afterPlot","others","ref","useRef","afterPlotInternal","useCallback","useLayoutEffect","propTypes","PropTypes","arrayOf","instanceOf","Object","isRequired","func","number","withStyles","styles","name"],"sources":["../../../src/Chart/Plot/Plot.js"],"sourcesContent":["import React, { useLayoutEffect, useRef, useCallback } from \"react\";\nimport PropTypes from \"prop-types\";\nimport Plotly from \"plotly.js-basic-dist\";\nimport createPlotlyComponent from \"react-plotly.js/factory\";\nimport { withStyles } from \"@mui/styles\";\nimport styles from \"./styles\";\n\nconst PlotGraph = createPlotlyComponent(Plotly);\n\nconst plotGraphStyle = { position: \"relative\" };\n\nconst Plot = ({ data, layout, config, revision = 0, onHover, onUnHover, afterPlot, ...others }) => {\n const ref = useRef(null);\n\n /* Callbacks */\n\n const afterPlotInternal = useCallback(() => {\n afterPlot?.(ref);\n }, [afterPlot]);\n\n /* Effects */\n\n /**\n * Call in the first render because react-plotly.js won't do so.\n * (https://github.com/plotly/react-plotly.js/blob/bd15ca98be12b159633fb57c4ea762cb7a64c3a7/src/factory.js#L88)\n */\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useLayoutEffect(afterPlotInternal, []);\n\n return (\n <PlotGraph\n ref={ref}\n data={data}\n layout={layout}\n config={config}\n revision={revision}\n onHover={onHover}\n onUnhover={onUnHover}\n onAfterPlot={afterPlot != null ? afterPlotInternal : null}\n style={plotGraphStyle}\n {...others}\n />\n );\n};\n\nPlot.propTypes = {\n /**\n * Plotly data object.\n */\n data: PropTypes.arrayOf(PropTypes.instanceOf(Object)).isRequired,\n /**\n * Plotly layout object.\n */\n layout: PropTypes.instanceOf(Object).isRequired,\n /**\n * Plotly config object.\n */\n config: PropTypes.instanceOf(Object).isRequired,\n /**\n * OnHover function.\n */\n onHover: PropTypes.func,\n /**\n * OnUnHover function.\n */\n onUnHover: PropTypes.func,\n /**\n * Function to be call after plot render.\n */\n afterPlot: PropTypes.func,\n /**\n * Plot revision.\n */\n revision: PropTypes.number,\n};\n\nexport default withStyles(styles, { name: \"HvChartPlot\" })(Plot);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AAA8B;AAAA;AAAA;AAAA;AAAA;AAAA;AAE9B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C,CAACC,UAAU;EAC/C;AACF;AACA;EACEhB,MAAM,EAAEY,kBAAS,CAACE,UAAU,CAACC,MAAM,CAAC,CAACC,UAAU;EAC/C;AACF;AACA;EACEd,OAAO,EAAEU,kBAAS,CAACK,IAAI;EACvB;AACF;AACA;EACEd,SAAS,EAAES,kBAAS,CAACK,IAAI;EACzB;AACF;AACA;EACEb,SAAS,EAAEQ,kBAAS,CAACK,IAAI;EACzB;AACF;AACA;EACEhB,QAAQ,EAAEW,kBAAS,CAACM;AACtB,CAAC;AAAC,eAEa,IAAAC,kBAAU,EAACC,gBAAM,EAAE;EAAEC,IAAI,EAAE;AAAc,CAAC,CAAC,CAACxB,IAAI,CAAC;AAAA"}
|
package/dist/Chart/Plot/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
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
|
});
|
|
@@ -11,6 +10,5 @@ Object.defineProperty(exports, "default", {
|
|
|
11
10
|
return _Plot.default;
|
|
12
11
|
}
|
|
13
12
|
});
|
|
14
|
-
|
|
15
13
|
var _Plot = _interopRequireDefault(require("./Plot"));
|
|
16
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/Chart/Plot/index.js"],"sourcesContent":["export { default } from \"./Plot\";\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/Chart/Plot/index.js"],"sourcesContent":["export { default } from \"./Plot\";\n"],"mappings":";;;;;;;;;;;;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","names":["styles"],"sources":["../../../src/Chart/Plot/styles.js"],"sourcesContent":["const styles = {};\n\nexport default styles;\n"],"mappings":";;;;;;AAAA,IAAMA,MAAM,GAAG,
|
|
1
|
+
{"version":3,"file":"styles.js","names":["styles"],"sources":["../../../src/Chart/Plot/styles.js"],"sourcesContent":["const styles = {};\n\nexport default styles;\n"],"mappings":";;;;;;AAAA,IAAMA,MAAM,GAAG,CAAC,CAAC;AAAC,eAEHA,MAAM;AAAA"}
|
|
@@ -1,51 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
require("core-js/modules/es.string.iterator.js");
|
|
4
|
-
|
|
5
4
|
require("core-js/modules/es.weak-map.js");
|
|
6
|
-
|
|
7
5
|
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
8
|
-
|
|
9
6
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
10
|
-
|
|
11
7
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
12
|
-
|
|
13
8
|
Object.defineProperty(exports, "__esModule", {
|
|
14
9
|
value: true
|
|
15
10
|
});
|
|
16
11
|
exports.default = void 0;
|
|
17
|
-
|
|
18
12
|
require("core-js/modules/es.array.map.js");
|
|
19
|
-
|
|
20
13
|
require("core-js/modules/es.function.name.js");
|
|
21
|
-
|
|
22
14
|
require("core-js/modules/es.array.iterator.js");
|
|
23
|
-
|
|
24
15
|
require("core-js/modules/es.object.to-string.js");
|
|
25
|
-
|
|
26
16
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
27
|
-
|
|
28
17
|
var _react = _interopRequireWildcard(require("react"));
|
|
29
|
-
|
|
30
18
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
31
|
-
|
|
32
19
|
var _styles = require("@mui/styles");
|
|
33
|
-
|
|
34
20
|
var _uikitReactCore = require("@hitachivantara/uikit-react-core");
|
|
35
|
-
|
|
36
21
|
var _styles2 = _interopRequireDefault(require("./styles"));
|
|
37
|
-
|
|
38
22
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
39
|
-
|
|
40
23
|
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); }
|
|
41
|
-
|
|
42
24
|
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; }
|
|
43
|
-
|
|
44
25
|
var MultiTooltip = function MultiTooltip(_ref) {
|
|
45
26
|
var _data$elements;
|
|
46
|
-
|
|
47
27
|
var classes = _ref.classes,
|
|
48
|
-
|
|
28
|
+
data = _ref.data;
|
|
49
29
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
50
30
|
className: classes.root,
|
|
51
31
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
@@ -88,7 +68,6 @@ var MultiTooltip = function MultiTooltip(_ref) {
|
|
|
88
68
|
})]
|
|
89
69
|
});
|
|
90
70
|
};
|
|
91
|
-
|
|
92
71
|
process.env.NODE_ENV !== "production" ? MultiTooltip.propTypes = {
|
|
93
72
|
/**
|
|
94
73
|
* A Jss Object used to override or extend the styles applied.
|
|
@@ -98,43 +77,35 @@ process.env.NODE_ENV !== "production" ? MultiTooltip.propTypes = {
|
|
|
98
77
|
* Styles applied to the root.
|
|
99
78
|
*/
|
|
100
79
|
root: _propTypes.default.string,
|
|
101
|
-
|
|
102
80
|
/**
|
|
103
81
|
* Styles applied to the title.
|
|
104
82
|
*/
|
|
105
83
|
title: _propTypes.default.string,
|
|
106
|
-
|
|
107
84
|
/**
|
|
108
85
|
* Styles applied to the values container.
|
|
109
86
|
*/
|
|
110
87
|
valuesContainer: _propTypes.default.string,
|
|
111
|
-
|
|
112
88
|
/**
|
|
113
89
|
* Styling applied to the elements describing a data.
|
|
114
90
|
*/
|
|
115
91
|
valueNameWrapper: _propTypes.default.string,
|
|
116
|
-
|
|
117
92
|
/**
|
|
118
93
|
* Styles applied to the values.
|
|
119
94
|
*/
|
|
120
95
|
values: _propTypes.default.string,
|
|
121
|
-
|
|
122
96
|
/**
|
|
123
97
|
* Styles applied to the color.
|
|
124
98
|
*/
|
|
125
99
|
color: _propTypes.default.string,
|
|
126
|
-
|
|
127
100
|
/**
|
|
128
101
|
* Styles applied to the separator between color and title.
|
|
129
102
|
*/
|
|
130
103
|
separatorColor: _propTypes.default.string,
|
|
131
|
-
|
|
132
104
|
/**
|
|
133
105
|
* Styles applied to the separator.
|
|
134
106
|
*/
|
|
135
107
|
separator: _propTypes.default.string
|
|
136
108
|
}).isRequired,
|
|
137
|
-
|
|
138
109
|
/**
|
|
139
110
|
* Data of the tooltip.
|
|
140
111
|
*/
|
|
@@ -143,7 +114,6 @@ process.env.NODE_ENV !== "production" ? MultiTooltip.propTypes = {
|
|
|
143
114
|
* Styles applied to the barchart root class.
|
|
144
115
|
*/
|
|
145
116
|
title: _propTypes.default.string,
|
|
146
|
-
|
|
147
117
|
/**
|
|
148
118
|
* Values of tooltip
|
|
149
119
|
*/
|
|
@@ -152,12 +122,10 @@ process.env.NODE_ENV !== "production" ? MultiTooltip.propTypes = {
|
|
|
152
122
|
* Color (in hex).
|
|
153
123
|
*/
|
|
154
124
|
color: _propTypes.default.string,
|
|
155
|
-
|
|
156
125
|
/**
|
|
157
126
|
* Name.
|
|
158
127
|
*/
|
|
159
128
|
name: _propTypes.default.string,
|
|
160
|
-
|
|
161
129
|
/**
|
|
162
130
|
* Value.
|
|
163
131
|
*/
|
|
@@ -165,14 +133,11 @@ process.env.NODE_ENV !== "production" ? MultiTooltip.propTypes = {
|
|
|
165
133
|
}))
|
|
166
134
|
}).isRequired
|
|
167
135
|
} : void 0;
|
|
168
|
-
|
|
169
136
|
var arePropsEqual = function arePropsEqual(prevProps, nextProps) {
|
|
170
137
|
return prevProps.data === nextProps.data;
|
|
171
138
|
};
|
|
172
|
-
|
|
173
139
|
var _default = (0, _styles.withStyles)(_styles2.default, {
|
|
174
140
|
name: "HvChartMultiTooltip"
|
|
175
141
|
})( /*#__PURE__*/(0, _react.memo)(MultiTooltip, arePropsEqual));
|
|
176
|
-
|
|
177
142
|
exports.default = _default;
|
|
178
143
|
//# sourceMappingURL=MultiTooltip.js.map
|