@insync-stageplayer/plotly-chart 0.5.31 → 0.5.35-beta.1
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/lib/PlotlyGraph/EventMenu.d.ts +13 -0
- package/lib/PlotlyGraph/EventMenu.d.ts.map +1 -0
- package/lib/PlotlyGraph/EventMenu.js +84 -0
- package/lib/PlotlyGraph/EventMenu.js.map +1 -0
- package/lib/PlotlyGraph/MarkerTracks.d.ts +17 -0
- package/lib/PlotlyGraph/MarkerTracks.d.ts.map +1 -0
- package/lib/PlotlyGraph/MarkerTracks.js +248 -0
- package/lib/PlotlyGraph/MarkerTracks.js.map +1 -0
- package/lib/PlotlyGraph/PlotlyLiveview.d.ts +4 -4
- package/lib/PlotlyGraph/PlotlyLiveview.js +297 -297
- package/lib/PlotlyGraph/PlotlyPlayback.d.ts +4 -4
- package/lib/PlotlyGraph/PlotlyPlayback.d.ts.map +1 -1
- package/lib/PlotlyGraph/PlotlyPlayback.js +524 -317
- package/lib/PlotlyGraph/PlotlyPlayback.js.map +1 -1
- package/lib/PlotlyGraph/PlotlyPlaybackOverlay.d.ts +23 -0
- package/lib/PlotlyGraph/PlotlyPlaybackOverlay.d.ts.map +1 -0
- package/lib/PlotlyGraph/PlotlyPlaybackOverlay.js +188 -0
- package/lib/PlotlyGraph/PlotlyPlaybackOverlay.js.map +1 -0
- package/lib/PlotlyGraph/index.d.ts +2 -2
- package/lib/PlotlyGraph/index.d.ts.map +1 -1
- package/lib/PlotlyGraph/index.js +2 -2
- package/lib/PlotlyGraph/index.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/package.json +5 -3
- package/lib/Plotly.d.ts +0 -5
- package/lib/Plotly.d.ts.map +0 -1
- package/lib/Plotly.js +0 -338
- package/lib/Plotly.js.map +0 -1
- package/lib/PlotlyGraph/Plotly.d.ts +0 -5
- package/lib/PlotlyGraph/Plotly.d.ts.map +0 -1
- package/lib/PlotlyGraph/Plotly.js +0 -347
- package/lib/PlotlyGraph/Plotly.js.map +0 -1
- package/lib/PlotlyLiveview.d.ts +0 -5
- package/lib/PlotlyLiveview.d.ts.map +0 -1
- package/lib/PlotlyLiveview.js +0 -310
- package/lib/PlotlyLiveview.js.map +0 -1
|
@@ -1,347 +0,0 @@
|
|
|
1
|
-
import React, { useCallback, useEffect, useState } from "react";
|
|
2
|
-
import Plot from "react-plotly.js";
|
|
3
|
-
import PropTypes from "prop-types";
|
|
4
|
-
import { withResizeDetector } from "react-resize-detector";
|
|
5
|
-
import { useTheme as useSelectedTheme, styled, } from "@insync-stageplayer/ui-components";
|
|
6
|
-
const normalizeRange = 1000;
|
|
7
|
-
const convertMicrosecondstoDateFormat = (inputMicroseconds) => {
|
|
8
|
-
let convertedDate = new Date(+inputMicroseconds / 1000);
|
|
9
|
-
return adjustWithLocalTimeZone(convertedDate);
|
|
10
|
-
};
|
|
11
|
-
const adjustWithLocalTimeZone = (date) => {
|
|
12
|
-
let adjustedDate = new Date(date.getTime() + date.getTimezoneOffset() * 60 * 1000);
|
|
13
|
-
return adjustedDate;
|
|
14
|
-
};
|
|
15
|
-
const convertDateToMicroseconds = (inputDate) => {
|
|
16
|
-
const convertIntoDate = new Date(inputDate);
|
|
17
|
-
return (convertIntoDate.getTime() * 1000 -
|
|
18
|
-
convertIntoDate.getTimezoneOffset() * 60 * 1000 * 1000);
|
|
19
|
-
};
|
|
20
|
-
const getMicroSecondStartAndLength = (originalFromDate, originalStopDate) => {
|
|
21
|
-
const start = convertDateToMicroseconds(originalFromDate);
|
|
22
|
-
const end = convertDateToMicroseconds(originalStopDate);
|
|
23
|
-
const length = end - start;
|
|
24
|
-
return [start, length];
|
|
25
|
-
};
|
|
26
|
-
// update some cursors to be more clear
|
|
27
|
-
const StyledPlotly = styled(Plot) `
|
|
28
|
-
rect.nsewdrag.cursor-ew-resize {
|
|
29
|
-
cursor: zoom-in;
|
|
30
|
-
}
|
|
31
|
-
rect.ewdrag.cursor-ew-resize {
|
|
32
|
-
cursor: grab;
|
|
33
|
-
}
|
|
34
|
-
`;
|
|
35
|
-
export const PlotlyReply = withResizeDetector(({ xRange, data, metadata, onStopSelect, onDrag, xScaleTickFormat, scrubbing, yAxisLabel, displaySecondYAxis, displayArrow, isLivePanel, totalTime, }) => {
|
|
36
|
-
var _a;
|
|
37
|
-
const [plotData, setPlotData] = useState([]);
|
|
38
|
-
const [nowLine, setNowline] = useState(isLivePanel ? 1 : (_a = sessionStorage.getItem("nl")) !== null && _a !== void 0 ? _a : 0);
|
|
39
|
-
const [layout, setLayout] = useState(null);
|
|
40
|
-
const selectedTheme = useSelectedTheme();
|
|
41
|
-
const [yAxisLabelLeft, setYAxisLabelLeft] = useState("");
|
|
42
|
-
const [yAxisLabelRight, setYAxisLabelRight] = useState("");
|
|
43
|
-
const updateLayout = useCallback(() => {
|
|
44
|
-
let annotations = [
|
|
45
|
-
{
|
|
46
|
-
xref: "paper",
|
|
47
|
-
yref: "paper",
|
|
48
|
-
x: nowLine,
|
|
49
|
-
xanchor: "right",
|
|
50
|
-
y: 1,
|
|
51
|
-
yanchor: "bottom",
|
|
52
|
-
text: "",
|
|
53
|
-
showarrow: displayArrow,
|
|
54
|
-
arrowhead: 0,
|
|
55
|
-
ax: 0,
|
|
56
|
-
ay: 1000,
|
|
57
|
-
arrowcolor: "red",
|
|
58
|
-
},
|
|
59
|
-
];
|
|
60
|
-
const convertXRangeFrom = xScaleTickFormat.includes(":")
|
|
61
|
-
? convertMicrosecondstoDateFormat(xRange.from > 0
|
|
62
|
-
? xRange.length === totalTime
|
|
63
|
-
? 0
|
|
64
|
-
: xRange.from + xRange.length > totalTime
|
|
65
|
-
? totalTime - xRange.length
|
|
66
|
-
: xRange.from
|
|
67
|
-
: 0)
|
|
68
|
-
: xRange.from / 1e6;
|
|
69
|
-
const convertXRangeTo = xScaleTickFormat.includes(":")
|
|
70
|
-
? convertMicrosecondstoDateFormat(xRange.from > 0
|
|
71
|
-
? xRange.length === totalTime
|
|
72
|
-
? xRange.length
|
|
73
|
-
: xRange.from + xRange.length > totalTime
|
|
74
|
-
? totalTime
|
|
75
|
-
: xRange.from + xRange.length
|
|
76
|
-
: xRange.length)
|
|
77
|
-
: (xRange.from + xRange.length) / 1e6;
|
|
78
|
-
let defaultLayout = {
|
|
79
|
-
// this hovermode setting creates a hover-over legend for all the signals at the same time. It also adds a spike line
|
|
80
|
-
hovermode: "x unified",
|
|
81
|
-
yaxis: {
|
|
82
|
-
fixedrange: true,
|
|
83
|
-
rangemode: isLivePanel ? "tozero" : "",
|
|
84
|
-
hoverformat: ".2f",
|
|
85
|
-
range: [],
|
|
86
|
-
title: yAxisLabelLeft,
|
|
87
|
-
showline: true,
|
|
88
|
-
showticklabels: isLivePanel ? false : true,
|
|
89
|
-
linewidth: 2,
|
|
90
|
-
linecolor: selectedTheme.colors.accent,
|
|
91
|
-
tickformat: null,
|
|
92
|
-
},
|
|
93
|
-
xaxis: {
|
|
94
|
-
rangemode: isLivePanel ? "tozero" : "",
|
|
95
|
-
showline: isLivePanel ? true : false,
|
|
96
|
-
linewidth: 2,
|
|
97
|
-
linecolor: selectedTheme.colors.accent,
|
|
98
|
-
fixedrange: isLivePanel ? true : false,
|
|
99
|
-
range: [convertXRangeFrom, convertXRangeTo],
|
|
100
|
-
tickformat: xScaleTickFormat.includes(":") ? "%H:%M:%S" : null,
|
|
101
|
-
},
|
|
102
|
-
showlegend: false,
|
|
103
|
-
autosize: true,
|
|
104
|
-
margin: { l: 25, r: 10, t: 20, b: 20 },
|
|
105
|
-
paper_bgcolor: selectedTheme.colors.background,
|
|
106
|
-
plot_bgcolor: selectedTheme.colors.background,
|
|
107
|
-
font: { color: selectedTheme.colors.foreground },
|
|
108
|
-
};
|
|
109
|
-
// Check if a second y-axis needs to be added
|
|
110
|
-
if (displaySecondYAxis && metadata.length == 2) {
|
|
111
|
-
const yAxis2 = {
|
|
112
|
-
fixedrange: true,
|
|
113
|
-
title: yAxisLabelRight,
|
|
114
|
-
anchor: "x",
|
|
115
|
-
overlaying: "y",
|
|
116
|
-
side: "right",
|
|
117
|
-
};
|
|
118
|
-
defaultLayout = Object.assign(Object.assign({}, defaultLayout), { yaxis2: yAxis2 });
|
|
119
|
-
}
|
|
120
|
-
// when scrubbing plotly is in charge, this to prevent the xRange to update and mess while
|
|
121
|
-
// still scrubbing in plotly
|
|
122
|
-
if (!scrubbing) {
|
|
123
|
-
setLayout(Object.assign(Object.assign({}, defaultLayout), { annotations }));
|
|
124
|
-
}
|
|
125
|
-
}, [
|
|
126
|
-
selectedTheme,
|
|
127
|
-
xRange,
|
|
128
|
-
xScaleTickFormat,
|
|
129
|
-
yAxisLabelLeft,
|
|
130
|
-
yAxisLabelRight,
|
|
131
|
-
displaySecondYAxis,
|
|
132
|
-
displayArrow,
|
|
133
|
-
scrubbing,
|
|
134
|
-
metadata,
|
|
135
|
-
nowLine,
|
|
136
|
-
]);
|
|
137
|
-
const onRelayout = (e) => {
|
|
138
|
-
if (e["xaxis.range[0]"] && e["xaxis.range[1]"]) {
|
|
139
|
-
let selection;
|
|
140
|
-
if (xScaleTickFormat.includes(":")) {
|
|
141
|
-
const [from, length] = getMicroSecondStartAndLength(e["xaxis.range[0]"], e["xaxis.range[1]"]);
|
|
142
|
-
selection = {
|
|
143
|
-
from: from,
|
|
144
|
-
length: length,
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
else {
|
|
148
|
-
selection = {
|
|
149
|
-
from: e["xaxis.range[0]"] * 1e6,
|
|
150
|
-
length: (e["xaxis.range[1]"] - e["xaxis.range[0]"]) * 1e6,
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
onStopSelect({ selection });
|
|
154
|
-
}
|
|
155
|
-
};
|
|
156
|
-
const onRelayouting = (e) => {
|
|
157
|
-
if (e["xaxis.range[0]"] && e["xaxis.range[1]"]) {
|
|
158
|
-
let seekTime;
|
|
159
|
-
if (xScaleTickFormat.includes(":")) {
|
|
160
|
-
const [from, length] = getMicroSecondStartAndLength(e["xaxis.range[0]"], e["xaxis.range[1]"]);
|
|
161
|
-
seekTime = (length / 2 + from) * 1e6;
|
|
162
|
-
}
|
|
163
|
-
else {
|
|
164
|
-
seekTime =
|
|
165
|
-
((e["xaxis.range[1]"] - e["xaxis.range[0]"]) / 2 +
|
|
166
|
-
e["xaxis.range[0]"]) *
|
|
167
|
-
1e6;
|
|
168
|
-
}
|
|
169
|
-
onDrag(seekTime);
|
|
170
|
-
}
|
|
171
|
-
};
|
|
172
|
-
useEffect(() => {
|
|
173
|
-
updateLayout();
|
|
174
|
-
const plotDataArr = [];
|
|
175
|
-
data.forEach((signal, idx) => {
|
|
176
|
-
const x = signal.map((item) => {
|
|
177
|
-
if (xScaleTickFormat.includes(":")) {
|
|
178
|
-
const xDateFormatted = convertMicrosecondstoDateFormat(+item.x);
|
|
179
|
-
return xDateFormatted;
|
|
180
|
-
}
|
|
181
|
-
else {
|
|
182
|
-
const xDateFormatted = +item.x / 1e6;
|
|
183
|
-
return xDateFormatted;
|
|
184
|
-
}
|
|
185
|
-
});
|
|
186
|
-
const y = signal.map((item) => {
|
|
187
|
-
return item.y;
|
|
188
|
-
});
|
|
189
|
-
const signalData = {
|
|
190
|
-
x,
|
|
191
|
-
y,
|
|
192
|
-
type: "scattergl",
|
|
193
|
-
mode: metadata[idx].frequency * (xRange.length / 1000 / 1000) > 250
|
|
194
|
-
? "lines"
|
|
195
|
-
: "lines+markers",
|
|
196
|
-
name: metadata[idx].name,
|
|
197
|
-
marker: {
|
|
198
|
-
color: metadata[idx].color,
|
|
199
|
-
size: 5,
|
|
200
|
-
line: {
|
|
201
|
-
color: metadata[idx].color,
|
|
202
|
-
width: 1,
|
|
203
|
-
},
|
|
204
|
-
},
|
|
205
|
-
};
|
|
206
|
-
plotDataArr.push(signalData);
|
|
207
|
-
});
|
|
208
|
-
// Check if a second y-axis needs to be added
|
|
209
|
-
if (displaySecondYAxis && metadata.length == 2) {
|
|
210
|
-
plotDataArr[1] = Object.assign(Object.assign({}, plotDataArr[1]), { yaxis: "y2" });
|
|
211
|
-
}
|
|
212
|
-
// Setting y-axis labels if needed and meeting the requirements
|
|
213
|
-
if (metadata.length == 1) {
|
|
214
|
-
setYAxisLabelLeft(yAxisLabel ? metadata[0].name : "");
|
|
215
|
-
}
|
|
216
|
-
else if (metadata.length == 2 && displaySecondYAxis) {
|
|
217
|
-
setYAxisLabelLeft(yAxisLabel ? metadata[0].name : "");
|
|
218
|
-
setYAxisLabelRight(yAxisLabel ? metadata[1].name : "");
|
|
219
|
-
}
|
|
220
|
-
else {
|
|
221
|
-
setYAxisLabelLeft("");
|
|
222
|
-
setYAxisLabelRight("");
|
|
223
|
-
}
|
|
224
|
-
setPlotData(plotDataArr);
|
|
225
|
-
}, [
|
|
226
|
-
data,
|
|
227
|
-
metadata,
|
|
228
|
-
updateLayout,
|
|
229
|
-
xScaleTickFormat,
|
|
230
|
-
xRange,
|
|
231
|
-
scrubbing,
|
|
232
|
-
yAxisLabel,
|
|
233
|
-
displaySecondYAxis,
|
|
234
|
-
]);
|
|
235
|
-
useEffect(() => {
|
|
236
|
-
if (xRange.from < 0) {
|
|
237
|
-
let d = (xRange.length / 2 + xRange.from) / xRange.length;
|
|
238
|
-
setNowline(d);
|
|
239
|
-
}
|
|
240
|
-
else {
|
|
241
|
-
if (!isLivePanel) {
|
|
242
|
-
if (xRange.length === totalTime) {
|
|
243
|
-
setNowline(0.5 + xRange.from / totalTime);
|
|
244
|
-
}
|
|
245
|
-
else if (xRange.from + xRange.length > totalTime) {
|
|
246
|
-
setNowline(0.5 + (xRange.from - (totalTime - xRange.length)) / xRange.length);
|
|
247
|
-
}
|
|
248
|
-
else {
|
|
249
|
-
setNowline(0.5);
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
else {
|
|
253
|
-
setNowline(1);
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
isLivePanel
|
|
257
|
-
? sessionStorage.removeItem("nl")
|
|
258
|
-
: sessionStorage.setItem("nl", nowLine);
|
|
259
|
-
}, [plotData, xRange]);
|
|
260
|
-
const shouldNormalize = React.useMemo(() => {
|
|
261
|
-
const units = metadata.reduce((acc, curr) => {
|
|
262
|
-
if (curr != undefined && acc.indexOf(curr === null || curr === void 0 ? void 0 : curr.unit) < 0) {
|
|
263
|
-
return [...acc, curr.unit];
|
|
264
|
-
}
|
|
265
|
-
return acc;
|
|
266
|
-
}, []);
|
|
267
|
-
return units.length > 1;
|
|
268
|
-
}, [metadata]);
|
|
269
|
-
const normalized = React.useMemo(() => {
|
|
270
|
-
if (plotData.length <= 0)
|
|
271
|
-
return;
|
|
272
|
-
if (shouldNormalize) {
|
|
273
|
-
const newLinesData = plotData.map((item, i) => {
|
|
274
|
-
const line = metadata[i];
|
|
275
|
-
const { min, max } = line;
|
|
276
|
-
const lineRange = max - min;
|
|
277
|
-
return Object.assign(Object.assign({}, item), { y: item.y.map((value) => {
|
|
278
|
-
return (value - min) / lineRange;
|
|
279
|
-
}) });
|
|
280
|
-
});
|
|
281
|
-
return newLinesData;
|
|
282
|
-
}
|
|
283
|
-
return plotData;
|
|
284
|
-
}, [shouldNormalize, plotData, metadata]);
|
|
285
|
-
return (
|
|
286
|
-
// <StyledPlotly
|
|
287
|
-
// useResizeHandler
|
|
288
|
-
// className="plot-div"
|
|
289
|
-
// data={normalized}
|
|
290
|
-
// layout={layout}
|
|
291
|
-
// style={{ width: "100%", height: "100%" }}
|
|
292
|
-
// config={{
|
|
293
|
-
// displaylogo: false,
|
|
294
|
-
// displayModeBar: false,
|
|
295
|
-
// responsive: true,
|
|
296
|
-
// }}
|
|
297
|
-
// onRelayout={(e) => onRelayout(e)}
|
|
298
|
-
// onRelayouting={(e) => onRelayouting(e)}
|
|
299
|
-
// />
|
|
300
|
-
React.createElement(React.Fragment, null));
|
|
301
|
-
});
|
|
302
|
-
PlotlyReply.defaultProps = {
|
|
303
|
-
xRange: null,
|
|
304
|
-
data: [],
|
|
305
|
-
metadata: [],
|
|
306
|
-
onStopSelect: () => { },
|
|
307
|
-
onDrag: () => { },
|
|
308
|
-
xScaleTickFormat: "SS",
|
|
309
|
-
scrubbing: false,
|
|
310
|
-
yAxisLabel: false,
|
|
311
|
-
displaySecondYAxis: false,
|
|
312
|
-
displayArrow: true,
|
|
313
|
-
selectedTheme: null,
|
|
314
|
-
isLivePanel: false,
|
|
315
|
-
totalTime: null,
|
|
316
|
-
};
|
|
317
|
-
const dataElement = PropTypes.shape({
|
|
318
|
-
x: PropTypes.number,
|
|
319
|
-
y: PropTypes.number,
|
|
320
|
-
});
|
|
321
|
-
const metadataElement = PropTypes.shape({
|
|
322
|
-
name: PropTypes.string,
|
|
323
|
-
color: PropTypes.string,
|
|
324
|
-
});
|
|
325
|
-
PlotlyReply.propTypes = {
|
|
326
|
-
xRange: PropTypes.shape({
|
|
327
|
-
from: PropTypes.number,
|
|
328
|
-
length: PropTypes.number,
|
|
329
|
-
}),
|
|
330
|
-
data: PropTypes.arrayOf(PropTypes.arrayOf(dataElement), PropTypes.arrayOf(dataElement)),
|
|
331
|
-
metadata: PropTypes.arrayOf(metadataElement),
|
|
332
|
-
onStopSelect: PropTypes.func,
|
|
333
|
-
onDrag: PropTypes.func,
|
|
334
|
-
xScaleTickFormat: PropTypes.string,
|
|
335
|
-
scrubbing: PropTypes.bool,
|
|
336
|
-
yAxisLabel: PropTypes.bool,
|
|
337
|
-
isLivePanel: PropTypes.bool,
|
|
338
|
-
displaySecondYAxis: PropTypes.bool,
|
|
339
|
-
displayArrow: PropTypes.bool,
|
|
340
|
-
selectedTheme: PropTypes.shape({
|
|
341
|
-
colors: PropTypes.shape({
|
|
342
|
-
background: PropTypes.string,
|
|
343
|
-
}),
|
|
344
|
-
}),
|
|
345
|
-
totalTime: PropTypes.number,
|
|
346
|
-
};
|
|
347
|
-
//# sourceMappingURL=Plotly.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Plotly.js","sourceRoot":"","sources":["../../src/PlotlyGraph/Plotly.js"],"names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AAC,WAAW,CAAC,CAC/B;IACD,QAAQ,EAAE,SAAS,CAAC,OAAO,CAAC,eAAe,CAAC;IAC5C,YAAY,EAAE,SAAS,CAAC,IAAI;IAC5B,MAAM,EAAE,SAAS,CAAC,IAAI;IACtB,gBAAgB,EAAE,SAAS,CAAC,MAAM;IAClC,SAAS,EAAE,SAAS,CAAC,IAAI;IACzB,UAAU,EAAE,SAAS,CAAC,IAAI;IAC1B,WAAW,EAAE,SAAS,CAAC,IAAI;IAC3B,kBAAkB,EAAE,SAAS,CAAC,IAAI;IAClC,YAAY,EAAE,SAAS,CAAC,IAAI;IAC5B,aAAa,EAAE,SAAS,CAAC,KAAK,CAAC;QAC7B,MAAM,EAAE,SAAS,CAAC,KAAK,CAAC;YACtB,UAAU,EAAE,SAAS,CAAC,MAAM;SAC7B,CAAC;KACH,CAAC;IACF,SAAS,EAAE,SAAS,CAAC,MAAM;CAC5B,CAAC"}
|
package/lib/PlotlyLiveview.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export const PlotlyChart: React.ForwardRefExoticComponent<Pick<Omit<Omit<Omit<any, "targetRef"> & {
|
|
2
|
-
targetRef?: any;
|
|
3
|
-
}, "width">, "height">, string | number | symbol> & React.RefAttributes<HTMLElement>>;
|
|
4
|
-
import React from "react";
|
|
5
|
-
//# sourceMappingURL=PlotlyLiveview.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PlotlyLiveview.d.ts","sourceRoot":"","sources":["../src/PlotlyLiveview.js"],"names":[],"mappings":"AAiDA;;sFAyRE"}
|
package/lib/PlotlyLiveview.js
DELETED
|
@@ -1,310 +0,0 @@
|
|
|
1
|
-
import React, { useCallback, useEffect, useState } from "react";
|
|
2
|
-
import Plot from "react-plotly.js";
|
|
3
|
-
import PropTypes from "prop-types";
|
|
4
|
-
import { withResizeDetector } from "react-resize-detector";
|
|
5
|
-
import { useTheme as useSelectedTheme, styled, } from "@insync-stageplayer/ui-components";
|
|
6
|
-
const normalizeRange = 1000;
|
|
7
|
-
const convertMicrosecondstoDateFormat = (inputMicroseconds) => {
|
|
8
|
-
let convertedDate = new Date(+inputMicroseconds / 1000);
|
|
9
|
-
return adjustWithLocalTimeZone(convertedDate);
|
|
10
|
-
};
|
|
11
|
-
const adjustWithLocalTimeZone = (date) => {
|
|
12
|
-
let adjustedDate = new Date(date.getTime() + date.getTimezoneOffset() * 60 * 1000);
|
|
13
|
-
return adjustedDate;
|
|
14
|
-
};
|
|
15
|
-
const convertDateToMicroseconds = (inputDate) => {
|
|
16
|
-
const convertIntoDate = new Date(inputDate);
|
|
17
|
-
return (convertIntoDate.getTime() * 1000 -
|
|
18
|
-
convertIntoDate.getTimezoneOffset() * 60 * 1000 * 1000);
|
|
19
|
-
};
|
|
20
|
-
const getMicroSecondStartAndLength = (originalFromDate, originalStopDate) => {
|
|
21
|
-
const start = convertDateToMicroseconds(originalFromDate);
|
|
22
|
-
const end = convertDateToMicroseconds(originalStopDate);
|
|
23
|
-
const length = end - start;
|
|
24
|
-
return [start, length];
|
|
25
|
-
};
|
|
26
|
-
// update some cursors to be more clear
|
|
27
|
-
const StyledPlotly = styled(Plot) `
|
|
28
|
-
rect.nsewdrag.cursor-ew-resize {
|
|
29
|
-
cursor: zoom-in;
|
|
30
|
-
}
|
|
31
|
-
rect.ewdrag.cursor-ew-resize {
|
|
32
|
-
cursor: grab;
|
|
33
|
-
}
|
|
34
|
-
`;
|
|
35
|
-
export const PlotlyChart = withResizeDetector(({ xRange, data, metadata, onStopSelect, onDrag, xScaleTickFormat, scrubbing, yAxisLabel, displaySecondYAxis, displayArrow, isLivePanel, }) => {
|
|
36
|
-
var _a;
|
|
37
|
-
const [plotData, setPlotData] = useState([]);
|
|
38
|
-
const [nowLine, setNowline] = useState(isLivePanel ? 1 : (_a = sessionStorage.getItem("nl")) !== null && _a !== void 0 ? _a : 0);
|
|
39
|
-
const [layout, setLayout] = useState(null);
|
|
40
|
-
const selectedTheme = useSelectedTheme();
|
|
41
|
-
const [yAxisLabelLeft, setYAxisLabelLeft] = useState("");
|
|
42
|
-
const [yAxisLabelRight, setYAxisLabelRight] = useState("");
|
|
43
|
-
const updateLayout = useCallback(() => {
|
|
44
|
-
let annotations = [
|
|
45
|
-
{
|
|
46
|
-
xref: "paper",
|
|
47
|
-
yref: "paper",
|
|
48
|
-
x: nowLine,
|
|
49
|
-
xanchor: "right",
|
|
50
|
-
y: 1,
|
|
51
|
-
yanchor: "bottom",
|
|
52
|
-
text: "",
|
|
53
|
-
showarrow: displayArrow,
|
|
54
|
-
arrowhead: 0,
|
|
55
|
-
ax: 0,
|
|
56
|
-
ay: 1000,
|
|
57
|
-
arrowcolor: "red",
|
|
58
|
-
},
|
|
59
|
-
];
|
|
60
|
-
const convertXRangeFrom = xScaleTickFormat.includes(":")
|
|
61
|
-
? convertMicrosecondstoDateFormat(xRange.from > 0 ? xRange.from : 0)
|
|
62
|
-
: xRange.from / 1e6;
|
|
63
|
-
const convertXRangeTo = xScaleTickFormat.includes(":")
|
|
64
|
-
? convertMicrosecondstoDateFormat(xRange.from > 0 ? xRange.from + xRange.length : xRange.length)
|
|
65
|
-
: (xRange.from + xRange.length) / 1e6;
|
|
66
|
-
let defaultLayout = {
|
|
67
|
-
// this hovermode setting creates a hover-over legend for all the signals at the same time. It also adds a spike line
|
|
68
|
-
hovermode: "x unified",
|
|
69
|
-
yaxis: {
|
|
70
|
-
fixedrange: true,
|
|
71
|
-
rangemode: isLivePanel ? "tozero" : "",
|
|
72
|
-
hoverformat: ".2f",
|
|
73
|
-
range: [],
|
|
74
|
-
title: yAxisLabelLeft,
|
|
75
|
-
showline: true,
|
|
76
|
-
showticklabels: isLivePanel ? false : true,
|
|
77
|
-
linewidth: 2,
|
|
78
|
-
linecolor: selectedTheme.colors.accent,
|
|
79
|
-
tickformat: null,
|
|
80
|
-
},
|
|
81
|
-
xaxis: {
|
|
82
|
-
rangemode: isLivePanel ? "tozero" : "",
|
|
83
|
-
showline: isLivePanel ? true : false,
|
|
84
|
-
linewidth: 2,
|
|
85
|
-
linecolor: selectedTheme.colors.accent,
|
|
86
|
-
fixedrange: isLivePanel ? true : false,
|
|
87
|
-
range: [convertXRangeFrom, convertXRangeTo],
|
|
88
|
-
tickformat: xScaleTickFormat.includes(":") ? "%H:%M:%S" : null,
|
|
89
|
-
},
|
|
90
|
-
showlegend: false,
|
|
91
|
-
autosize: true,
|
|
92
|
-
margin: { l: 25, r: 10, t: 20, b: 20 },
|
|
93
|
-
paper_bgcolor: selectedTheme.colors.background,
|
|
94
|
-
plot_bgcolor: selectedTheme.colors.background,
|
|
95
|
-
font: { color: selectedTheme.colors.foreground },
|
|
96
|
-
};
|
|
97
|
-
// Check if a second y-axis needs to be added
|
|
98
|
-
if (displaySecondYAxis && metadata.length == 2) {
|
|
99
|
-
const yAxis2 = {
|
|
100
|
-
fixedrange: true,
|
|
101
|
-
title: yAxisLabelRight,
|
|
102
|
-
anchor: "x",
|
|
103
|
-
overlaying: "y",
|
|
104
|
-
side: "right",
|
|
105
|
-
};
|
|
106
|
-
defaultLayout = Object.assign(Object.assign({}, defaultLayout), { yaxis2: yAxis2 });
|
|
107
|
-
}
|
|
108
|
-
// when scrubbing plotly is in charge, this to prevent the xRange to update and mess while
|
|
109
|
-
// still scrubbing in plotly
|
|
110
|
-
if (!scrubbing) {
|
|
111
|
-
setLayout(Object.assign(Object.assign({}, defaultLayout), { annotations }));
|
|
112
|
-
}
|
|
113
|
-
}, [
|
|
114
|
-
selectedTheme,
|
|
115
|
-
xRange,
|
|
116
|
-
xScaleTickFormat,
|
|
117
|
-
yAxisLabelLeft,
|
|
118
|
-
yAxisLabelRight,
|
|
119
|
-
displaySecondYAxis,
|
|
120
|
-
displayArrow,
|
|
121
|
-
scrubbing,
|
|
122
|
-
metadata,
|
|
123
|
-
nowLine,
|
|
124
|
-
]);
|
|
125
|
-
const onRelayout = (e) => {
|
|
126
|
-
if (e["xaxis.range[0]"] && e["xaxis.range[1]"]) {
|
|
127
|
-
let selection;
|
|
128
|
-
if (xScaleTickFormat.includes(":")) {
|
|
129
|
-
const [from, length] = getMicroSecondStartAndLength(e["xaxis.range[0]"], e["xaxis.range[1]"]);
|
|
130
|
-
selection = {
|
|
131
|
-
from: from,
|
|
132
|
-
length: length,
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
136
|
-
selection = {
|
|
137
|
-
from: e["xaxis.range[0]"] * 1e6,
|
|
138
|
-
length: (e["xaxis.range[1]"] - e["xaxis.range[0]"]) * 1e6,
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
onStopSelect({ selection });
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
const onRelayouting = (e) => {
|
|
145
|
-
if (e["xaxis.range[0]"] && e["xaxis.range[1]"]) {
|
|
146
|
-
let seekTime;
|
|
147
|
-
if (xScaleTickFormat.includes(":")) {
|
|
148
|
-
const [from, length] = getMicroSecondStartAndLength(e["xaxis.range[0]"], e["xaxis.range[1]"]);
|
|
149
|
-
seekTime = (length / 2 + from) * 1e6;
|
|
150
|
-
}
|
|
151
|
-
else {
|
|
152
|
-
seekTime =
|
|
153
|
-
((e["xaxis.range[1]"] - e["xaxis.range[0]"]) / 2 +
|
|
154
|
-
e["xaxis.range[0]"]) *
|
|
155
|
-
1e6;
|
|
156
|
-
}
|
|
157
|
-
onDrag(seekTime);
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
useEffect(() => {
|
|
161
|
-
updateLayout();
|
|
162
|
-
const plotDataArr = [];
|
|
163
|
-
data.forEach((signal, idx) => {
|
|
164
|
-
const x = signal.map((item) => {
|
|
165
|
-
if (xScaleTickFormat.includes(":")) {
|
|
166
|
-
const xDateFormatted = convertMicrosecondstoDateFormat(+item.x);
|
|
167
|
-
return xDateFormatted;
|
|
168
|
-
}
|
|
169
|
-
else {
|
|
170
|
-
const xDateFormatted = +item.x / 1e6;
|
|
171
|
-
return xDateFormatted;
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
const y = signal.map((item) => {
|
|
175
|
-
return item.y;
|
|
176
|
-
});
|
|
177
|
-
const signalData = {
|
|
178
|
-
x,
|
|
179
|
-
y,
|
|
180
|
-
type: "scattergl",
|
|
181
|
-
mode: metadata[idx].frequency * (xRange.length / 1000 / 1000) > 250
|
|
182
|
-
? "lines"
|
|
183
|
-
: "lines+markers",
|
|
184
|
-
name: metadata[idx].name,
|
|
185
|
-
marker: {
|
|
186
|
-
color: metadata[idx].color,
|
|
187
|
-
size: 5,
|
|
188
|
-
line: {
|
|
189
|
-
color: metadata[idx].color,
|
|
190
|
-
width: 1,
|
|
191
|
-
},
|
|
192
|
-
},
|
|
193
|
-
};
|
|
194
|
-
plotDataArr.push(signalData);
|
|
195
|
-
});
|
|
196
|
-
// Check if a second y-axis needs to be added
|
|
197
|
-
if (displaySecondYAxis && metadata.length == 2) {
|
|
198
|
-
plotDataArr[1] = Object.assign(Object.assign({}, plotDataArr[1]), { yaxis: "y2" });
|
|
199
|
-
}
|
|
200
|
-
// Setting y-axis labels if needed and meeting the requirements
|
|
201
|
-
if (metadata.length == 1) {
|
|
202
|
-
setYAxisLabelLeft(yAxisLabel ? metadata[0].name : "");
|
|
203
|
-
}
|
|
204
|
-
else if (metadata.length == 2 && displaySecondYAxis) {
|
|
205
|
-
setYAxisLabelLeft(yAxisLabel ? metadata[0].name : "");
|
|
206
|
-
setYAxisLabelRight(yAxisLabel ? metadata[1].name : "");
|
|
207
|
-
}
|
|
208
|
-
else {
|
|
209
|
-
setYAxisLabelLeft("");
|
|
210
|
-
setYAxisLabelRight("");
|
|
211
|
-
}
|
|
212
|
-
setPlotData(plotDataArr);
|
|
213
|
-
}, [
|
|
214
|
-
data,
|
|
215
|
-
metadata,
|
|
216
|
-
updateLayout,
|
|
217
|
-
xScaleTickFormat,
|
|
218
|
-
xRange,
|
|
219
|
-
scrubbing,
|
|
220
|
-
yAxisLabel,
|
|
221
|
-
displaySecondYAxis,
|
|
222
|
-
]);
|
|
223
|
-
useEffect(() => {
|
|
224
|
-
if (xRange.from < 0) {
|
|
225
|
-
let d = (xRange.length / 2 + (xRange.from * xRange.length) / xRange.length) /
|
|
226
|
-
xRange.length;
|
|
227
|
-
setNowline(d);
|
|
228
|
-
}
|
|
229
|
-
else {
|
|
230
|
-
setNowline(isLivePanel ? 1 : 0.5);
|
|
231
|
-
}
|
|
232
|
-
isLivePanel
|
|
233
|
-
? sessionStorage.removeItem("nl")
|
|
234
|
-
: sessionStorage.setItem("nl", nowLine);
|
|
235
|
-
}, [plotData, xRange]);
|
|
236
|
-
const shouldNormalize = React.useMemo(() => {
|
|
237
|
-
const units = metadata.reduce((acc, curr) => {
|
|
238
|
-
if (curr != undefined && acc.indexOf(curr === null || curr === void 0 ? void 0 : curr.unit) < 0) {
|
|
239
|
-
return [...acc, curr.unit];
|
|
240
|
-
}
|
|
241
|
-
return acc;
|
|
242
|
-
}, []);
|
|
243
|
-
return units.length > 1;
|
|
244
|
-
}, [metadata]);
|
|
245
|
-
const normalized = React.useMemo(() => {
|
|
246
|
-
if (plotData.length <= 0)
|
|
247
|
-
return;
|
|
248
|
-
if (shouldNormalize) {
|
|
249
|
-
const newLinesData = plotData.map((item, i) => {
|
|
250
|
-
const line = metadata[i];
|
|
251
|
-
const { min, max } = line;
|
|
252
|
-
const lineRange = max - min;
|
|
253
|
-
return Object.assign(Object.assign({}, item), { y: item.y.map((value) => {
|
|
254
|
-
return (value - min) / lineRange;
|
|
255
|
-
}) });
|
|
256
|
-
});
|
|
257
|
-
return newLinesData;
|
|
258
|
-
}
|
|
259
|
-
return plotData;
|
|
260
|
-
}, [shouldNormalize, plotData, metadata]);
|
|
261
|
-
return (React.createElement(StyledPlotly, { useResizeHandler: true, className: "plot-div", data: normalized, layout: layout, style: { width: "100%", height: "100%" }, config: {
|
|
262
|
-
displaylogo: false,
|
|
263
|
-
displayModeBar: false,
|
|
264
|
-
responsive: true,
|
|
265
|
-
}, onRelayout: (e) => onRelayout(e), onRelayouting: (e) => onRelayouting(e) }));
|
|
266
|
-
});
|
|
267
|
-
PlotlyChart.defaultProps = {
|
|
268
|
-
xRange: null,
|
|
269
|
-
data: [],
|
|
270
|
-
metadata: [],
|
|
271
|
-
onStopSelect: () => { },
|
|
272
|
-
onDrag: () => { },
|
|
273
|
-
xScaleTickFormat: "SS",
|
|
274
|
-
scrubbing: false,
|
|
275
|
-
yAxisLabel: false,
|
|
276
|
-
displaySecondYAxis: false,
|
|
277
|
-
displayArrow: true,
|
|
278
|
-
selectedTheme: null,
|
|
279
|
-
isLivePanel: false,
|
|
280
|
-
};
|
|
281
|
-
const dataElement = PropTypes.shape({
|
|
282
|
-
x: PropTypes.number,
|
|
283
|
-
y: PropTypes.number,
|
|
284
|
-
});
|
|
285
|
-
const metadataElement = PropTypes.shape({
|
|
286
|
-
name: PropTypes.string,
|
|
287
|
-
color: PropTypes.string,
|
|
288
|
-
});
|
|
289
|
-
PlotlyChart.propTypes = {
|
|
290
|
-
xRange: PropTypes.shape({
|
|
291
|
-
from: PropTypes.number,
|
|
292
|
-
length: PropTypes.number,
|
|
293
|
-
}),
|
|
294
|
-
data: PropTypes.arrayOf(PropTypes.arrayOf(dataElement), PropTypes.arrayOf(dataElement)),
|
|
295
|
-
metadata: PropTypes.arrayOf(metadataElement),
|
|
296
|
-
onStopSelect: PropTypes.func,
|
|
297
|
-
onDrag: PropTypes.func,
|
|
298
|
-
xScaleTickFormat: PropTypes.string,
|
|
299
|
-
scrubbing: PropTypes.bool,
|
|
300
|
-
yAxisLabel: PropTypes.bool,
|
|
301
|
-
isLivePanel: PropTypes.bool,
|
|
302
|
-
displaySecondYAxis: PropTypes.bool,
|
|
303
|
-
displayArrow: PropTypes.bool,
|
|
304
|
-
selectedTheme: PropTypes.shape({
|
|
305
|
-
colors: PropTypes.shape({
|
|
306
|
-
background: PropTypes.string,
|
|
307
|
-
}),
|
|
308
|
-
}),
|
|
309
|
-
};
|
|
310
|
-
//# sourceMappingURL=PlotlyLiveview.js.map
|