@splunk/visualizations 28.3.0 → 28.5.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 +28 -8
- package/Area.config.js.map +2 -2
- package/Area.js +583 -120
- package/Area.js.map +3 -3
- package/Bar/Bar.d.ts.map +1 -1
- package/Bar.config.js +28 -8
- package/Bar.config.js.map +2 -2
- package/Bar.js +593 -120
- package/Bar.js.map +3 -3
- package/Bubble.config.js +4 -5
- package/Bubble.config.js.map +2 -2
- package/Bubble.js +554 -98
- package/Bubble.js.map +3 -3
- package/CHANGELOG.external.md +165 -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 +595 -111
- package/ChoroplethSvg.js.map +4 -4
- package/Column/Column.d.ts.map +1 -1
- package/Column.config.js +28 -8
- package/Column.config.js.map +2 -2
- package/Column.js +583 -120
- package/Column.js.map +3 -3
- package/Ellipse/config.d.ts.map +1 -1
- package/Ellipse.config.js +14 -5
- package/Ellipse.config.js.map +4 -4
- package/Ellipse.js +640 -159
- package/Ellipse.js.map +4 -4
- package/Events/PureEvents/PureEvents.d.ts.map +1 -1
- package/Events.js +668 -157
- 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 +751 -169
- package/FillerGauge.js.map +4 -4
- package/Image/Image.d.ts.map +1 -1
- package/Image.js +620 -116
- 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 +154 -0
- package/Line/mockdata/LineData.d.ts.map +1 -1
- package/Line.config.js +28 -8
- package/Line.config.js.map +2 -2
- package/Line.js +704 -122
- 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 +1411 -662
- 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/ClusterLayer.d.ts.map +1 -1
- package/Map/PureMap/LocalChoroplethLayer.d.ts.map +1 -1
- package/Map/PureMap/MapUtils.d.ts +2 -2
- package/Map/PureMap/MapUtils.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 +831 -247
- package/Map.js.map +4 -4
- package/Markdown/Markdown.d.ts.map +1 -1
- package/Markdown/config.d.ts.map +1 -1
- package/Markdown.config.js +14 -5
- package/Markdown.config.js.map +4 -4
- package/Markdown.js +619 -109
- 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 +1535 -172
- 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/dragUtils.d.ts +78 -0
- package/NetworkGraph/PureNetworkGraph/utils/dragUtils.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 +122 -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 +7053 -0
- package/NetworkGraph.js.map +7 -0
- package/PERFORMANCE.md +23 -0
- package/ParallelCoordinates/ParallelCoordinates.d.ts +1 -46
- package/ParallelCoordinates/ParallelCoordinates.d.ts.map +1 -1
- package/ParallelCoordinates/PureParallelCoordinates/PureParallelCoordinates.d.ts +12 -58
- package/ParallelCoordinates/PureParallelCoordinates/PureParallelCoordinates.d.ts.map +1 -1
- package/ParallelCoordinates/PureParallelCoordinates/src/ParallelCoordinatesChart.d.ts +1 -0
- package/ParallelCoordinates/PureParallelCoordinates/src/ParallelCoordinatesChart.d.ts.map +1 -1
- package/ParallelCoordinates.js +664 -228
- package/ParallelCoordinates.js.map +4 -4
- package/Pie/Pie.d.ts.map +1 -1
- package/Pie/config.d.ts.map +1 -1
- package/Pie/pieUtils.d.ts +4 -0
- package/Pie/pieUtils.d.ts.map +1 -1
- package/Pie.config.js +16 -0
- package/Pie.config.js.map +2 -2
- package/Pie.js +610 -118
- package/Pie.js.map +3 -3
- package/Punchcard.js +579 -92
- package/Punchcard.js.map +4 -4
- package/Rectangle/config.d.ts.map +1 -1
- package/Rectangle.config.js +14 -5
- package/Rectangle.config.js.map +4 -4
- package/Rectangle.js +611 -130
- package/Rectangle.js.map +4 -4
- package/Sankey/PureSankey/PureSankey.d.ts +26 -72
- package/Sankey/PureSankey/PureSankey.d.ts.map +1 -1
- package/Sankey/PureSankey/SankeyLink.d.ts +3 -19
- package/Sankey/PureSankey/SankeyLink.d.ts.map +1 -1
- package/Sankey/PureSankey/SankeyNode.d.ts +3 -20
- package/Sankey/PureSankey/SankeyNode.d.ts.map +1 -1
- package/Sankey/PureSankey/SankeyTooltip.d.ts +3 -24
- package/Sankey/PureSankey/SankeyTooltip.d.ts.map +1 -1
- package/Sankey.js +814 -429
- package/Sankey.js.map +4 -4
- package/Scatter/Scatter.d.ts.map +1 -1
- package/Scatter.config.js +168 -148
- package/Scatter.config.js.map +4 -4
- package/Scatter.js +733 -260
- package/Scatter.js.map +4 -4
- 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 +733 -229
- 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 +14 -6
- package/SingleValueIcon.config.js.map +4 -4
- package/SingleValueIcon.js +612 -182
- package/SingleValueIcon.js.map +4 -4
- package/SingleValueRadial/PureSingleValueRadial/GaugeGraph.d.ts.map +1 -1
- 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 +594 -182
- 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/Table.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 +6 -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 +836 -253
- package/Table.js.map +4 -4
- package/Timeline/PureTimeline/PureTimeline.d.ts.map +1 -1
- package/Timeline/PureTimeline/src/CursorPlugin.d.ts.map +1 -1
- package/Timeline/PureTimeline/src/TimelineLegend.d.ts.map +1 -1
- package/Timeline/PureTimeline/src/TimelinePlugin.d.ts.map +1 -1
- package/Timeline/PureTimeline/src/TimelineYAxis.d.ts.map +1 -1
- package/Timeline/PureTimeline/src/utils/timelineUtils.d.ts +2 -1
- package/Timeline/PureTimeline/src/utils/timelineUtils.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 +785 -247
- 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/GaugeMajorTicks.js +150 -13
- package/common/GaugeMajorTicks.js.map +4 -4
- package/common/GaugeValueMarker.js +84 -17
- package/common/GaugeValueMarker.js.map +4 -4
- package/common/OptionsDoc.js.map +1 -1
- package/common/OverviewDoc.d.ts.map +1 -1
- package/common/OverviewDoc.js +2 -2
- package/common/OverviewDoc.js.map +2 -2
- 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 +617 -91
- package/common/TimeSeriesChartWrapper.js.map +4 -4
- package/common/chartingUtils.d.ts +52 -6
- package/common/chartingUtils.d.ts.map +1 -1
- package/common/chartingUtils.js +116 -17
- package/common/chartingUtils.js.map +3 -3
- package/common/editorConfig/AxesChartDataConfig.d.ts +3 -3
- package/common/editorConfig/AxesChartDataConfig.d.ts.map +1 -1
- package/common/editorConfig/AxesChartDataDisplay.d.ts +4 -0
- package/common/editorConfig/AxesChartDataDisplay.d.ts.map +1 -1
- package/common/editorConfig/AxesChartLegend.d.ts.map +1 -1
- package/common/gaugeUtils.d.ts +37 -0
- package/common/gaugeUtils.d.ts.map +1 -1
- package/common/gaugeUtils.js +152 -2
- package/common/gaugeUtils.js.map +4 -4
- package/common/hocs/mockdata/trellisData.d.ts +119 -0
- package/common/hocs/mockdata/trellisData.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/interfaces/Overview.d.ts +1 -0
- package/common/interfaces/Overview.d.ts.map +1 -1
- package/common/interfaces/VizConfig.d.ts +2 -1
- package/common/interfaces/VizConfig.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 +16 -20
- package/common/utils/trellisUtils.js.map +2 -2
- package/common/withDashboardViz.d.ts.map +1 -1
- package/common/withDashboardViz.js +600 -92
- package/common/withDashboardViz.js.map +4 -4
- package/package.json +46 -39
- 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
package/SingleValue.js
CHANGED
|
@@ -344,7 +344,6 @@ var computeText = ({
|
|
|
344
344
|
}) => {
|
|
345
345
|
let text = (0, numberUtils_exports.isNumerial)(value) ? (0, numberUtils_exports.formatNumber)(value, numberPrecision, {
|
|
346
346
|
useThousandSeparators: shouldUseThousandSeparators,
|
|
347
|
-
// todo: need update formatNumber
|
|
348
347
|
useTrendUnits: shouldAbbreviateValue
|
|
349
348
|
}) : value;
|
|
350
349
|
text = text || "";
|
|
@@ -653,16 +652,19 @@ var changeColor = (color, ratio) => {
|
|
|
653
652
|
return `#${newR.toString(16).padStart(2, 0)}${newG.toString(16).padStart(2, 0)}${newB.toString(16).padStart(2, 0)}`;
|
|
654
653
|
};
|
|
655
654
|
var darken = (color) => changeColor(color, 0.5);
|
|
656
|
-
var handleValueClickCallback = (ev, majorValue, majorValueField, trendValue, onValueClick,
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
655
|
+
var handleValueClickCallback = (ev, majorValue, majorValueField, trendValue, onValueClick, trellisContext = {}) => {
|
|
656
|
+
const { trellisEnabled = false, trellisSplitBy = "", trellisKey = "" } = trellisContext;
|
|
657
|
+
return onValueClick(__spreadProps(__spreadValues({}, ev), {
|
|
658
|
+
payload: __spreadValues({
|
|
659
|
+
trendValue,
|
|
660
|
+
value: majorValue,
|
|
661
|
+
name: majorValueField
|
|
662
|
+
}, trellisEnabled && {
|
|
663
|
+
"trellis.name": trellisSplitBy,
|
|
664
|
+
"trellis.value": trellisKey
|
|
665
|
+
})
|
|
666
|
+
}));
|
|
667
|
+
};
|
|
666
668
|
var getTrendColorWithPercent = (options) => {
|
|
667
669
|
const shouldUsePercentTrendColor = options.trendColor === "> trendValue | rangeValue(trendColorEditorConfig)" && options.trendDisplay === "percent";
|
|
668
670
|
return shouldUsePercentTrendColor ? {
|
|
@@ -976,6 +978,8 @@ var StyledSvg = styled_components_default.svg`
|
|
|
976
978
|
var StyledTooltip = styled_components_default.div`
|
|
977
979
|
padding: 3px 8px;
|
|
978
980
|
font-size: 12px;
|
|
981
|
+
text-align: center;
|
|
982
|
+
min-width: 20px;
|
|
979
983
|
`;
|
|
980
984
|
var preventDefault = (e) => e.preventDefault();
|
|
981
985
|
var _SparkLine = class _SparkLine extends react_exports.Component {
|
|
@@ -1112,16 +1116,19 @@ var _SparkLine = class _SparkLine extends react_exports.Component {
|
|
|
1112
1116
|
* @method getSegmentSets
|
|
1113
1117
|
* @param {Array} data
|
|
1114
1118
|
* @param {Array} points
|
|
1115
|
-
* @returns {
|
|
1119
|
+
* @returns {Object} Object containing lines (arrays of points for polylines) and isolatedPoints (single points surrounded by nulls)
|
|
1116
1120
|
*/
|
|
1117
1121
|
getSegmentSets(data, points) {
|
|
1118
1122
|
const { acceptNull } = this.props;
|
|
1119
1123
|
const lines = [];
|
|
1124
|
+
const isolatedPoints = [];
|
|
1120
1125
|
let currentLine = [];
|
|
1121
1126
|
for (const [idx, p] of data.entries()) {
|
|
1122
1127
|
if (!acceptNull && (0, lodash_exports.isNull)(p)) {
|
|
1123
1128
|
if (currentLine.length > 1) {
|
|
1124
1129
|
lines.push(currentLine);
|
|
1130
|
+
} else if (currentLine.length === 1) {
|
|
1131
|
+
isolatedPoints.push(currentLine[0]);
|
|
1125
1132
|
}
|
|
1126
1133
|
currentLine = [];
|
|
1127
1134
|
} else {
|
|
@@ -1130,8 +1137,10 @@ var _SparkLine = class _SparkLine extends react_exports.Component {
|
|
|
1130
1137
|
}
|
|
1131
1138
|
if (currentLine.length > 1) {
|
|
1132
1139
|
lines.push(currentLine);
|
|
1140
|
+
} else if (currentLine.length === 1) {
|
|
1141
|
+
isolatedPoints.push(currentLine[0]);
|
|
1133
1142
|
}
|
|
1134
|
-
return lines;
|
|
1143
|
+
return { lines, isolatedPoints };
|
|
1135
1144
|
}
|
|
1136
1145
|
/**
|
|
1137
1146
|
* Utility for fill null value with number 0.
|
|
@@ -1199,8 +1208,8 @@ var _SparkLine = class _SparkLine extends react_exports.Component {
|
|
|
1199
1208
|
if (!isArea || points.length === 0) {
|
|
1200
1209
|
return null;
|
|
1201
1210
|
}
|
|
1202
|
-
|
|
1203
|
-
segments =
|
|
1211
|
+
const { lines } = this.getSegmentSets(data, points);
|
|
1212
|
+
const segments = lines.map(
|
|
1204
1213
|
(s) => s.concat([
|
|
1205
1214
|
[s.at(-1)[0], height],
|
|
1206
1215
|
// down to bottom of graph
|
|
@@ -1246,6 +1255,7 @@ var _SparkLine = class _SparkLine extends react_exports.Component {
|
|
|
1246
1255
|
}
|
|
1247
1256
|
renderTooltip(tooltipValue, isOpen) {
|
|
1248
1257
|
const { anchor } = this.state;
|
|
1258
|
+
const displayValue = tooltipValue === null ? "-" : tooltipValue;
|
|
1249
1259
|
return /* @__PURE__ */ react_default.createElement(
|
|
1250
1260
|
Popover_default,
|
|
1251
1261
|
{
|
|
@@ -1257,7 +1267,7 @@ var _SparkLine = class _SparkLine extends react_exports.Component {
|
|
|
1257
1267
|
defaultPlacement: "above",
|
|
1258
1268
|
animation: false
|
|
1259
1269
|
},
|
|
1260
|
-
/* @__PURE__ */ react_default.createElement(StyledTooltip, null,
|
|
1270
|
+
/* @__PURE__ */ react_default.createElement(StyledTooltip, null, displayValue)
|
|
1261
1271
|
);
|
|
1262
1272
|
}
|
|
1263
1273
|
/**
|
|
@@ -1287,16 +1297,46 @@ var _SparkLine = class _SparkLine extends react_exports.Component {
|
|
|
1287
1297
|
}
|
|
1288
1298
|
)));
|
|
1289
1299
|
}
|
|
1300
|
+
/**
|
|
1301
|
+
* Renders circles for isolated points (single data points surrounded by nulls)
|
|
1302
|
+
* These would otherwise be invisible since a line requires at least 2 points
|
|
1303
|
+
* @method renderIsolatedPoints
|
|
1304
|
+
* @param {Array} isolatedPoints - Array of [x, y] coordinates for isolated points
|
|
1305
|
+
* @returns {Object} SVG Group of circles
|
|
1306
|
+
*/
|
|
1307
|
+
renderIsolatedPoints(isolatedPoints) {
|
|
1308
|
+
const { lineColor, lineStrokeWidth } = this.props;
|
|
1309
|
+
if (!isolatedPoints || isolatedPoints.length === 0) {
|
|
1310
|
+
return null;
|
|
1311
|
+
}
|
|
1312
|
+
const radius = lineStrokeWidth + 0.5;
|
|
1313
|
+
return /* @__PURE__ */ react_default.createElement("g", { "data-test": "isolated-points" }, isolatedPoints.map((point) => /* @__PURE__ */ react_default.createElement(
|
|
1314
|
+
"circle",
|
|
1315
|
+
{
|
|
1316
|
+
key: `isolated-${point[0]}-${point[1]}`,
|
|
1317
|
+
"data-test": "isolated-point",
|
|
1318
|
+
cx: point[0],
|
|
1319
|
+
cy: point[1],
|
|
1320
|
+
r: radius,
|
|
1321
|
+
style: {
|
|
1322
|
+
fill: lineColor
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
)));
|
|
1326
|
+
}
|
|
1290
1327
|
/**
|
|
1291
1328
|
* Renders the line(s) above the area graph
|
|
1292
1329
|
* @method renderPolyline
|
|
1293
1330
|
* @param {Array} points
|
|
1294
|
-
* @returns {Object} SVG Group of polylines
|
|
1331
|
+
* @returns {Object} SVG Group of polylines and isolated points
|
|
1295
1332
|
*/
|
|
1296
1333
|
renderPolyline(points) {
|
|
1297
1334
|
const { data, lineColor, lineLength, lineStrokeWidth } = this.props;
|
|
1298
1335
|
const linePoints = (0, lodash_exports.isFinite)(lineLength) && lineLength > 0 ? lineLength : points.length;
|
|
1299
|
-
const lines = this.getSegmentSets(
|
|
1336
|
+
const { lines, isolatedPoints } = this.getSegmentSets(
|
|
1337
|
+
data.slice(-linePoints),
|
|
1338
|
+
points.slice(-linePoints)
|
|
1339
|
+
);
|
|
1300
1340
|
return /* @__PURE__ */ react_default.createElement("g", { "data-test": "sparkline" }, lines.map((lineData) => /* @__PURE__ */ react_default.createElement(
|
|
1301
1341
|
"polyline",
|
|
1302
1342
|
{
|
|
@@ -1311,7 +1351,7 @@ var _SparkLine = class _SparkLine extends react_exports.Component {
|
|
|
1311
1351
|
},
|
|
1312
1352
|
points: lineData.join(" ")
|
|
1313
1353
|
}
|
|
1314
|
-
)));
|
|
1354
|
+
)), this.renderIsolatedPoints(isolatedPoints));
|
|
1315
1355
|
}
|
|
1316
1356
|
getInteractionState({ data, points, showTooltip, activeIndex, hoveredIndex, componentIsFocused }) {
|
|
1317
1357
|
if (!showTooltip) {
|
|
@@ -1519,6 +1559,21 @@ var SparkLine = _SparkLine;
|
|
|
1519
1559
|
var SparkLine_default = SparkLine;
|
|
1520
1560
|
|
|
1521
1561
|
// src/SingleValue/PureSingleValue/SingleValueSparkline.jsx
|
|
1562
|
+
var processDataForNullDisplay = (data, nullValueDisplay) => {
|
|
1563
|
+
if (!Array.isArray(data)) {
|
|
1564
|
+
return [];
|
|
1565
|
+
}
|
|
1566
|
+
if (nullValueDisplay === "connect") {
|
|
1567
|
+
return data.filter((d) => d !== null);
|
|
1568
|
+
}
|
|
1569
|
+
return data;
|
|
1570
|
+
};
|
|
1571
|
+
var getAcceptNull = (nullValueDisplay) => (
|
|
1572
|
+
// acceptNull=true treats null as 0 (for 'zero' mode)
|
|
1573
|
+
// acceptNull=false creates gaps (for 'gaps' mode)
|
|
1574
|
+
// For 'connect' mode, nulls are filtered out so this doesn't matter
|
|
1575
|
+
nullValueDisplay === "zero"
|
|
1576
|
+
);
|
|
1522
1577
|
var SingleValueSparkline = ({
|
|
1523
1578
|
width,
|
|
1524
1579
|
height,
|
|
@@ -1530,42 +1585,64 @@ var SingleValueSparkline = ({
|
|
|
1530
1585
|
isArea,
|
|
1531
1586
|
lineLength = 0,
|
|
1532
1587
|
endDotCount = 0,
|
|
1533
|
-
acceptNull =
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
{
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
fillOpacity: fillOpacity.toString(10),
|
|
1540
|
-
data,
|
|
1541
|
-
height,
|
|
1542
|
-
width,
|
|
1543
|
-
showTooltip,
|
|
1544
|
-
isArea,
|
|
1545
|
-
lineStrokeWidth: 1.5,
|
|
1546
|
-
lineLength: isArea ? lineLength : void 0,
|
|
1547
|
-
endDotCount: isArea ? endDotCount : void 0,
|
|
1548
|
-
endDotRadius: Math.min(width, height) < 15 ? 1 : 3,
|
|
1549
|
-
endDotStroke: (0, propUtils_exports.formatColor)(stroke),
|
|
1550
|
-
endDotFillColor: (0, propUtils_exports.formatColor)(stroke),
|
|
1551
|
-
acceptNull,
|
|
1552
|
-
style: {
|
|
1553
|
-
flex: "0 0 auto",
|
|
1554
|
-
justifyContent: "center",
|
|
1555
|
-
display: "flex",
|
|
1556
|
-
alignItems: "flex-end"
|
|
1588
|
+
acceptNull = false,
|
|
1589
|
+
nullValueDisplay
|
|
1590
|
+
}) => {
|
|
1591
|
+
const effectiveNullValueDisplay = (0, react_exports.useMemo)(() => {
|
|
1592
|
+
if (nullValueDisplay !== void 0) {
|
|
1593
|
+
return nullValueDisplay;
|
|
1557
1594
|
}
|
|
1558
|
-
|
|
1559
|
-
|
|
1595
|
+
if (acceptNull === true) {
|
|
1596
|
+
return "zero";
|
|
1597
|
+
}
|
|
1598
|
+
return "gaps";
|
|
1599
|
+
}, [nullValueDisplay, acceptNull]);
|
|
1600
|
+
const processedData = (0, react_exports.useMemo)(
|
|
1601
|
+
() => processDataForNullDisplay(data, effectiveNullValueDisplay),
|
|
1602
|
+
[data, effectiveNullValueDisplay]
|
|
1603
|
+
);
|
|
1604
|
+
const sparklineAcceptNull = (0, react_exports.useMemo)(
|
|
1605
|
+
() => getAcceptNull(effectiveNullValueDisplay),
|
|
1606
|
+
[effectiveNullValueDisplay]
|
|
1607
|
+
);
|
|
1608
|
+
return /* @__PURE__ */ react_default.createElement(
|
|
1609
|
+
SparkLine_default,
|
|
1610
|
+
{
|
|
1611
|
+
lineColor: (0, propUtils_exports.formatColor)(stroke),
|
|
1612
|
+
fillColor: (0, propUtils_exports.formatColor)(fill),
|
|
1613
|
+
fillOpacity: fillOpacity.toString(10),
|
|
1614
|
+
data: processedData,
|
|
1615
|
+
height,
|
|
1616
|
+
width,
|
|
1617
|
+
showTooltip,
|
|
1618
|
+
isArea,
|
|
1619
|
+
lineStrokeWidth: 1.5,
|
|
1620
|
+
lineLength: isArea ? lineLength : void 0,
|
|
1621
|
+
endDotCount: isArea ? endDotCount : void 0,
|
|
1622
|
+
endDotRadius: Math.min(width, height) < 15 ? 1 : 3,
|
|
1623
|
+
endDotStroke: (0, propUtils_exports.formatColor)(stroke),
|
|
1624
|
+
endDotFillColor: (0, propUtils_exports.formatColor)(stroke),
|
|
1625
|
+
acceptNull: sparklineAcceptNull,
|
|
1626
|
+
style: {
|
|
1627
|
+
flex: "0 0 auto",
|
|
1628
|
+
justifyContent: "center",
|
|
1629
|
+
display: "flex",
|
|
1630
|
+
alignItems: "flex-end"
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
);
|
|
1634
|
+
};
|
|
1560
1635
|
SingleValueSparkline.propTypes = {
|
|
1636
|
+
/** @deprecated Use nullValueDisplay instead */
|
|
1561
1637
|
acceptNull: prop_types_default.bool,
|
|
1562
|
-
data: prop_types_default.arrayOf(prop_types_default.number),
|
|
1638
|
+
data: prop_types_default.arrayOf(prop_types_default.oneOfType([prop_types_default.number, prop_types_default.oneOf([null])])),
|
|
1563
1639
|
endDotCount: prop_types_default.number,
|
|
1564
1640
|
fill: prop_types_default.string,
|
|
1565
1641
|
fillOpacity: prop_types_default.number,
|
|
1566
1642
|
height: prop_types_default.number,
|
|
1567
1643
|
isArea: prop_types_default.bool,
|
|
1568
1644
|
lineLength: prop_types_default.number,
|
|
1645
|
+
nullValueDisplay: prop_types_default.oneOf(["gaps", "zero", "connect"]),
|
|
1569
1646
|
showTooltip: prop_types_default.bool,
|
|
1570
1647
|
stroke: prop_types_default.string,
|
|
1571
1648
|
width: prop_types_default.number
|
|
@@ -1603,17 +1680,13 @@ var getAvailableContentHeight = ({
|
|
|
1603
1680
|
return majorTextFontSize + CONTENT_SPARKLINE_SPACING + underLabelHeight;
|
|
1604
1681
|
};
|
|
1605
1682
|
var isValidPosition = (sparklinePosition) => VALID_SPARKLINE_POSITIONS.indexOf(sparklinePosition) > -1;
|
|
1606
|
-
var parseSparklineValues = ({ sparklineValues }) => (
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
}
|
|
1614
|
-
return numV || v;
|
|
1615
|
-
}) : void 0
|
|
1616
|
-
);
|
|
1683
|
+
var parseSparklineValues = ({ sparklineValues }) => Array.isArray(sparklineValues) ? sparklineValues.map((v) => {
|
|
1684
|
+
const numV = (0, numberUtils_exports.parseNumber)(v);
|
|
1685
|
+
if (numV === 0) {
|
|
1686
|
+
return null;
|
|
1687
|
+
}
|
|
1688
|
+
return numV || v;
|
|
1689
|
+
}) : void 0;
|
|
1617
1690
|
var shouldShowSparkline = ({ showSparkline, sparklineValues }) => showSparkline && Array.isArray(sparklineValues) && sparklineValues.length > 1 && sparklineValues.every((v) => v === null || !Number.isNaN((0, numberUtils_exports.parseNumber)(v))) && sparklineValues.filter((v) => v !== null).length > 0;
|
|
1618
1691
|
var getSparklineWidth = ({ width, isSparklinePositionBelow }) => {
|
|
1619
1692
|
const spaceRatio = isSparklinePositionBelow ? 1 : 0.6;
|
|
@@ -1748,7 +1821,7 @@ var SingleValueContent = (_a) => {
|
|
|
1748
1821
|
sparklineStrokeColor,
|
|
1749
1822
|
showSparklineTooltip,
|
|
1750
1823
|
showSparklineAreaGraph,
|
|
1751
|
-
|
|
1824
|
+
sparklineNullValueDisplay,
|
|
1752
1825
|
sparklineSegments,
|
|
1753
1826
|
endDots,
|
|
1754
1827
|
align
|
|
@@ -1765,7 +1838,7 @@ var SingleValueContent = (_a) => {
|
|
|
1765
1838
|
stroke: sparklineStrokeColor,
|
|
1766
1839
|
showTooltip: showSparklineTooltip,
|
|
1767
1840
|
isArea: showSparklineAreaGraph,
|
|
1768
|
-
|
|
1841
|
+
nullValueDisplay: sparklineNullValueDisplay,
|
|
1769
1842
|
lineLength: sparklineSegments,
|
|
1770
1843
|
endDotCount: endDots
|
|
1771
1844
|
}
|
|
@@ -1812,7 +1885,7 @@ SingleValueContent.propTypes = __spreadProps(__spreadValues({}, SingleValueBasic
|
|
|
1812
1885
|
sparklineStrokeColor: prop_types_default.string,
|
|
1813
1886
|
showSparklineTooltip: prop_types_default.bool,
|
|
1814
1887
|
showSparklineAreaGraph: prop_types_default.bool,
|
|
1815
|
-
|
|
1888
|
+
sparklineNullValueDisplay: prop_types_default.oneOf(["gaps", "zero", "connect"]),
|
|
1816
1889
|
sparklineSegments: prop_types_default.number,
|
|
1817
1890
|
endDots: prop_types_default.number
|
|
1818
1891
|
});
|
|
@@ -1854,34 +1927,31 @@ var Container = styled_components_default.div`
|
|
|
1854
1927
|
var SingleValue = (_a) => {
|
|
1855
1928
|
var props = __objRest(_a, []);
|
|
1856
1929
|
const {
|
|
1857
|
-
width,
|
|
1930
|
+
width = "100%",
|
|
1858
1931
|
height = 250,
|
|
1859
|
-
hasEventHandlers,
|
|
1932
|
+
hasEventHandlers = false,
|
|
1860
1933
|
style,
|
|
1861
1934
|
majorFontSize,
|
|
1862
|
-
majorValue,
|
|
1935
|
+
majorValue = "N/A",
|
|
1863
1936
|
majorValueDisplay,
|
|
1864
|
-
majorValueField,
|
|
1937
|
+
majorValueField = "",
|
|
1865
1938
|
trendValue,
|
|
1866
1939
|
trendFontSize,
|
|
1867
|
-
unitPosition,
|
|
1868
|
-
underLabelFontSize,
|
|
1869
|
-
numberPrecision,
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
shouldAbbreviateTrendValue,
|
|
1874
|
-
// fixme todo probably belongs in a DSL formatter
|
|
1875
|
-
shouldAbbreviateMajorValue,
|
|
1876
|
-
// fixme todo probably belongs in a DSL formatter
|
|
1940
|
+
unitPosition = "after",
|
|
1941
|
+
underLabelFontSize = 12,
|
|
1942
|
+
numberPrecision = 0,
|
|
1943
|
+
shouldUseThousandSeparators = true,
|
|
1944
|
+
shouldAbbreviateTrendValue = false,
|
|
1945
|
+
shouldAbbreviateMajorValue = false,
|
|
1877
1946
|
sparklineValues,
|
|
1878
|
-
sparklineHighlightSegments,
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
onValueClick
|
|
1947
|
+
sparklineHighlightSegments = 0,
|
|
1948
|
+
sparklineHighlightDots = 0,
|
|
1949
|
+
showSparklineAreaGraph = false,
|
|
1950
|
+
showSparklineTooltip = false,
|
|
1951
|
+
shouldSparklineAcceptNullData = true,
|
|
1952
|
+
sparklineNullValueDisplay,
|
|
1953
|
+
onValueClick = () => {
|
|
1954
|
+
},
|
|
1885
1955
|
defaultFontColor,
|
|
1886
1956
|
defaultBackgroundColor: defaultBackgroundColor2,
|
|
1887
1957
|
defaultBlockFontColor,
|
|
@@ -1891,7 +1961,7 @@ var SingleValue = (_a) => {
|
|
|
1891
1961
|
splitByLayout,
|
|
1892
1962
|
trellisKey = "",
|
|
1893
1963
|
trellisSplitBy = "",
|
|
1894
|
-
align
|
|
1964
|
+
align = "center"
|
|
1895
1965
|
} = props;
|
|
1896
1966
|
const defaultColors = {
|
|
1897
1967
|
defaultFontColor,
|
|
@@ -1907,16 +1977,11 @@ var SingleValue = (_a) => {
|
|
|
1907
1977
|
}, []);
|
|
1908
1978
|
const trellisEnabled = useTrellisEnabled(splitByLayout);
|
|
1909
1979
|
const handleValueClick = (0, react_exports.useCallback)(
|
|
1910
|
-
(ev) => handleValueClickCallback(
|
|
1911
|
-
ev,
|
|
1912
|
-
majorValue,
|
|
1913
|
-
majorValueField,
|
|
1914
|
-
trendValue,
|
|
1915
|
-
onValueClick,
|
|
1980
|
+
(ev) => handleValueClickCallback(ev, majorValue, majorValueField, trendValue, onValueClick, {
|
|
1916
1981
|
trellisEnabled,
|
|
1917
1982
|
trellisSplitBy,
|
|
1918
1983
|
trellisKey
|
|
1919
|
-
),
|
|
1984
|
+
}),
|
|
1920
1985
|
[onValueClick, majorValue, majorValueField, trendValue, trellisEnabled, trellisSplitBy, trellisKey]
|
|
1921
1986
|
);
|
|
1922
1987
|
const { backgroundEnabled, backgroundColor, majorColor, trendColor, underLabelColor } = computeColors(
|
|
@@ -1928,6 +1993,15 @@ var SingleValue = (_a) => {
|
|
|
1928
1993
|
backgroundColor,
|
|
1929
1994
|
sparklineSeverityColors
|
|
1930
1995
|
}).stroke;
|
|
1996
|
+
const effectiveSparklineNullValueDisplay = (0, react_exports.useMemo)(() => {
|
|
1997
|
+
if (sparklineNullValueDisplay !== void 0) {
|
|
1998
|
+
return sparklineNullValueDisplay;
|
|
1999
|
+
}
|
|
2000
|
+
if (shouldSparklineAcceptNullData === true) {
|
|
2001
|
+
return "zero";
|
|
2002
|
+
}
|
|
2003
|
+
return "gaps";
|
|
2004
|
+
}, [sparklineNullValueDisplay, shouldSparklineAcceptNullData]);
|
|
1931
2005
|
const renderVisualization = () => {
|
|
1932
2006
|
if (!containerWidth || !containerHeight) {
|
|
1933
2007
|
return null;
|
|
@@ -2029,7 +2103,7 @@ var SingleValue = (_a) => {
|
|
|
2029
2103
|
sparklineStrokeColor,
|
|
2030
2104
|
showSparklineTooltip,
|
|
2031
2105
|
showSparklineAreaGraph,
|
|
2032
|
-
|
|
2106
|
+
sparklineNullValueDisplay: effectiveSparklineNullValueDisplay,
|
|
2033
2107
|
sparklineSegments,
|
|
2034
2108
|
endDots,
|
|
2035
2109
|
align
|
|
@@ -2077,6 +2151,7 @@ SingleValue.propTypes = {
|
|
|
2077
2151
|
sparklineAreaColor: prop_types_default.string,
|
|
2078
2152
|
sparklineStrokeColor: prop_types_default.string,
|
|
2079
2153
|
shouldSparklineAcceptNullData: prop_types_default.bool,
|
|
2154
|
+
sparklineNullValueDisplay: prop_types_default.oneOf(["gaps", "zero", "connect"]),
|
|
2080
2155
|
sparklineHighlightSegments: prop_types_default.number,
|
|
2081
2156
|
sparklineHighlightDots: prop_types_default.number,
|
|
2082
2157
|
hasEventHandlers: prop_types_default.bool,
|
|
@@ -2091,31 +2166,6 @@ SingleValue.propTypes = {
|
|
|
2091
2166
|
trellisSplitBy: prop_types_default.string,
|
|
2092
2167
|
align: prop_types_default.string
|
|
2093
2168
|
};
|
|
2094
|
-
SingleValue.defaultProps = {
|
|
2095
|
-
width: "100%",
|
|
2096
|
-
height: 250,
|
|
2097
|
-
majorValue: "N/A",
|
|
2098
|
-
majorValueField: "",
|
|
2099
|
-
trendDisplay: "absolute",
|
|
2100
|
-
shouldAbbreviateTrendValue: false,
|
|
2101
|
-
shouldAbbreviateMajorValue: false,
|
|
2102
|
-
unitPosition: "after",
|
|
2103
|
-
underLabelFontSize: 12,
|
|
2104
|
-
numberPrecision: 0,
|
|
2105
|
-
shouldUseThousandSeparators: true,
|
|
2106
|
-
showSparklineTooltip: false,
|
|
2107
|
-
showSparklineAreaGraph: false,
|
|
2108
|
-
sparklineDisplay: "below",
|
|
2109
|
-
shouldSparklineAcceptNullData: true,
|
|
2110
|
-
sparklineHighlightSegments: 0,
|
|
2111
|
-
sparklineHighlightDots: 0,
|
|
2112
|
-
hasEventHandlers: false,
|
|
2113
|
-
onValueClick: () => {
|
|
2114
|
-
},
|
|
2115
|
-
trellisKey: "",
|
|
2116
|
-
trellisSplitBy: "",
|
|
2117
|
-
align: "center"
|
|
2118
|
-
};
|
|
2119
2169
|
var SingleValue_default = SingleValue;
|
|
2120
2170
|
|
|
2121
2171
|
// esm-externals:@splunk/themes/getSettingsFromThemedProps
|
|
@@ -2453,7 +2503,7 @@ var Cover = styled_components_default.div`
|
|
|
2453
2503
|
bottom: 0;
|
|
2454
2504
|
`;
|
|
2455
2505
|
var Blocker = styled_components_default.div.attrs({
|
|
2456
|
-
"data-splunk-visualization-version": "28.
|
|
2506
|
+
"data-splunk-visualization-version": "28.5.0 - b192418b7"
|
|
2457
2507
|
})`
|
|
2458
2508
|
position: relative;
|
|
2459
2509
|
width: 100%;
|
|
@@ -2543,7 +2593,7 @@ var withFixedSizeContainer = (Viz) => {
|
|
|
2543
2593
|
FixSizeItem,
|
|
2544
2594
|
{
|
|
2545
2595
|
"data-test": "fix-size-item",
|
|
2546
|
-
"data-splunk-visualization-version": "28.
|
|
2596
|
+
"data-splunk-visualization-version": "28.5.0 - b192418b7",
|
|
2547
2597
|
width,
|
|
2548
2598
|
height,
|
|
2549
2599
|
backgroundColor
|
|
@@ -2630,6 +2680,7 @@ var withPlaceholder = (Visualization, useIconPlaceholder = shouldShowIconPlaceho
|
|
|
2630
2680
|
var withPlaceholder_default = withPlaceholder;
|
|
2631
2681
|
|
|
2632
2682
|
// src/common/utils/dataUtils.ts
|
|
2683
|
+
var getFieldName = (field) => typeof field === "string" ? field : field.name;
|
|
2633
2684
|
var largestTriangleThreeBuckets = (data, threshold, preferredDownsampleIndices) => {
|
|
2634
2685
|
const dataLength = data.length;
|
|
2635
2686
|
const downsampledIndices = [];
|
|
@@ -2746,9 +2797,9 @@ var tryToCoerceAllDisplayedFields = (ds, xField, yFields, fieldTypes, options) =
|
|
|
2746
2797
|
let xColumn = [];
|
|
2747
2798
|
const yColumns = [];
|
|
2748
2799
|
const canDownsample = !ds.data.fields.some((field, index) => {
|
|
2749
|
-
var _a
|
|
2750
|
-
const fieldName = (
|
|
2751
|
-
const fieldType = (
|
|
2800
|
+
var _a;
|
|
2801
|
+
const fieldName = getFieldName(field);
|
|
2802
|
+
const fieldType = (_a = fieldTypes[index]) != null ? _a : "unknown";
|
|
2752
2803
|
const column = ds.data.columns[index];
|
|
2753
2804
|
let hasDisplayedColumnThatCantBeDownsampled = false;
|
|
2754
2805
|
if (fieldName === xField) {
|
|
@@ -3035,7 +3086,7 @@ var trellisUtils_default = "default" in defaultImport33 ? defaultImport33.defaul
|
|
|
3035
3086
|
var AGGREGATIONS = "aggregations";
|
|
3036
3087
|
var dataSourcesSplitByAggregationsUnknown = (dataSource) => {
|
|
3037
3088
|
var _a, _b, _c, _d;
|
|
3038
|
-
const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
|
|
3089
|
+
const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
|
|
3039
3090
|
const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
|
|
3040
3091
|
let splitDataSources = null;
|
|
3041
3092
|
let errorCode = null;
|
|
@@ -3056,7 +3107,7 @@ var dataSourcesSplitByAggregationsUnknown = (dataSource) => {
|
|
|
3056
3107
|
}
|
|
3057
3108
|
return { splitDataSources, errorCode };
|
|
3058
3109
|
};
|
|
3059
|
-
var toFieldEntries = (fields) => {
|
|
3110
|
+
var toFieldEntries = (fields = []) => {
|
|
3060
3111
|
return fields.map((field) => {
|
|
3061
3112
|
if (typeof field === "string") {
|
|
3062
3113
|
return { name: field };
|
|
@@ -3071,7 +3122,7 @@ var dataSourcesSplitByAggregationsTimechartAndChart = (dataSource) => {
|
|
|
3071
3122
|
let splitDataSources = null;
|
|
3072
3123
|
let splitByFields = [];
|
|
3073
3124
|
let errorCode = null;
|
|
3074
|
-
if (
|
|
3125
|
+
if (fields.length > 0) {
|
|
3075
3126
|
splitByFields = (0, trellisUtils_exports.extractDataSourceAggregationKeysChart)(fields);
|
|
3076
3127
|
}
|
|
3077
3128
|
if (splitByFields && splitByFields.length > 0) {
|
|
@@ -3109,12 +3160,12 @@ var dataSourcesSplitByAggregationsTimechartAndChart = (dataSource) => {
|
|
|
3109
3160
|
};
|
|
3110
3161
|
var dataSourcesSplitByAggregationsStats = (dataSource) => {
|
|
3111
3162
|
var _a, _b, _c, _d;
|
|
3112
|
-
const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
|
|
3163
|
+
const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
|
|
3113
3164
|
const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
|
|
3114
3165
|
let splitDataSources = null;
|
|
3115
3166
|
let splitByFields = [];
|
|
3116
3167
|
let errorCode = null;
|
|
3117
|
-
if (
|
|
3168
|
+
if (fields.length > 0) {
|
|
3118
3169
|
splitByFields = (0, trellisUtils_exports.extractDataSourceAggregationKeysStats)(fields);
|
|
3119
3170
|
}
|
|
3120
3171
|
if (splitByFields && splitByFields.length > 0) {
|
|
@@ -3138,12 +3189,12 @@ var dataSourcesSplitByAggregationsStats = (dataSource) => {
|
|
|
3138
3189
|
};
|
|
3139
3190
|
var dataSourcesSplitByModeTimechart = (dataSource, splitBy) => {
|
|
3140
3191
|
var _a, _b, _c, _d, _e;
|
|
3141
|
-
const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
|
|
3192
|
+
const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
|
|
3142
3193
|
const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
|
|
3143
3194
|
let splitDataSources = null;
|
|
3144
3195
|
let splitByFields = [];
|
|
3145
3196
|
let errorCode = null;
|
|
3146
|
-
if (
|
|
3197
|
+
if (fields.length > 0) {
|
|
3147
3198
|
splitByFields = (0, trellisUtils_exports.extractSplitByFieldsChartFields)(fields);
|
|
3148
3199
|
}
|
|
3149
3200
|
if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
|
|
@@ -3159,16 +3210,14 @@ var dataSourcesSplitByModeTimechart = (dataSource, splitBy) => {
|
|
|
3159
3210
|
splitDataSources[val] = (0, lodash_exports.cloneDeep)(
|
|
3160
3211
|
(0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
|
|
3161
3212
|
);
|
|
3162
|
-
splitDataSources[val].primary.data.fields = [
|
|
3163
|
-
{ name: fields[0].name },
|
|
3164
|
-
...dataSourceKeys.map((k) => ({
|
|
3165
|
-
name: k
|
|
3166
|
-
}))
|
|
3167
|
-
];
|
|
3213
|
+
splitDataSources[val].primary.data.fields = [{ name: fields[0].name }];
|
|
3168
3214
|
splitDataSources[val].primary.data.columns = [[...columns[0]]];
|
|
3169
3215
|
dataSourceKeys.forEach((dsKey) => {
|
|
3170
3216
|
fields.forEach((field, idx) => {
|
|
3171
3217
|
if (field.data_source === dsKey && (field.splitby_value === val || field.name === val)) {
|
|
3218
|
+
splitDataSources[val].primary.data.fields.push({
|
|
3219
|
+
name: dsKey
|
|
3220
|
+
});
|
|
3172
3221
|
splitDataSources[val].primary.data.columns.push([...columns[idx]]);
|
|
3173
3222
|
}
|
|
3174
3223
|
});
|
|
@@ -3181,12 +3230,12 @@ var dataSourcesSplitByModeTimechart = (dataSource, splitBy) => {
|
|
|
3181
3230
|
};
|
|
3182
3231
|
var dataSourcesSplitByModeChart = (dataSource, splitBy) => {
|
|
3183
3232
|
var _a, _b, _c, _d;
|
|
3184
|
-
const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
|
|
3233
|
+
const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
|
|
3185
3234
|
const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
|
|
3186
3235
|
let splitDataSources = null;
|
|
3187
3236
|
let splitByFields = [];
|
|
3188
3237
|
let errorCode = null;
|
|
3189
|
-
if (
|
|
3238
|
+
if (fields.length > 0) {
|
|
3190
3239
|
splitByFields = (0, trellisUtils_exports.extractSplitByFieldsChartFields)(fields);
|
|
3191
3240
|
}
|
|
3192
3241
|
if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
|
|
@@ -3274,17 +3323,15 @@ var dataSourcesSplitByModeChart = (dataSource, splitBy) => {
|
|
|
3274
3323
|
};
|
|
3275
3324
|
var dataSourcesSplitByModeStatsorUnknown = (dataSource, splitBy, splitMode) => {
|
|
3276
3325
|
var _a, _b, _c, _d, _e, _f;
|
|
3277
|
-
const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
|
|
3326
|
+
const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
|
|
3278
3327
|
const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
|
|
3279
3328
|
let splitDataSources = null;
|
|
3280
3329
|
let splitByFields = [];
|
|
3281
3330
|
let errorCode = null;
|
|
3282
|
-
if (
|
|
3331
|
+
if (fields.length > 0) {
|
|
3283
3332
|
splitByFields = splitMode !== trellisUtils_exports.UNKNOWN ? (0, trellisUtils_exports.extractSplitByFieldsForStats)(fields) : (0, trellisUtils_exports.extractSplitByFieldsForUnknown)(fields);
|
|
3284
3333
|
}
|
|
3285
|
-
const splitByIndex = fields
|
|
3286
|
-
(field) => field === splitBy || field.name === splitBy
|
|
3287
|
-
);
|
|
3334
|
+
const splitByIndex = fields.findIndex((field) => field.name === splitBy);
|
|
3288
3335
|
if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
|
|
3289
3336
|
const splitByColumn = (_f = (_e = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _e.data) == null ? void 0 : _f.columns[splitByIndex];
|
|
3290
3337
|
splitDataSources = {};
|
|
@@ -3419,6 +3466,16 @@ var triangleEventAnnotationRenderer = ({
|
|
|
3419
3466
|
eventColor: eventWithColor.color
|
|
3420
3467
|
});
|
|
3421
3468
|
};
|
|
3469
|
+
var shouldEnableSearchZoom = (eventHandlers = [], xField = "") => {
|
|
3470
|
+
const rangeSelectEventHandler = eventHandlers.find(
|
|
3471
|
+
(eventHandler) => {
|
|
3472
|
+
var _a;
|
|
3473
|
+
return (_a = eventHandler.options.events) == null ? void 0 : _a.includes("range.select");
|
|
3474
|
+
}
|
|
3475
|
+
);
|
|
3476
|
+
const xAxisIsTime = xField === "_time";
|
|
3477
|
+
return !!rangeSelectEventHandler && xAxisIsTime;
|
|
3478
|
+
};
|
|
3422
3479
|
var canvasSupportedTimeSeriesCharts = ["splunk.line"];
|
|
3423
3480
|
var isTimeSeriesCanvasRenderSupported = (vizConfigKey) => {
|
|
3424
3481
|
return canvasSupportedTimeSeriesCharts.indexOf(vizConfigKey) > -1;
|
|
@@ -3439,17 +3496,34 @@ var filterChartDataFromInternalFields = (chartData) => {
|
|
|
3439
3496
|
var convert2DArrayToNumbers = (arr) => {
|
|
3440
3497
|
return arr.map((subArray) => subArray.map((element) => parseFloat(element)));
|
|
3441
3498
|
};
|
|
3442
|
-
var
|
|
3443
|
-
|
|
3499
|
+
var parseAxisValue = (val) => {
|
|
3500
|
+
if (val === void 0 || val === null || val === "auto" || val === "") {
|
|
3501
|
+
return void 0;
|
|
3502
|
+
}
|
|
3503
|
+
const num = typeof val === "number" ? val : Number.parseFloat(val);
|
|
3504
|
+
return Number.isNaN(num) ? void 0 : num;
|
|
3505
|
+
};
|
|
3506
|
+
var parseXAxisLineVisibility = (visibility) => {
|
|
3507
|
+
if (visibility === "hide") return false;
|
|
3508
|
+
if (visibility === "show") return true;
|
|
3509
|
+
return void 0;
|
|
3510
|
+
};
|
|
3444
3511
|
var getLegend = (props) => {
|
|
3445
3512
|
const legendPlacement = props == null ? void 0 : props.legendDisplay;
|
|
3513
|
+
const { isSeriesCompare, legendTruncation } = props;
|
|
3514
|
+
const commonLegendProps = {
|
|
3515
|
+
center: true,
|
|
3516
|
+
fontSize: 12,
|
|
3517
|
+
largerTiles: true,
|
|
3518
|
+
hideSeriesValue: !isSeriesCompare,
|
|
3519
|
+
// Show values if in seriesCompare mode
|
|
3520
|
+
legendTruncation
|
|
3521
|
+
};
|
|
3446
3522
|
switch (legendPlacement) {
|
|
3447
3523
|
case "off":
|
|
3448
3524
|
return false;
|
|
3449
3525
|
case "left":
|
|
3450
|
-
return (0, visualization_canvas_exports.LeftLegendFactory)(__spreadValues({
|
|
3451
|
-
width: SideLegendWidth
|
|
3452
|
-
}, commonLegendProps));
|
|
3526
|
+
return (0, visualization_canvas_exports.LeftLegendFactory)(__spreadValues({}, commonLegendProps));
|
|
3453
3527
|
case "bottom":
|
|
3454
3528
|
return (0, visualization_canvas_exports.BottomLegendFactory)(__spreadValues({
|
|
3455
3529
|
wrap: true
|
|
@@ -3459,9 +3533,7 @@ var getLegend = (props) => {
|
|
|
3459
3533
|
wrap: true
|
|
3460
3534
|
}, commonLegendProps));
|
|
3461
3535
|
default:
|
|
3462
|
-
return (0, visualization_canvas_exports.SideLegendFactory)(__spreadValues({
|
|
3463
|
-
width: SideLegendWidth
|
|
3464
|
-
}, commonLegendProps));
|
|
3536
|
+
return (0, visualization_canvas_exports.SideLegendFactory)(__spreadValues({}, commonLegendProps));
|
|
3465
3537
|
}
|
|
3466
3538
|
};
|
|
3467
3539
|
var getComputedAxisTitles = (inputAxisTitle, fields, axisTitleVisibility) => {
|
|
@@ -3496,22 +3568,25 @@ var ellipsisAxisTitle = (axisTitle, containerSpacing, fontSize = 12) => {
|
|
|
3496
3568
|
const end = axisTitle.slice(-halfChars);
|
|
3497
3569
|
return `${start}...${end}`;
|
|
3498
3570
|
};
|
|
3499
|
-
var
|
|
3571
|
+
var getFieldName2 = (field) => {
|
|
3500
3572
|
const fieldName = typeof field === "object" ? field == null ? void 0 : field.name : field;
|
|
3501
3573
|
return fieldName;
|
|
3502
3574
|
};
|
|
3503
3575
|
var getFieldNames = (fields) => {
|
|
3504
|
-
return fields.map((field) =>
|
|
3576
|
+
return fields.map((field) => getFieldName2(field));
|
|
3505
3577
|
};
|
|
3506
|
-
var getXScaleConfig = (label, xAxisLabelVisibility) => {
|
|
3578
|
+
var getXScaleConfig = (label, xAxisLabelVisibility, xAxisLabelRotation) => {
|
|
3507
3579
|
const xConfig = { x: {} };
|
|
3508
3580
|
xConfig.x.label = label;
|
|
3509
3581
|
if (xAxisLabelVisibility === "hide") {
|
|
3510
3582
|
xConfig.x.hideLabels = true;
|
|
3511
3583
|
}
|
|
3584
|
+
if (xAxisLabelRotation !== void 0) {
|
|
3585
|
+
xConfig.x.labelRotation = xAxisLabelRotation;
|
|
3586
|
+
}
|
|
3512
3587
|
return xConfig;
|
|
3513
3588
|
};
|
|
3514
|
-
var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility) => {
|
|
3589
|
+
var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility, yAxisMin, yAxisMax) => {
|
|
3515
3590
|
const scaleType = yAxisScale != null ? yAxisScale : "linear";
|
|
3516
3591
|
const yConfig = { y: {} };
|
|
3517
3592
|
yConfig.y.label = label;
|
|
@@ -3519,34 +3594,46 @@ var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibilit
|
|
|
3519
3594
|
if (yAxisAbbreviation !== "none") {
|
|
3520
3595
|
yConfig.y.tickFmt = (v) => (0, visualization_canvas_exports.shortenNumber)(v, 1);
|
|
3521
3596
|
}
|
|
3522
|
-
if (yAxisAbbreviation
|
|
3523
|
-
yConfig.y.width = 55;
|
|
3524
|
-
} else {
|
|
3597
|
+
if (yAxisAbbreviation !== "none") {
|
|
3525
3598
|
yConfig.y.width = label && label.length > 0 ? 30 : 10;
|
|
3526
3599
|
}
|
|
3527
3600
|
if (yAxisLabelVisibility === "hide") {
|
|
3528
3601
|
yConfig.y.hideLabels = true;
|
|
3529
3602
|
}
|
|
3603
|
+
if (yAxisMin !== void 0 || yAxisMax !== void 0) {
|
|
3604
|
+
yConfig.y.range = (u, dataMin, dataMax) => {
|
|
3605
|
+
const min2 = yAxisMin != null ? yAxisMin : dataMin;
|
|
3606
|
+
const max2 = yAxisMax != null ? yAxisMax : dataMax;
|
|
3607
|
+
return [min2, max2];
|
|
3608
|
+
};
|
|
3609
|
+
}
|
|
3530
3610
|
return yConfig;
|
|
3531
3611
|
};
|
|
3532
|
-
var getY2ScaleConfig = (label, axisAbbreviation, axisScale, roundAxisLabelsToInteger, y2AxisLabelVisibility) => {
|
|
3612
|
+
var getY2ScaleConfig = (label, axisAbbreviation, axisScale, roundAxisLabelsToInteger, y2AxisLabelVisibility, y2AxisMin, y2AxisMax) => {
|
|
3533
3613
|
const y2Config = { y2: {} };
|
|
3534
3614
|
const scaleType = axisScale != null ? axisScale : "linear";
|
|
3535
3615
|
y2Config.y2.label = label;
|
|
3536
3616
|
y2Config.y2.side = "right";
|
|
3537
|
-
y2Config.y2.showGrid = false;
|
|
3538
3617
|
y2Config.y2.type = scaleType;
|
|
3539
3618
|
if (axisAbbreviation !== "none") {
|
|
3540
3619
|
y2Config.y2.tickFmt = (v) => (0, visualization_canvas_exports.shortenNumber)(v, 1, roundAxisLabelsToInteger);
|
|
3620
|
+
y2Config.y2.width = label && label.length > 0 ? 50 : 10;
|
|
3541
3621
|
} else if (roundAxisLabelsToInteger) {
|
|
3542
3622
|
y2Config.y2.tickFmt = (v) => roundAxisLabelsToInteger ? Math.round(v).toString() : v.toString();
|
|
3543
3623
|
}
|
|
3544
3624
|
if (y2AxisLabelVisibility === "hide") {
|
|
3545
3625
|
y2Config.y2.hideLabels = true;
|
|
3546
3626
|
}
|
|
3627
|
+
if (y2AxisMin !== void 0 || y2AxisMax !== void 0) {
|
|
3628
|
+
y2Config.y2.range = (u, dataMin, dataMax) => {
|
|
3629
|
+
const min2 = y2AxisMin != null ? y2AxisMin : dataMin;
|
|
3630
|
+
const max2 = y2AxisMax != null ? y2AxisMax : dataMax;
|
|
3631
|
+
return [min2, max2];
|
|
3632
|
+
};
|
|
3633
|
+
}
|
|
3547
3634
|
return y2Config;
|
|
3548
3635
|
};
|
|
3549
|
-
var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled, nullValueMode, markerDisplay) => {
|
|
3636
|
+
var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled, nullValueMode, markerDisplay, lineDashStyle, lineDashStylesByField, stepPosition, stepPositionsByField) => {
|
|
3550
3637
|
const seriesConfig = {};
|
|
3551
3638
|
let spanGaps;
|
|
3552
3639
|
let replaceNullsWithZero;
|
|
@@ -3573,6 +3660,8 @@ var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled
|
|
|
3573
3660
|
);
|
|
3574
3661
|
if (shouldAssignToY2) {
|
|
3575
3662
|
seriesConfig[field].overrides.scale = "y2";
|
|
3663
|
+
} else {
|
|
3664
|
+
seriesConfig[field].overrides.scale = "y";
|
|
3576
3665
|
}
|
|
3577
3666
|
}
|
|
3578
3667
|
if (overlayFields == null ? void 0 : overlayFields.includes(field)) {
|
|
@@ -3581,12 +3670,50 @@ var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled
|
|
|
3581
3670
|
if (markerDisplay !== void 0) {
|
|
3582
3671
|
seriesConfig[field].markerDisplay = markerDisplay;
|
|
3583
3672
|
}
|
|
3673
|
+
const fieldDashStyle = (lineDashStylesByField == null ? void 0 : lineDashStylesByField[field]) || lineDashStyle;
|
|
3674
|
+
if (fieldDashStyle) {
|
|
3675
|
+
seriesConfig[field].lineDashStyle = fieldDashStyle;
|
|
3676
|
+
}
|
|
3677
|
+
const hasFieldStepPosition = Object.hasOwn(stepPositionsByField || {}, field);
|
|
3678
|
+
const fieldStepPosition = hasFieldStepPosition ? stepPositionsByField == null ? void 0 : stepPositionsByField[field] : stepPosition;
|
|
3679
|
+
if (fieldStepPosition && fieldStepPosition !== "off") {
|
|
3680
|
+
seriesConfig[field].stepPosition = fieldStepPosition;
|
|
3681
|
+
}
|
|
3584
3682
|
if (replaceNullsWithZero !== void 0) {
|
|
3585
3683
|
seriesConfig[field].replaceNullsWithZero = replaceNullsWithZero;
|
|
3586
3684
|
}
|
|
3587
3685
|
});
|
|
3588
3686
|
return seriesConfig;
|
|
3589
3687
|
};
|
|
3688
|
+
var findRangeIndices = (xData, startValue, endValue) => {
|
|
3689
|
+
let startXIndex = -1;
|
|
3690
|
+
let endXIndex = -1;
|
|
3691
|
+
const xDataEpoch = xData.map((val) => {
|
|
3692
|
+
if (typeof val === "string") {
|
|
3693
|
+
return new Date(val).getTime() / 1e3;
|
|
3694
|
+
}
|
|
3695
|
+
return val;
|
|
3696
|
+
});
|
|
3697
|
+
for (let i = 0; i < xDataEpoch.length; i += 1) {
|
|
3698
|
+
if (xDataEpoch[i] >= startValue) {
|
|
3699
|
+
startXIndex = i;
|
|
3700
|
+
break;
|
|
3701
|
+
}
|
|
3702
|
+
}
|
|
3703
|
+
if (startXIndex === -1 && xDataEpoch.length > 0) {
|
|
3704
|
+
startXIndex = xDataEpoch.length - 1;
|
|
3705
|
+
}
|
|
3706
|
+
for (let i = xDataEpoch.length - 1; i >= 0; i -= 1) {
|
|
3707
|
+
if (xDataEpoch[i] <= endValue) {
|
|
3708
|
+
endXIndex = i;
|
|
3709
|
+
break;
|
|
3710
|
+
}
|
|
3711
|
+
}
|
|
3712
|
+
if (endXIndex === -1 && xDataEpoch.length > 0) {
|
|
3713
|
+
endXIndex = 0;
|
|
3714
|
+
}
|
|
3715
|
+
return { startXIndex, endXIndex };
|
|
3716
|
+
};
|
|
3590
3717
|
|
|
3591
3718
|
// src/common/TimeSeriesChartWrapper.tsx
|
|
3592
3719
|
var TimeSeriesChartContainer = styled_components_default.div`
|
|
@@ -3597,38 +3724,123 @@ var TimeSeriesChartContainer = styled_components_default.div`
|
|
|
3597
3724
|
position: absolute !important; // This is needed for canvas element export pdf/png to work correctly
|
|
3598
3725
|
}
|
|
3599
3726
|
`;
|
|
3600
|
-
var
|
|
3727
|
+
var appendTrellisToPayload = (payload, trellisKey, trellisSplitBy) => {
|
|
3728
|
+
const result = __spreadValues({}, payload);
|
|
3729
|
+
if (trellisSplitBy) {
|
|
3730
|
+
result["trellis.name"] = trellisSplitBy;
|
|
3731
|
+
}
|
|
3732
|
+
if (trellisKey) {
|
|
3733
|
+
result["trellis.value"] = trellisKey;
|
|
3734
|
+
}
|
|
3735
|
+
return result;
|
|
3736
|
+
};
|
|
3737
|
+
var hasMouseoverPayloadChanged = (currentPayload, previousPayload) => {
|
|
3738
|
+
if (!previousPayload) {
|
|
3739
|
+
return true;
|
|
3740
|
+
}
|
|
3741
|
+
if (currentPayload.index !== previousPayload.index) {
|
|
3742
|
+
return true;
|
|
3743
|
+
}
|
|
3744
|
+
if (currentPayload.seriesIndex !== previousPayload.seriesIndex) {
|
|
3745
|
+
return true;
|
|
3746
|
+
}
|
|
3747
|
+
if (currentPayload["trellis.name"] !== previousPayload["trellis.name"]) {
|
|
3748
|
+
return true;
|
|
3749
|
+
}
|
|
3750
|
+
if (currentPayload["trellis.value"] !== previousPayload["trellis.value"]) {
|
|
3751
|
+
return true;
|
|
3752
|
+
}
|
|
3753
|
+
return false;
|
|
3754
|
+
};
|
|
3755
|
+
var handleClick = (chartEvent, onClick, trellisKey, trellisSplitBy) => {
|
|
3601
3756
|
const payload = __spreadProps(__spreadValues({}, (0, lodash_exports.pick)(chartEvent, "value", "seriesKey")), {
|
|
3602
3757
|
name: chartEvent.seriesKey
|
|
3603
3758
|
});
|
|
3604
3759
|
delete payload.seriesKey;
|
|
3605
3760
|
if (chartEvent.rowContext) {
|
|
3606
|
-
Object.
|
|
3607
|
-
payload
|
|
3608
|
-
|
|
3761
|
+
Object.assign(
|
|
3762
|
+
payload,
|
|
3763
|
+
Object.keys(chartEvent.rowContext).reduce((acc, fieldName) => {
|
|
3764
|
+
acc[`row.${fieldName}.value`] = chartEvent.rowContext[fieldName];
|
|
3765
|
+
return acc;
|
|
3766
|
+
}, {})
|
|
3767
|
+
);
|
|
3609
3768
|
}
|
|
3769
|
+
const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
|
|
3610
3770
|
if (onClick) {
|
|
3611
3771
|
onClick({
|
|
3612
3772
|
type: "point.click",
|
|
3613
3773
|
originalEvent: chartEvent,
|
|
3614
|
-
payload
|
|
3774
|
+
payload: updatedPayload
|
|
3615
3775
|
});
|
|
3616
3776
|
}
|
|
3617
3777
|
};
|
|
3618
|
-
var handleLegendClick = (chartEvent, onClick) => {
|
|
3778
|
+
var handleLegendClick = (chartEvent, onClick, trellisKey, trellisSplitBy) => {
|
|
3619
3779
|
const payload = {
|
|
3620
3780
|
name: chartEvent
|
|
3621
3781
|
};
|
|
3782
|
+
const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
|
|
3622
3783
|
if (onClick) {
|
|
3623
3784
|
onClick({
|
|
3624
3785
|
type: "legend.click",
|
|
3625
3786
|
originalEvent: chartEvent,
|
|
3626
|
-
payload
|
|
3787
|
+
payload: updatedPayload
|
|
3788
|
+
});
|
|
3789
|
+
}
|
|
3790
|
+
};
|
|
3791
|
+
var handleRangeSelection = (rangeEvent, onSelect, chartData, trellisKey, trellisSplitBy) => {
|
|
3792
|
+
var _a;
|
|
3793
|
+
if (!rangeEvent) {
|
|
3794
|
+
return;
|
|
3795
|
+
}
|
|
3796
|
+
const xData = ((_a = chartData == null ? void 0 : chartData.columns) == null ? void 0 : _a[0]) || [];
|
|
3797
|
+
const { startXIndex, endXIndex } = findRangeIndices(xData, rangeEvent.start, rangeEvent.end);
|
|
3798
|
+
const payload = {
|
|
3799
|
+
startXIndex,
|
|
3800
|
+
startXValue: rangeEvent.start,
|
|
3801
|
+
endXIndex,
|
|
3802
|
+
endXValue: rangeEvent.end
|
|
3803
|
+
};
|
|
3804
|
+
const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
|
|
3805
|
+
if (onSelect) {
|
|
3806
|
+
onSelect({
|
|
3807
|
+
type: "range.selectBeforeZoom",
|
|
3808
|
+
originalEvent: rangeEvent,
|
|
3809
|
+
payload: updatedPayload
|
|
3810
|
+
});
|
|
3811
|
+
}
|
|
3812
|
+
};
|
|
3813
|
+
var handleRangeZoom = (rangeEvent, onSelect, chartData, trellisKey, trellisSplitBy) => {
|
|
3814
|
+
var _a;
|
|
3815
|
+
const xData = ((_a = chartData == null ? void 0 : chartData.columns) == null ? void 0 : _a[0]) || [];
|
|
3816
|
+
const { startXIndex, endXIndex } = findRangeIndices(xData, rangeEvent.start, rangeEvent.end);
|
|
3817
|
+
const payload = {
|
|
3818
|
+
startXIndex,
|
|
3819
|
+
startXValue: rangeEvent.start,
|
|
3820
|
+
endXIndex,
|
|
3821
|
+
endXValue: rangeEvent.end
|
|
3822
|
+
};
|
|
3823
|
+
const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
|
|
3824
|
+
if (onSelect) {
|
|
3825
|
+
onSelect({
|
|
3826
|
+
type: "range.select",
|
|
3827
|
+
originalEvent: rangeEvent,
|
|
3828
|
+
payload: updatedPayload
|
|
3627
3829
|
});
|
|
3628
3830
|
}
|
|
3629
3831
|
};
|
|
3832
|
+
var parseArrayOption = (value) => {
|
|
3833
|
+
if (Array.isArray(value)) {
|
|
3834
|
+
return value;
|
|
3835
|
+
}
|
|
3836
|
+
if (value) {
|
|
3837
|
+
return JSON.parse(value);
|
|
3838
|
+
}
|
|
3839
|
+
return void 0;
|
|
3840
|
+
};
|
|
3630
3841
|
var TimeSeriesChartWrapper = (props) => {
|
|
3631
|
-
|
|
3842
|
+
var _b, _c, _d;
|
|
3843
|
+
const _a = props, {
|
|
3632
3844
|
width,
|
|
3633
3845
|
height,
|
|
3634
3846
|
chartData,
|
|
@@ -3641,12 +3853,57 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
3641
3853
|
markerDisplay,
|
|
3642
3854
|
onClick,
|
|
3643
3855
|
onPointMouseOver,
|
|
3644
|
-
onPointMouseOut
|
|
3645
|
-
|
|
3646
|
-
|
|
3856
|
+
onPointMouseOut,
|
|
3857
|
+
onSelect,
|
|
3858
|
+
splitByLayout,
|
|
3859
|
+
trellisKey,
|
|
3860
|
+
trellisSplitBy,
|
|
3647
3861
|
backgroundColor,
|
|
3862
|
+
defaultFontColor,
|
|
3863
|
+
additionalTooltipValues,
|
|
3864
|
+
xAxisLineVisibility: xAxisLineVisibility,
|
|
3865
|
+
yAxisLineVisibility,
|
|
3866
|
+
y2AxisLineVisibility,
|
|
3867
|
+
showYAxisWithZero: showYAxisWithZeroFromProps,
|
|
3868
|
+
showY2AxisWithZero: showY2AxisWithZeroFromProps
|
|
3869
|
+
} = _a, otherOptions = __objRest(_a, [
|
|
3870
|
+
"width",
|
|
3871
|
+
"height",
|
|
3872
|
+
"chartData",
|
|
3873
|
+
"options",
|
|
3874
|
+
"userLocale",
|
|
3875
|
+
"annotationX",
|
|
3876
|
+
"annotationLabel",
|
|
3877
|
+
"annotationColor",
|
|
3878
|
+
"legendDisplay",
|
|
3879
|
+
"markerDisplay",
|
|
3880
|
+
"onClick",
|
|
3881
|
+
"onPointMouseOver",
|
|
3882
|
+
"onPointMouseOut",
|
|
3883
|
+
"onSelect",
|
|
3884
|
+
"splitByLayout",
|
|
3885
|
+
"trellisKey",
|
|
3886
|
+
"trellisSplitBy",
|
|
3887
|
+
"backgroundColor",
|
|
3888
|
+
"defaultFontColor",
|
|
3889
|
+
"additionalTooltipValues",
|
|
3890
|
+
// Extract axis line visibility options from props
|
|
3891
|
+
"xAxisLineVisibility",
|
|
3892
|
+
"yAxisLineVisibility",
|
|
3893
|
+
"y2AxisLineVisibility",
|
|
3894
|
+
// Extract showYAxisWithZero directly from props for accelerated render mode
|
|
3895
|
+
"showYAxisWithZero",
|
|
3896
|
+
"showY2AxisWithZero"
|
|
3897
|
+
]);
|
|
3898
|
+
const { eventHandlers, xField: xFieldFromProps } = otherOptions;
|
|
3899
|
+
const trellisEnabled = useTrellisEnabled(splitByLayout);
|
|
3900
|
+
const {
|
|
3901
|
+
backgroundColor: bgColorFromOptions,
|
|
3648
3902
|
seriesColors: seriesColorsStr,
|
|
3649
3903
|
fieldColors,
|
|
3904
|
+
legendLabels: legendLabelsStr,
|
|
3905
|
+
legendMode,
|
|
3906
|
+
legendTruncation,
|
|
3650
3907
|
"axisTitleX.text": xAxisTitleText,
|
|
3651
3908
|
"axisTitleY.text": yAxisTitleText,
|
|
3652
3909
|
"axisTitleY2.text": y2AxisTitleText,
|
|
@@ -3654,8 +3911,12 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
3654
3911
|
"axisTitleY.visibility": yAxisTitleVisibility,
|
|
3655
3912
|
"axisTitleY2.visibility": y2AxisTitleVisibility,
|
|
3656
3913
|
"axisLabelsX.majorLabelVisibility": xAxisLabelVisibility,
|
|
3914
|
+
"axisLabelsX.majorLabelStyle.rotation": xAxisLabelRotation,
|
|
3915
|
+
"axisLabelsX.maxLabelParts": xAxisMaxLabelParts,
|
|
3657
3916
|
"axisLabelsY.majorLabelVisibility": yAxisLabelVisibility,
|
|
3917
|
+
"axisLabelsY.majorUnit": yAxisMajorUnitFromSimpleXML,
|
|
3658
3918
|
"axisLabelsY2.majorLabelVisibility": y2AxisLabelVisibility,
|
|
3919
|
+
"axisLabelsY2.majorUnit": y2AxisMajorUnitFromSimpleXML,
|
|
3659
3920
|
"axisY.abbreviation": yAxisAbbreviation,
|
|
3660
3921
|
"axisY.scale": yAxisScale,
|
|
3661
3922
|
"axisY2.abbreviation": y2AxisAbbreviation,
|
|
@@ -3665,10 +3926,73 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
3665
3926
|
"axisLabelsY2.integerUnits": y2IntegerUnits,
|
|
3666
3927
|
"chart.overlayFields": overlayFieldsStr,
|
|
3667
3928
|
"chart.nullValueMode": nullValueMode,
|
|
3668
|
-
|
|
3929
|
+
"chart.showDataLabels": showDataLabels,
|
|
3930
|
+
lineWidth,
|
|
3931
|
+
lineDashStyle,
|
|
3932
|
+
fieldDashStyles: lineDashStylesByFieldStr,
|
|
3933
|
+
stepPosition,
|
|
3934
|
+
fieldStepPositions: stepPositionsByFieldStr,
|
|
3935
|
+
yAxisMin: yAxisMinRaw,
|
|
3936
|
+
yAxisMax: yAxisMaxRaw,
|
|
3937
|
+
y2AxisMin: y2AxisMinRaw,
|
|
3938
|
+
y2AxisMax: y2AxisMaxRaw,
|
|
3939
|
+
showXMajorGridLines,
|
|
3940
|
+
showYMajorGridLines,
|
|
3941
|
+
showY2MajorGridLines,
|
|
3942
|
+
showYMinorGridLines,
|
|
3943
|
+
showY2MinorGridLines,
|
|
3944
|
+
showLineSmoothing,
|
|
3945
|
+
xAxisMajorTickVisibility,
|
|
3946
|
+
xAxisMajorTickSize,
|
|
3947
|
+
yAxisMajorTickVisibility,
|
|
3948
|
+
y2AxisMajorTickVisibility,
|
|
3949
|
+
yAxisMajorTickSize,
|
|
3950
|
+
y2AxisMajorTickSize,
|
|
3951
|
+
yAxisMajorTickInterval,
|
|
3952
|
+
y2AxisMajorTickInterval,
|
|
3953
|
+
yAxisMinorTickVisibility,
|
|
3954
|
+
y2AxisMinorTickVisibility,
|
|
3955
|
+
yAxisMinorTickSize,
|
|
3956
|
+
y2AxisMinorTickSize,
|
|
3957
|
+
showYAxisWithZero: showYAxisWithZeroFromOptions,
|
|
3958
|
+
showY2AxisWithZero: showY2AxisWithZeroFromOptions
|
|
3669
3959
|
} = options;
|
|
3960
|
+
const dataValuesDisplay = showDataLabels === "none" ? "off" : showDataLabels;
|
|
3961
|
+
const showYAxisWithZero = showYAxisWithZeroFromProps != null ? showYAxisWithZeroFromProps : showYAxisWithZeroFromOptions;
|
|
3962
|
+
const showY2AxisWithZero = showY2AxisWithZeroFromProps != null ? showY2AxisWithZeroFromProps : showY2AxisWithZeroFromOptions;
|
|
3963
|
+
const showXMajorTicks = xAxisMajorTickVisibility !== "hide";
|
|
3964
|
+
const showYMajorTicks = yAxisMajorTickVisibility === "show";
|
|
3965
|
+
const showY2MajorTicks = y2AxisMajorTickVisibility === "show";
|
|
3966
|
+
const showYMinorTicks = yAxisMinorTickVisibility === "show";
|
|
3967
|
+
const showY2MinorTicks = y2AxisMinorTickVisibility === "show";
|
|
3968
|
+
const showXAxisLine = parseXAxisLineVisibility(xAxisLineVisibility);
|
|
3969
|
+
const showYAxisLine = yAxisLineVisibility === "show";
|
|
3970
|
+
const showY2AxisLine = y2AxisLineVisibility === "show";
|
|
3971
|
+
const yAxisMin = parseAxisValue(yAxisMinRaw);
|
|
3972
|
+
const yAxisMax = parseAxisValue(yAxisMaxRaw);
|
|
3973
|
+
const y2AxisMin = parseAxisValue(y2AxisMinRaw);
|
|
3974
|
+
const y2AxisMax = parseAxisValue(y2AxisMaxRaw);
|
|
3975
|
+
const parseTickInterval = (simpleXMLValue, canvasValue) => {
|
|
3976
|
+
if (simpleXMLValue) return Number(simpleXMLValue);
|
|
3977
|
+
if (canvasValue) return Number(canvasValue);
|
|
3978
|
+
return void 0;
|
|
3979
|
+
};
|
|
3980
|
+
const yAxisMajorTickIntervalNum = parseTickInterval(yAxisMajorUnitFromSimpleXML, yAxisMajorTickInterval);
|
|
3981
|
+
const y2AxisMajorTickIntervalNum = parseTickInterval(
|
|
3982
|
+
y2AxisMajorUnitFromSimpleXML,
|
|
3983
|
+
y2AxisMajorTickInterval
|
|
3984
|
+
);
|
|
3985
|
+
const xAxisMajorTickSizeNum = xAxisMajorTickSize != null ? Number(xAxisMajorTickSize) : void 0;
|
|
3986
|
+
const yAxisMajorTickSizeNum = yAxisMajorTickSize != null ? Number(yAxisMajorTickSize) : void 0;
|
|
3987
|
+
const y2AxisMajorTickSizeNum = y2AxisMajorTickSize != null ? Number(y2AxisMajorTickSize) : void 0;
|
|
3988
|
+
const yAxisMinorTickSizeNum = yAxisMinorTickSize != null ? Number(yAxisMinorTickSize) : void 0;
|
|
3989
|
+
const y2AxisMinorTickSizeNum = y2AxisMinorTickSize != null ? Number(y2AxisMinorTickSize) : void 0;
|
|
3670
3990
|
const seriesColors = seriesColorsStr ? JSON.parse(seriesColorsStr) : void 0;
|
|
3671
3991
|
const seriesColorsByField = fieldColors ? JSON.parse(fieldColors) : void 0;
|
|
3992
|
+
const lineDashStylesByField = lineDashStylesByFieldStr ? JSON.parse(lineDashStylesByFieldStr) : void 0;
|
|
3993
|
+
const stepPositionsByField = stepPositionsByFieldStr ? JSON.parse(stepPositionsByFieldStr) : void 0;
|
|
3994
|
+
const legendLabels = parseArrayOption(legendLabelsStr);
|
|
3995
|
+
const bgColor = backgroundColor || bgColorFromOptions;
|
|
3672
3996
|
const [containerWidth, setContainerWidth] = react_exports.useState(Number(props.width));
|
|
3673
3997
|
const [containerHeight, setContainerHeight] = react_exports.useState(Number(props.height));
|
|
3674
3998
|
const cachedHandleResize = react_exports.useCallback((w, h) => {
|
|
@@ -3679,31 +4003,64 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
3679
4003
|
fields: chartData.fields,
|
|
3680
4004
|
columns: chartData.seriesList
|
|
3681
4005
|
});
|
|
3682
|
-
const xField =
|
|
4006
|
+
const xField = getFieldName2(filteredChartData.fields[0]);
|
|
3683
4007
|
const yFields = getFieldNames(
|
|
3684
4008
|
filteredChartData.fields.length > 1 ? filteredChartData.fields.slice(1) : []
|
|
3685
4009
|
);
|
|
3686
|
-
const y2Fields =
|
|
3687
|
-
|
|
4010
|
+
const y2Fields = (0, react_exports.useMemo)(
|
|
4011
|
+
() => y2FieldsStr ? y2FieldsStr.split(",").map((f) => f.trim()) : [],
|
|
4012
|
+
[y2FieldsStr]
|
|
4013
|
+
);
|
|
4014
|
+
const overlayFields = (0, react_exports.useMemo)(
|
|
4015
|
+
() => overlayFieldsStr ? overlayFieldsStr.split(",").map((f) => f.trim()) : [],
|
|
4016
|
+
[overlayFieldsStr]
|
|
4017
|
+
);
|
|
3688
4018
|
let xAxisTitle = getComputedAxisTitles(xAxisTitleText, [xField], xAxisTitleVisibility);
|
|
3689
4019
|
xAxisTitle = ellipsisAxisTitle(xAxisTitle, containerWidth);
|
|
3690
|
-
|
|
4020
|
+
const yFieldsForTitle = y2Enabled ? yFields.filter((field) => !y2Fields.includes(field)) : yFields;
|
|
4021
|
+
let yAxisTitle = getComputedAxisTitles(yAxisTitleText, yFieldsForTitle, yAxisTitleVisibility);
|
|
3691
4022
|
yAxisTitle = ellipsisAxisTitle(yAxisTitle, containerHeight);
|
|
3692
4023
|
const fieldsForY2Axis = y2Fields.length > 0 ? y2Fields : overlayFields;
|
|
3693
4024
|
let y2AxisTitle = getComputedAxisTitles(y2AxisTitleText, fieldsForY2Axis, y2AxisTitleVisibility);
|
|
3694
4025
|
y2AxisTitle = ellipsisAxisTitle(y2AxisTitle, containerHeight);
|
|
3695
|
-
const xScaleConfig =
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
4026
|
+
const xScaleConfig = (0, react_exports.useMemo)(
|
|
4027
|
+
() => getXScaleConfig(xAxisTitle, xAxisLabelVisibility, xAxisLabelRotation),
|
|
4028
|
+
[xAxisTitle, xAxisLabelVisibility, xAxisLabelRotation]
|
|
4029
|
+
);
|
|
4030
|
+
const yScaleConfig = (0, react_exports.useMemo)(
|
|
4031
|
+
() => getYScaleConfig(
|
|
4032
|
+
yAxisTitle,
|
|
4033
|
+
yAxisAbbreviation,
|
|
4034
|
+
yAxisScale,
|
|
4035
|
+
yAxisLabelVisibility,
|
|
4036
|
+
yAxisMin,
|
|
4037
|
+
yAxisMax
|
|
4038
|
+
),
|
|
4039
|
+
[yAxisTitle, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility, yAxisMin, yAxisMax]
|
|
4040
|
+
);
|
|
4041
|
+
const y2ScaleConfig = (0, react_exports.useMemo)(() => {
|
|
4042
|
+
if (y2Enabled) {
|
|
4043
|
+
return getY2ScaleConfig(
|
|
4044
|
+
y2AxisTitle,
|
|
4045
|
+
y2AxisAbbreviation,
|
|
4046
|
+
y2AxisScale,
|
|
4047
|
+
y2IntegerUnits,
|
|
4048
|
+
y2AxisLabelVisibility,
|
|
4049
|
+
y2AxisMin,
|
|
4050
|
+
y2AxisMax
|
|
4051
|
+
);
|
|
4052
|
+
}
|
|
4053
|
+
return {};
|
|
4054
|
+
}, [
|
|
4055
|
+
y2Enabled,
|
|
4056
|
+
y2AxisTitle,
|
|
4057
|
+
y2AxisAbbreviation,
|
|
4058
|
+
y2AxisScale,
|
|
4059
|
+
y2IntegerUnits,
|
|
4060
|
+
y2AxisLabelVisibility,
|
|
4061
|
+
y2AxisMin,
|
|
4062
|
+
y2AxisMax
|
|
4063
|
+
]);
|
|
3707
4064
|
const uplotContainerElement = (0, react_exports.useRef)(null);
|
|
3708
4065
|
const seriesDataFormatted = [
|
|
3709
4066
|
filteredChartData.columns[0],
|
|
@@ -3719,9 +4076,25 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
3719
4076
|
overlayFields,
|
|
3720
4077
|
y2Enabled,
|
|
3721
4078
|
nullValueMode,
|
|
3722
|
-
markerDisplay
|
|
4079
|
+
markerDisplay,
|
|
4080
|
+
lineDashStyle,
|
|
4081
|
+
lineDashStylesByField,
|
|
4082
|
+
stepPosition,
|
|
4083
|
+
stepPositionsByField
|
|
3723
4084
|
),
|
|
3724
|
-
[
|
|
4085
|
+
[
|
|
4086
|
+
yFields,
|
|
4087
|
+
y2Fields,
|
|
4088
|
+
lineWidth,
|
|
4089
|
+
overlayFields,
|
|
4090
|
+
y2Enabled,
|
|
4091
|
+
nullValueMode,
|
|
4092
|
+
markerDisplay,
|
|
4093
|
+
lineDashStyle,
|
|
4094
|
+
lineDashStylesByField,
|
|
4095
|
+
stepPosition,
|
|
4096
|
+
stepPositionsByField
|
|
4097
|
+
]
|
|
3725
4098
|
);
|
|
3726
4099
|
const chartingEventAnnotations = (0, react_exports.useMemo)(
|
|
3727
4100
|
() => getAnnotationsForCanvas({
|
|
@@ -3735,25 +4108,59 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
3735
4108
|
() => __spreadValues(__spreadValues(__spreadValues({}, xScaleConfig), yScaleConfig), y2ScaleConfig),
|
|
3736
4109
|
[xScaleConfig, yScaleConfig, y2ScaleConfig]
|
|
3737
4110
|
);
|
|
3738
|
-
const
|
|
4111
|
+
const isSeriesCompare = legendMode === "seriesCompare";
|
|
4112
|
+
const legend = (0, react_exports.useMemo)(
|
|
4113
|
+
() => getLegend({
|
|
4114
|
+
legendDisplay: isSeriesCompare && legendDisplay !== "off" ? "right" : legendDisplay,
|
|
4115
|
+
isSeriesCompare,
|
|
4116
|
+
legendTruncation
|
|
4117
|
+
}),
|
|
4118
|
+
[legendDisplay, isSeriesCompare, legendTruncation]
|
|
4119
|
+
);
|
|
3739
4120
|
const handleChartClick = react_exports.useCallback(
|
|
3740
4121
|
(event) => {
|
|
3741
4122
|
if (onClick) {
|
|
3742
|
-
handleClick(event, onClick);
|
|
4123
|
+
handleClick(event, onClick, trellisKey, trellisSplitBy);
|
|
3743
4124
|
}
|
|
3744
4125
|
},
|
|
3745
|
-
[onClick]
|
|
4126
|
+
[onClick, trellisKey, trellisSplitBy]
|
|
3746
4127
|
);
|
|
3747
4128
|
const handleChartLegendClick = react_exports.useCallback(
|
|
3748
4129
|
(event) => {
|
|
3749
4130
|
if (onClick) {
|
|
3750
|
-
handleLegendClick(event, onClick);
|
|
4131
|
+
handleLegendClick(event, onClick, trellisKey, trellisSplitBy);
|
|
3751
4132
|
}
|
|
3752
4133
|
},
|
|
3753
|
-
[onClick]
|
|
4134
|
+
[onClick, trellisKey, trellisSplitBy]
|
|
4135
|
+
);
|
|
4136
|
+
const handleChartRangeSelection = react_exports.useCallback(
|
|
4137
|
+
(range2) => {
|
|
4138
|
+
if (onSelect) {
|
|
4139
|
+
handleRangeSelection(range2, onSelect, chartData, trellisKey, trellisSplitBy);
|
|
4140
|
+
}
|
|
4141
|
+
},
|
|
4142
|
+
[onSelect, chartData, trellisKey, trellisSplitBy]
|
|
4143
|
+
);
|
|
4144
|
+
const handleChartRangeZoom = react_exports.useCallback(
|
|
4145
|
+
(range2) => {
|
|
4146
|
+
if (onSelect) {
|
|
4147
|
+
handleRangeZoom(range2, onSelect, chartData, trellisKey, trellisSplitBy);
|
|
4148
|
+
}
|
|
4149
|
+
},
|
|
4150
|
+
[onSelect, chartData, trellisKey, trellisSplitBy]
|
|
4151
|
+
);
|
|
4152
|
+
const xFieldToUse = xFieldFromProps || xField;
|
|
4153
|
+
const enableSearchZoom = react_exports.useMemo(
|
|
4154
|
+
() => shouldEnableSearchZoom(eventHandlers, xFieldToUse),
|
|
4155
|
+
[eventHandlers, xFieldToUse]
|
|
3754
4156
|
);
|
|
3755
4157
|
const lastPayloadRef = react_exports.useRef(null);
|
|
3756
4158
|
const lastOriginalEventRef = react_exports.useRef(null);
|
|
4159
|
+
const previousMouseoverPayloadRef = react_exports.useRef(null);
|
|
4160
|
+
const additionalTooltipValuesRef = react_exports.useRef(additionalTooltipValues);
|
|
4161
|
+
react_exports.useEffect(() => {
|
|
4162
|
+
additionalTooltipValuesRef.current = additionalTooltipValues;
|
|
4163
|
+
}, [additionalTooltipValues]);
|
|
3757
4164
|
const handleChartCrosshairChange = react_exports.useCallback(
|
|
3758
4165
|
(event) => {
|
|
3759
4166
|
if (onPointMouseOver || onPointMouseOut) {
|
|
@@ -3765,6 +4172,7 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
3765
4172
|
payload: lastPayloadRef.current
|
|
3766
4173
|
});
|
|
3767
4174
|
}
|
|
4175
|
+
previousMouseoverPayloadRef.current = null;
|
|
3768
4176
|
return;
|
|
3769
4177
|
}
|
|
3770
4178
|
const payload = __spreadProps(__spreadValues({}, (0, lodash_exports.pick)(event, "value", "seriesKey", "time", "index", "seriesIndex")), {
|
|
@@ -3772,25 +4180,36 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
3772
4180
|
});
|
|
3773
4181
|
delete payload.seriesKey;
|
|
3774
4182
|
if (event.rowContext) {
|
|
3775
|
-
Object.
|
|
3776
|
-
payload
|
|
3777
|
-
|
|
4183
|
+
Object.assign(
|
|
4184
|
+
payload,
|
|
4185
|
+
Object.keys(event.rowContext).reduce((acc, fieldName) => {
|
|
4186
|
+
acc[`row.${fieldName}.value`] = event.rowContext[fieldName];
|
|
4187
|
+
return acc;
|
|
4188
|
+
}, {})
|
|
4189
|
+
);
|
|
4190
|
+
}
|
|
4191
|
+
const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
|
|
4192
|
+
if (!hasMouseoverPayloadChanged(updatedPayload, previousMouseoverPayloadRef.current)) {
|
|
4193
|
+
return;
|
|
3778
4194
|
}
|
|
3779
|
-
lastPayloadRef.current =
|
|
4195
|
+
lastPayloadRef.current = updatedPayload;
|
|
3780
4196
|
lastOriginalEventRef.current = event;
|
|
4197
|
+
previousMouseoverPayloadRef.current = __spreadValues({}, updatedPayload);
|
|
3781
4198
|
if (onPointMouseOver) {
|
|
3782
4199
|
onPointMouseOver({
|
|
3783
4200
|
type: "point.mouseover",
|
|
3784
4201
|
originalEvent: event,
|
|
3785
|
-
payload
|
|
4202
|
+
payload: updatedPayload
|
|
3786
4203
|
});
|
|
3787
4204
|
}
|
|
3788
4205
|
}
|
|
3789
4206
|
},
|
|
3790
|
-
[onPointMouseOver, onPointMouseOut]
|
|
4207
|
+
[onPointMouseOver, onPointMouseOut, trellisKey, trellisSplitBy]
|
|
3791
4208
|
);
|
|
3792
|
-
const
|
|
3793
|
-
|
|
4209
|
+
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}`;
|
|
4210
|
+
const memoizedChart = (0, react_exports.useMemo)(() => {
|
|
4211
|
+
const computedOnRangeZoom = onSelect ? handleChartRangeZoom : void 0;
|
|
4212
|
+
return /* @__PURE__ */ react_exports.createElement(visualization_canvas_exports.RangeSelectionProvider, { key: dataKey }, /* @__PURE__ */ react_exports.createElement(
|
|
3794
4213
|
visualization_canvas_exports.TimeSeriesChart,
|
|
3795
4214
|
{
|
|
3796
4215
|
data: chartData,
|
|
@@ -3800,49 +4219,121 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
3800
4219
|
seriesColorsByField,
|
|
3801
4220
|
seriesConfig: seriesOverrides,
|
|
3802
4221
|
legend,
|
|
4222
|
+
legendLabels,
|
|
4223
|
+
legendTruncation,
|
|
4224
|
+
isSeriesCompare: legendMode === "seriesCompare",
|
|
4225
|
+
maxSeriesFocus: legendMode === "seriesCompare" ? 0 : void 0,
|
|
3803
4226
|
scaleConfig,
|
|
3804
4227
|
timestampFormat: "expanded",
|
|
3805
4228
|
onCrosshairClick: onClick ? handleChartClick : void 0,
|
|
3806
4229
|
onCrosshairChange: onPointMouseOver || onPointMouseOut ? handleChartCrosshairChange : void 0,
|
|
3807
4230
|
onSeriesClick: onClick ? handleChartLegendClick : void 0,
|
|
4231
|
+
onRangeSelection: handleChartRangeSelection,
|
|
4232
|
+
onRangeZoom: computedOnRangeZoom,
|
|
4233
|
+
serverSideZoom: enableSearchZoom,
|
|
3808
4234
|
userLocale,
|
|
3809
4235
|
events: chartingEventAnnotations,
|
|
3810
|
-
eventsConfig: { renderer: triangleEventAnnotationRenderer }
|
|
4236
|
+
eventsConfig: { renderer: triangleEventAnnotationRenderer },
|
|
4237
|
+
additionalTooltipValuesRef,
|
|
4238
|
+
showXMajorGridLines,
|
|
4239
|
+
showYMajorGridLines,
|
|
4240
|
+
showY2MajorGridLines,
|
|
4241
|
+
showYMinorGridLines,
|
|
4242
|
+
showY2MinorGridLines,
|
|
4243
|
+
showLineSmoothing,
|
|
4244
|
+
dataValuesDisplay,
|
|
4245
|
+
showXMajorTicks,
|
|
4246
|
+
xAxisMajorTickSize: xAxisMajorTickSizeNum,
|
|
4247
|
+
showYMajorTicks,
|
|
4248
|
+
showY2MajorTicks,
|
|
4249
|
+
yAxisMajorTickSize: yAxisMajorTickSizeNum,
|
|
4250
|
+
y2AxisMajorTickSize: y2AxisMajorTickSizeNum,
|
|
4251
|
+
yAxisMajorTickInterval: yAxisMajorTickIntervalNum,
|
|
4252
|
+
y2AxisMajorTickInterval: y2AxisMajorTickIntervalNum,
|
|
4253
|
+
showYMinorTicks,
|
|
4254
|
+
showY2MinorTicks,
|
|
4255
|
+
yAxisMinorTickSize: yAxisMinorTickSizeNum,
|
|
4256
|
+
y2AxisMinorTickSize: y2AxisMinorTickSizeNum,
|
|
4257
|
+
showYAxisWithZero,
|
|
4258
|
+
showY2AxisWithZero,
|
|
4259
|
+
showXAxisLine,
|
|
4260
|
+
showYAxisLine,
|
|
4261
|
+
showY2AxisLine,
|
|
4262
|
+
xAxisMaxLabelParts
|
|
3811
4263
|
}
|
|
3812
|
-
)
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
4264
|
+
));
|
|
4265
|
+
}, [
|
|
4266
|
+
onSelect,
|
|
4267
|
+
handleChartRangeZoom,
|
|
4268
|
+
dataKey,
|
|
4269
|
+
chartData,
|
|
4270
|
+
containerWidth,
|
|
4271
|
+
containerHeight,
|
|
4272
|
+
seriesColors,
|
|
4273
|
+
seriesColorsByField,
|
|
4274
|
+
seriesOverrides,
|
|
4275
|
+
legend,
|
|
4276
|
+
legendLabels,
|
|
4277
|
+
legendTruncation,
|
|
4278
|
+
scaleConfig,
|
|
4279
|
+
onClick,
|
|
4280
|
+
handleChartClick,
|
|
4281
|
+
onPointMouseOver,
|
|
4282
|
+
onPointMouseOut,
|
|
4283
|
+
handleChartCrosshairChange,
|
|
4284
|
+
handleChartLegendClick,
|
|
4285
|
+
handleChartRangeSelection,
|
|
4286
|
+
enableSearchZoom,
|
|
4287
|
+
userLocale,
|
|
4288
|
+
chartingEventAnnotations,
|
|
4289
|
+
showXMajorGridLines,
|
|
4290
|
+
showYMajorGridLines,
|
|
4291
|
+
showY2MajorGridLines,
|
|
4292
|
+
showYMinorGridLines,
|
|
4293
|
+
showY2MinorGridLines,
|
|
4294
|
+
showLineSmoothing,
|
|
4295
|
+
dataValuesDisplay,
|
|
4296
|
+
showXMajorTicks,
|
|
4297
|
+
xAxisMajorTickSizeNum,
|
|
4298
|
+
showYMajorTicks,
|
|
4299
|
+
showY2MajorTicks,
|
|
4300
|
+
yAxisMajorTickSizeNum,
|
|
4301
|
+
y2AxisMajorTickSizeNum,
|
|
4302
|
+
yAxisMajorTickIntervalNum,
|
|
4303
|
+
y2AxisMajorTickIntervalNum,
|
|
4304
|
+
showYMinorTicks,
|
|
4305
|
+
showY2MinorTicks,
|
|
4306
|
+
yAxisMinorTickSizeNum,
|
|
4307
|
+
y2AxisMinorTickSizeNum,
|
|
4308
|
+
showYAxisWithZero,
|
|
4309
|
+
showY2AxisWithZero,
|
|
4310
|
+
showXAxisLine,
|
|
4311
|
+
showYAxisLine,
|
|
4312
|
+
showY2AxisLine,
|
|
4313
|
+
legendMode,
|
|
4314
|
+
xAxisMaxLabelParts
|
|
4315
|
+
]);
|
|
3832
4316
|
const memoizedVisualization = (0, react_exports.useMemo)(() => {
|
|
3833
|
-
return /* @__PURE__ */ react_exports.createElement(VizStyleWrapper_default, { backgroundColor }, memoizedChart);
|
|
3834
|
-
}, [
|
|
3835
|
-
return /* @__PURE__ */ react_exports.createElement(
|
|
4317
|
+
return /* @__PURE__ */ react_exports.createElement(VizStyleWrapper_default, { backgroundColor: bgColor }, memoizedChart);
|
|
4318
|
+
}, [bgColor, memoizedChart]);
|
|
4319
|
+
return /* @__PURE__ */ react_exports.createElement(react_exports.Fragment, null, trellisEnabled && /* @__PURE__ */ react_exports.createElement(
|
|
4320
|
+
TrellisTitle,
|
|
4321
|
+
{
|
|
4322
|
+
trellisKey,
|
|
4323
|
+
backgroundColor: bgColor,
|
|
4324
|
+
fontColor: defaultFontColor
|
|
4325
|
+
}
|
|
4326
|
+
), /* @__PURE__ */ react_exports.createElement(
|
|
3836
4327
|
TimeSeriesChartContainer,
|
|
3837
4328
|
{
|
|
3838
|
-
height,
|
|
4329
|
+
height: trellisEnabled ? Number(height) - TRELLIS_TITLE_HEIGHT : height,
|
|
3839
4330
|
width,
|
|
3840
4331
|
ref: uplotContainerElement,
|
|
3841
4332
|
"data-test": "timeseries-chart-wrapper"
|
|
3842
4333
|
},
|
|
3843
4334
|
/* @__PURE__ */ react_exports.createElement(SizeAwareWrapper_default, { width, height, onResize: cachedHandleResize }),
|
|
3844
4335
|
memoizedVisualization
|
|
3845
|
-
);
|
|
4336
|
+
));
|
|
3846
4337
|
};
|
|
3847
4338
|
var TimeSeriesChartWrapper_default = TimeSeriesChartWrapper;
|
|
3848
4339
|
|
|
@@ -4322,7 +4813,6 @@ var StaticMajorAndTrendLayout = [
|
|
|
4322
4813
|
[
|
|
4323
4814
|
{
|
|
4324
4815
|
label: (0, i18n_exports._)("Unit position"),
|
|
4325
|
-
// todo: we need a new editor combining unit and position
|
|
4326
4816
|
option: "unitPosition",
|
|
4327
4817
|
editor: "editor.select",
|
|
4328
4818
|
editorProps: {
|
|
@@ -4632,7 +5122,6 @@ var themes = {
|
|
|
4632
5122
|
enterprise: variables_default.textColor(props),
|
|
4633
5123
|
prisma: variables_default.contentColorActive(props)
|
|
4634
5124
|
})(props),
|
|
4635
|
-
// TODO(fkurniawan): update with SCP-36839
|
|
4636
5125
|
sparklineSeverityColors: (props) => pick_default2({
|
|
4637
5126
|
enterprise: {
|
|
4638
5127
|
dark: JSON.stringify({
|
|
@@ -4780,6 +5269,21 @@ var editorConfig = [
|
|
|
4780
5269
|
}
|
|
4781
5270
|
}
|
|
4782
5271
|
],
|
|
5272
|
+
[
|
|
5273
|
+
{
|
|
5274
|
+
label: (0, i18n_exports._)("Null value display"),
|
|
5275
|
+
option: "sparklineNullValueDisplay",
|
|
5276
|
+
editor: "editor.radioBar",
|
|
5277
|
+
editorProps: {
|
|
5278
|
+
values: [
|
|
5279
|
+
{ label: (0, i18n_exports._)("Gaps"), value: "gaps" },
|
|
5280
|
+
{ label: (0, i18n_exports._)("Zero"), value: "zero" },
|
|
5281
|
+
{ label: (0, i18n_exports._)("Connect"), value: "connect" }
|
|
5282
|
+
]
|
|
5283
|
+
},
|
|
5284
|
+
showEditor: ({ options }) => options.sparklineDisplay !== "off"
|
|
5285
|
+
}
|
|
5286
|
+
],
|
|
4783
5287
|
...TrellisEditorConfig
|
|
4784
5288
|
]
|
|
4785
5289
|
},
|