@splunk/visualizations 28.3.0 → 28.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Area/Area.d.ts.map +1 -1
- package/Area.config.js +0 -1
- package/Area.config.js.map +2 -2
- package/Area.js +495 -99
- package/Area.js.map +3 -3
- package/Bar/Bar.d.ts.map +1 -1
- package/Bar.config.js +0 -1
- package/Bar.config.js.map +2 -2
- package/Bar.js +505 -99
- package/Bar.js.map +3 -3
- package/Bubble.config.js +0 -1
- package/Bubble.config.js.map +2 -2
- package/Bubble.js +494 -86
- package/Bubble.js.map +3 -3
- package/CHANGELOG.external.md +76 -0
- package/ChoroplethSvg/ChoroplethSvg.d.ts +4 -3
- package/ChoroplethSvg/ChoroplethSvg.d.ts.map +1 -1
- package/ChoroplethSvg.config.js +1 -3
- package/ChoroplethSvg.config.js.map +2 -2
- package/ChoroplethSvg.js +539 -103
- package/ChoroplethSvg.js.map +4 -4
- package/Column/Column.d.ts.map +1 -1
- package/Column.config.js +0 -1
- package/Column.config.js.map +2 -2
- package/Column.js +495 -99
- package/Column.js.map +3 -3
- package/Ellipse.js +528 -104
- package/Ellipse.js.map +4 -4
- package/Events/PureEvents/PureEvents.d.ts.map +1 -1
- package/Events.js +612 -149
- package/Events.js.map +4 -4
- package/FillerGauge/FillerGauge.d.ts.map +1 -1
- package/FillerGauge/PureFillerGauge/FillerGauge.d.ts.map +1 -1
- package/FillerGauge.js +535 -140
- package/FillerGauge.js.map +4 -4
- package/Image/Image.d.ts.map +1 -1
- package/Image.js +564 -108
- package/Image.js.map +4 -4
- package/Line/Line.d.ts.map +1 -1
- package/Line/lineUtils.d.ts.map +1 -1
- package/Line/mockdata/LineData.d.ts +59 -0
- package/Line/mockdata/LineData.d.ts.map +1 -1
- package/Line.config.js +0 -1
- package/Line.config.js.map +2 -2
- package/Line.js +601 -100
- package/Line.js.map +3 -3
- package/LinkGraph/PureLinkGraph/PureLinkGraph.d.ts +5 -0
- package/LinkGraph/PureLinkGraph/PureLinkGraph.d.ts.map +1 -1
- package/LinkGraph/PureLinkGraph/PureLinkGraphUtils.d.ts.map +1 -1
- package/LinkGraph/PureLinkGraph/components/Graph.d.ts +9 -1
- package/LinkGraph/PureLinkGraph/components/Graph.d.ts.map +1 -1
- package/LinkGraph/PureLinkGraph/components/GraphStyles.d.ts.map +1 -1
- package/LinkGraph/PureLinkGraph/components/Node.d.ts +1 -0
- package/LinkGraph/PureLinkGraph/components/Node.d.ts.map +1 -1
- package/LinkGraph/PureLinkGraph/components/Nodes.d.ts +1 -0
- package/LinkGraph/PureLinkGraph/components/Nodes.d.ts.map +1 -1
- package/LinkGraph/PureLinkGraph/measurementUtils.d.ts +16 -0
- package/LinkGraph/PureLinkGraph/measurementUtils.d.ts.map +1 -0
- package/LinkGraph/PureLinkGraph/utils/iconLoader.d.ts.map +1 -1
- package/LinkGraph/config.d.ts.map +1 -1
- package/LinkGraph.config.js +15 -1
- package/LinkGraph.config.js.map +2 -2
- package/LinkGraph.js +1355 -654
- package/LinkGraph.js.map +4 -4
- package/Map/Map.d.ts +2 -2
- package/Map/Map.d.ts.map +1 -1
- package/Map/PureMap/BubbleLayer.d.ts +5 -0
- package/Map/PureMap/BubbleLayer.d.ts.map +1 -1
- package/Map/PureMap/LocalChoroplethLayer.d.ts.map +1 -1
- package/Map/PureMap/PureMap.d.ts.map +1 -1
- package/Map/PureMap/PureMapContainer.d.ts.map +1 -1
- package/Map/PureMap/Tooltip.d.ts.map +1 -1
- package/Map/config.d.ts.map +1 -1
- package/Map.config.js +0 -1
- package/Map.config.js.map +2 -2
- package/Map.js +738 -228
- package/Map.js.map +4 -4
- package/Markdown/Markdown.d.ts.map +1 -1
- package/Markdown.js +548 -95
- package/Markdown.js.map +4 -4
- package/MarkerGauge/MarkerGauge.d.ts +5 -1
- package/MarkerGauge/MarkerGauge.d.ts.map +1 -1
- package/MarkerGauge/PureMarkerGauge/MarkerGauge.d.ts +4 -0
- package/MarkerGauge/PureMarkerGauge/MarkerGauge.d.ts.map +1 -1
- package/MarkerGauge/config.d.ts.map +1 -1
- package/MarkerGauge.config.js +121 -3
- package/MarkerGauge.config.js.map +3 -3
- package/MarkerGauge.js +1318 -142
- package/MarkerGauge.js.map +4 -4
- package/NetworkGraph/NetworkGraph.d.ts +22 -0
- package/NetworkGraph/NetworkGraph.d.ts.map +1 -0
- package/NetworkGraph/PureNetworkGraph/PureNetworkGraph.d.ts +60 -0
- package/NetworkGraph/PureNetworkGraph/PureNetworkGraph.d.ts.map +1 -0
- package/NetworkGraph/PureNetworkGraph/components/Link.d.ts +19 -0
- package/NetworkGraph/PureNetworkGraph/components/Link.d.ts.map +1 -0
- package/NetworkGraph/PureNetworkGraph/components/NetworkGraphSvg.d.ts +29 -0
- package/NetworkGraph/PureNetworkGraph/components/NetworkGraphSvg.d.ts.map +1 -0
- package/NetworkGraph/PureNetworkGraph/components/Node.d.ts +27 -0
- package/NetworkGraph/PureNetworkGraph/components/Node.d.ts.map +1 -0
- package/NetworkGraph/PureNetworkGraph/components/Tooltip.d.ts +12 -0
- package/NetworkGraph/PureNetworkGraph/components/Tooltip.d.ts.map +1 -0
- package/NetworkGraph/PureNetworkGraph/components/ZoomControls.d.ts +13 -0
- package/NetworkGraph/PureNetworkGraph/components/ZoomControls.d.ts.map +1 -0
- package/NetworkGraph/PureNetworkGraph/mockdata/data.d.ts +140 -0
- package/NetworkGraph/PureNetworkGraph/mockdata/data.d.ts.map +1 -0
- package/NetworkGraph/PureNetworkGraph/mockdata/datasource.d.ts +89 -0
- package/NetworkGraph/PureNetworkGraph/mockdata/datasource.d.ts.map +1 -0
- package/NetworkGraph/PureNetworkGraph/utils/forceLayout.d.ts +47 -0
- package/NetworkGraph/PureNetworkGraph/utils/forceLayout.d.ts.map +1 -0
- package/NetworkGraph/PureNetworkGraph/utils/iconLoader.d.ts +78 -0
- package/NetworkGraph/PureNetworkGraph/utils/iconLoader.d.ts.map +1 -0
- package/NetworkGraph/PureNetworkGraph/utils/networkGraphShared.d.ts +111 -0
- package/NetworkGraph/PureNetworkGraph/utils/networkGraphShared.d.ts.map +1 -0
- package/NetworkGraph/PureNetworkGraph/utils/networkGraphUtils.d.ts +123 -0
- package/NetworkGraph/PureNetworkGraph/utils/networkGraphUtils.d.ts.map +1 -0
- package/NetworkGraph/config.d.ts +4 -0
- package/NetworkGraph/config.d.ts.map +1 -0
- package/NetworkGraph/index.d.ts +3 -0
- package/NetworkGraph/index.d.ts.map +1 -0
- package/NetworkGraph.config.js +938 -0
- package/NetworkGraph.config.js.map +7 -0
- package/NetworkGraph.js +6793 -0
- package/NetworkGraph.js.map +7 -0
- package/ParallelCoordinates.js +532 -93
- package/ParallelCoordinates.js.map +4 -4
- package/Pie/Pie.d.ts.map +1 -1
- package/Pie/pieUtils.d.ts.map +1 -1
- package/Pie.js +510 -101
- package/Pie.js.map +3 -3
- package/Punchcard.js +523 -84
- package/Punchcard.js.map +4 -4
- package/Rectangle.js +537 -113
- package/Rectangle.js.map +4 -4
- package/Sankey/PureSankey/SankeyTooltip.d.ts.map +1 -1
- package/Sankey.js +562 -111
- package/Sankey.js.map +4 -4
- package/Scatter/Scatter.d.ts.map +1 -1
- package/Scatter.config.js +0 -1
- package/Scatter.config.js.map +2 -2
- package/Scatter.js +505 -99
- package/Scatter.js.map +3 -3
- package/SingleValue/SingleValue.d.ts.map +1 -1
- package/SingleValue/config.d.ts.map +1 -1
- package/SingleValue.config.js +15 -2
- package/SingleValue.config.js.map +2 -2
- package/SingleValue.js +656 -173
- package/SingleValue.js.map +3 -3
- package/SingleValueBasic.js.map +1 -1
- package/SingleValueIcon/SingleValueIcon.d.ts.map +1 -1
- package/SingleValueIcon/config.d.ts.map +1 -1
- package/SingleValueIcon.config.js +0 -1
- package/SingleValueIcon.config.js.map +2 -2
- package/SingleValueIcon.js +512 -124
- package/SingleValueIcon.js.map +3 -3
- package/SingleValueRadial/PureSingleValueRadial/utils/gaugeUtils.d.ts +0 -8
- package/SingleValueRadial/PureSingleValueRadial/utils/gaugeUtils.d.ts.map +1 -1
- package/SingleValueRadial/SingleValueRadial.d.ts.map +1 -1
- package/SingleValueRadial.config.js +0 -1
- package/SingleValueRadial.config.js.map +2 -2
- package/SingleValueRadial.js +517 -124
- package/SingleValueRadial.js.map +4 -4
- package/SparkLine.js +46 -8
- package/SparkLine.js.map +2 -2
- package/Table/PureTable.d.ts +10 -0
- package/Table/PureTable.d.ts.map +1 -1
- package/Table/cells/SparklineCell.d.ts.map +1 -1
- package/Table/config.d.ts.map +1 -1
- package/Table/hooks.d.ts +4 -0
- package/Table/hooks.d.ts.map +1 -1
- package/Table.config.js +1 -1
- package/Table.config.js.map +2 -2
- package/Table.js +760 -223
- package/Table.js.map +4 -4
- package/Timeline/PureTimeline/src/CursorPlugin.d.ts.map +1 -1
- package/Timeline/PureTimeline/src/TimelineLegend.d.ts.map +1 -1
- package/Timeline/config.d.ts.map +1 -1
- package/Timeline.config.js +31 -12
- package/Timeline.config.js.map +4 -4
- package/Timeline.js +649 -211
- package/Timeline.js.map +4 -4
- package/common/Charting.d.ts +5 -0
- package/common/Charting.d.ts.map +1 -1
- package/common/Charting.js +12 -0
- package/common/Charting.js.map +2 -2
- package/common/OptionsDoc.js.map +1 -1
- package/common/ThemesDoc.js +0 -1
- package/common/ThemesDoc.js.map +2 -2
- package/common/TimeSeriesChartWrapper.d.ts +24 -11
- package/common/TimeSeriesChartWrapper.d.ts.map +1 -1
- package/common/TimeSeriesChartWrapper.js +561 -83
- package/common/TimeSeriesChartWrapper.js.map +4 -4
- package/common/chartingUtils.d.ts +45 -5
- package/common/chartingUtils.d.ts.map +1 -1
- package/common/chartingUtils.js +102 -8
- package/common/chartingUtils.js.map +3 -3
- package/common/editorConfig/AxesChartDataConfig.d.ts.map +1 -1
- package/common/hocs/withTrellis.d.ts.map +1 -1
- package/common/interfaces/DashboardVizProps.d.ts +0 -3
- package/common/interfaces/DashboardVizProps.d.ts.map +1 -1
- package/common/interfaces/DataSource.d.ts +1 -1
- package/common/interfaces/DataSource.d.ts.map +1 -1
- package/common/shapeUtils.js +5 -20
- package/common/shapeUtils.js.map +2 -2
- package/common/utils/dataUtils.d.ts.map +1 -1
- package/common/utils/dataUtils.js +5 -4
- package/common/utils/dataUtils.js.map +2 -2
- package/common/utils/mapUtils.js +16 -9
- package/common/utils/mapUtils.js.map +2 -2
- package/common/utils/singleValueUtils.js +17 -18
- package/common/utils/singleValueUtils.js.map +2 -2
- package/common/utils/textUtils.d.ts +20 -0
- package/common/utils/textUtils.d.ts.map +1 -0
- package/common/utils/textUtils.js +76 -0
- package/common/utils/textUtils.js.map +7 -0
- package/common/utils/trellisUtils.d.ts.map +1 -1
- package/common/utils/trellisUtils.js +12 -14
- package/common/utils/trellisUtils.js.map +2 -2
- package/common/withDashboardViz.d.ts.map +1 -1
- package/common/withDashboardViz.js +544 -84
- package/common/withDashboardViz.js.map +4 -4
- package/package.json +33 -26
- package/common/utils/styleUtils.d.ts +0 -2
- package/common/utils/styleUtils.d.ts.map +0 -1
- package/common/utils/styleUtils.js +0 -30
- package/common/utils/styleUtils.js.map +0 -7
|
@@ -25,6 +25,18 @@ var __spreadValues = (a, b) => {
|
|
|
25
25
|
return a;
|
|
26
26
|
};
|
|
27
27
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
28
|
+
var __objRest = (source, exclude) => {
|
|
29
|
+
var target = {};
|
|
30
|
+
for (var prop in source)
|
|
31
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
32
|
+
target[prop] = source[prop];
|
|
33
|
+
if (source != null && __getOwnPropSymbols)
|
|
34
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
35
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
36
|
+
target[prop] = source[prop];
|
|
37
|
+
}
|
|
38
|
+
return target;
|
|
39
|
+
};
|
|
28
40
|
var __export = (target, all) => {
|
|
29
41
|
for (var name in all)
|
|
30
42
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -51,10 +63,15 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
51
63
|
// src/common/TimeSeriesChartWrapper.tsx
|
|
52
64
|
var TimeSeriesChartWrapper_exports = {};
|
|
53
65
|
__export(TimeSeriesChartWrapper_exports, {
|
|
66
|
+
appendTrellisToPayload: () => appendTrellisToPayload,
|
|
54
67
|
default: () => TimeSeriesChartWrapper_default,
|
|
55
68
|
handleClick: () => handleClick,
|
|
56
69
|
handleCrosshairChange: () => handleCrosshairChange,
|
|
57
|
-
handleLegendClick: () => handleLegendClick
|
|
70
|
+
handleLegendClick: () => handleLegendClick,
|
|
71
|
+
handleRangeSelection: () => handleRangeSelection,
|
|
72
|
+
handleRangeZoom: () => handleRangeZoom,
|
|
73
|
+
hasMouseoverPayloadChanged: () => hasMouseoverPayloadChanged,
|
|
74
|
+
parseArrayOption: () => parseArrayOption
|
|
58
75
|
});
|
|
59
76
|
module.exports = __toCommonJS(TimeSeriesChartWrapper_exports);
|
|
60
77
|
|
|
@@ -172,6 +189,16 @@ var triangleEventAnnotationRenderer = ({
|
|
|
172
189
|
eventColor: eventWithColor.color
|
|
173
190
|
});
|
|
174
191
|
};
|
|
192
|
+
var shouldEnableSearchZoom = (eventHandlers = [], xField = "") => {
|
|
193
|
+
const rangeSelectEventHandler = eventHandlers.find(
|
|
194
|
+
(eventHandler) => {
|
|
195
|
+
var _a;
|
|
196
|
+
return (_a = eventHandler.options.events) == null ? void 0 : _a.includes("range.select");
|
|
197
|
+
}
|
|
198
|
+
);
|
|
199
|
+
const xAxisIsTime = xField === "_time";
|
|
200
|
+
return !!rangeSelectEventHandler && xAxisIsTime;
|
|
201
|
+
};
|
|
175
202
|
var filterChartDataFromInternalFields = (chartData) => {
|
|
176
203
|
const { fields, columns } = chartData;
|
|
177
204
|
const keepIndexes = fields.reduce((acc, field, index) => {
|
|
@@ -188,16 +215,31 @@ var filterChartDataFromInternalFields = (chartData) => {
|
|
|
188
215
|
var convert2DArrayToNumbers = (arr) => {
|
|
189
216
|
return arr.map((subArray) => subArray.map((element) => parseFloat(element)));
|
|
190
217
|
};
|
|
218
|
+
var parseAxisValue = (val) => {
|
|
219
|
+
if (val === void 0 || val === null || val === "auto" || val === "") {
|
|
220
|
+
return void 0;
|
|
221
|
+
}
|
|
222
|
+
const num = typeof val === "number" ? val : Number.parseFloat(val);
|
|
223
|
+
return Number.isNaN(num) ? void 0 : num;
|
|
224
|
+
};
|
|
191
225
|
var SideLegendWidth = 75;
|
|
192
|
-
var
|
|
226
|
+
var SeriesCompareLegendWidth = 200;
|
|
193
227
|
var getLegend = (props) => {
|
|
194
228
|
const legendPlacement = props == null ? void 0 : props.legendDisplay;
|
|
229
|
+
const { isSeriesCompare } = props;
|
|
230
|
+
const commonLegendProps = {
|
|
231
|
+
center: true,
|
|
232
|
+
fontSize: 12,
|
|
233
|
+
largerTiles: true,
|
|
234
|
+
hideSeriesValue: !isSeriesCompare
|
|
235
|
+
// Show values if in seriesCompare mode
|
|
236
|
+
};
|
|
195
237
|
switch (legendPlacement) {
|
|
196
238
|
case "off":
|
|
197
239
|
return false;
|
|
198
240
|
case "left":
|
|
199
241
|
return (0, visualization_canvas_exports.LeftLegendFactory)(__spreadValues({
|
|
200
|
-
width: SideLegendWidth
|
|
242
|
+
width: isSeriesCompare ? SeriesCompareLegendWidth : SideLegendWidth
|
|
201
243
|
}, commonLegendProps));
|
|
202
244
|
case "bottom":
|
|
203
245
|
return (0, visualization_canvas_exports.BottomLegendFactory)(__spreadValues({
|
|
@@ -209,7 +251,7 @@ var getLegend = (props) => {
|
|
|
209
251
|
}, commonLegendProps));
|
|
210
252
|
default:
|
|
211
253
|
return (0, visualization_canvas_exports.SideLegendFactory)(__spreadValues({
|
|
212
|
-
width: SideLegendWidth
|
|
254
|
+
width: isSeriesCompare ? SeriesCompareLegendWidth : SideLegendWidth
|
|
213
255
|
}, commonLegendProps));
|
|
214
256
|
}
|
|
215
257
|
};
|
|
@@ -252,15 +294,18 @@ var getFieldName = (field) => {
|
|
|
252
294
|
var getFieldNames = (fields) => {
|
|
253
295
|
return fields.map((field) => getFieldName(field));
|
|
254
296
|
};
|
|
255
|
-
var getXScaleConfig = (label, xAxisLabelVisibility) => {
|
|
297
|
+
var getXScaleConfig = (label, xAxisLabelVisibility, xAxisLabelRotation) => {
|
|
256
298
|
const xConfig = { x: {} };
|
|
257
299
|
xConfig.x.label = label;
|
|
258
300
|
if (xAxisLabelVisibility === "hide") {
|
|
259
301
|
xConfig.x.hideLabels = true;
|
|
260
302
|
}
|
|
303
|
+
if (xAxisLabelRotation !== void 0) {
|
|
304
|
+
xConfig.x.labelRotation = xAxisLabelRotation;
|
|
305
|
+
}
|
|
261
306
|
return xConfig;
|
|
262
307
|
};
|
|
263
|
-
var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility) => {
|
|
308
|
+
var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility, yAxisMin, yAxisMax) => {
|
|
264
309
|
const scaleType = yAxisScale != null ? yAxisScale : "linear";
|
|
265
310
|
const yConfig = { y: {} };
|
|
266
311
|
yConfig.y.label = label;
|
|
@@ -276,14 +321,20 @@ var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibilit
|
|
|
276
321
|
if (yAxisLabelVisibility === "hide") {
|
|
277
322
|
yConfig.y.hideLabels = true;
|
|
278
323
|
}
|
|
324
|
+
if (yAxisMin !== void 0 || yAxisMax !== void 0) {
|
|
325
|
+
yConfig.y.range = (u, dataMin, dataMax) => {
|
|
326
|
+
const min = yAxisMin != null ? yAxisMin : dataMin;
|
|
327
|
+
const max = yAxisMax != null ? yAxisMax : dataMax;
|
|
328
|
+
return [min, max];
|
|
329
|
+
};
|
|
330
|
+
}
|
|
279
331
|
return yConfig;
|
|
280
332
|
};
|
|
281
|
-
var getY2ScaleConfig = (label, axisAbbreviation, axisScale, roundAxisLabelsToInteger, y2AxisLabelVisibility) => {
|
|
333
|
+
var getY2ScaleConfig = (label, axisAbbreviation, axisScale, roundAxisLabelsToInteger, y2AxisLabelVisibility, y2AxisMin, y2AxisMax) => {
|
|
282
334
|
const y2Config = { y2: {} };
|
|
283
335
|
const scaleType = axisScale != null ? axisScale : "linear";
|
|
284
336
|
y2Config.y2.label = label;
|
|
285
337
|
y2Config.y2.side = "right";
|
|
286
|
-
y2Config.y2.showGrid = false;
|
|
287
338
|
y2Config.y2.type = scaleType;
|
|
288
339
|
if (axisAbbreviation !== "none") {
|
|
289
340
|
y2Config.y2.tickFmt = (v) => (0, visualization_canvas_exports.shortenNumber)(v, 1, roundAxisLabelsToInteger);
|
|
@@ -293,9 +344,16 @@ var getY2ScaleConfig = (label, axisAbbreviation, axisScale, roundAxisLabelsToInt
|
|
|
293
344
|
if (y2AxisLabelVisibility === "hide") {
|
|
294
345
|
y2Config.y2.hideLabels = true;
|
|
295
346
|
}
|
|
347
|
+
if (y2AxisMin !== void 0 || y2AxisMax !== void 0) {
|
|
348
|
+
y2Config.y2.range = (u, dataMin, dataMax) => {
|
|
349
|
+
const min = y2AxisMin != null ? y2AxisMin : dataMin;
|
|
350
|
+
const max = y2AxisMax != null ? y2AxisMax : dataMax;
|
|
351
|
+
return [min, max];
|
|
352
|
+
};
|
|
353
|
+
}
|
|
296
354
|
return y2Config;
|
|
297
355
|
};
|
|
298
|
-
var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled, nullValueMode, markerDisplay) => {
|
|
356
|
+
var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled, nullValueMode, markerDisplay, lineDashStyle, lineDashStylesByField) => {
|
|
299
357
|
const seriesConfig = {};
|
|
300
358
|
let spanGaps;
|
|
301
359
|
let replaceNullsWithZero;
|
|
@@ -330,12 +388,105 @@ var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled
|
|
|
330
388
|
if (markerDisplay !== void 0) {
|
|
331
389
|
seriesConfig[field].markerDisplay = markerDisplay;
|
|
332
390
|
}
|
|
391
|
+
const fieldDashStyle = (lineDashStylesByField == null ? void 0 : lineDashStylesByField[field]) || lineDashStyle;
|
|
392
|
+
if (fieldDashStyle) {
|
|
393
|
+
seriesConfig[field].lineDashStyle = fieldDashStyle;
|
|
394
|
+
}
|
|
333
395
|
if (replaceNullsWithZero !== void 0) {
|
|
334
396
|
seriesConfig[field].replaceNullsWithZero = replaceNullsWithZero;
|
|
335
397
|
}
|
|
336
398
|
});
|
|
337
399
|
return seriesConfig;
|
|
338
400
|
};
|
|
401
|
+
var findRangeIndices = (xData, startValue, endValue) => {
|
|
402
|
+
let startXIndex = -1;
|
|
403
|
+
let endXIndex = -1;
|
|
404
|
+
const xDataEpoch = xData.map((val) => {
|
|
405
|
+
if (typeof val === "string") {
|
|
406
|
+
return new Date(val).getTime() / 1e3;
|
|
407
|
+
}
|
|
408
|
+
return val;
|
|
409
|
+
});
|
|
410
|
+
for (let i = 0; i < xDataEpoch.length; i += 1) {
|
|
411
|
+
if (xDataEpoch[i] >= startValue) {
|
|
412
|
+
startXIndex = i;
|
|
413
|
+
break;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
if (startXIndex === -1 && xDataEpoch.length > 0) {
|
|
417
|
+
startXIndex = xDataEpoch.length - 1;
|
|
418
|
+
}
|
|
419
|
+
for (let i = xDataEpoch.length - 1; i >= 0; i -= 1) {
|
|
420
|
+
if (xDataEpoch[i] <= endValue) {
|
|
421
|
+
endXIndex = i;
|
|
422
|
+
break;
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
if (endXIndex === -1 && xDataEpoch.length > 0) {
|
|
426
|
+
endXIndex = 0;
|
|
427
|
+
}
|
|
428
|
+
return { startXIndex, endXIndex };
|
|
429
|
+
};
|
|
430
|
+
|
|
431
|
+
// esm-externals:@splunk/visualization-context/FeatureFlagContext
|
|
432
|
+
var FeatureFlagContext_exports = {};
|
|
433
|
+
__export(FeatureFlagContext_exports, {
|
|
434
|
+
default: () => FeatureFlagContext_default
|
|
435
|
+
});
|
|
436
|
+
var defaultImport9 = __toESM(require("@splunk/visualization-context/FeatureFlagContext"));
|
|
437
|
+
__reExport(FeatureFlagContext_exports, require("@splunk/visualization-context/FeatureFlagContext"));
|
|
438
|
+
var FeatureFlagContext_default = "default" in defaultImport9 ? defaultImport9.default : defaultImport9;
|
|
439
|
+
|
|
440
|
+
// esm-externals:@splunk/visualization-schemas
|
|
441
|
+
var visualization_schemas_exports = {};
|
|
442
|
+
__export(visualization_schemas_exports, {
|
|
443
|
+
default: () => visualization_schemas_default
|
|
444
|
+
});
|
|
445
|
+
var defaultImport10 = __toESM(require("@splunk/visualization-schemas"));
|
|
446
|
+
__reExport(visualization_schemas_exports, require("@splunk/visualization-schemas"));
|
|
447
|
+
var visualization_schemas_default = "default" in defaultImport10 ? defaultImport10.default : defaultImport10;
|
|
448
|
+
|
|
449
|
+
// src/common/hooks/useTrellisEnabled.ts
|
|
450
|
+
var useTrellisFeatureFlagOn = () => {
|
|
451
|
+
const context = (0, react_exports.useContext)(FeatureFlagContext_default);
|
|
452
|
+
return Boolean(context == null ? void 0 : context.visualizations_enableTrellis);
|
|
453
|
+
};
|
|
454
|
+
var useTrellisEnabled = (layoutType = visualization_schemas_exports.LAYOUT_TYPE.Off) => {
|
|
455
|
+
const trellisFeatureEnabled = useTrellisFeatureFlagOn();
|
|
456
|
+
return trellisFeatureEnabled && layoutType === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
|
|
457
|
+
};
|
|
458
|
+
|
|
459
|
+
// src/common/components/TrellisTitle.tsx
|
|
460
|
+
var TRELLIS_TITLE_HEIGHT = 28;
|
|
461
|
+
var TrellisTitleText = styled_components_default.div`
|
|
462
|
+
margin-left: 10px;
|
|
463
|
+
margin-right: 10px;
|
|
464
|
+
padding-top: 8px;
|
|
465
|
+
text-overflow: ellipsis;
|
|
466
|
+
white-space: nowrap;
|
|
467
|
+
overflow: hidden;
|
|
468
|
+
`;
|
|
469
|
+
var TrellisTitleDiv = styled_components_default.div`
|
|
470
|
+
height: ${TRELLIS_TITLE_HEIGHT}px;
|
|
471
|
+
font-size: 14px;
|
|
472
|
+
font-weight: 700;
|
|
473
|
+
color: ${(props) => props.fontColor};
|
|
474
|
+
background-color: ${(props) => props.backgroundColor};
|
|
475
|
+
box-shadow: 0 1px ${(props) => props.backgroundColor}; // this is added to avoid a 1px gap between title and viz divs that showed up intermittently because of pixel rounding error in chrome.
|
|
476
|
+
`;
|
|
477
|
+
var TrellisTitle = (props) => {
|
|
478
|
+
const titleText = String(props.trellisKey).toString();
|
|
479
|
+
return /* @__PURE__ */ react_exports.createElement(
|
|
480
|
+
TrellisTitleDiv,
|
|
481
|
+
{
|
|
482
|
+
fontColor: props.fontColor,
|
|
483
|
+
backgroundColor: props.backgroundColor,
|
|
484
|
+
"data-test": "trellis-title",
|
|
485
|
+
title: titleText
|
|
486
|
+
},
|
|
487
|
+
/* @__PURE__ */ react_exports.createElement(TrellisTitleText, null, titleText)
|
|
488
|
+
);
|
|
489
|
+
};
|
|
339
490
|
|
|
340
491
|
// src/common/TimeSeriesChartWrapper.tsx
|
|
341
492
|
var TimeSeriesChartContainer = styled_components_default.div`
|
|
@@ -346,37 +497,112 @@ var TimeSeriesChartContainer = styled_components_default.div`
|
|
|
346
497
|
position: absolute !important; // This is needed for canvas element export pdf/png to work correctly
|
|
347
498
|
}
|
|
348
499
|
`;
|
|
349
|
-
var
|
|
500
|
+
var appendTrellisToPayload = (payload, trellisKey, trellisSplitBy) => {
|
|
501
|
+
const result = __spreadValues({}, payload);
|
|
502
|
+
if (trellisSplitBy) {
|
|
503
|
+
result["trellis.name"] = trellisSplitBy;
|
|
504
|
+
}
|
|
505
|
+
if (trellisKey) {
|
|
506
|
+
result["trellis.value"] = trellisKey;
|
|
507
|
+
}
|
|
508
|
+
return result;
|
|
509
|
+
};
|
|
510
|
+
var hasMouseoverPayloadChanged = (currentPayload, previousPayload) => {
|
|
511
|
+
if (!previousPayload) {
|
|
512
|
+
return true;
|
|
513
|
+
}
|
|
514
|
+
if (currentPayload.index !== previousPayload.index) {
|
|
515
|
+
return true;
|
|
516
|
+
}
|
|
517
|
+
if (currentPayload.seriesIndex !== previousPayload.seriesIndex) {
|
|
518
|
+
return true;
|
|
519
|
+
}
|
|
520
|
+
if (currentPayload["trellis.name"] !== previousPayload["trellis.name"]) {
|
|
521
|
+
return true;
|
|
522
|
+
}
|
|
523
|
+
if (currentPayload["trellis.value"] !== previousPayload["trellis.value"]) {
|
|
524
|
+
return true;
|
|
525
|
+
}
|
|
526
|
+
return false;
|
|
527
|
+
};
|
|
528
|
+
var handleClick = (chartEvent, onClick, trellisKey, trellisSplitBy) => {
|
|
350
529
|
const payload = __spreadProps(__spreadValues({}, (0, lodash_exports.pick)(chartEvent, "value", "seriesKey")), {
|
|
351
530
|
name: chartEvent.seriesKey
|
|
352
531
|
});
|
|
353
532
|
delete payload.seriesKey;
|
|
354
533
|
if (chartEvent.rowContext) {
|
|
355
|
-
Object.
|
|
356
|
-
payload
|
|
357
|
-
|
|
534
|
+
Object.assign(
|
|
535
|
+
payload,
|
|
536
|
+
Object.keys(chartEvent.rowContext).reduce((acc, fieldName) => {
|
|
537
|
+
acc[`row.${fieldName}.value`] = chartEvent.rowContext[fieldName];
|
|
538
|
+
return acc;
|
|
539
|
+
}, {})
|
|
540
|
+
);
|
|
358
541
|
}
|
|
542
|
+
const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
|
|
359
543
|
if (onClick) {
|
|
360
544
|
onClick({
|
|
361
545
|
type: "point.click",
|
|
362
546
|
originalEvent: chartEvent,
|
|
363
|
-
payload
|
|
547
|
+
payload: updatedPayload
|
|
364
548
|
});
|
|
365
549
|
}
|
|
366
550
|
};
|
|
367
|
-
var handleLegendClick = (chartEvent, onClick) => {
|
|
551
|
+
var handleLegendClick = (chartEvent, onClick, trellisKey, trellisSplitBy) => {
|
|
368
552
|
const payload = {
|
|
369
553
|
name: chartEvent
|
|
370
554
|
};
|
|
555
|
+
const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
|
|
371
556
|
if (onClick) {
|
|
372
557
|
onClick({
|
|
373
558
|
type: "legend.click",
|
|
374
559
|
originalEvent: chartEvent,
|
|
375
|
-
payload
|
|
560
|
+
payload: updatedPayload
|
|
561
|
+
});
|
|
562
|
+
}
|
|
563
|
+
};
|
|
564
|
+
var handleRangeSelection = (rangeEvent, onSelect, chartData, trellisKey, trellisSplitBy) => {
|
|
565
|
+
var _a;
|
|
566
|
+
if (!rangeEvent) {
|
|
567
|
+
return;
|
|
568
|
+
}
|
|
569
|
+
const xData = ((_a = chartData == null ? void 0 : chartData.columns) == null ? void 0 : _a[0]) || [];
|
|
570
|
+
const { startXIndex, endXIndex } = findRangeIndices(xData, rangeEvent.start, rangeEvent.end);
|
|
571
|
+
const payload = {
|
|
572
|
+
startXIndex,
|
|
573
|
+
startXValue: rangeEvent.start,
|
|
574
|
+
endXIndex,
|
|
575
|
+
endXValue: rangeEvent.end
|
|
576
|
+
};
|
|
577
|
+
const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
|
|
578
|
+
if (onSelect) {
|
|
579
|
+
onSelect({
|
|
580
|
+
type: "range.selectBeforeZoom",
|
|
581
|
+
originalEvent: rangeEvent,
|
|
582
|
+
payload: updatedPayload
|
|
376
583
|
});
|
|
377
584
|
}
|
|
378
585
|
};
|
|
379
|
-
var
|
|
586
|
+
var handleRangeZoom = (rangeEvent, onSelect, chartData, trellisKey, trellisSplitBy) => {
|
|
587
|
+
var _a;
|
|
588
|
+
const xData = ((_a = chartData == null ? void 0 : chartData.columns) == null ? void 0 : _a[0]) || [];
|
|
589
|
+
const { startXIndex, endXIndex } = findRangeIndices(xData, rangeEvent.start, rangeEvent.end);
|
|
590
|
+
const payload = {
|
|
591
|
+
startXIndex,
|
|
592
|
+
startXValue: rangeEvent.start,
|
|
593
|
+
endXIndex,
|
|
594
|
+
endXValue: rangeEvent.end
|
|
595
|
+
};
|
|
596
|
+
const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
|
|
597
|
+
if (onSelect) {
|
|
598
|
+
onSelect({
|
|
599
|
+
type: "range.select",
|
|
600
|
+
originalEvent: rangeEvent,
|
|
601
|
+
payload: updatedPayload
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
};
|
|
605
|
+
var handleCrosshairChange = (chartEvent, onPointMouseOver, onPointMouseOut, trellisKey, trellisSplitBy, lastPayload = null, lastOriginalEvent = null) => {
|
|
380
606
|
if (!chartEvent) {
|
|
381
607
|
if (onPointMouseOut && lastPayload) {
|
|
382
608
|
onPointMouseOut({
|
|
@@ -392,21 +618,36 @@ var handleCrosshairChange = (chartEvent, onPointMouseOver, onPointMouseOut, last
|
|
|
392
618
|
});
|
|
393
619
|
delete payload.seriesKey;
|
|
394
620
|
if (chartEvent.rowContext) {
|
|
395
|
-
Object.
|
|
396
|
-
payload
|
|
397
|
-
|
|
621
|
+
Object.assign(
|
|
622
|
+
payload,
|
|
623
|
+
Object.keys(chartEvent.rowContext).reduce((acc, fieldName) => {
|
|
624
|
+
acc[`row.${fieldName}.value`] = chartEvent.rowContext[fieldName];
|
|
625
|
+
return acc;
|
|
626
|
+
}, {})
|
|
627
|
+
);
|
|
398
628
|
}
|
|
629
|
+
const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
|
|
399
630
|
if (onPointMouseOver) {
|
|
400
631
|
onPointMouseOver({
|
|
401
632
|
type: "point.mouseover",
|
|
402
633
|
originalEvent: chartEvent,
|
|
403
|
-
payload
|
|
634
|
+
payload: updatedPayload
|
|
404
635
|
});
|
|
405
636
|
}
|
|
406
|
-
return { payload, originalEvent: chartEvent };
|
|
637
|
+
return { payload: updatedPayload, originalEvent: chartEvent };
|
|
638
|
+
};
|
|
639
|
+
var parseArrayOption = (value) => {
|
|
640
|
+
if (Array.isArray(value)) {
|
|
641
|
+
return value;
|
|
642
|
+
}
|
|
643
|
+
if (value) {
|
|
644
|
+
return JSON.parse(value);
|
|
645
|
+
}
|
|
646
|
+
return void 0;
|
|
407
647
|
};
|
|
408
648
|
var TimeSeriesChartWrapper = (props) => {
|
|
409
|
-
|
|
649
|
+
var _b, _c, _d;
|
|
650
|
+
const _a = props, {
|
|
410
651
|
width,
|
|
411
652
|
height,
|
|
412
653
|
chartData,
|
|
@@ -419,12 +660,49 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
419
660
|
markerDisplay,
|
|
420
661
|
onClick,
|
|
421
662
|
onPointMouseOver,
|
|
422
|
-
onPointMouseOut
|
|
423
|
-
|
|
424
|
-
|
|
663
|
+
onPointMouseOut,
|
|
664
|
+
onSelect,
|
|
665
|
+
splitByLayout,
|
|
666
|
+
trellisKey,
|
|
667
|
+
trellisSplitBy,
|
|
425
668
|
backgroundColor,
|
|
669
|
+
defaultFontColor,
|
|
670
|
+
additionalTooltipValues,
|
|
671
|
+
showYAxisWithZero: showYAxisWithZeroFromProps,
|
|
672
|
+
showY2AxisWithZero: showY2AxisWithZeroFromProps
|
|
673
|
+
} = _a, otherOptions = __objRest(_a, [
|
|
674
|
+
"width",
|
|
675
|
+
"height",
|
|
676
|
+
"chartData",
|
|
677
|
+
"options",
|
|
678
|
+
"userLocale",
|
|
679
|
+
"annotationX",
|
|
680
|
+
"annotationLabel",
|
|
681
|
+
"annotationColor",
|
|
682
|
+
"legendDisplay",
|
|
683
|
+
"markerDisplay",
|
|
684
|
+
"onClick",
|
|
685
|
+
"onPointMouseOver",
|
|
686
|
+
"onPointMouseOut",
|
|
687
|
+
"onSelect",
|
|
688
|
+
"splitByLayout",
|
|
689
|
+
"trellisKey",
|
|
690
|
+
"trellisSplitBy",
|
|
691
|
+
"backgroundColor",
|
|
692
|
+
"defaultFontColor",
|
|
693
|
+
"additionalTooltipValues",
|
|
694
|
+
// Extract showYAxisWithZero directly from props for accelerated render mode
|
|
695
|
+
"showYAxisWithZero",
|
|
696
|
+
"showY2AxisWithZero"
|
|
697
|
+
]);
|
|
698
|
+
const { eventHandlers, xField: xFieldFromProps } = otherOptions;
|
|
699
|
+
const trellisEnabled = useTrellisEnabled(splitByLayout);
|
|
700
|
+
const {
|
|
701
|
+
backgroundColor: bgColorFromOptions,
|
|
426
702
|
seriesColors: seriesColorsStr,
|
|
427
703
|
fieldColors,
|
|
704
|
+
legendLabels: legendLabelsStr,
|
|
705
|
+
legendMode,
|
|
428
706
|
"axisTitleX.text": xAxisTitleText,
|
|
429
707
|
"axisTitleY.text": yAxisTitleText,
|
|
430
708
|
"axisTitleY2.text": y2AxisTitleText,
|
|
@@ -432,8 +710,11 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
432
710
|
"axisTitleY.visibility": yAxisTitleVisibility,
|
|
433
711
|
"axisTitleY2.visibility": y2AxisTitleVisibility,
|
|
434
712
|
"axisLabelsX.majorLabelVisibility": xAxisLabelVisibility,
|
|
713
|
+
"axisLabelsX.majorLabelStyle.rotation": xAxisLabelRotation,
|
|
435
714
|
"axisLabelsY.majorLabelVisibility": yAxisLabelVisibility,
|
|
715
|
+
"axisLabelsY.majorUnit": yAxisMajorUnitFromSimpleXML,
|
|
436
716
|
"axisLabelsY2.majorLabelVisibility": y2AxisLabelVisibility,
|
|
717
|
+
"axisLabelsY2.majorUnit": y2AxisMajorUnitFromSimpleXML,
|
|
437
718
|
"axisY.abbreviation": yAxisAbbreviation,
|
|
438
719
|
"axisY.scale": yAxisScale,
|
|
439
720
|
"axisY2.abbreviation": y2AxisAbbreviation,
|
|
@@ -443,10 +724,63 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
443
724
|
"axisLabelsY2.integerUnits": y2IntegerUnits,
|
|
444
725
|
"chart.overlayFields": overlayFieldsStr,
|
|
445
726
|
"chart.nullValueMode": nullValueMode,
|
|
446
|
-
|
|
727
|
+
"chart.showDataLabels": showDataLabels,
|
|
728
|
+
lineWidth,
|
|
729
|
+
lineDashStyle,
|
|
730
|
+
fieldDashStyles: lineDashStylesByFieldStr,
|
|
731
|
+
yAxisMin: yAxisMinRaw,
|
|
732
|
+
yAxisMax: yAxisMaxRaw,
|
|
733
|
+
y2AxisMin: y2AxisMinRaw,
|
|
734
|
+
y2AxisMax: y2AxisMaxRaw,
|
|
735
|
+
showXMajorGridLines,
|
|
736
|
+
showYMajorGridLines,
|
|
737
|
+
showY2MajorGridLines,
|
|
738
|
+
showYMinorGridLines,
|
|
739
|
+
showY2MinorGridLines,
|
|
740
|
+
showLineSmoothing,
|
|
741
|
+
yAxisMajorTickVisibility,
|
|
742
|
+
y2AxisMajorTickVisibility,
|
|
743
|
+
yAxisMajorTickSize,
|
|
744
|
+
y2AxisMajorTickSize,
|
|
745
|
+
yAxisMajorTickInterval,
|
|
746
|
+
y2AxisMajorTickInterval,
|
|
747
|
+
yAxisMinorTickVisibility,
|
|
748
|
+
y2AxisMinorTickVisibility,
|
|
749
|
+
yAxisMinorTickSize,
|
|
750
|
+
y2AxisMinorTickSize,
|
|
751
|
+
showYAxisWithZero: showYAxisWithZeroFromOptions,
|
|
752
|
+
showY2AxisWithZero: showY2AxisWithZeroFromOptions
|
|
447
753
|
} = options;
|
|
754
|
+
const dataValuesDisplay = showDataLabels === "none" ? "off" : showDataLabels;
|
|
755
|
+
const showYAxisWithZero = showYAxisWithZeroFromProps != null ? showYAxisWithZeroFromProps : showYAxisWithZeroFromOptions;
|
|
756
|
+
const showY2AxisWithZero = showY2AxisWithZeroFromProps != null ? showY2AxisWithZeroFromProps : showY2AxisWithZeroFromOptions;
|
|
757
|
+
const showYMajorTicks = yAxisMajorTickVisibility === "show";
|
|
758
|
+
const showY2MajorTicks = y2AxisMajorTickVisibility === "show";
|
|
759
|
+
const showYMinorTicks = yAxisMinorTickVisibility === "show";
|
|
760
|
+
const showY2MinorTicks = y2AxisMinorTickVisibility === "show";
|
|
761
|
+
const yAxisMin = parseAxisValue(yAxisMinRaw);
|
|
762
|
+
const yAxisMax = parseAxisValue(yAxisMaxRaw);
|
|
763
|
+
const y2AxisMin = parseAxisValue(y2AxisMinRaw);
|
|
764
|
+
const y2AxisMax = parseAxisValue(y2AxisMaxRaw);
|
|
765
|
+
const parseTickInterval = (simpleXMLValue, canvasValue) => {
|
|
766
|
+
if (simpleXMLValue) return Number(simpleXMLValue);
|
|
767
|
+
if (canvasValue) return Number(canvasValue);
|
|
768
|
+
return void 0;
|
|
769
|
+
};
|
|
770
|
+
const yAxisMajorTickIntervalNum = parseTickInterval(yAxisMajorUnitFromSimpleXML, yAxisMajorTickInterval);
|
|
771
|
+
const y2AxisMajorTickIntervalNum = parseTickInterval(
|
|
772
|
+
y2AxisMajorUnitFromSimpleXML,
|
|
773
|
+
y2AxisMajorTickInterval
|
|
774
|
+
);
|
|
775
|
+
const yAxisMajorTickSizeNum = yAxisMajorTickSize ? Number(yAxisMajorTickSize) : void 0;
|
|
776
|
+
const y2AxisMajorTickSizeNum = y2AxisMajorTickSize ? Number(y2AxisMajorTickSize) : void 0;
|
|
777
|
+
const yAxisMinorTickSizeNum = yAxisMinorTickSize ? Number(yAxisMinorTickSize) : void 0;
|
|
778
|
+
const y2AxisMinorTickSizeNum = y2AxisMinorTickSize ? Number(y2AxisMinorTickSize) : void 0;
|
|
448
779
|
const seriesColors = seriesColorsStr ? JSON.parse(seriesColorsStr) : void 0;
|
|
449
780
|
const seriesColorsByField = fieldColors ? JSON.parse(fieldColors) : void 0;
|
|
781
|
+
const lineDashStylesByField = lineDashStylesByFieldStr ? JSON.parse(lineDashStylesByFieldStr) : void 0;
|
|
782
|
+
const legendLabels = parseArrayOption(legendLabelsStr);
|
|
783
|
+
const bgColor = backgroundColor || bgColorFromOptions;
|
|
450
784
|
const [containerWidth, setContainerWidth] = react_exports.useState(Number(props.width));
|
|
451
785
|
const [containerHeight, setContainerHeight] = react_exports.useState(Number(props.height));
|
|
452
786
|
const cachedHandleResize = react_exports.useCallback((w, h) => {
|
|
@@ -461,27 +795,60 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
461
795
|
const yFields = getFieldNames(
|
|
462
796
|
filteredChartData.fields.length > 1 ? filteredChartData.fields.slice(1) : []
|
|
463
797
|
);
|
|
464
|
-
const y2Fields =
|
|
465
|
-
|
|
798
|
+
const y2Fields = (0, react_exports.useMemo)(
|
|
799
|
+
() => y2FieldsStr ? y2FieldsStr.split(",").map((f) => f.trim()) : [],
|
|
800
|
+
[y2FieldsStr]
|
|
801
|
+
);
|
|
802
|
+
const overlayFields = (0, react_exports.useMemo)(
|
|
803
|
+
() => overlayFieldsStr ? overlayFieldsStr.split(",").map((f) => f.trim()) : [],
|
|
804
|
+
[overlayFieldsStr]
|
|
805
|
+
);
|
|
466
806
|
let xAxisTitle = getComputedAxisTitles(xAxisTitleText, [xField], xAxisTitleVisibility);
|
|
467
807
|
xAxisTitle = ellipsisAxisTitle(xAxisTitle, containerWidth);
|
|
468
|
-
|
|
808
|
+
const yFieldsForTitle = y2Enabled ? yFields.filter((field) => !y2Fields.includes(field)) : yFields;
|
|
809
|
+
let yAxisTitle = getComputedAxisTitles(yAxisTitleText, yFieldsForTitle, yAxisTitleVisibility);
|
|
469
810
|
yAxisTitle = ellipsisAxisTitle(yAxisTitle, containerHeight);
|
|
470
811
|
const fieldsForY2Axis = y2Fields.length > 0 ? y2Fields : overlayFields;
|
|
471
812
|
let y2AxisTitle = getComputedAxisTitles(y2AxisTitleText, fieldsForY2Axis, y2AxisTitleVisibility);
|
|
472
813
|
y2AxisTitle = ellipsisAxisTitle(y2AxisTitle, containerHeight);
|
|
473
|
-
const xScaleConfig =
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
814
|
+
const xScaleConfig = (0, react_exports.useMemo)(
|
|
815
|
+
() => getXScaleConfig(xAxisTitle, xAxisLabelVisibility, xAxisLabelRotation),
|
|
816
|
+
[xAxisTitle, xAxisLabelVisibility, xAxisLabelRotation]
|
|
817
|
+
);
|
|
818
|
+
const yScaleConfig = (0, react_exports.useMemo)(
|
|
819
|
+
() => getYScaleConfig(
|
|
820
|
+
yAxisTitle,
|
|
821
|
+
yAxisAbbreviation,
|
|
822
|
+
yAxisScale,
|
|
823
|
+
yAxisLabelVisibility,
|
|
824
|
+
yAxisMin,
|
|
825
|
+
yAxisMax
|
|
826
|
+
),
|
|
827
|
+
[yAxisTitle, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility, yAxisMin, yAxisMax]
|
|
828
|
+
);
|
|
829
|
+
const y2ScaleConfig = (0, react_exports.useMemo)(() => {
|
|
830
|
+
if (y2Enabled) {
|
|
831
|
+
return getY2ScaleConfig(
|
|
832
|
+
y2AxisTitle,
|
|
833
|
+
y2AxisAbbreviation,
|
|
834
|
+
y2AxisScale,
|
|
835
|
+
y2IntegerUnits,
|
|
836
|
+
y2AxisLabelVisibility,
|
|
837
|
+
y2AxisMin,
|
|
838
|
+
y2AxisMax
|
|
839
|
+
);
|
|
840
|
+
}
|
|
841
|
+
return {};
|
|
842
|
+
}, [
|
|
843
|
+
y2Enabled,
|
|
844
|
+
y2AxisTitle,
|
|
845
|
+
y2AxisAbbreviation,
|
|
846
|
+
y2AxisScale,
|
|
847
|
+
y2IntegerUnits,
|
|
848
|
+
y2AxisLabelVisibility,
|
|
849
|
+
y2AxisMin,
|
|
850
|
+
y2AxisMax
|
|
851
|
+
]);
|
|
485
852
|
const uplotContainerElement = (0, react_exports.useRef)(null);
|
|
486
853
|
const seriesDataFormatted = [
|
|
487
854
|
filteredChartData.columns[0],
|
|
@@ -497,9 +864,21 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
497
864
|
overlayFields,
|
|
498
865
|
y2Enabled,
|
|
499
866
|
nullValueMode,
|
|
500
|
-
markerDisplay
|
|
867
|
+
markerDisplay,
|
|
868
|
+
lineDashStyle,
|
|
869
|
+
lineDashStylesByField
|
|
501
870
|
),
|
|
502
|
-
[
|
|
871
|
+
[
|
|
872
|
+
yFields,
|
|
873
|
+
y2Fields,
|
|
874
|
+
lineWidth,
|
|
875
|
+
overlayFields,
|
|
876
|
+
y2Enabled,
|
|
877
|
+
nullValueMode,
|
|
878
|
+
markerDisplay,
|
|
879
|
+
lineDashStyle,
|
|
880
|
+
lineDashStylesByField
|
|
881
|
+
]
|
|
503
882
|
);
|
|
504
883
|
const chartingEventAnnotations = (0, react_exports.useMemo)(
|
|
505
884
|
() => getAnnotationsForCanvas({
|
|
@@ -513,25 +892,54 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
513
892
|
() => __spreadValues(__spreadValues(__spreadValues({}, xScaleConfig), yScaleConfig), y2ScaleConfig),
|
|
514
893
|
[xScaleConfig, yScaleConfig, y2ScaleConfig]
|
|
515
894
|
);
|
|
516
|
-
const legend = (0, react_exports.useMemo)(
|
|
895
|
+
const legend = (0, react_exports.useMemo)(
|
|
896
|
+
() => getLegend({ legendDisplay, isSeriesCompare: legendMode === "seriesCompare" }),
|
|
897
|
+
[legendDisplay, legendMode]
|
|
898
|
+
);
|
|
517
899
|
const handleChartClick = react_exports.useCallback(
|
|
518
900
|
(event) => {
|
|
519
901
|
if (onClick) {
|
|
520
|
-
handleClick(event, onClick);
|
|
902
|
+
handleClick(event, onClick, trellisKey, trellisSplitBy);
|
|
521
903
|
}
|
|
522
904
|
},
|
|
523
|
-
[onClick]
|
|
905
|
+
[onClick, trellisKey, trellisSplitBy]
|
|
524
906
|
);
|
|
525
907
|
const handleChartLegendClick = react_exports.useCallback(
|
|
526
908
|
(event) => {
|
|
527
909
|
if (onClick) {
|
|
528
|
-
handleLegendClick(event, onClick);
|
|
910
|
+
handleLegendClick(event, onClick, trellisKey, trellisSplitBy);
|
|
911
|
+
}
|
|
912
|
+
},
|
|
913
|
+
[onClick, trellisKey, trellisSplitBy]
|
|
914
|
+
);
|
|
915
|
+
const handleChartRangeSelection = react_exports.useCallback(
|
|
916
|
+
(range) => {
|
|
917
|
+
if (onSelect) {
|
|
918
|
+
handleRangeSelection(range, onSelect, chartData, trellisKey, trellisSplitBy);
|
|
529
919
|
}
|
|
530
920
|
},
|
|
531
|
-
[
|
|
921
|
+
[onSelect, chartData, trellisKey, trellisSplitBy]
|
|
922
|
+
);
|
|
923
|
+
const handleChartRangeZoom = react_exports.useCallback(
|
|
924
|
+
(range) => {
|
|
925
|
+
if (onSelect) {
|
|
926
|
+
handleRangeZoom(range, onSelect, chartData, trellisKey, trellisSplitBy);
|
|
927
|
+
}
|
|
928
|
+
},
|
|
929
|
+
[onSelect, chartData, trellisKey, trellisSplitBy]
|
|
930
|
+
);
|
|
931
|
+
const xFieldToUse = xFieldFromProps || xField;
|
|
932
|
+
const enableSearchZoom = react_exports.useMemo(
|
|
933
|
+
() => shouldEnableSearchZoom(eventHandlers, xFieldToUse),
|
|
934
|
+
[eventHandlers, xFieldToUse]
|
|
532
935
|
);
|
|
533
936
|
const lastPayloadRef = react_exports.useRef(null);
|
|
534
937
|
const lastOriginalEventRef = react_exports.useRef(null);
|
|
938
|
+
const previousMouseoverPayloadRef = react_exports.useRef(null);
|
|
939
|
+
const additionalTooltipValuesRef = react_exports.useRef(additionalTooltipValues);
|
|
940
|
+
react_exports.useEffect(() => {
|
|
941
|
+
additionalTooltipValuesRef.current = additionalTooltipValues;
|
|
942
|
+
}, [additionalTooltipValues]);
|
|
535
943
|
const handleChartCrosshairChange = react_exports.useCallback(
|
|
536
944
|
(event) => {
|
|
537
945
|
if (onPointMouseOver || onPointMouseOut) {
|
|
@@ -543,6 +951,7 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
543
951
|
payload: lastPayloadRef.current
|
|
544
952
|
});
|
|
545
953
|
}
|
|
954
|
+
previousMouseoverPayloadRef.current = null;
|
|
546
955
|
return;
|
|
547
956
|
}
|
|
548
957
|
const payload = __spreadProps(__spreadValues({}, (0, lodash_exports.pick)(event, "value", "seriesKey", "time", "index", "seriesIndex")), {
|
|
@@ -550,25 +959,36 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
550
959
|
});
|
|
551
960
|
delete payload.seriesKey;
|
|
552
961
|
if (event.rowContext) {
|
|
553
|
-
Object.
|
|
554
|
-
payload
|
|
555
|
-
|
|
962
|
+
Object.assign(
|
|
963
|
+
payload,
|
|
964
|
+
Object.keys(event.rowContext).reduce((acc, fieldName) => {
|
|
965
|
+
acc[`row.${fieldName}.value`] = event.rowContext[fieldName];
|
|
966
|
+
return acc;
|
|
967
|
+
}, {})
|
|
968
|
+
);
|
|
556
969
|
}
|
|
557
|
-
|
|
970
|
+
const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
|
|
971
|
+
if (!hasMouseoverPayloadChanged(updatedPayload, previousMouseoverPayloadRef.current)) {
|
|
972
|
+
return;
|
|
973
|
+
}
|
|
974
|
+
lastPayloadRef.current = updatedPayload;
|
|
558
975
|
lastOriginalEventRef.current = event;
|
|
976
|
+
previousMouseoverPayloadRef.current = __spreadValues({}, updatedPayload);
|
|
559
977
|
if (onPointMouseOver) {
|
|
560
978
|
onPointMouseOver({
|
|
561
979
|
type: "point.mouseover",
|
|
562
980
|
originalEvent: event,
|
|
563
|
-
payload
|
|
981
|
+
payload: updatedPayload
|
|
564
982
|
});
|
|
565
983
|
}
|
|
566
984
|
}
|
|
567
985
|
},
|
|
568
|
-
[onPointMouseOver, onPointMouseOut]
|
|
986
|
+
[onPointMouseOver, onPointMouseOut, trellisKey, trellisSplitBy]
|
|
569
987
|
);
|
|
570
|
-
const
|
|
571
|
-
|
|
988
|
+
const dataKey = `${(_b = chartData.columns[0]) == null ? void 0 : _b[0]}-${(_c = chartData.columns[0]) == null ? void 0 : _c[chartData.columns[0].length - 1]}-${(_d = chartData.columns[0]) == null ? void 0 : _d.length}`;
|
|
989
|
+
const memoizedChart = (0, react_exports.useMemo)(() => {
|
|
990
|
+
const computedOnRangeZoom = onSelect ? handleChartRangeZoom : void 0;
|
|
991
|
+
return /* @__PURE__ */ react_exports.createElement(visualization_canvas_exports.RangeSelectionProvider, { key: dataKey }, /* @__PURE__ */ react_exports.createElement(
|
|
572
992
|
visualization_canvas_exports.TimeSeriesChart,
|
|
573
993
|
{
|
|
574
994
|
data: chartData,
|
|
@@ -578,49 +998,107 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
578
998
|
seriesColorsByField,
|
|
579
999
|
seriesConfig: seriesOverrides,
|
|
580
1000
|
legend,
|
|
1001
|
+
legendLabels,
|
|
1002
|
+
isSeriesCompare: legendMode === "seriesCompare",
|
|
1003
|
+
maxSeriesFocus: legendMode === "seriesCompare" ? 0 : void 0,
|
|
581
1004
|
scaleConfig,
|
|
582
1005
|
timestampFormat: "expanded",
|
|
583
1006
|
onCrosshairClick: onClick ? handleChartClick : void 0,
|
|
584
1007
|
onCrosshairChange: onPointMouseOver || onPointMouseOut ? handleChartCrosshairChange : void 0,
|
|
585
1008
|
onSeriesClick: onClick ? handleChartLegendClick : void 0,
|
|
1009
|
+
onRangeSelection: handleChartRangeSelection,
|
|
1010
|
+
onRangeZoom: computedOnRangeZoom,
|
|
1011
|
+
serverSideZoom: enableSearchZoom,
|
|
586
1012
|
userLocale,
|
|
587
1013
|
events: chartingEventAnnotations,
|
|
588
|
-
eventsConfig: { renderer: triangleEventAnnotationRenderer }
|
|
1014
|
+
eventsConfig: { renderer: triangleEventAnnotationRenderer },
|
|
1015
|
+
additionalTooltipValuesRef,
|
|
1016
|
+
showXMajorGridLines,
|
|
1017
|
+
showYMajorGridLines,
|
|
1018
|
+
showY2MajorGridLines,
|
|
1019
|
+
showYMinorGridLines,
|
|
1020
|
+
showY2MinorGridLines,
|
|
1021
|
+
showLineSmoothing,
|
|
1022
|
+
dataValuesDisplay,
|
|
1023
|
+
showYMajorTicks,
|
|
1024
|
+
showY2MajorTicks,
|
|
1025
|
+
yAxisMajorTickSize: yAxisMajorTickSizeNum,
|
|
1026
|
+
y2AxisMajorTickSize: y2AxisMajorTickSizeNum,
|
|
1027
|
+
yAxisMajorTickInterval: yAxisMajorTickIntervalNum,
|
|
1028
|
+
y2AxisMajorTickInterval: y2AxisMajorTickIntervalNum,
|
|
1029
|
+
showYMinorTicks,
|
|
1030
|
+
showY2MinorTicks,
|
|
1031
|
+
yAxisMinorTickSize: yAxisMinorTickSizeNum,
|
|
1032
|
+
y2AxisMinorTickSize: y2AxisMinorTickSizeNum,
|
|
1033
|
+
showYAxisWithZero,
|
|
1034
|
+
showY2AxisWithZero
|
|
589
1035
|
}
|
|
590
|
-
)
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
1036
|
+
));
|
|
1037
|
+
}, [
|
|
1038
|
+
onSelect,
|
|
1039
|
+
handleChartRangeZoom,
|
|
1040
|
+
dataKey,
|
|
1041
|
+
chartData,
|
|
1042
|
+
containerWidth,
|
|
1043
|
+
containerHeight,
|
|
1044
|
+
seriesColors,
|
|
1045
|
+
seriesColorsByField,
|
|
1046
|
+
seriesOverrides,
|
|
1047
|
+
legend,
|
|
1048
|
+
legendLabels,
|
|
1049
|
+
scaleConfig,
|
|
1050
|
+
onClick,
|
|
1051
|
+
handleChartClick,
|
|
1052
|
+
onPointMouseOver,
|
|
1053
|
+
onPointMouseOut,
|
|
1054
|
+
handleChartCrosshairChange,
|
|
1055
|
+
handleChartLegendClick,
|
|
1056
|
+
handleChartRangeSelection,
|
|
1057
|
+
enableSearchZoom,
|
|
1058
|
+
userLocale,
|
|
1059
|
+
chartingEventAnnotations,
|
|
1060
|
+
showXMajorGridLines,
|
|
1061
|
+
showYMajorGridLines,
|
|
1062
|
+
showY2MajorGridLines,
|
|
1063
|
+
showYMinorGridLines,
|
|
1064
|
+
showY2MinorGridLines,
|
|
1065
|
+
showLineSmoothing,
|
|
1066
|
+
dataValuesDisplay,
|
|
1067
|
+
showYMajorTicks,
|
|
1068
|
+
showY2MajorTicks,
|
|
1069
|
+
yAxisMajorTickSizeNum,
|
|
1070
|
+
y2AxisMajorTickSizeNum,
|
|
1071
|
+
yAxisMajorTickIntervalNum,
|
|
1072
|
+
y2AxisMajorTickIntervalNum,
|
|
1073
|
+
showYMinorTicks,
|
|
1074
|
+
showY2MinorTicks,
|
|
1075
|
+
yAxisMinorTickSizeNum,
|
|
1076
|
+
y2AxisMinorTickSizeNum,
|
|
1077
|
+
showYAxisWithZero,
|
|
1078
|
+
showY2AxisWithZero,
|
|
1079
|
+
legendMode
|
|
1080
|
+
]);
|
|
610
1081
|
const memoizedVisualization = (0, react_exports.useMemo)(() => {
|
|
611
|
-
return /* @__PURE__ */ react_exports.createElement(VizStyleWrapper_default, { backgroundColor }, memoizedChart);
|
|
612
|
-
}, [
|
|
613
|
-
return /* @__PURE__ */ react_exports.createElement(
|
|
1082
|
+
return /* @__PURE__ */ react_exports.createElement(VizStyleWrapper_default, { backgroundColor: bgColor }, memoizedChart);
|
|
1083
|
+
}, [bgColor, memoizedChart]);
|
|
1084
|
+
return /* @__PURE__ */ react_exports.createElement(react_exports.Fragment, null, trellisEnabled && /* @__PURE__ */ react_exports.createElement(
|
|
1085
|
+
TrellisTitle,
|
|
1086
|
+
{
|
|
1087
|
+
trellisKey,
|
|
1088
|
+
backgroundColor: bgColor,
|
|
1089
|
+
fontColor: defaultFontColor
|
|
1090
|
+
}
|
|
1091
|
+
), /* @__PURE__ */ react_exports.createElement(
|
|
614
1092
|
TimeSeriesChartContainer,
|
|
615
1093
|
{
|
|
616
|
-
height,
|
|
1094
|
+
height: trellisEnabled ? Number(height) - TRELLIS_TITLE_HEIGHT : height,
|
|
617
1095
|
width,
|
|
618
1096
|
ref: uplotContainerElement,
|
|
619
1097
|
"data-test": "timeseries-chart-wrapper"
|
|
620
1098
|
},
|
|
621
1099
|
/* @__PURE__ */ react_exports.createElement(SizeAwareWrapper_default, { width, height, onResize: cachedHandleResize }),
|
|
622
1100
|
memoizedVisualization
|
|
623
|
-
);
|
|
1101
|
+
));
|
|
624
1102
|
};
|
|
625
1103
|
var TimeSeriesChartWrapper_default = TimeSeriesChartWrapper;
|
|
626
1104
|
//# sourceMappingURL=TimeSeriesChartWrapper.js.map
|