@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 });
|
|
@@ -462,7 +474,7 @@ var Cover = styled_components_default.div`
|
|
|
462
474
|
bottom: 0;
|
|
463
475
|
`;
|
|
464
476
|
var Blocker = styled_components_default.div.attrs({
|
|
465
|
-
"data-splunk-visualization-version": "28.
|
|
477
|
+
"data-splunk-visualization-version": "28.4.0 - 002bd482f"
|
|
466
478
|
})`
|
|
467
479
|
position: relative;
|
|
468
480
|
width: 100%;
|
|
@@ -561,7 +573,7 @@ var withFixedSizeContainer = (Viz) => {
|
|
|
561
573
|
FixSizeItem,
|
|
562
574
|
{
|
|
563
575
|
"data-test": "fix-size-item",
|
|
564
|
-
"data-splunk-visualization-version": "28.
|
|
576
|
+
"data-splunk-visualization-version": "28.4.0 - 002bd482f",
|
|
565
577
|
width,
|
|
566
578
|
height,
|
|
567
579
|
backgroundColor
|
|
@@ -657,6 +669,7 @@ __reExport(numberUtils_exports, require("@splunk/visualizations-shared/numberUti
|
|
|
657
669
|
var numberUtils_default = "default" in defaultImport21 ? defaultImport21.default : defaultImport21;
|
|
658
670
|
|
|
659
671
|
// src/common/utils/dataUtils.ts
|
|
672
|
+
var getFieldName = (field) => typeof field === "string" ? field : field.name;
|
|
660
673
|
var largestTriangleThreeBuckets = (data, threshold, preferredDownsampleIndices) => {
|
|
661
674
|
const dataLength = data.length;
|
|
662
675
|
const downsampledIndices = [];
|
|
@@ -773,9 +786,9 @@ var tryToCoerceAllDisplayedFields = (ds, xField, yFields, fieldTypes, options) =
|
|
|
773
786
|
let xColumn = [];
|
|
774
787
|
const yColumns = [];
|
|
775
788
|
const canDownsample = !ds.data.fields.some((field, index) => {
|
|
776
|
-
var _a
|
|
777
|
-
const fieldName = (
|
|
778
|
-
const fieldType = (
|
|
789
|
+
var _a;
|
|
790
|
+
const fieldName = getFieldName(field);
|
|
791
|
+
const fieldType = (_a = fieldTypes[index]) != null ? _a : "unknown";
|
|
779
792
|
const column = ds.data.columns[index];
|
|
780
793
|
let hasDisplayedColumnThatCantBeDownsampled = false;
|
|
781
794
|
if (fieldName === xField) {
|
|
@@ -1128,6 +1141,16 @@ var triangleEventAnnotationRenderer = ({
|
|
|
1128
1141
|
eventColor: eventWithColor.color
|
|
1129
1142
|
});
|
|
1130
1143
|
};
|
|
1144
|
+
var shouldEnableSearchZoom = (eventHandlers = [], xField = "") => {
|
|
1145
|
+
const rangeSelectEventHandler = eventHandlers.find(
|
|
1146
|
+
(eventHandler) => {
|
|
1147
|
+
var _a;
|
|
1148
|
+
return (_a = eventHandler.options.events) == null ? void 0 : _a.includes("range.select");
|
|
1149
|
+
}
|
|
1150
|
+
);
|
|
1151
|
+
const xAxisIsTime = xField === "_time";
|
|
1152
|
+
return !!rangeSelectEventHandler && xAxisIsTime;
|
|
1153
|
+
};
|
|
1131
1154
|
var canvasSupportedTimeSeriesCharts = ["splunk.line"];
|
|
1132
1155
|
var isTimeSeriesCanvasRenderSupported = (vizConfigKey) => {
|
|
1133
1156
|
return canvasSupportedTimeSeriesCharts.indexOf(vizConfigKey) > -1;
|
|
@@ -1148,16 +1171,31 @@ var filterChartDataFromInternalFields = (chartData) => {
|
|
|
1148
1171
|
var convert2DArrayToNumbers = (arr) => {
|
|
1149
1172
|
return arr.map((subArray) => subArray.map((element) => parseFloat(element)));
|
|
1150
1173
|
};
|
|
1174
|
+
var parseAxisValue = (val) => {
|
|
1175
|
+
if (val === void 0 || val === null || val === "auto" || val === "") {
|
|
1176
|
+
return void 0;
|
|
1177
|
+
}
|
|
1178
|
+
const num = typeof val === "number" ? val : Number.parseFloat(val);
|
|
1179
|
+
return Number.isNaN(num) ? void 0 : num;
|
|
1180
|
+
};
|
|
1151
1181
|
var SideLegendWidth = 75;
|
|
1152
|
-
var
|
|
1182
|
+
var SeriesCompareLegendWidth = 200;
|
|
1153
1183
|
var getLegend = (props) => {
|
|
1154
1184
|
const legendPlacement = props == null ? void 0 : props.legendDisplay;
|
|
1185
|
+
const { isSeriesCompare } = props;
|
|
1186
|
+
const commonLegendProps = {
|
|
1187
|
+
center: true,
|
|
1188
|
+
fontSize: 12,
|
|
1189
|
+
largerTiles: true,
|
|
1190
|
+
hideSeriesValue: !isSeriesCompare
|
|
1191
|
+
// Show values if in seriesCompare mode
|
|
1192
|
+
};
|
|
1155
1193
|
switch (legendPlacement) {
|
|
1156
1194
|
case "off":
|
|
1157
1195
|
return false;
|
|
1158
1196
|
case "left":
|
|
1159
1197
|
return (0, visualization_canvas_exports.LeftLegendFactory)(__spreadValues({
|
|
1160
|
-
width: SideLegendWidth
|
|
1198
|
+
width: isSeriesCompare ? SeriesCompareLegendWidth : SideLegendWidth
|
|
1161
1199
|
}, commonLegendProps));
|
|
1162
1200
|
case "bottom":
|
|
1163
1201
|
return (0, visualization_canvas_exports.BottomLegendFactory)(__spreadValues({
|
|
@@ -1169,7 +1207,7 @@ var getLegend = (props) => {
|
|
|
1169
1207
|
}, commonLegendProps));
|
|
1170
1208
|
default:
|
|
1171
1209
|
return (0, visualization_canvas_exports.SideLegendFactory)(__spreadValues({
|
|
1172
|
-
width: SideLegendWidth
|
|
1210
|
+
width: isSeriesCompare ? SeriesCompareLegendWidth : SideLegendWidth
|
|
1173
1211
|
}, commonLegendProps));
|
|
1174
1212
|
}
|
|
1175
1213
|
};
|
|
@@ -1205,22 +1243,25 @@ var ellipsisAxisTitle = (axisTitle, containerSpacing, fontSize = 12) => {
|
|
|
1205
1243
|
const end = axisTitle.slice(-halfChars);
|
|
1206
1244
|
return `${start}...${end}`;
|
|
1207
1245
|
};
|
|
1208
|
-
var
|
|
1246
|
+
var getFieldName2 = (field) => {
|
|
1209
1247
|
const fieldName = typeof field === "object" ? field == null ? void 0 : field.name : field;
|
|
1210
1248
|
return fieldName;
|
|
1211
1249
|
};
|
|
1212
1250
|
var getFieldNames = (fields) => {
|
|
1213
|
-
return fields.map((field) =>
|
|
1251
|
+
return fields.map((field) => getFieldName2(field));
|
|
1214
1252
|
};
|
|
1215
|
-
var getXScaleConfig = (label, xAxisLabelVisibility) => {
|
|
1253
|
+
var getXScaleConfig = (label, xAxisLabelVisibility, xAxisLabelRotation) => {
|
|
1216
1254
|
const xConfig = { x: {} };
|
|
1217
1255
|
xConfig.x.label = label;
|
|
1218
1256
|
if (xAxisLabelVisibility === "hide") {
|
|
1219
1257
|
xConfig.x.hideLabels = true;
|
|
1220
1258
|
}
|
|
1259
|
+
if (xAxisLabelRotation !== void 0) {
|
|
1260
|
+
xConfig.x.labelRotation = xAxisLabelRotation;
|
|
1261
|
+
}
|
|
1221
1262
|
return xConfig;
|
|
1222
1263
|
};
|
|
1223
|
-
var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility) => {
|
|
1264
|
+
var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility, yAxisMin, yAxisMax) => {
|
|
1224
1265
|
const scaleType = yAxisScale != null ? yAxisScale : "linear";
|
|
1225
1266
|
const yConfig = { y: {} };
|
|
1226
1267
|
yConfig.y.label = label;
|
|
@@ -1236,14 +1277,20 @@ var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibilit
|
|
|
1236
1277
|
if (yAxisLabelVisibility === "hide") {
|
|
1237
1278
|
yConfig.y.hideLabels = true;
|
|
1238
1279
|
}
|
|
1280
|
+
if (yAxisMin !== void 0 || yAxisMax !== void 0) {
|
|
1281
|
+
yConfig.y.range = (u, dataMin, dataMax) => {
|
|
1282
|
+
const min = yAxisMin != null ? yAxisMin : dataMin;
|
|
1283
|
+
const max = yAxisMax != null ? yAxisMax : dataMax;
|
|
1284
|
+
return [min, max];
|
|
1285
|
+
};
|
|
1286
|
+
}
|
|
1239
1287
|
return yConfig;
|
|
1240
1288
|
};
|
|
1241
|
-
var getY2ScaleConfig = (label, axisAbbreviation, axisScale, roundAxisLabelsToInteger, y2AxisLabelVisibility) => {
|
|
1289
|
+
var getY2ScaleConfig = (label, axisAbbreviation, axisScale, roundAxisLabelsToInteger, y2AxisLabelVisibility, y2AxisMin, y2AxisMax) => {
|
|
1242
1290
|
const y2Config = { y2: {} };
|
|
1243
1291
|
const scaleType = axisScale != null ? axisScale : "linear";
|
|
1244
1292
|
y2Config.y2.label = label;
|
|
1245
1293
|
y2Config.y2.side = "right";
|
|
1246
|
-
y2Config.y2.showGrid = false;
|
|
1247
1294
|
y2Config.y2.type = scaleType;
|
|
1248
1295
|
if (axisAbbreviation !== "none") {
|
|
1249
1296
|
y2Config.y2.tickFmt = (v) => (0, visualization_canvas_exports.shortenNumber)(v, 1, roundAxisLabelsToInteger);
|
|
@@ -1253,9 +1300,16 @@ var getY2ScaleConfig = (label, axisAbbreviation, axisScale, roundAxisLabelsToInt
|
|
|
1253
1300
|
if (y2AxisLabelVisibility === "hide") {
|
|
1254
1301
|
y2Config.y2.hideLabels = true;
|
|
1255
1302
|
}
|
|
1303
|
+
if (y2AxisMin !== void 0 || y2AxisMax !== void 0) {
|
|
1304
|
+
y2Config.y2.range = (u, dataMin, dataMax) => {
|
|
1305
|
+
const min = y2AxisMin != null ? y2AxisMin : dataMin;
|
|
1306
|
+
const max = y2AxisMax != null ? y2AxisMax : dataMax;
|
|
1307
|
+
return [min, max];
|
|
1308
|
+
};
|
|
1309
|
+
}
|
|
1256
1310
|
return y2Config;
|
|
1257
1311
|
};
|
|
1258
|
-
var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled, nullValueMode, markerDisplay) => {
|
|
1312
|
+
var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled, nullValueMode, markerDisplay, lineDashStyle, lineDashStylesByField) => {
|
|
1259
1313
|
const seriesConfig = {};
|
|
1260
1314
|
let spanGaps;
|
|
1261
1315
|
let replaceNullsWithZero;
|
|
@@ -1290,12 +1344,96 @@ var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled
|
|
|
1290
1344
|
if (markerDisplay !== void 0) {
|
|
1291
1345
|
seriesConfig[field].markerDisplay = markerDisplay;
|
|
1292
1346
|
}
|
|
1347
|
+
const fieldDashStyle = (lineDashStylesByField == null ? void 0 : lineDashStylesByField[field]) || lineDashStyle;
|
|
1348
|
+
if (fieldDashStyle) {
|
|
1349
|
+
seriesConfig[field].lineDashStyle = fieldDashStyle;
|
|
1350
|
+
}
|
|
1293
1351
|
if (replaceNullsWithZero !== void 0) {
|
|
1294
1352
|
seriesConfig[field].replaceNullsWithZero = replaceNullsWithZero;
|
|
1295
1353
|
}
|
|
1296
1354
|
});
|
|
1297
1355
|
return seriesConfig;
|
|
1298
1356
|
};
|
|
1357
|
+
var findRangeIndices = (xData, startValue, endValue) => {
|
|
1358
|
+
let startXIndex = -1;
|
|
1359
|
+
let endXIndex = -1;
|
|
1360
|
+
const xDataEpoch = xData.map((val) => {
|
|
1361
|
+
if (typeof val === "string") {
|
|
1362
|
+
return new Date(val).getTime() / 1e3;
|
|
1363
|
+
}
|
|
1364
|
+
return val;
|
|
1365
|
+
});
|
|
1366
|
+
for (let i = 0; i < xDataEpoch.length; i += 1) {
|
|
1367
|
+
if (xDataEpoch[i] >= startValue) {
|
|
1368
|
+
startXIndex = i;
|
|
1369
|
+
break;
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1372
|
+
if (startXIndex === -1 && xDataEpoch.length > 0) {
|
|
1373
|
+
startXIndex = xDataEpoch.length - 1;
|
|
1374
|
+
}
|
|
1375
|
+
for (let i = xDataEpoch.length - 1; i >= 0; i -= 1) {
|
|
1376
|
+
if (xDataEpoch[i] <= endValue) {
|
|
1377
|
+
endXIndex = i;
|
|
1378
|
+
break;
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
if (endXIndex === -1 && xDataEpoch.length > 0) {
|
|
1382
|
+
endXIndex = 0;
|
|
1383
|
+
}
|
|
1384
|
+
return { startXIndex, endXIndex };
|
|
1385
|
+
};
|
|
1386
|
+
|
|
1387
|
+
// esm-externals:@splunk/visualization-schemas
|
|
1388
|
+
var visualization_schemas_exports = {};
|
|
1389
|
+
__export(visualization_schemas_exports, {
|
|
1390
|
+
default: () => visualization_schemas_default
|
|
1391
|
+
});
|
|
1392
|
+
var defaultImport26 = __toESM(require("@splunk/visualization-schemas"));
|
|
1393
|
+
__reExport(visualization_schemas_exports, require("@splunk/visualization-schemas"));
|
|
1394
|
+
var visualization_schemas_default = "default" in defaultImport26 ? defaultImport26.default : defaultImport26;
|
|
1395
|
+
|
|
1396
|
+
// src/common/hooks/useTrellisEnabled.ts
|
|
1397
|
+
var useTrellisFeatureFlagOn = () => {
|
|
1398
|
+
const context = (0, react_exports.useContext)(FeatureFlagContext_default);
|
|
1399
|
+
return Boolean(context == null ? void 0 : context.visualizations_enableTrellis);
|
|
1400
|
+
};
|
|
1401
|
+
var useTrellisEnabled = (layoutType = visualization_schemas_exports.LAYOUT_TYPE.Off) => {
|
|
1402
|
+
const trellisFeatureEnabled = useTrellisFeatureFlagOn();
|
|
1403
|
+
return trellisFeatureEnabled && layoutType === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
|
|
1404
|
+
};
|
|
1405
|
+
|
|
1406
|
+
// src/common/components/TrellisTitle.tsx
|
|
1407
|
+
var TRELLIS_TITLE_HEIGHT = 28;
|
|
1408
|
+
var TrellisTitleText = styled_components_default.div`
|
|
1409
|
+
margin-left: 10px;
|
|
1410
|
+
margin-right: 10px;
|
|
1411
|
+
padding-top: 8px;
|
|
1412
|
+
text-overflow: ellipsis;
|
|
1413
|
+
white-space: nowrap;
|
|
1414
|
+
overflow: hidden;
|
|
1415
|
+
`;
|
|
1416
|
+
var TrellisTitleDiv = styled_components_default.div`
|
|
1417
|
+
height: ${TRELLIS_TITLE_HEIGHT}px;
|
|
1418
|
+
font-size: 14px;
|
|
1419
|
+
font-weight: 700;
|
|
1420
|
+
color: ${(props) => props.fontColor};
|
|
1421
|
+
background-color: ${(props) => props.backgroundColor};
|
|
1422
|
+
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.
|
|
1423
|
+
`;
|
|
1424
|
+
var TrellisTitle = (props) => {
|
|
1425
|
+
const titleText = String(props.trellisKey).toString();
|
|
1426
|
+
return /* @__PURE__ */ react_exports.createElement(
|
|
1427
|
+
TrellisTitleDiv,
|
|
1428
|
+
{
|
|
1429
|
+
fontColor: props.fontColor,
|
|
1430
|
+
backgroundColor: props.backgroundColor,
|
|
1431
|
+
"data-test": "trellis-title",
|
|
1432
|
+
title: titleText
|
|
1433
|
+
},
|
|
1434
|
+
/* @__PURE__ */ react_exports.createElement(TrellisTitleText, null, titleText)
|
|
1435
|
+
);
|
|
1436
|
+
};
|
|
1299
1437
|
|
|
1300
1438
|
// src/common/TimeSeriesChartWrapper.tsx
|
|
1301
1439
|
var TimeSeriesChartContainer = styled_components_default.div`
|
|
@@ -1306,38 +1444,123 @@ var TimeSeriesChartContainer = styled_components_default.div`
|
|
|
1306
1444
|
position: absolute !important; // This is needed for canvas element export pdf/png to work correctly
|
|
1307
1445
|
}
|
|
1308
1446
|
`;
|
|
1309
|
-
var
|
|
1447
|
+
var appendTrellisToPayload = (payload, trellisKey, trellisSplitBy) => {
|
|
1448
|
+
const result = __spreadValues({}, payload);
|
|
1449
|
+
if (trellisSplitBy) {
|
|
1450
|
+
result["trellis.name"] = trellisSplitBy;
|
|
1451
|
+
}
|
|
1452
|
+
if (trellisKey) {
|
|
1453
|
+
result["trellis.value"] = trellisKey;
|
|
1454
|
+
}
|
|
1455
|
+
return result;
|
|
1456
|
+
};
|
|
1457
|
+
var hasMouseoverPayloadChanged = (currentPayload, previousPayload) => {
|
|
1458
|
+
if (!previousPayload) {
|
|
1459
|
+
return true;
|
|
1460
|
+
}
|
|
1461
|
+
if (currentPayload.index !== previousPayload.index) {
|
|
1462
|
+
return true;
|
|
1463
|
+
}
|
|
1464
|
+
if (currentPayload.seriesIndex !== previousPayload.seriesIndex) {
|
|
1465
|
+
return true;
|
|
1466
|
+
}
|
|
1467
|
+
if (currentPayload["trellis.name"] !== previousPayload["trellis.name"]) {
|
|
1468
|
+
return true;
|
|
1469
|
+
}
|
|
1470
|
+
if (currentPayload["trellis.value"] !== previousPayload["trellis.value"]) {
|
|
1471
|
+
return true;
|
|
1472
|
+
}
|
|
1473
|
+
return false;
|
|
1474
|
+
};
|
|
1475
|
+
var handleClick = (chartEvent, onClick, trellisKey, trellisSplitBy) => {
|
|
1310
1476
|
const payload = __spreadProps(__spreadValues({}, (0, lodash_exports.pick)(chartEvent, "value", "seriesKey")), {
|
|
1311
1477
|
name: chartEvent.seriesKey
|
|
1312
1478
|
});
|
|
1313
1479
|
delete payload.seriesKey;
|
|
1314
1480
|
if (chartEvent.rowContext) {
|
|
1315
|
-
Object.
|
|
1316
|
-
payload
|
|
1317
|
-
|
|
1481
|
+
Object.assign(
|
|
1482
|
+
payload,
|
|
1483
|
+
Object.keys(chartEvent.rowContext).reduce((acc, fieldName) => {
|
|
1484
|
+
acc[`row.${fieldName}.value`] = chartEvent.rowContext[fieldName];
|
|
1485
|
+
return acc;
|
|
1486
|
+
}, {})
|
|
1487
|
+
);
|
|
1318
1488
|
}
|
|
1489
|
+
const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
|
|
1319
1490
|
if (onClick) {
|
|
1320
1491
|
onClick({
|
|
1321
1492
|
type: "point.click",
|
|
1322
1493
|
originalEvent: chartEvent,
|
|
1323
|
-
payload
|
|
1494
|
+
payload: updatedPayload
|
|
1324
1495
|
});
|
|
1325
1496
|
}
|
|
1326
1497
|
};
|
|
1327
|
-
var handleLegendClick = (chartEvent, onClick) => {
|
|
1498
|
+
var handleLegendClick = (chartEvent, onClick, trellisKey, trellisSplitBy) => {
|
|
1328
1499
|
const payload = {
|
|
1329
1500
|
name: chartEvent
|
|
1330
1501
|
};
|
|
1502
|
+
const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
|
|
1331
1503
|
if (onClick) {
|
|
1332
1504
|
onClick({
|
|
1333
1505
|
type: "legend.click",
|
|
1334
1506
|
originalEvent: chartEvent,
|
|
1335
|
-
payload
|
|
1507
|
+
payload: updatedPayload
|
|
1508
|
+
});
|
|
1509
|
+
}
|
|
1510
|
+
};
|
|
1511
|
+
var handleRangeSelection = (rangeEvent, onSelect, chartData, trellisKey, trellisSplitBy) => {
|
|
1512
|
+
var _a;
|
|
1513
|
+
if (!rangeEvent) {
|
|
1514
|
+
return;
|
|
1515
|
+
}
|
|
1516
|
+
const xData = ((_a = chartData == null ? void 0 : chartData.columns) == null ? void 0 : _a[0]) || [];
|
|
1517
|
+
const { startXIndex, endXIndex } = findRangeIndices(xData, rangeEvent.start, rangeEvent.end);
|
|
1518
|
+
const payload = {
|
|
1519
|
+
startXIndex,
|
|
1520
|
+
startXValue: rangeEvent.start,
|
|
1521
|
+
endXIndex,
|
|
1522
|
+
endXValue: rangeEvent.end
|
|
1523
|
+
};
|
|
1524
|
+
const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
|
|
1525
|
+
if (onSelect) {
|
|
1526
|
+
onSelect({
|
|
1527
|
+
type: "range.selectBeforeZoom",
|
|
1528
|
+
originalEvent: rangeEvent,
|
|
1529
|
+
payload: updatedPayload
|
|
1530
|
+
});
|
|
1531
|
+
}
|
|
1532
|
+
};
|
|
1533
|
+
var handleRangeZoom = (rangeEvent, onSelect, chartData, trellisKey, trellisSplitBy) => {
|
|
1534
|
+
var _a;
|
|
1535
|
+
const xData = ((_a = chartData == null ? void 0 : chartData.columns) == null ? void 0 : _a[0]) || [];
|
|
1536
|
+
const { startXIndex, endXIndex } = findRangeIndices(xData, rangeEvent.start, rangeEvent.end);
|
|
1537
|
+
const payload = {
|
|
1538
|
+
startXIndex,
|
|
1539
|
+
startXValue: rangeEvent.start,
|
|
1540
|
+
endXIndex,
|
|
1541
|
+
endXValue: rangeEvent.end
|
|
1542
|
+
};
|
|
1543
|
+
const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
|
|
1544
|
+
if (onSelect) {
|
|
1545
|
+
onSelect({
|
|
1546
|
+
type: "range.select",
|
|
1547
|
+
originalEvent: rangeEvent,
|
|
1548
|
+
payload: updatedPayload
|
|
1336
1549
|
});
|
|
1337
1550
|
}
|
|
1338
1551
|
};
|
|
1552
|
+
var parseArrayOption = (value) => {
|
|
1553
|
+
if (Array.isArray(value)) {
|
|
1554
|
+
return value;
|
|
1555
|
+
}
|
|
1556
|
+
if (value) {
|
|
1557
|
+
return JSON.parse(value);
|
|
1558
|
+
}
|
|
1559
|
+
return void 0;
|
|
1560
|
+
};
|
|
1339
1561
|
var TimeSeriesChartWrapper = (props) => {
|
|
1340
|
-
|
|
1562
|
+
var _b, _c, _d;
|
|
1563
|
+
const _a = props, {
|
|
1341
1564
|
width,
|
|
1342
1565
|
height,
|
|
1343
1566
|
chartData,
|
|
@@ -1350,12 +1573,49 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
1350
1573
|
markerDisplay,
|
|
1351
1574
|
onClick,
|
|
1352
1575
|
onPointMouseOver,
|
|
1353
|
-
onPointMouseOut
|
|
1354
|
-
|
|
1355
|
-
|
|
1576
|
+
onPointMouseOut,
|
|
1577
|
+
onSelect,
|
|
1578
|
+
splitByLayout,
|
|
1579
|
+
trellisKey,
|
|
1580
|
+
trellisSplitBy,
|
|
1356
1581
|
backgroundColor,
|
|
1582
|
+
defaultFontColor,
|
|
1583
|
+
additionalTooltipValues,
|
|
1584
|
+
showYAxisWithZero: showYAxisWithZeroFromProps,
|
|
1585
|
+
showY2AxisWithZero: showY2AxisWithZeroFromProps
|
|
1586
|
+
} = _a, otherOptions = __objRest(_a, [
|
|
1587
|
+
"width",
|
|
1588
|
+
"height",
|
|
1589
|
+
"chartData",
|
|
1590
|
+
"options",
|
|
1591
|
+
"userLocale",
|
|
1592
|
+
"annotationX",
|
|
1593
|
+
"annotationLabel",
|
|
1594
|
+
"annotationColor",
|
|
1595
|
+
"legendDisplay",
|
|
1596
|
+
"markerDisplay",
|
|
1597
|
+
"onClick",
|
|
1598
|
+
"onPointMouseOver",
|
|
1599
|
+
"onPointMouseOut",
|
|
1600
|
+
"onSelect",
|
|
1601
|
+
"splitByLayout",
|
|
1602
|
+
"trellisKey",
|
|
1603
|
+
"trellisSplitBy",
|
|
1604
|
+
"backgroundColor",
|
|
1605
|
+
"defaultFontColor",
|
|
1606
|
+
"additionalTooltipValues",
|
|
1607
|
+
// Extract showYAxisWithZero directly from props for accelerated render mode
|
|
1608
|
+
"showYAxisWithZero",
|
|
1609
|
+
"showY2AxisWithZero"
|
|
1610
|
+
]);
|
|
1611
|
+
const { eventHandlers, xField: xFieldFromProps } = otherOptions;
|
|
1612
|
+
const trellisEnabled = useTrellisEnabled(splitByLayout);
|
|
1613
|
+
const {
|
|
1614
|
+
backgroundColor: bgColorFromOptions,
|
|
1357
1615
|
seriesColors: seriesColorsStr,
|
|
1358
1616
|
fieldColors,
|
|
1617
|
+
legendLabels: legendLabelsStr,
|
|
1618
|
+
legendMode,
|
|
1359
1619
|
"axisTitleX.text": xAxisTitleText,
|
|
1360
1620
|
"axisTitleY.text": yAxisTitleText,
|
|
1361
1621
|
"axisTitleY2.text": y2AxisTitleText,
|
|
@@ -1363,8 +1623,11 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
1363
1623
|
"axisTitleY.visibility": yAxisTitleVisibility,
|
|
1364
1624
|
"axisTitleY2.visibility": y2AxisTitleVisibility,
|
|
1365
1625
|
"axisLabelsX.majorLabelVisibility": xAxisLabelVisibility,
|
|
1626
|
+
"axisLabelsX.majorLabelStyle.rotation": xAxisLabelRotation,
|
|
1366
1627
|
"axisLabelsY.majorLabelVisibility": yAxisLabelVisibility,
|
|
1628
|
+
"axisLabelsY.majorUnit": yAxisMajorUnitFromSimpleXML,
|
|
1367
1629
|
"axisLabelsY2.majorLabelVisibility": y2AxisLabelVisibility,
|
|
1630
|
+
"axisLabelsY2.majorUnit": y2AxisMajorUnitFromSimpleXML,
|
|
1368
1631
|
"axisY.abbreviation": yAxisAbbreviation,
|
|
1369
1632
|
"axisY.scale": yAxisScale,
|
|
1370
1633
|
"axisY2.abbreviation": y2AxisAbbreviation,
|
|
@@ -1374,10 +1637,63 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
1374
1637
|
"axisLabelsY2.integerUnits": y2IntegerUnits,
|
|
1375
1638
|
"chart.overlayFields": overlayFieldsStr,
|
|
1376
1639
|
"chart.nullValueMode": nullValueMode,
|
|
1377
|
-
|
|
1640
|
+
"chart.showDataLabels": showDataLabels,
|
|
1641
|
+
lineWidth,
|
|
1642
|
+
lineDashStyle,
|
|
1643
|
+
fieldDashStyles: lineDashStylesByFieldStr,
|
|
1644
|
+
yAxisMin: yAxisMinRaw,
|
|
1645
|
+
yAxisMax: yAxisMaxRaw,
|
|
1646
|
+
y2AxisMin: y2AxisMinRaw,
|
|
1647
|
+
y2AxisMax: y2AxisMaxRaw,
|
|
1648
|
+
showXMajorGridLines,
|
|
1649
|
+
showYMajorGridLines,
|
|
1650
|
+
showY2MajorGridLines,
|
|
1651
|
+
showYMinorGridLines,
|
|
1652
|
+
showY2MinorGridLines,
|
|
1653
|
+
showLineSmoothing,
|
|
1654
|
+
yAxisMajorTickVisibility,
|
|
1655
|
+
y2AxisMajorTickVisibility,
|
|
1656
|
+
yAxisMajorTickSize,
|
|
1657
|
+
y2AxisMajorTickSize,
|
|
1658
|
+
yAxisMajorTickInterval,
|
|
1659
|
+
y2AxisMajorTickInterval,
|
|
1660
|
+
yAxisMinorTickVisibility,
|
|
1661
|
+
y2AxisMinorTickVisibility,
|
|
1662
|
+
yAxisMinorTickSize,
|
|
1663
|
+
y2AxisMinorTickSize,
|
|
1664
|
+
showYAxisWithZero: showYAxisWithZeroFromOptions,
|
|
1665
|
+
showY2AxisWithZero: showY2AxisWithZeroFromOptions
|
|
1378
1666
|
} = options;
|
|
1667
|
+
const dataValuesDisplay = showDataLabels === "none" ? "off" : showDataLabels;
|
|
1668
|
+
const showYAxisWithZero = showYAxisWithZeroFromProps != null ? showYAxisWithZeroFromProps : showYAxisWithZeroFromOptions;
|
|
1669
|
+
const showY2AxisWithZero = showY2AxisWithZeroFromProps != null ? showY2AxisWithZeroFromProps : showY2AxisWithZeroFromOptions;
|
|
1670
|
+
const showYMajorTicks = yAxisMajorTickVisibility === "show";
|
|
1671
|
+
const showY2MajorTicks = y2AxisMajorTickVisibility === "show";
|
|
1672
|
+
const showYMinorTicks = yAxisMinorTickVisibility === "show";
|
|
1673
|
+
const showY2MinorTicks = y2AxisMinorTickVisibility === "show";
|
|
1674
|
+
const yAxisMin = parseAxisValue(yAxisMinRaw);
|
|
1675
|
+
const yAxisMax = parseAxisValue(yAxisMaxRaw);
|
|
1676
|
+
const y2AxisMin = parseAxisValue(y2AxisMinRaw);
|
|
1677
|
+
const y2AxisMax = parseAxisValue(y2AxisMaxRaw);
|
|
1678
|
+
const parseTickInterval = (simpleXMLValue, canvasValue) => {
|
|
1679
|
+
if (simpleXMLValue) return Number(simpleXMLValue);
|
|
1680
|
+
if (canvasValue) return Number(canvasValue);
|
|
1681
|
+
return void 0;
|
|
1682
|
+
};
|
|
1683
|
+
const yAxisMajorTickIntervalNum = parseTickInterval(yAxisMajorUnitFromSimpleXML, yAxisMajorTickInterval);
|
|
1684
|
+
const y2AxisMajorTickIntervalNum = parseTickInterval(
|
|
1685
|
+
y2AxisMajorUnitFromSimpleXML,
|
|
1686
|
+
y2AxisMajorTickInterval
|
|
1687
|
+
);
|
|
1688
|
+
const yAxisMajorTickSizeNum = yAxisMajorTickSize ? Number(yAxisMajorTickSize) : void 0;
|
|
1689
|
+
const y2AxisMajorTickSizeNum = y2AxisMajorTickSize ? Number(y2AxisMajorTickSize) : void 0;
|
|
1690
|
+
const yAxisMinorTickSizeNum = yAxisMinorTickSize ? Number(yAxisMinorTickSize) : void 0;
|
|
1691
|
+
const y2AxisMinorTickSizeNum = y2AxisMinorTickSize ? Number(y2AxisMinorTickSize) : void 0;
|
|
1379
1692
|
const seriesColors = seriesColorsStr ? JSON.parse(seriesColorsStr) : void 0;
|
|
1380
1693
|
const seriesColorsByField = fieldColors ? JSON.parse(fieldColors) : void 0;
|
|
1694
|
+
const lineDashStylesByField = lineDashStylesByFieldStr ? JSON.parse(lineDashStylesByFieldStr) : void 0;
|
|
1695
|
+
const legendLabels = parseArrayOption(legendLabelsStr);
|
|
1696
|
+
const bgColor = backgroundColor || bgColorFromOptions;
|
|
1381
1697
|
const [containerWidth, setContainerWidth] = react_exports.useState(Number(props.width));
|
|
1382
1698
|
const [containerHeight, setContainerHeight] = react_exports.useState(Number(props.height));
|
|
1383
1699
|
const cachedHandleResize = react_exports.useCallback((w, h) => {
|
|
@@ -1388,31 +1704,64 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
1388
1704
|
fields: chartData.fields,
|
|
1389
1705
|
columns: chartData.seriesList
|
|
1390
1706
|
});
|
|
1391
|
-
const xField =
|
|
1707
|
+
const xField = getFieldName2(filteredChartData.fields[0]);
|
|
1392
1708
|
const yFields = getFieldNames(
|
|
1393
1709
|
filteredChartData.fields.length > 1 ? filteredChartData.fields.slice(1) : []
|
|
1394
1710
|
);
|
|
1395
|
-
const y2Fields =
|
|
1396
|
-
|
|
1711
|
+
const y2Fields = (0, react_exports.useMemo)(
|
|
1712
|
+
() => y2FieldsStr ? y2FieldsStr.split(",").map((f) => f.trim()) : [],
|
|
1713
|
+
[y2FieldsStr]
|
|
1714
|
+
);
|
|
1715
|
+
const overlayFields = (0, react_exports.useMemo)(
|
|
1716
|
+
() => overlayFieldsStr ? overlayFieldsStr.split(",").map((f) => f.trim()) : [],
|
|
1717
|
+
[overlayFieldsStr]
|
|
1718
|
+
);
|
|
1397
1719
|
let xAxisTitle = getComputedAxisTitles(xAxisTitleText, [xField], xAxisTitleVisibility);
|
|
1398
1720
|
xAxisTitle = ellipsisAxisTitle(xAxisTitle, containerWidth);
|
|
1399
|
-
|
|
1721
|
+
const yFieldsForTitle = y2Enabled ? yFields.filter((field) => !y2Fields.includes(field)) : yFields;
|
|
1722
|
+
let yAxisTitle = getComputedAxisTitles(yAxisTitleText, yFieldsForTitle, yAxisTitleVisibility);
|
|
1400
1723
|
yAxisTitle = ellipsisAxisTitle(yAxisTitle, containerHeight);
|
|
1401
1724
|
const fieldsForY2Axis = y2Fields.length > 0 ? y2Fields : overlayFields;
|
|
1402
1725
|
let y2AxisTitle = getComputedAxisTitles(y2AxisTitleText, fieldsForY2Axis, y2AxisTitleVisibility);
|
|
1403
1726
|
y2AxisTitle = ellipsisAxisTitle(y2AxisTitle, containerHeight);
|
|
1404
|
-
const xScaleConfig =
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1727
|
+
const xScaleConfig = (0, react_exports.useMemo)(
|
|
1728
|
+
() => getXScaleConfig(xAxisTitle, xAxisLabelVisibility, xAxisLabelRotation),
|
|
1729
|
+
[xAxisTitle, xAxisLabelVisibility, xAxisLabelRotation]
|
|
1730
|
+
);
|
|
1731
|
+
const yScaleConfig = (0, react_exports.useMemo)(
|
|
1732
|
+
() => getYScaleConfig(
|
|
1733
|
+
yAxisTitle,
|
|
1734
|
+
yAxisAbbreviation,
|
|
1735
|
+
yAxisScale,
|
|
1736
|
+
yAxisLabelVisibility,
|
|
1737
|
+
yAxisMin,
|
|
1738
|
+
yAxisMax
|
|
1739
|
+
),
|
|
1740
|
+
[yAxisTitle, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility, yAxisMin, yAxisMax]
|
|
1741
|
+
);
|
|
1742
|
+
const y2ScaleConfig = (0, react_exports.useMemo)(() => {
|
|
1743
|
+
if (y2Enabled) {
|
|
1744
|
+
return getY2ScaleConfig(
|
|
1745
|
+
y2AxisTitle,
|
|
1746
|
+
y2AxisAbbreviation,
|
|
1747
|
+
y2AxisScale,
|
|
1748
|
+
y2IntegerUnits,
|
|
1749
|
+
y2AxisLabelVisibility,
|
|
1750
|
+
y2AxisMin,
|
|
1751
|
+
y2AxisMax
|
|
1752
|
+
);
|
|
1753
|
+
}
|
|
1754
|
+
return {};
|
|
1755
|
+
}, [
|
|
1756
|
+
y2Enabled,
|
|
1757
|
+
y2AxisTitle,
|
|
1758
|
+
y2AxisAbbreviation,
|
|
1759
|
+
y2AxisScale,
|
|
1760
|
+
y2IntegerUnits,
|
|
1761
|
+
y2AxisLabelVisibility,
|
|
1762
|
+
y2AxisMin,
|
|
1763
|
+
y2AxisMax
|
|
1764
|
+
]);
|
|
1416
1765
|
const uplotContainerElement = (0, react_exports.useRef)(null);
|
|
1417
1766
|
const seriesDataFormatted = [
|
|
1418
1767
|
filteredChartData.columns[0],
|
|
@@ -1428,9 +1777,21 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
1428
1777
|
overlayFields,
|
|
1429
1778
|
y2Enabled,
|
|
1430
1779
|
nullValueMode,
|
|
1431
|
-
markerDisplay
|
|
1780
|
+
markerDisplay,
|
|
1781
|
+
lineDashStyle,
|
|
1782
|
+
lineDashStylesByField
|
|
1432
1783
|
),
|
|
1433
|
-
[
|
|
1784
|
+
[
|
|
1785
|
+
yFields,
|
|
1786
|
+
y2Fields,
|
|
1787
|
+
lineWidth,
|
|
1788
|
+
overlayFields,
|
|
1789
|
+
y2Enabled,
|
|
1790
|
+
nullValueMode,
|
|
1791
|
+
markerDisplay,
|
|
1792
|
+
lineDashStyle,
|
|
1793
|
+
lineDashStylesByField
|
|
1794
|
+
]
|
|
1434
1795
|
);
|
|
1435
1796
|
const chartingEventAnnotations = (0, react_exports.useMemo)(
|
|
1436
1797
|
() => getAnnotationsForCanvas({
|
|
@@ -1444,25 +1805,54 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
1444
1805
|
() => __spreadValues(__spreadValues(__spreadValues({}, xScaleConfig), yScaleConfig), y2ScaleConfig),
|
|
1445
1806
|
[xScaleConfig, yScaleConfig, y2ScaleConfig]
|
|
1446
1807
|
);
|
|
1447
|
-
const legend = (0, react_exports.useMemo)(
|
|
1808
|
+
const legend = (0, react_exports.useMemo)(
|
|
1809
|
+
() => getLegend({ legendDisplay, isSeriesCompare: legendMode === "seriesCompare" }),
|
|
1810
|
+
[legendDisplay, legendMode]
|
|
1811
|
+
);
|
|
1448
1812
|
const handleChartClick = react_exports.useCallback(
|
|
1449
1813
|
(event) => {
|
|
1450
1814
|
if (onClick) {
|
|
1451
|
-
handleClick(event, onClick);
|
|
1815
|
+
handleClick(event, onClick, trellisKey, trellisSplitBy);
|
|
1452
1816
|
}
|
|
1453
1817
|
},
|
|
1454
|
-
[onClick]
|
|
1818
|
+
[onClick, trellisKey, trellisSplitBy]
|
|
1455
1819
|
);
|
|
1456
1820
|
const handleChartLegendClick = react_exports.useCallback(
|
|
1457
1821
|
(event) => {
|
|
1458
1822
|
if (onClick) {
|
|
1459
|
-
handleLegendClick(event, onClick);
|
|
1823
|
+
handleLegendClick(event, onClick, trellisKey, trellisSplitBy);
|
|
1824
|
+
}
|
|
1825
|
+
},
|
|
1826
|
+
[onClick, trellisKey, trellisSplitBy]
|
|
1827
|
+
);
|
|
1828
|
+
const handleChartRangeSelection = react_exports.useCallback(
|
|
1829
|
+
(range) => {
|
|
1830
|
+
if (onSelect) {
|
|
1831
|
+
handleRangeSelection(range, onSelect, chartData, trellisKey, trellisSplitBy);
|
|
1832
|
+
}
|
|
1833
|
+
},
|
|
1834
|
+
[onSelect, chartData, trellisKey, trellisSplitBy]
|
|
1835
|
+
);
|
|
1836
|
+
const handleChartRangeZoom = react_exports.useCallback(
|
|
1837
|
+
(range) => {
|
|
1838
|
+
if (onSelect) {
|
|
1839
|
+
handleRangeZoom(range, onSelect, chartData, trellisKey, trellisSplitBy);
|
|
1460
1840
|
}
|
|
1461
1841
|
},
|
|
1462
|
-
[
|
|
1842
|
+
[onSelect, chartData, trellisKey, trellisSplitBy]
|
|
1843
|
+
);
|
|
1844
|
+
const xFieldToUse = xFieldFromProps || xField;
|
|
1845
|
+
const enableSearchZoom = react_exports.useMemo(
|
|
1846
|
+
() => shouldEnableSearchZoom(eventHandlers, xFieldToUse),
|
|
1847
|
+
[eventHandlers, xFieldToUse]
|
|
1463
1848
|
);
|
|
1464
1849
|
const lastPayloadRef = react_exports.useRef(null);
|
|
1465
1850
|
const lastOriginalEventRef = react_exports.useRef(null);
|
|
1851
|
+
const previousMouseoverPayloadRef = react_exports.useRef(null);
|
|
1852
|
+
const additionalTooltipValuesRef = react_exports.useRef(additionalTooltipValues);
|
|
1853
|
+
react_exports.useEffect(() => {
|
|
1854
|
+
additionalTooltipValuesRef.current = additionalTooltipValues;
|
|
1855
|
+
}, [additionalTooltipValues]);
|
|
1466
1856
|
const handleChartCrosshairChange = react_exports.useCallback(
|
|
1467
1857
|
(event) => {
|
|
1468
1858
|
if (onPointMouseOver || onPointMouseOut) {
|
|
@@ -1474,6 +1864,7 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
1474
1864
|
payload: lastPayloadRef.current
|
|
1475
1865
|
});
|
|
1476
1866
|
}
|
|
1867
|
+
previousMouseoverPayloadRef.current = null;
|
|
1477
1868
|
return;
|
|
1478
1869
|
}
|
|
1479
1870
|
const payload = __spreadProps(__spreadValues({}, (0, lodash_exports.pick)(event, "value", "seriesKey", "time", "index", "seriesIndex")), {
|
|
@@ -1481,25 +1872,36 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
1481
1872
|
});
|
|
1482
1873
|
delete payload.seriesKey;
|
|
1483
1874
|
if (event.rowContext) {
|
|
1484
|
-
Object.
|
|
1485
|
-
payload
|
|
1486
|
-
|
|
1875
|
+
Object.assign(
|
|
1876
|
+
payload,
|
|
1877
|
+
Object.keys(event.rowContext).reduce((acc, fieldName) => {
|
|
1878
|
+
acc[`row.${fieldName}.value`] = event.rowContext[fieldName];
|
|
1879
|
+
return acc;
|
|
1880
|
+
}, {})
|
|
1881
|
+
);
|
|
1882
|
+
}
|
|
1883
|
+
const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
|
|
1884
|
+
if (!hasMouseoverPayloadChanged(updatedPayload, previousMouseoverPayloadRef.current)) {
|
|
1885
|
+
return;
|
|
1487
1886
|
}
|
|
1488
|
-
lastPayloadRef.current =
|
|
1887
|
+
lastPayloadRef.current = updatedPayload;
|
|
1489
1888
|
lastOriginalEventRef.current = event;
|
|
1889
|
+
previousMouseoverPayloadRef.current = __spreadValues({}, updatedPayload);
|
|
1490
1890
|
if (onPointMouseOver) {
|
|
1491
1891
|
onPointMouseOver({
|
|
1492
1892
|
type: "point.mouseover",
|
|
1493
1893
|
originalEvent: event,
|
|
1494
|
-
payload
|
|
1894
|
+
payload: updatedPayload
|
|
1495
1895
|
});
|
|
1496
1896
|
}
|
|
1497
1897
|
}
|
|
1498
1898
|
},
|
|
1499
|
-
[onPointMouseOver, onPointMouseOut]
|
|
1899
|
+
[onPointMouseOver, onPointMouseOut, trellisKey, trellisSplitBy]
|
|
1500
1900
|
);
|
|
1501
|
-
const
|
|
1502
|
-
|
|
1901
|
+
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}`;
|
|
1902
|
+
const memoizedChart = (0, react_exports.useMemo)(() => {
|
|
1903
|
+
const computedOnRangeZoom = onSelect ? handleChartRangeZoom : void 0;
|
|
1904
|
+
return /* @__PURE__ */ react_exports.createElement(visualization_canvas_exports.RangeSelectionProvider, { key: dataKey }, /* @__PURE__ */ react_exports.createElement(
|
|
1503
1905
|
visualization_canvas_exports.TimeSeriesChart,
|
|
1504
1906
|
{
|
|
1505
1907
|
data: chartData,
|
|
@@ -1509,49 +1911,107 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
1509
1911
|
seriesColorsByField,
|
|
1510
1912
|
seriesConfig: seriesOverrides,
|
|
1511
1913
|
legend,
|
|
1914
|
+
legendLabels,
|
|
1915
|
+
isSeriesCompare: legendMode === "seriesCompare",
|
|
1916
|
+
maxSeriesFocus: legendMode === "seriesCompare" ? 0 : void 0,
|
|
1512
1917
|
scaleConfig,
|
|
1513
1918
|
timestampFormat: "expanded",
|
|
1514
1919
|
onCrosshairClick: onClick ? handleChartClick : void 0,
|
|
1515
1920
|
onCrosshairChange: onPointMouseOver || onPointMouseOut ? handleChartCrosshairChange : void 0,
|
|
1516
1921
|
onSeriesClick: onClick ? handleChartLegendClick : void 0,
|
|
1922
|
+
onRangeSelection: handleChartRangeSelection,
|
|
1923
|
+
onRangeZoom: computedOnRangeZoom,
|
|
1924
|
+
serverSideZoom: enableSearchZoom,
|
|
1517
1925
|
userLocale,
|
|
1518
1926
|
events: chartingEventAnnotations,
|
|
1519
|
-
eventsConfig: { renderer: triangleEventAnnotationRenderer }
|
|
1927
|
+
eventsConfig: { renderer: triangleEventAnnotationRenderer },
|
|
1928
|
+
additionalTooltipValuesRef,
|
|
1929
|
+
showXMajorGridLines,
|
|
1930
|
+
showYMajorGridLines,
|
|
1931
|
+
showY2MajorGridLines,
|
|
1932
|
+
showYMinorGridLines,
|
|
1933
|
+
showY2MinorGridLines,
|
|
1934
|
+
showLineSmoothing,
|
|
1935
|
+
dataValuesDisplay,
|
|
1936
|
+
showYMajorTicks,
|
|
1937
|
+
showY2MajorTicks,
|
|
1938
|
+
yAxisMajorTickSize: yAxisMajorTickSizeNum,
|
|
1939
|
+
y2AxisMajorTickSize: y2AxisMajorTickSizeNum,
|
|
1940
|
+
yAxisMajorTickInterval: yAxisMajorTickIntervalNum,
|
|
1941
|
+
y2AxisMajorTickInterval: y2AxisMajorTickIntervalNum,
|
|
1942
|
+
showYMinorTicks,
|
|
1943
|
+
showY2MinorTicks,
|
|
1944
|
+
yAxisMinorTickSize: yAxisMinorTickSizeNum,
|
|
1945
|
+
y2AxisMinorTickSize: y2AxisMinorTickSizeNum,
|
|
1946
|
+
showYAxisWithZero,
|
|
1947
|
+
showY2AxisWithZero
|
|
1520
1948
|
}
|
|
1521
|
-
)
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1949
|
+
));
|
|
1950
|
+
}, [
|
|
1951
|
+
onSelect,
|
|
1952
|
+
handleChartRangeZoom,
|
|
1953
|
+
dataKey,
|
|
1954
|
+
chartData,
|
|
1955
|
+
containerWidth,
|
|
1956
|
+
containerHeight,
|
|
1957
|
+
seriesColors,
|
|
1958
|
+
seriesColorsByField,
|
|
1959
|
+
seriesOverrides,
|
|
1960
|
+
legend,
|
|
1961
|
+
legendLabels,
|
|
1962
|
+
scaleConfig,
|
|
1963
|
+
onClick,
|
|
1964
|
+
handleChartClick,
|
|
1965
|
+
onPointMouseOver,
|
|
1966
|
+
onPointMouseOut,
|
|
1967
|
+
handleChartCrosshairChange,
|
|
1968
|
+
handleChartLegendClick,
|
|
1969
|
+
handleChartRangeSelection,
|
|
1970
|
+
enableSearchZoom,
|
|
1971
|
+
userLocale,
|
|
1972
|
+
chartingEventAnnotations,
|
|
1973
|
+
showXMajorGridLines,
|
|
1974
|
+
showYMajorGridLines,
|
|
1975
|
+
showY2MajorGridLines,
|
|
1976
|
+
showYMinorGridLines,
|
|
1977
|
+
showY2MinorGridLines,
|
|
1978
|
+
showLineSmoothing,
|
|
1979
|
+
dataValuesDisplay,
|
|
1980
|
+
showYMajorTicks,
|
|
1981
|
+
showY2MajorTicks,
|
|
1982
|
+
yAxisMajorTickSizeNum,
|
|
1983
|
+
y2AxisMajorTickSizeNum,
|
|
1984
|
+
yAxisMajorTickIntervalNum,
|
|
1985
|
+
y2AxisMajorTickIntervalNum,
|
|
1986
|
+
showYMinorTicks,
|
|
1987
|
+
showY2MinorTicks,
|
|
1988
|
+
yAxisMinorTickSizeNum,
|
|
1989
|
+
y2AxisMinorTickSizeNum,
|
|
1990
|
+
showYAxisWithZero,
|
|
1991
|
+
showY2AxisWithZero,
|
|
1992
|
+
legendMode
|
|
1993
|
+
]);
|
|
1541
1994
|
const memoizedVisualization = (0, react_exports.useMemo)(() => {
|
|
1542
|
-
return /* @__PURE__ */ react_exports.createElement(VizStyleWrapper_default, { backgroundColor }, memoizedChart);
|
|
1543
|
-
}, [
|
|
1544
|
-
return /* @__PURE__ */ react_exports.createElement(
|
|
1995
|
+
return /* @__PURE__ */ react_exports.createElement(VizStyleWrapper_default, { backgroundColor: bgColor }, memoizedChart);
|
|
1996
|
+
}, [bgColor, memoizedChart]);
|
|
1997
|
+
return /* @__PURE__ */ react_exports.createElement(react_exports.Fragment, null, trellisEnabled && /* @__PURE__ */ react_exports.createElement(
|
|
1998
|
+
TrellisTitle,
|
|
1999
|
+
{
|
|
2000
|
+
trellisKey,
|
|
2001
|
+
backgroundColor: bgColor,
|
|
2002
|
+
fontColor: defaultFontColor
|
|
2003
|
+
}
|
|
2004
|
+
), /* @__PURE__ */ react_exports.createElement(
|
|
1545
2005
|
TimeSeriesChartContainer,
|
|
1546
2006
|
{
|
|
1547
|
-
height,
|
|
2007
|
+
height: trellisEnabled ? Number(height) - TRELLIS_TITLE_HEIGHT : height,
|
|
1548
2008
|
width,
|
|
1549
2009
|
ref: uplotContainerElement,
|
|
1550
2010
|
"data-test": "timeseries-chart-wrapper"
|
|
1551
2011
|
},
|
|
1552
2012
|
/* @__PURE__ */ react_exports.createElement(SizeAwareWrapper_default, { width, height, onResize: cachedHandleResize }),
|
|
1553
2013
|
memoizedVisualization
|
|
1554
|
-
);
|
|
2014
|
+
));
|
|
1555
2015
|
};
|
|
1556
2016
|
var TimeSeriesChartWrapper_default = TimeSeriesChartWrapper;
|
|
1557
2017
|
|