@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/Pie.js
CHANGED
|
@@ -250,6 +250,7 @@ var DefaultVizActionHandler = class {
|
|
|
250
250
|
};
|
|
251
251
|
|
|
252
252
|
// src/common/utils/dataUtils.ts
|
|
253
|
+
var getFieldName = (field) => typeof field === "string" ? field : field.name;
|
|
253
254
|
var largestTriangleThreeBuckets = (data, threshold, preferredDownsampleIndices) => {
|
|
254
255
|
const dataLength = data.length;
|
|
255
256
|
const downsampledIndices = [];
|
|
@@ -423,9 +424,9 @@ var tryToCoerceAllDisplayedFields = (ds, xField, yFields, fieldTypes, options) =
|
|
|
423
424
|
let xColumn = [];
|
|
424
425
|
const yColumns = [];
|
|
425
426
|
const canDownsample = !ds.data.fields.some((field, index) => {
|
|
426
|
-
var _a
|
|
427
|
-
const fieldName = (
|
|
428
|
-
const fieldType = (
|
|
427
|
+
var _a;
|
|
428
|
+
const fieldName = getFieldName(field);
|
|
429
|
+
const fieldType = (_a = fieldTypes[index]) != null ? _a : "unknown";
|
|
429
430
|
const column = ds.data.columns[index];
|
|
430
431
|
let hasDisplayedColumnThatCantBeDownsampled = false;
|
|
431
432
|
if (fieldName === xField) {
|
|
@@ -629,6 +630,7 @@ var Charting = (props) => {
|
|
|
629
630
|
const timezone = (0, react_exports.useContext)(TimezoneContext_default);
|
|
630
631
|
const selectChartEvent = (0, react_exports.useRef)(null);
|
|
631
632
|
const trellisEnabled = useTrellisEnabled(props.splitByLayout);
|
|
633
|
+
const isResizing = (0, react_exports.useRef)(false);
|
|
632
634
|
const drawChartRef = (0, react_exports.useRef)(() => {
|
|
633
635
|
});
|
|
634
636
|
const debouncedDrawChart = (0, react_exports.useMemo)(
|
|
@@ -727,6 +729,9 @@ var Charting = (props) => {
|
|
|
727
729
|
recalculateDownsamplingThreshold();
|
|
728
730
|
}, [recalculateDownsamplingThreshold]);
|
|
729
731
|
const handleSelect = useEventCallback_default((chartEvent) => {
|
|
732
|
+
if (isResizing.current) {
|
|
733
|
+
return;
|
|
734
|
+
}
|
|
730
735
|
selectChartEvent.current = chartEvent;
|
|
731
736
|
recalculateDownsamplingThreshold();
|
|
732
737
|
const payload = appendTrellisToPayload(
|
|
@@ -861,6 +866,14 @@ var Charting = (props) => {
|
|
|
861
866
|
}
|
|
862
867
|
if (chart.current) {
|
|
863
868
|
if (Math.round(chart.current.height) !== Math.round(computedHeight) || Math.round(chart.current.width) !== Math.round(computedWidth)) {
|
|
869
|
+
isResizing.current = true;
|
|
870
|
+
queueMicrotask(() => {
|
|
871
|
+
try {
|
|
872
|
+
isResizing.current = false;
|
|
873
|
+
} catch (e) {
|
|
874
|
+
(0, lodash_exports.noop)(e);
|
|
875
|
+
}
|
|
876
|
+
});
|
|
864
877
|
chart.current.resize(computedWidth, computedHeight);
|
|
865
878
|
}
|
|
866
879
|
}
|
|
@@ -1241,6 +1254,22 @@ var editorConfig = [
|
|
|
1241
1254
|
}
|
|
1242
1255
|
}
|
|
1243
1256
|
],
|
|
1257
|
+
[
|
|
1258
|
+
{
|
|
1259
|
+
label: (0, i18n_exports._)("Legend display"),
|
|
1260
|
+
option: "legendDisplay",
|
|
1261
|
+
editor: "editor.select",
|
|
1262
|
+
editorProps: {
|
|
1263
|
+
values: [
|
|
1264
|
+
{ label: (0, i18n_exports._)("Off"), value: "off" },
|
|
1265
|
+
{ label: (0, i18n_exports._)("Right"), value: "right" },
|
|
1266
|
+
{ label: (0, i18n_exports._)("Left"), value: "left" },
|
|
1267
|
+
{ label: (0, i18n_exports._)("Top"), value: "top" },
|
|
1268
|
+
{ label: (0, i18n_exports._)("Bottom"), value: "bottom" }
|
|
1269
|
+
]
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
],
|
|
1244
1273
|
[
|
|
1245
1274
|
{
|
|
1246
1275
|
label: (0, i18n_exports._)("Percentage precision"),
|
|
@@ -1666,7 +1695,7 @@ var Cover = styled_components_default.div`
|
|
|
1666
1695
|
bottom: 0;
|
|
1667
1696
|
`;
|
|
1668
1697
|
var Blocker = styled_components_default.div.attrs({
|
|
1669
|
-
"data-splunk-visualization-version": "28.
|
|
1698
|
+
"data-splunk-visualization-version": "28.5.0 - b192418b7"
|
|
1670
1699
|
})`
|
|
1671
1700
|
position: relative;
|
|
1672
1701
|
width: 100%;
|
|
@@ -1747,7 +1776,7 @@ var withFixedSizeContainer = (Viz) => {
|
|
|
1747
1776
|
FixSizeItem,
|
|
1748
1777
|
{
|
|
1749
1778
|
"data-test": "fix-size-item",
|
|
1750
|
-
"data-splunk-visualization-version": "28.
|
|
1779
|
+
"data-splunk-visualization-version": "28.5.0 - b192418b7",
|
|
1751
1780
|
width,
|
|
1752
1781
|
height,
|
|
1753
1782
|
backgroundColor
|
|
@@ -2023,7 +2052,7 @@ var trellisUtils_default = "default" in defaultImport35 ? defaultImport35.defaul
|
|
|
2023
2052
|
var AGGREGATIONS = "aggregations";
|
|
2024
2053
|
var dataSourcesSplitByAggregationsUnknown = (dataSource) => {
|
|
2025
2054
|
var _a, _b, _c, _d;
|
|
2026
|
-
const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
|
|
2055
|
+
const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
|
|
2027
2056
|
const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
|
|
2028
2057
|
let splitDataSources = null;
|
|
2029
2058
|
let errorCode = null;
|
|
@@ -2044,7 +2073,7 @@ var dataSourcesSplitByAggregationsUnknown = (dataSource) => {
|
|
|
2044
2073
|
}
|
|
2045
2074
|
return { splitDataSources, errorCode };
|
|
2046
2075
|
};
|
|
2047
|
-
var toFieldEntries = (fields) => {
|
|
2076
|
+
var toFieldEntries = (fields = []) => {
|
|
2048
2077
|
return fields.map((field) => {
|
|
2049
2078
|
if (typeof field === "string") {
|
|
2050
2079
|
return { name: field };
|
|
@@ -2059,7 +2088,7 @@ var dataSourcesSplitByAggregationsTimechartAndChart = (dataSource) => {
|
|
|
2059
2088
|
let splitDataSources = null;
|
|
2060
2089
|
let splitByFields = [];
|
|
2061
2090
|
let errorCode = null;
|
|
2062
|
-
if (
|
|
2091
|
+
if (fields.length > 0) {
|
|
2063
2092
|
splitByFields = (0, trellisUtils_exports.extractDataSourceAggregationKeysChart)(fields);
|
|
2064
2093
|
}
|
|
2065
2094
|
if (splitByFields && splitByFields.length > 0) {
|
|
@@ -2097,12 +2126,12 @@ var dataSourcesSplitByAggregationsTimechartAndChart = (dataSource) => {
|
|
|
2097
2126
|
};
|
|
2098
2127
|
var dataSourcesSplitByAggregationsStats = (dataSource) => {
|
|
2099
2128
|
var _a, _b, _c, _d;
|
|
2100
|
-
const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
|
|
2129
|
+
const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
|
|
2101
2130
|
const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
|
|
2102
2131
|
let splitDataSources = null;
|
|
2103
2132
|
let splitByFields = [];
|
|
2104
2133
|
let errorCode = null;
|
|
2105
|
-
if (
|
|
2134
|
+
if (fields.length > 0) {
|
|
2106
2135
|
splitByFields = (0, trellisUtils_exports.extractDataSourceAggregationKeysStats)(fields);
|
|
2107
2136
|
}
|
|
2108
2137
|
if (splitByFields && splitByFields.length > 0) {
|
|
@@ -2126,12 +2155,12 @@ var dataSourcesSplitByAggregationsStats = (dataSource) => {
|
|
|
2126
2155
|
};
|
|
2127
2156
|
var dataSourcesSplitByModeTimechart = (dataSource, splitBy) => {
|
|
2128
2157
|
var _a, _b, _c, _d, _e;
|
|
2129
|
-
const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
|
|
2158
|
+
const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
|
|
2130
2159
|
const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
|
|
2131
2160
|
let splitDataSources = null;
|
|
2132
2161
|
let splitByFields = [];
|
|
2133
2162
|
let errorCode = null;
|
|
2134
|
-
if (
|
|
2163
|
+
if (fields.length > 0) {
|
|
2135
2164
|
splitByFields = (0, trellisUtils_exports.extractSplitByFieldsChartFields)(fields);
|
|
2136
2165
|
}
|
|
2137
2166
|
if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
|
|
@@ -2147,16 +2176,14 @@ var dataSourcesSplitByModeTimechart = (dataSource, splitBy) => {
|
|
|
2147
2176
|
splitDataSources[val] = (0, lodash_exports.cloneDeep)(
|
|
2148
2177
|
(0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
|
|
2149
2178
|
);
|
|
2150
|
-
splitDataSources[val].primary.data.fields = [
|
|
2151
|
-
{ name: fields[0].name },
|
|
2152
|
-
...dataSourceKeys.map((k) => ({
|
|
2153
|
-
name: k
|
|
2154
|
-
}))
|
|
2155
|
-
];
|
|
2179
|
+
splitDataSources[val].primary.data.fields = [{ name: fields[0].name }];
|
|
2156
2180
|
splitDataSources[val].primary.data.columns = [[...columns[0]]];
|
|
2157
2181
|
dataSourceKeys.forEach((dsKey) => {
|
|
2158
2182
|
fields.forEach((field, idx) => {
|
|
2159
2183
|
if (field.data_source === dsKey && (field.splitby_value === val || field.name === val)) {
|
|
2184
|
+
splitDataSources[val].primary.data.fields.push({
|
|
2185
|
+
name: dsKey
|
|
2186
|
+
});
|
|
2160
2187
|
splitDataSources[val].primary.data.columns.push([...columns[idx]]);
|
|
2161
2188
|
}
|
|
2162
2189
|
});
|
|
@@ -2169,12 +2196,12 @@ var dataSourcesSplitByModeTimechart = (dataSource, splitBy) => {
|
|
|
2169
2196
|
};
|
|
2170
2197
|
var dataSourcesSplitByModeChart = (dataSource, splitBy) => {
|
|
2171
2198
|
var _a, _b, _c, _d;
|
|
2172
|
-
const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
|
|
2199
|
+
const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
|
|
2173
2200
|
const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
|
|
2174
2201
|
let splitDataSources = null;
|
|
2175
2202
|
let splitByFields = [];
|
|
2176
2203
|
let errorCode = null;
|
|
2177
|
-
if (
|
|
2204
|
+
if (fields.length > 0) {
|
|
2178
2205
|
splitByFields = (0, trellisUtils_exports.extractSplitByFieldsChartFields)(fields);
|
|
2179
2206
|
}
|
|
2180
2207
|
if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
|
|
@@ -2262,17 +2289,15 @@ var dataSourcesSplitByModeChart = (dataSource, splitBy) => {
|
|
|
2262
2289
|
};
|
|
2263
2290
|
var dataSourcesSplitByModeStatsorUnknown = (dataSource, splitBy, splitMode) => {
|
|
2264
2291
|
var _a, _b, _c, _d, _e, _f;
|
|
2265
|
-
const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
|
|
2292
|
+
const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
|
|
2266
2293
|
const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
|
|
2267
2294
|
let splitDataSources = null;
|
|
2268
2295
|
let splitByFields = [];
|
|
2269
2296
|
let errorCode = null;
|
|
2270
|
-
if (
|
|
2297
|
+
if (fields.length > 0) {
|
|
2271
2298
|
splitByFields = splitMode !== trellisUtils_exports.UNKNOWN ? (0, trellisUtils_exports.extractSplitByFieldsForStats)(fields) : (0, trellisUtils_exports.extractSplitByFieldsForUnknown)(fields);
|
|
2272
2299
|
}
|
|
2273
|
-
const splitByIndex = fields
|
|
2274
|
-
(field) => field === splitBy || field.name === splitBy
|
|
2275
|
-
);
|
|
2300
|
+
const splitByIndex = fields.findIndex((field) => field.name === splitBy);
|
|
2276
2301
|
if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
|
|
2277
2302
|
const splitByColumn = (_f = (_e = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _e.data) == null ? void 0 : _f.columns[splitByIndex];
|
|
2278
2303
|
splitDataSources = {};
|
|
@@ -2436,6 +2461,16 @@ var truncateData = (dataSet, truncationLimit) => {
|
|
|
2436
2461
|
);
|
|
2437
2462
|
return truncatedData;
|
|
2438
2463
|
};
|
|
2464
|
+
var shouldEnableSearchZoom = (eventHandlers = [], xField = "") => {
|
|
2465
|
+
const rangeSelectEventHandler = eventHandlers.find(
|
|
2466
|
+
(eventHandler) => {
|
|
2467
|
+
var _a;
|
|
2468
|
+
return (_a = eventHandler.options.events) == null ? void 0 : _a.includes("range.select");
|
|
2469
|
+
}
|
|
2470
|
+
);
|
|
2471
|
+
const xAxisIsTime = xField === "_time";
|
|
2472
|
+
return !!rangeSelectEventHandler && xAxisIsTime;
|
|
2473
|
+
};
|
|
2439
2474
|
var canvasSupportedTimeSeriesCharts = ["splunk.line"];
|
|
2440
2475
|
var isTimeSeriesCanvasRenderSupported = (vizConfigKey) => {
|
|
2441
2476
|
return canvasSupportedTimeSeriesCharts.indexOf(vizConfigKey) > -1;
|
|
@@ -2456,17 +2491,34 @@ var filterChartDataFromInternalFields = (chartData) => {
|
|
|
2456
2491
|
var convert2DArrayToNumbers = (arr) => {
|
|
2457
2492
|
return arr.map((subArray) => subArray.map((element) => parseFloat(element)));
|
|
2458
2493
|
};
|
|
2459
|
-
var
|
|
2460
|
-
|
|
2494
|
+
var parseAxisValue = (val) => {
|
|
2495
|
+
if (val === void 0 || val === null || val === "auto" || val === "") {
|
|
2496
|
+
return void 0;
|
|
2497
|
+
}
|
|
2498
|
+
const num = typeof val === "number" ? val : Number.parseFloat(val);
|
|
2499
|
+
return Number.isNaN(num) ? void 0 : num;
|
|
2500
|
+
};
|
|
2501
|
+
var parseXAxisLineVisibility = (visibility) => {
|
|
2502
|
+
if (visibility === "hide") return false;
|
|
2503
|
+
if (visibility === "show") return true;
|
|
2504
|
+
return void 0;
|
|
2505
|
+
};
|
|
2461
2506
|
var getLegend = (props) => {
|
|
2462
2507
|
const legendPlacement = props == null ? void 0 : props.legendDisplay;
|
|
2508
|
+
const { isSeriesCompare, legendTruncation } = props;
|
|
2509
|
+
const commonLegendProps = {
|
|
2510
|
+
center: true,
|
|
2511
|
+
fontSize: 12,
|
|
2512
|
+
largerTiles: true,
|
|
2513
|
+
hideSeriesValue: !isSeriesCompare,
|
|
2514
|
+
// Show values if in seriesCompare mode
|
|
2515
|
+
legendTruncation
|
|
2516
|
+
};
|
|
2463
2517
|
switch (legendPlacement) {
|
|
2464
2518
|
case "off":
|
|
2465
2519
|
return false;
|
|
2466
2520
|
case "left":
|
|
2467
|
-
return (0, visualization_canvas_exports.LeftLegendFactory)(__spreadValues({
|
|
2468
|
-
width: SideLegendWidth
|
|
2469
|
-
}, commonLegendProps));
|
|
2521
|
+
return (0, visualization_canvas_exports.LeftLegendFactory)(__spreadValues({}, commonLegendProps));
|
|
2470
2522
|
case "bottom":
|
|
2471
2523
|
return (0, visualization_canvas_exports.BottomLegendFactory)(__spreadValues({
|
|
2472
2524
|
wrap: true
|
|
@@ -2476,9 +2528,7 @@ var getLegend = (props) => {
|
|
|
2476
2528
|
wrap: true
|
|
2477
2529
|
}, commonLegendProps));
|
|
2478
2530
|
default:
|
|
2479
|
-
return (0, visualization_canvas_exports.SideLegendFactory)(__spreadValues({
|
|
2480
|
-
width: SideLegendWidth
|
|
2481
|
-
}, commonLegendProps));
|
|
2531
|
+
return (0, visualization_canvas_exports.SideLegendFactory)(__spreadValues({}, commonLegendProps));
|
|
2482
2532
|
}
|
|
2483
2533
|
};
|
|
2484
2534
|
var getComputedAxisTitles = (inputAxisTitle, fields, axisTitleVisibility) => {
|
|
@@ -2513,22 +2563,25 @@ var ellipsisAxisTitle = (axisTitle, containerSpacing, fontSize = 12) => {
|
|
|
2513
2563
|
const end = axisTitle.slice(-halfChars);
|
|
2514
2564
|
return `${start}...${end}`;
|
|
2515
2565
|
};
|
|
2516
|
-
var
|
|
2566
|
+
var getFieldName2 = (field) => {
|
|
2517
2567
|
const fieldName = typeof field === "object" ? field == null ? void 0 : field.name : field;
|
|
2518
2568
|
return fieldName;
|
|
2519
2569
|
};
|
|
2520
2570
|
var getFieldNames = (fields) => {
|
|
2521
|
-
return fields.map((field) =>
|
|
2571
|
+
return fields.map((field) => getFieldName2(field));
|
|
2522
2572
|
};
|
|
2523
|
-
var getXScaleConfig = (label, xAxisLabelVisibility) => {
|
|
2573
|
+
var getXScaleConfig = (label, xAxisLabelVisibility, xAxisLabelRotation) => {
|
|
2524
2574
|
const xConfig = { x: {} };
|
|
2525
2575
|
xConfig.x.label = label;
|
|
2526
2576
|
if (xAxisLabelVisibility === "hide") {
|
|
2527
2577
|
xConfig.x.hideLabels = true;
|
|
2528
2578
|
}
|
|
2579
|
+
if (xAxisLabelRotation !== void 0) {
|
|
2580
|
+
xConfig.x.labelRotation = xAxisLabelRotation;
|
|
2581
|
+
}
|
|
2529
2582
|
return xConfig;
|
|
2530
2583
|
};
|
|
2531
|
-
var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility) => {
|
|
2584
|
+
var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility, yAxisMin, yAxisMax) => {
|
|
2532
2585
|
const scaleType = yAxisScale != null ? yAxisScale : "linear";
|
|
2533
2586
|
const yConfig = { y: {} };
|
|
2534
2587
|
yConfig.y.label = label;
|
|
@@ -2536,34 +2589,46 @@ var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibilit
|
|
|
2536
2589
|
if (yAxisAbbreviation !== "none") {
|
|
2537
2590
|
yConfig.y.tickFmt = (v) => (0, visualization_canvas_exports.shortenNumber)(v, 1);
|
|
2538
2591
|
}
|
|
2539
|
-
if (yAxisAbbreviation
|
|
2540
|
-
yConfig.y.width = 55;
|
|
2541
|
-
} else {
|
|
2592
|
+
if (yAxisAbbreviation !== "none") {
|
|
2542
2593
|
yConfig.y.width = label && label.length > 0 ? 30 : 10;
|
|
2543
2594
|
}
|
|
2544
2595
|
if (yAxisLabelVisibility === "hide") {
|
|
2545
2596
|
yConfig.y.hideLabels = true;
|
|
2546
2597
|
}
|
|
2598
|
+
if (yAxisMin !== void 0 || yAxisMax !== void 0) {
|
|
2599
|
+
yConfig.y.range = (u, dataMin, dataMax) => {
|
|
2600
|
+
const min = yAxisMin != null ? yAxisMin : dataMin;
|
|
2601
|
+
const max = yAxisMax != null ? yAxisMax : dataMax;
|
|
2602
|
+
return [min, max];
|
|
2603
|
+
};
|
|
2604
|
+
}
|
|
2547
2605
|
return yConfig;
|
|
2548
2606
|
};
|
|
2549
|
-
var getY2ScaleConfig = (label, axisAbbreviation, axisScale, roundAxisLabelsToInteger, y2AxisLabelVisibility) => {
|
|
2607
|
+
var getY2ScaleConfig = (label, axisAbbreviation, axisScale, roundAxisLabelsToInteger, y2AxisLabelVisibility, y2AxisMin, y2AxisMax) => {
|
|
2550
2608
|
const y2Config = { y2: {} };
|
|
2551
2609
|
const scaleType = axisScale != null ? axisScale : "linear";
|
|
2552
2610
|
y2Config.y2.label = label;
|
|
2553
2611
|
y2Config.y2.side = "right";
|
|
2554
|
-
y2Config.y2.showGrid = false;
|
|
2555
2612
|
y2Config.y2.type = scaleType;
|
|
2556
2613
|
if (axisAbbreviation !== "none") {
|
|
2557
2614
|
y2Config.y2.tickFmt = (v) => (0, visualization_canvas_exports.shortenNumber)(v, 1, roundAxisLabelsToInteger);
|
|
2615
|
+
y2Config.y2.width = label && label.length > 0 ? 50 : 10;
|
|
2558
2616
|
} else if (roundAxisLabelsToInteger) {
|
|
2559
2617
|
y2Config.y2.tickFmt = (v) => roundAxisLabelsToInteger ? Math.round(v).toString() : v.toString();
|
|
2560
2618
|
}
|
|
2561
2619
|
if (y2AxisLabelVisibility === "hide") {
|
|
2562
2620
|
y2Config.y2.hideLabels = true;
|
|
2563
2621
|
}
|
|
2622
|
+
if (y2AxisMin !== void 0 || y2AxisMax !== void 0) {
|
|
2623
|
+
y2Config.y2.range = (u, dataMin, dataMax) => {
|
|
2624
|
+
const min = y2AxisMin != null ? y2AxisMin : dataMin;
|
|
2625
|
+
const max = y2AxisMax != null ? y2AxisMax : dataMax;
|
|
2626
|
+
return [min, max];
|
|
2627
|
+
};
|
|
2628
|
+
}
|
|
2564
2629
|
return y2Config;
|
|
2565
2630
|
};
|
|
2566
|
-
var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled, nullValueMode, markerDisplay) => {
|
|
2631
|
+
var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled, nullValueMode, markerDisplay, lineDashStyle, lineDashStylesByField, stepPosition, stepPositionsByField) => {
|
|
2567
2632
|
const seriesConfig = {};
|
|
2568
2633
|
let spanGaps;
|
|
2569
2634
|
let replaceNullsWithZero;
|
|
@@ -2590,6 +2655,8 @@ var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled
|
|
|
2590
2655
|
);
|
|
2591
2656
|
if (shouldAssignToY2) {
|
|
2592
2657
|
seriesConfig[field].overrides.scale = "y2";
|
|
2658
|
+
} else {
|
|
2659
|
+
seriesConfig[field].overrides.scale = "y";
|
|
2593
2660
|
}
|
|
2594
2661
|
}
|
|
2595
2662
|
if (overlayFields == null ? void 0 : overlayFields.includes(field)) {
|
|
@@ -2598,12 +2665,50 @@ var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled
|
|
|
2598
2665
|
if (markerDisplay !== void 0) {
|
|
2599
2666
|
seriesConfig[field].markerDisplay = markerDisplay;
|
|
2600
2667
|
}
|
|
2668
|
+
const fieldDashStyle = (lineDashStylesByField == null ? void 0 : lineDashStylesByField[field]) || lineDashStyle;
|
|
2669
|
+
if (fieldDashStyle) {
|
|
2670
|
+
seriesConfig[field].lineDashStyle = fieldDashStyle;
|
|
2671
|
+
}
|
|
2672
|
+
const hasFieldStepPosition = Object.hasOwn(stepPositionsByField || {}, field);
|
|
2673
|
+
const fieldStepPosition = hasFieldStepPosition ? stepPositionsByField == null ? void 0 : stepPositionsByField[field] : stepPosition;
|
|
2674
|
+
if (fieldStepPosition && fieldStepPosition !== "off") {
|
|
2675
|
+
seriesConfig[field].stepPosition = fieldStepPosition;
|
|
2676
|
+
}
|
|
2601
2677
|
if (replaceNullsWithZero !== void 0) {
|
|
2602
2678
|
seriesConfig[field].replaceNullsWithZero = replaceNullsWithZero;
|
|
2603
2679
|
}
|
|
2604
2680
|
});
|
|
2605
2681
|
return seriesConfig;
|
|
2606
2682
|
};
|
|
2683
|
+
var findRangeIndices = (xData, startValue, endValue) => {
|
|
2684
|
+
let startXIndex = -1;
|
|
2685
|
+
let endXIndex = -1;
|
|
2686
|
+
const xDataEpoch = xData.map((val) => {
|
|
2687
|
+
if (typeof val === "string") {
|
|
2688
|
+
return new Date(val).getTime() / 1e3;
|
|
2689
|
+
}
|
|
2690
|
+
return val;
|
|
2691
|
+
});
|
|
2692
|
+
for (let i = 0; i < xDataEpoch.length; i += 1) {
|
|
2693
|
+
if (xDataEpoch[i] >= startValue) {
|
|
2694
|
+
startXIndex = i;
|
|
2695
|
+
break;
|
|
2696
|
+
}
|
|
2697
|
+
}
|
|
2698
|
+
if (startXIndex === -1 && xDataEpoch.length > 0) {
|
|
2699
|
+
startXIndex = xDataEpoch.length - 1;
|
|
2700
|
+
}
|
|
2701
|
+
for (let i = xDataEpoch.length - 1; i >= 0; i -= 1) {
|
|
2702
|
+
if (xDataEpoch[i] <= endValue) {
|
|
2703
|
+
endXIndex = i;
|
|
2704
|
+
break;
|
|
2705
|
+
}
|
|
2706
|
+
}
|
|
2707
|
+
if (endXIndex === -1 && xDataEpoch.length > 0) {
|
|
2708
|
+
endXIndex = 0;
|
|
2709
|
+
}
|
|
2710
|
+
return { startXIndex, endXIndex };
|
|
2711
|
+
};
|
|
2607
2712
|
|
|
2608
2713
|
// src/common/TimeSeriesChartWrapper.tsx
|
|
2609
2714
|
var TimeSeriesChartContainer = styled_components_default.div`
|
|
@@ -2614,38 +2719,123 @@ var TimeSeriesChartContainer = styled_components_default.div`
|
|
|
2614
2719
|
position: absolute !important; // This is needed for canvas element export pdf/png to work correctly
|
|
2615
2720
|
}
|
|
2616
2721
|
`;
|
|
2617
|
-
var
|
|
2722
|
+
var appendTrellisToPayload2 = (payload, trellisKey, trellisSplitBy) => {
|
|
2723
|
+
const result = __spreadValues({}, payload);
|
|
2724
|
+
if (trellisSplitBy) {
|
|
2725
|
+
result["trellis.name"] = trellisSplitBy;
|
|
2726
|
+
}
|
|
2727
|
+
if (trellisKey) {
|
|
2728
|
+
result["trellis.value"] = trellisKey;
|
|
2729
|
+
}
|
|
2730
|
+
return result;
|
|
2731
|
+
};
|
|
2732
|
+
var hasMouseoverPayloadChanged = (currentPayload, previousPayload) => {
|
|
2733
|
+
if (!previousPayload) {
|
|
2734
|
+
return true;
|
|
2735
|
+
}
|
|
2736
|
+
if (currentPayload.index !== previousPayload.index) {
|
|
2737
|
+
return true;
|
|
2738
|
+
}
|
|
2739
|
+
if (currentPayload.seriesIndex !== previousPayload.seriesIndex) {
|
|
2740
|
+
return true;
|
|
2741
|
+
}
|
|
2742
|
+
if (currentPayload["trellis.name"] !== previousPayload["trellis.name"]) {
|
|
2743
|
+
return true;
|
|
2744
|
+
}
|
|
2745
|
+
if (currentPayload["trellis.value"] !== previousPayload["trellis.value"]) {
|
|
2746
|
+
return true;
|
|
2747
|
+
}
|
|
2748
|
+
return false;
|
|
2749
|
+
};
|
|
2750
|
+
var handleClick = (chartEvent, onClick, trellisKey, trellisSplitBy) => {
|
|
2618
2751
|
const payload = __spreadProps(__spreadValues({}, (0, lodash_exports.pick)(chartEvent, "value", "seriesKey")), {
|
|
2619
2752
|
name: chartEvent.seriesKey
|
|
2620
2753
|
});
|
|
2621
2754
|
delete payload.seriesKey;
|
|
2622
2755
|
if (chartEvent.rowContext) {
|
|
2623
|
-
Object.
|
|
2624
|
-
payload
|
|
2625
|
-
|
|
2756
|
+
Object.assign(
|
|
2757
|
+
payload,
|
|
2758
|
+
Object.keys(chartEvent.rowContext).reduce((acc, fieldName) => {
|
|
2759
|
+
acc[`row.${fieldName}.value`] = chartEvent.rowContext[fieldName];
|
|
2760
|
+
return acc;
|
|
2761
|
+
}, {})
|
|
2762
|
+
);
|
|
2626
2763
|
}
|
|
2764
|
+
const updatedPayload = appendTrellisToPayload2(payload, trellisKey, trellisSplitBy);
|
|
2627
2765
|
if (onClick) {
|
|
2628
2766
|
onClick({
|
|
2629
2767
|
type: "point.click",
|
|
2630
2768
|
originalEvent: chartEvent,
|
|
2631
|
-
payload
|
|
2769
|
+
payload: updatedPayload
|
|
2632
2770
|
});
|
|
2633
2771
|
}
|
|
2634
2772
|
};
|
|
2635
|
-
var handleLegendClick = (chartEvent, onClick) => {
|
|
2773
|
+
var handleLegendClick = (chartEvent, onClick, trellisKey, trellisSplitBy) => {
|
|
2636
2774
|
const payload = {
|
|
2637
2775
|
name: chartEvent
|
|
2638
2776
|
};
|
|
2777
|
+
const updatedPayload = appendTrellisToPayload2(payload, trellisKey, trellisSplitBy);
|
|
2639
2778
|
if (onClick) {
|
|
2640
2779
|
onClick({
|
|
2641
2780
|
type: "legend.click",
|
|
2642
2781
|
originalEvent: chartEvent,
|
|
2643
|
-
payload
|
|
2782
|
+
payload: updatedPayload
|
|
2783
|
+
});
|
|
2784
|
+
}
|
|
2785
|
+
};
|
|
2786
|
+
var handleRangeSelection = (rangeEvent, onSelect, chartData, trellisKey, trellisSplitBy) => {
|
|
2787
|
+
var _a;
|
|
2788
|
+
if (!rangeEvent) {
|
|
2789
|
+
return;
|
|
2790
|
+
}
|
|
2791
|
+
const xData = ((_a = chartData == null ? void 0 : chartData.columns) == null ? void 0 : _a[0]) || [];
|
|
2792
|
+
const { startXIndex, endXIndex } = findRangeIndices(xData, rangeEvent.start, rangeEvent.end);
|
|
2793
|
+
const payload = {
|
|
2794
|
+
startXIndex,
|
|
2795
|
+
startXValue: rangeEvent.start,
|
|
2796
|
+
endXIndex,
|
|
2797
|
+
endXValue: rangeEvent.end
|
|
2798
|
+
};
|
|
2799
|
+
const updatedPayload = appendTrellisToPayload2(payload, trellisKey, trellisSplitBy);
|
|
2800
|
+
if (onSelect) {
|
|
2801
|
+
onSelect({
|
|
2802
|
+
type: "range.selectBeforeZoom",
|
|
2803
|
+
originalEvent: rangeEvent,
|
|
2804
|
+
payload: updatedPayload
|
|
2805
|
+
});
|
|
2806
|
+
}
|
|
2807
|
+
};
|
|
2808
|
+
var handleRangeZoom = (rangeEvent, onSelect, chartData, trellisKey, trellisSplitBy) => {
|
|
2809
|
+
var _a;
|
|
2810
|
+
const xData = ((_a = chartData == null ? void 0 : chartData.columns) == null ? void 0 : _a[0]) || [];
|
|
2811
|
+
const { startXIndex, endXIndex } = findRangeIndices(xData, rangeEvent.start, rangeEvent.end);
|
|
2812
|
+
const payload = {
|
|
2813
|
+
startXIndex,
|
|
2814
|
+
startXValue: rangeEvent.start,
|
|
2815
|
+
endXIndex,
|
|
2816
|
+
endXValue: rangeEvent.end
|
|
2817
|
+
};
|
|
2818
|
+
const updatedPayload = appendTrellisToPayload2(payload, trellisKey, trellisSplitBy);
|
|
2819
|
+
if (onSelect) {
|
|
2820
|
+
onSelect({
|
|
2821
|
+
type: "range.select",
|
|
2822
|
+
originalEvent: rangeEvent,
|
|
2823
|
+
payload: updatedPayload
|
|
2644
2824
|
});
|
|
2645
2825
|
}
|
|
2646
2826
|
};
|
|
2827
|
+
var parseArrayOption = (value) => {
|
|
2828
|
+
if (Array.isArray(value)) {
|
|
2829
|
+
return value;
|
|
2830
|
+
}
|
|
2831
|
+
if (value) {
|
|
2832
|
+
return JSON.parse(value);
|
|
2833
|
+
}
|
|
2834
|
+
return void 0;
|
|
2835
|
+
};
|
|
2647
2836
|
var TimeSeriesChartWrapper = (props) => {
|
|
2648
|
-
|
|
2837
|
+
var _b, _c, _d;
|
|
2838
|
+
const _a = props, {
|
|
2649
2839
|
width,
|
|
2650
2840
|
height,
|
|
2651
2841
|
chartData,
|
|
@@ -2658,12 +2848,57 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
2658
2848
|
markerDisplay,
|
|
2659
2849
|
onClick,
|
|
2660
2850
|
onPointMouseOver,
|
|
2661
|
-
onPointMouseOut
|
|
2662
|
-
|
|
2663
|
-
|
|
2851
|
+
onPointMouseOut,
|
|
2852
|
+
onSelect,
|
|
2853
|
+
splitByLayout,
|
|
2854
|
+
trellisKey,
|
|
2855
|
+
trellisSplitBy,
|
|
2664
2856
|
backgroundColor,
|
|
2857
|
+
defaultFontColor,
|
|
2858
|
+
additionalTooltipValues,
|
|
2859
|
+
xAxisLineVisibility: xAxisLineVisibility,
|
|
2860
|
+
yAxisLineVisibility,
|
|
2861
|
+
y2AxisLineVisibility,
|
|
2862
|
+
showYAxisWithZero: showYAxisWithZeroFromProps,
|
|
2863
|
+
showY2AxisWithZero: showY2AxisWithZeroFromProps
|
|
2864
|
+
} = _a, otherOptions = __objRest(_a, [
|
|
2865
|
+
"width",
|
|
2866
|
+
"height",
|
|
2867
|
+
"chartData",
|
|
2868
|
+
"options",
|
|
2869
|
+
"userLocale",
|
|
2870
|
+
"annotationX",
|
|
2871
|
+
"annotationLabel",
|
|
2872
|
+
"annotationColor",
|
|
2873
|
+
"legendDisplay",
|
|
2874
|
+
"markerDisplay",
|
|
2875
|
+
"onClick",
|
|
2876
|
+
"onPointMouseOver",
|
|
2877
|
+
"onPointMouseOut",
|
|
2878
|
+
"onSelect",
|
|
2879
|
+
"splitByLayout",
|
|
2880
|
+
"trellisKey",
|
|
2881
|
+
"trellisSplitBy",
|
|
2882
|
+
"backgroundColor",
|
|
2883
|
+
"defaultFontColor",
|
|
2884
|
+
"additionalTooltipValues",
|
|
2885
|
+
// Extract axis line visibility options from props
|
|
2886
|
+
"xAxisLineVisibility",
|
|
2887
|
+
"yAxisLineVisibility",
|
|
2888
|
+
"y2AxisLineVisibility",
|
|
2889
|
+
// Extract showYAxisWithZero directly from props for accelerated render mode
|
|
2890
|
+
"showYAxisWithZero",
|
|
2891
|
+
"showY2AxisWithZero"
|
|
2892
|
+
]);
|
|
2893
|
+
const { eventHandlers, xField: xFieldFromProps } = otherOptions;
|
|
2894
|
+
const trellisEnabled = useTrellisEnabled(splitByLayout);
|
|
2895
|
+
const {
|
|
2896
|
+
backgroundColor: bgColorFromOptions,
|
|
2665
2897
|
seriesColors: seriesColorsStr,
|
|
2666
2898
|
fieldColors,
|
|
2899
|
+
legendLabels: legendLabelsStr,
|
|
2900
|
+
legendMode,
|
|
2901
|
+
legendTruncation,
|
|
2667
2902
|
"axisTitleX.text": xAxisTitleText,
|
|
2668
2903
|
"axisTitleY.text": yAxisTitleText,
|
|
2669
2904
|
"axisTitleY2.text": y2AxisTitleText,
|
|
@@ -2671,8 +2906,12 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
2671
2906
|
"axisTitleY.visibility": yAxisTitleVisibility,
|
|
2672
2907
|
"axisTitleY2.visibility": y2AxisTitleVisibility,
|
|
2673
2908
|
"axisLabelsX.majorLabelVisibility": xAxisLabelVisibility,
|
|
2909
|
+
"axisLabelsX.majorLabelStyle.rotation": xAxisLabelRotation,
|
|
2910
|
+
"axisLabelsX.maxLabelParts": xAxisMaxLabelParts,
|
|
2674
2911
|
"axisLabelsY.majorLabelVisibility": yAxisLabelVisibility,
|
|
2912
|
+
"axisLabelsY.majorUnit": yAxisMajorUnitFromSimpleXML,
|
|
2675
2913
|
"axisLabelsY2.majorLabelVisibility": y2AxisLabelVisibility,
|
|
2914
|
+
"axisLabelsY2.majorUnit": y2AxisMajorUnitFromSimpleXML,
|
|
2676
2915
|
"axisY.abbreviation": yAxisAbbreviation,
|
|
2677
2916
|
"axisY.scale": yAxisScale,
|
|
2678
2917
|
"axisY2.abbreviation": y2AxisAbbreviation,
|
|
@@ -2682,10 +2921,73 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
2682
2921
|
"axisLabelsY2.integerUnits": y2IntegerUnits,
|
|
2683
2922
|
"chart.overlayFields": overlayFieldsStr,
|
|
2684
2923
|
"chart.nullValueMode": nullValueMode,
|
|
2685
|
-
|
|
2924
|
+
"chart.showDataLabels": showDataLabels,
|
|
2925
|
+
lineWidth,
|
|
2926
|
+
lineDashStyle,
|
|
2927
|
+
fieldDashStyles: lineDashStylesByFieldStr,
|
|
2928
|
+
stepPosition,
|
|
2929
|
+
fieldStepPositions: stepPositionsByFieldStr,
|
|
2930
|
+
yAxisMin: yAxisMinRaw,
|
|
2931
|
+
yAxisMax: yAxisMaxRaw,
|
|
2932
|
+
y2AxisMin: y2AxisMinRaw,
|
|
2933
|
+
y2AxisMax: y2AxisMaxRaw,
|
|
2934
|
+
showXMajorGridLines,
|
|
2935
|
+
showYMajorGridLines,
|
|
2936
|
+
showY2MajorGridLines,
|
|
2937
|
+
showYMinorGridLines,
|
|
2938
|
+
showY2MinorGridLines,
|
|
2939
|
+
showLineSmoothing,
|
|
2940
|
+
xAxisMajorTickVisibility,
|
|
2941
|
+
xAxisMajorTickSize,
|
|
2942
|
+
yAxisMajorTickVisibility,
|
|
2943
|
+
y2AxisMajorTickVisibility,
|
|
2944
|
+
yAxisMajorTickSize,
|
|
2945
|
+
y2AxisMajorTickSize,
|
|
2946
|
+
yAxisMajorTickInterval,
|
|
2947
|
+
y2AxisMajorTickInterval,
|
|
2948
|
+
yAxisMinorTickVisibility,
|
|
2949
|
+
y2AxisMinorTickVisibility,
|
|
2950
|
+
yAxisMinorTickSize,
|
|
2951
|
+
y2AxisMinorTickSize,
|
|
2952
|
+
showYAxisWithZero: showYAxisWithZeroFromOptions,
|
|
2953
|
+
showY2AxisWithZero: showY2AxisWithZeroFromOptions
|
|
2686
2954
|
} = options;
|
|
2955
|
+
const dataValuesDisplay = showDataLabels === "none" ? "off" : showDataLabels;
|
|
2956
|
+
const showYAxisWithZero = showYAxisWithZeroFromProps != null ? showYAxisWithZeroFromProps : showYAxisWithZeroFromOptions;
|
|
2957
|
+
const showY2AxisWithZero = showY2AxisWithZeroFromProps != null ? showY2AxisWithZeroFromProps : showY2AxisWithZeroFromOptions;
|
|
2958
|
+
const showXMajorTicks = xAxisMajorTickVisibility !== "hide";
|
|
2959
|
+
const showYMajorTicks = yAxisMajorTickVisibility === "show";
|
|
2960
|
+
const showY2MajorTicks = y2AxisMajorTickVisibility === "show";
|
|
2961
|
+
const showYMinorTicks = yAxisMinorTickVisibility === "show";
|
|
2962
|
+
const showY2MinorTicks = y2AxisMinorTickVisibility === "show";
|
|
2963
|
+
const showXAxisLine = parseXAxisLineVisibility(xAxisLineVisibility);
|
|
2964
|
+
const showYAxisLine = yAxisLineVisibility === "show";
|
|
2965
|
+
const showY2AxisLine = y2AxisLineVisibility === "show";
|
|
2966
|
+
const yAxisMin = parseAxisValue(yAxisMinRaw);
|
|
2967
|
+
const yAxisMax = parseAxisValue(yAxisMaxRaw);
|
|
2968
|
+
const y2AxisMin = parseAxisValue(y2AxisMinRaw);
|
|
2969
|
+
const y2AxisMax = parseAxisValue(y2AxisMaxRaw);
|
|
2970
|
+
const parseTickInterval = (simpleXMLValue, canvasValue) => {
|
|
2971
|
+
if (simpleXMLValue) return Number(simpleXMLValue);
|
|
2972
|
+
if (canvasValue) return Number(canvasValue);
|
|
2973
|
+
return void 0;
|
|
2974
|
+
};
|
|
2975
|
+
const yAxisMajorTickIntervalNum = parseTickInterval(yAxisMajorUnitFromSimpleXML, yAxisMajorTickInterval);
|
|
2976
|
+
const y2AxisMajorTickIntervalNum = parseTickInterval(
|
|
2977
|
+
y2AxisMajorUnitFromSimpleXML,
|
|
2978
|
+
y2AxisMajorTickInterval
|
|
2979
|
+
);
|
|
2980
|
+
const xAxisMajorTickSizeNum = xAxisMajorTickSize != null ? Number(xAxisMajorTickSize) : void 0;
|
|
2981
|
+
const yAxisMajorTickSizeNum = yAxisMajorTickSize != null ? Number(yAxisMajorTickSize) : void 0;
|
|
2982
|
+
const y2AxisMajorTickSizeNum = y2AxisMajorTickSize != null ? Number(y2AxisMajorTickSize) : void 0;
|
|
2983
|
+
const yAxisMinorTickSizeNum = yAxisMinorTickSize != null ? Number(yAxisMinorTickSize) : void 0;
|
|
2984
|
+
const y2AxisMinorTickSizeNum = y2AxisMinorTickSize != null ? Number(y2AxisMinorTickSize) : void 0;
|
|
2687
2985
|
const seriesColors = seriesColorsStr ? JSON.parse(seriesColorsStr) : void 0;
|
|
2688
2986
|
const seriesColorsByField = fieldColors ? JSON.parse(fieldColors) : void 0;
|
|
2987
|
+
const lineDashStylesByField = lineDashStylesByFieldStr ? JSON.parse(lineDashStylesByFieldStr) : void 0;
|
|
2988
|
+
const stepPositionsByField = stepPositionsByFieldStr ? JSON.parse(stepPositionsByFieldStr) : void 0;
|
|
2989
|
+
const legendLabels = parseArrayOption(legendLabelsStr);
|
|
2990
|
+
const bgColor = backgroundColor || bgColorFromOptions;
|
|
2689
2991
|
const [containerWidth, setContainerWidth] = react_exports.useState(Number(props.width));
|
|
2690
2992
|
const [containerHeight, setContainerHeight] = react_exports.useState(Number(props.height));
|
|
2691
2993
|
const cachedHandleResize = react_exports.useCallback((w, h) => {
|
|
@@ -2696,31 +2998,64 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
2696
2998
|
fields: chartData.fields,
|
|
2697
2999
|
columns: chartData.seriesList
|
|
2698
3000
|
});
|
|
2699
|
-
const xField =
|
|
3001
|
+
const xField = getFieldName2(filteredChartData.fields[0]);
|
|
2700
3002
|
const yFields = getFieldNames(
|
|
2701
3003
|
filteredChartData.fields.length > 1 ? filteredChartData.fields.slice(1) : []
|
|
2702
3004
|
);
|
|
2703
|
-
const y2Fields =
|
|
2704
|
-
|
|
3005
|
+
const y2Fields = (0, react_exports.useMemo)(
|
|
3006
|
+
() => y2FieldsStr ? y2FieldsStr.split(",").map((f) => f.trim()) : [],
|
|
3007
|
+
[y2FieldsStr]
|
|
3008
|
+
);
|
|
3009
|
+
const overlayFields = (0, react_exports.useMemo)(
|
|
3010
|
+
() => overlayFieldsStr ? overlayFieldsStr.split(",").map((f) => f.trim()) : [],
|
|
3011
|
+
[overlayFieldsStr]
|
|
3012
|
+
);
|
|
2705
3013
|
let xAxisTitle = getComputedAxisTitles(xAxisTitleText, [xField], xAxisTitleVisibility);
|
|
2706
3014
|
xAxisTitle = ellipsisAxisTitle(xAxisTitle, containerWidth);
|
|
2707
|
-
|
|
3015
|
+
const yFieldsForTitle = y2Enabled ? yFields.filter((field) => !y2Fields.includes(field)) : yFields;
|
|
3016
|
+
let yAxisTitle = getComputedAxisTitles(yAxisTitleText, yFieldsForTitle, yAxisTitleVisibility);
|
|
2708
3017
|
yAxisTitle = ellipsisAxisTitle(yAxisTitle, containerHeight);
|
|
2709
3018
|
const fieldsForY2Axis = y2Fields.length > 0 ? y2Fields : overlayFields;
|
|
2710
3019
|
let y2AxisTitle = getComputedAxisTitles(y2AxisTitleText, fieldsForY2Axis, y2AxisTitleVisibility);
|
|
2711
3020
|
y2AxisTitle = ellipsisAxisTitle(y2AxisTitle, containerHeight);
|
|
2712
|
-
const xScaleConfig =
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
3021
|
+
const xScaleConfig = (0, react_exports.useMemo)(
|
|
3022
|
+
() => getXScaleConfig(xAxisTitle, xAxisLabelVisibility, xAxisLabelRotation),
|
|
3023
|
+
[xAxisTitle, xAxisLabelVisibility, xAxisLabelRotation]
|
|
3024
|
+
);
|
|
3025
|
+
const yScaleConfig = (0, react_exports.useMemo)(
|
|
3026
|
+
() => getYScaleConfig(
|
|
3027
|
+
yAxisTitle,
|
|
3028
|
+
yAxisAbbreviation,
|
|
3029
|
+
yAxisScale,
|
|
3030
|
+
yAxisLabelVisibility,
|
|
3031
|
+
yAxisMin,
|
|
3032
|
+
yAxisMax
|
|
3033
|
+
),
|
|
3034
|
+
[yAxisTitle, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility, yAxisMin, yAxisMax]
|
|
3035
|
+
);
|
|
3036
|
+
const y2ScaleConfig = (0, react_exports.useMemo)(() => {
|
|
3037
|
+
if (y2Enabled) {
|
|
3038
|
+
return getY2ScaleConfig(
|
|
3039
|
+
y2AxisTitle,
|
|
3040
|
+
y2AxisAbbreviation,
|
|
3041
|
+
y2AxisScale,
|
|
3042
|
+
y2IntegerUnits,
|
|
3043
|
+
y2AxisLabelVisibility,
|
|
3044
|
+
y2AxisMin,
|
|
3045
|
+
y2AxisMax
|
|
3046
|
+
);
|
|
3047
|
+
}
|
|
3048
|
+
return {};
|
|
3049
|
+
}, [
|
|
3050
|
+
y2Enabled,
|
|
3051
|
+
y2AxisTitle,
|
|
3052
|
+
y2AxisAbbreviation,
|
|
3053
|
+
y2AxisScale,
|
|
3054
|
+
y2IntegerUnits,
|
|
3055
|
+
y2AxisLabelVisibility,
|
|
3056
|
+
y2AxisMin,
|
|
3057
|
+
y2AxisMax
|
|
3058
|
+
]);
|
|
2724
3059
|
const uplotContainerElement = (0, react_exports.useRef)(null);
|
|
2725
3060
|
const seriesDataFormatted = [
|
|
2726
3061
|
filteredChartData.columns[0],
|
|
@@ -2736,9 +3071,25 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
2736
3071
|
overlayFields,
|
|
2737
3072
|
y2Enabled,
|
|
2738
3073
|
nullValueMode,
|
|
2739
|
-
markerDisplay
|
|
3074
|
+
markerDisplay,
|
|
3075
|
+
lineDashStyle,
|
|
3076
|
+
lineDashStylesByField,
|
|
3077
|
+
stepPosition,
|
|
3078
|
+
stepPositionsByField
|
|
2740
3079
|
),
|
|
2741
|
-
[
|
|
3080
|
+
[
|
|
3081
|
+
yFields,
|
|
3082
|
+
y2Fields,
|
|
3083
|
+
lineWidth,
|
|
3084
|
+
overlayFields,
|
|
3085
|
+
y2Enabled,
|
|
3086
|
+
nullValueMode,
|
|
3087
|
+
markerDisplay,
|
|
3088
|
+
lineDashStyle,
|
|
3089
|
+
lineDashStylesByField,
|
|
3090
|
+
stepPosition,
|
|
3091
|
+
stepPositionsByField
|
|
3092
|
+
]
|
|
2742
3093
|
);
|
|
2743
3094
|
const chartingEventAnnotations = (0, react_exports.useMemo)(
|
|
2744
3095
|
() => getAnnotationsForCanvas({
|
|
@@ -2752,25 +3103,59 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
2752
3103
|
() => __spreadValues(__spreadValues(__spreadValues({}, xScaleConfig), yScaleConfig), y2ScaleConfig),
|
|
2753
3104
|
[xScaleConfig, yScaleConfig, y2ScaleConfig]
|
|
2754
3105
|
);
|
|
2755
|
-
const
|
|
3106
|
+
const isSeriesCompare = legendMode === "seriesCompare";
|
|
3107
|
+
const legend = (0, react_exports.useMemo)(
|
|
3108
|
+
() => getLegend({
|
|
3109
|
+
legendDisplay: isSeriesCompare && legendDisplay !== "off" ? "right" : legendDisplay,
|
|
3110
|
+
isSeriesCompare,
|
|
3111
|
+
legendTruncation
|
|
3112
|
+
}),
|
|
3113
|
+
[legendDisplay, isSeriesCompare, legendTruncation]
|
|
3114
|
+
);
|
|
2756
3115
|
const handleChartClick = react_exports.useCallback(
|
|
2757
3116
|
(event) => {
|
|
2758
3117
|
if (onClick) {
|
|
2759
|
-
handleClick(event, onClick);
|
|
3118
|
+
handleClick(event, onClick, trellisKey, trellisSplitBy);
|
|
2760
3119
|
}
|
|
2761
3120
|
},
|
|
2762
|
-
[onClick]
|
|
3121
|
+
[onClick, trellisKey, trellisSplitBy]
|
|
2763
3122
|
);
|
|
2764
3123
|
const handleChartLegendClick = react_exports.useCallback(
|
|
2765
3124
|
(event) => {
|
|
2766
3125
|
if (onClick) {
|
|
2767
|
-
handleLegendClick(event, onClick);
|
|
3126
|
+
handleLegendClick(event, onClick, trellisKey, trellisSplitBy);
|
|
2768
3127
|
}
|
|
2769
3128
|
},
|
|
2770
|
-
[onClick]
|
|
3129
|
+
[onClick, trellisKey, trellisSplitBy]
|
|
3130
|
+
);
|
|
3131
|
+
const handleChartRangeSelection = react_exports.useCallback(
|
|
3132
|
+
(range2) => {
|
|
3133
|
+
if (onSelect) {
|
|
3134
|
+
handleRangeSelection(range2, onSelect, chartData, trellisKey, trellisSplitBy);
|
|
3135
|
+
}
|
|
3136
|
+
},
|
|
3137
|
+
[onSelect, chartData, trellisKey, trellisSplitBy]
|
|
3138
|
+
);
|
|
3139
|
+
const handleChartRangeZoom = react_exports.useCallback(
|
|
3140
|
+
(range2) => {
|
|
3141
|
+
if (onSelect) {
|
|
3142
|
+
handleRangeZoom(range2, onSelect, chartData, trellisKey, trellisSplitBy);
|
|
3143
|
+
}
|
|
3144
|
+
},
|
|
3145
|
+
[onSelect, chartData, trellisKey, trellisSplitBy]
|
|
3146
|
+
);
|
|
3147
|
+
const xFieldToUse = xFieldFromProps || xField;
|
|
3148
|
+
const enableSearchZoom = react_exports.useMemo(
|
|
3149
|
+
() => shouldEnableSearchZoom(eventHandlers, xFieldToUse),
|
|
3150
|
+
[eventHandlers, xFieldToUse]
|
|
2771
3151
|
);
|
|
2772
3152
|
const lastPayloadRef = react_exports.useRef(null);
|
|
2773
3153
|
const lastOriginalEventRef = react_exports.useRef(null);
|
|
3154
|
+
const previousMouseoverPayloadRef = react_exports.useRef(null);
|
|
3155
|
+
const additionalTooltipValuesRef = react_exports.useRef(additionalTooltipValues);
|
|
3156
|
+
react_exports.useEffect(() => {
|
|
3157
|
+
additionalTooltipValuesRef.current = additionalTooltipValues;
|
|
3158
|
+
}, [additionalTooltipValues]);
|
|
2774
3159
|
const handleChartCrosshairChange = react_exports.useCallback(
|
|
2775
3160
|
(event) => {
|
|
2776
3161
|
if (onPointMouseOver || onPointMouseOut) {
|
|
@@ -2782,6 +3167,7 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
2782
3167
|
payload: lastPayloadRef.current
|
|
2783
3168
|
});
|
|
2784
3169
|
}
|
|
3170
|
+
previousMouseoverPayloadRef.current = null;
|
|
2785
3171
|
return;
|
|
2786
3172
|
}
|
|
2787
3173
|
const payload = __spreadProps(__spreadValues({}, (0, lodash_exports.pick)(event, "value", "seriesKey", "time", "index", "seriesIndex")), {
|
|
@@ -2789,25 +3175,36 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
2789
3175
|
});
|
|
2790
3176
|
delete payload.seriesKey;
|
|
2791
3177
|
if (event.rowContext) {
|
|
2792
|
-
Object.
|
|
2793
|
-
payload
|
|
2794
|
-
|
|
3178
|
+
Object.assign(
|
|
3179
|
+
payload,
|
|
3180
|
+
Object.keys(event.rowContext).reduce((acc, fieldName) => {
|
|
3181
|
+
acc[`row.${fieldName}.value`] = event.rowContext[fieldName];
|
|
3182
|
+
return acc;
|
|
3183
|
+
}, {})
|
|
3184
|
+
);
|
|
3185
|
+
}
|
|
3186
|
+
const updatedPayload = appendTrellisToPayload2(payload, trellisKey, trellisSplitBy);
|
|
3187
|
+
if (!hasMouseoverPayloadChanged(updatedPayload, previousMouseoverPayloadRef.current)) {
|
|
3188
|
+
return;
|
|
2795
3189
|
}
|
|
2796
|
-
lastPayloadRef.current =
|
|
3190
|
+
lastPayloadRef.current = updatedPayload;
|
|
2797
3191
|
lastOriginalEventRef.current = event;
|
|
3192
|
+
previousMouseoverPayloadRef.current = __spreadValues({}, updatedPayload);
|
|
2798
3193
|
if (onPointMouseOver) {
|
|
2799
3194
|
onPointMouseOver({
|
|
2800
3195
|
type: "point.mouseover",
|
|
2801
3196
|
originalEvent: event,
|
|
2802
|
-
payload
|
|
3197
|
+
payload: updatedPayload
|
|
2803
3198
|
});
|
|
2804
3199
|
}
|
|
2805
3200
|
}
|
|
2806
3201
|
},
|
|
2807
|
-
[onPointMouseOver, onPointMouseOut]
|
|
3202
|
+
[onPointMouseOver, onPointMouseOut, trellisKey, trellisSplitBy]
|
|
2808
3203
|
);
|
|
2809
|
-
const
|
|
2810
|
-
|
|
3204
|
+
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}`;
|
|
3205
|
+
const memoizedChart = (0, react_exports.useMemo)(() => {
|
|
3206
|
+
const computedOnRangeZoom = onSelect ? handleChartRangeZoom : void 0;
|
|
3207
|
+
return /* @__PURE__ */ react_exports.createElement(visualization_canvas_exports.RangeSelectionProvider, { key: dataKey }, /* @__PURE__ */ react_exports.createElement(
|
|
2811
3208
|
visualization_canvas_exports.TimeSeriesChart,
|
|
2812
3209
|
{
|
|
2813
3210
|
data: chartData,
|
|
@@ -2817,49 +3214,121 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
2817
3214
|
seriesColorsByField,
|
|
2818
3215
|
seriesConfig: seriesOverrides,
|
|
2819
3216
|
legend,
|
|
3217
|
+
legendLabels,
|
|
3218
|
+
legendTruncation,
|
|
3219
|
+
isSeriesCompare: legendMode === "seriesCompare",
|
|
3220
|
+
maxSeriesFocus: legendMode === "seriesCompare" ? 0 : void 0,
|
|
2820
3221
|
scaleConfig,
|
|
2821
3222
|
timestampFormat: "expanded",
|
|
2822
3223
|
onCrosshairClick: onClick ? handleChartClick : void 0,
|
|
2823
3224
|
onCrosshairChange: onPointMouseOver || onPointMouseOut ? handleChartCrosshairChange : void 0,
|
|
2824
3225
|
onSeriesClick: onClick ? handleChartLegendClick : void 0,
|
|
3226
|
+
onRangeSelection: handleChartRangeSelection,
|
|
3227
|
+
onRangeZoom: computedOnRangeZoom,
|
|
3228
|
+
serverSideZoom: enableSearchZoom,
|
|
2825
3229
|
userLocale,
|
|
2826
3230
|
events: chartingEventAnnotations,
|
|
2827
|
-
eventsConfig: { renderer: triangleEventAnnotationRenderer }
|
|
3231
|
+
eventsConfig: { renderer: triangleEventAnnotationRenderer },
|
|
3232
|
+
additionalTooltipValuesRef,
|
|
3233
|
+
showXMajorGridLines,
|
|
3234
|
+
showYMajorGridLines,
|
|
3235
|
+
showY2MajorGridLines,
|
|
3236
|
+
showYMinorGridLines,
|
|
3237
|
+
showY2MinorGridLines,
|
|
3238
|
+
showLineSmoothing,
|
|
3239
|
+
dataValuesDisplay,
|
|
3240
|
+
showXMajorTicks,
|
|
3241
|
+
xAxisMajorTickSize: xAxisMajorTickSizeNum,
|
|
3242
|
+
showYMajorTicks,
|
|
3243
|
+
showY2MajorTicks,
|
|
3244
|
+
yAxisMajorTickSize: yAxisMajorTickSizeNum,
|
|
3245
|
+
y2AxisMajorTickSize: y2AxisMajorTickSizeNum,
|
|
3246
|
+
yAxisMajorTickInterval: yAxisMajorTickIntervalNum,
|
|
3247
|
+
y2AxisMajorTickInterval: y2AxisMajorTickIntervalNum,
|
|
3248
|
+
showYMinorTicks,
|
|
3249
|
+
showY2MinorTicks,
|
|
3250
|
+
yAxisMinorTickSize: yAxisMinorTickSizeNum,
|
|
3251
|
+
y2AxisMinorTickSize: y2AxisMinorTickSizeNum,
|
|
3252
|
+
showYAxisWithZero,
|
|
3253
|
+
showY2AxisWithZero,
|
|
3254
|
+
showXAxisLine,
|
|
3255
|
+
showYAxisLine,
|
|
3256
|
+
showY2AxisLine,
|
|
3257
|
+
xAxisMaxLabelParts
|
|
2828
3258
|
}
|
|
2829
|
-
)
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
3259
|
+
));
|
|
3260
|
+
}, [
|
|
3261
|
+
onSelect,
|
|
3262
|
+
handleChartRangeZoom,
|
|
3263
|
+
dataKey,
|
|
3264
|
+
chartData,
|
|
3265
|
+
containerWidth,
|
|
3266
|
+
containerHeight,
|
|
3267
|
+
seriesColors,
|
|
3268
|
+
seriesColorsByField,
|
|
3269
|
+
seriesOverrides,
|
|
3270
|
+
legend,
|
|
3271
|
+
legendLabels,
|
|
3272
|
+
legendTruncation,
|
|
3273
|
+
scaleConfig,
|
|
3274
|
+
onClick,
|
|
3275
|
+
handleChartClick,
|
|
3276
|
+
onPointMouseOver,
|
|
3277
|
+
onPointMouseOut,
|
|
3278
|
+
handleChartCrosshairChange,
|
|
3279
|
+
handleChartLegendClick,
|
|
3280
|
+
handleChartRangeSelection,
|
|
3281
|
+
enableSearchZoom,
|
|
3282
|
+
userLocale,
|
|
3283
|
+
chartingEventAnnotations,
|
|
3284
|
+
showXMajorGridLines,
|
|
3285
|
+
showYMajorGridLines,
|
|
3286
|
+
showY2MajorGridLines,
|
|
3287
|
+
showYMinorGridLines,
|
|
3288
|
+
showY2MinorGridLines,
|
|
3289
|
+
showLineSmoothing,
|
|
3290
|
+
dataValuesDisplay,
|
|
3291
|
+
showXMajorTicks,
|
|
3292
|
+
xAxisMajorTickSizeNum,
|
|
3293
|
+
showYMajorTicks,
|
|
3294
|
+
showY2MajorTicks,
|
|
3295
|
+
yAxisMajorTickSizeNum,
|
|
3296
|
+
y2AxisMajorTickSizeNum,
|
|
3297
|
+
yAxisMajorTickIntervalNum,
|
|
3298
|
+
y2AxisMajorTickIntervalNum,
|
|
3299
|
+
showYMinorTicks,
|
|
3300
|
+
showY2MinorTicks,
|
|
3301
|
+
yAxisMinorTickSizeNum,
|
|
3302
|
+
y2AxisMinorTickSizeNum,
|
|
3303
|
+
showYAxisWithZero,
|
|
3304
|
+
showY2AxisWithZero,
|
|
3305
|
+
showXAxisLine,
|
|
3306
|
+
showYAxisLine,
|
|
3307
|
+
showY2AxisLine,
|
|
3308
|
+
legendMode,
|
|
3309
|
+
xAxisMaxLabelParts
|
|
3310
|
+
]);
|
|
2849
3311
|
const memoizedVisualization = (0, react_exports.useMemo)(() => {
|
|
2850
|
-
return /* @__PURE__ */ react_exports.createElement(VizStyleWrapper_default, { backgroundColor }, memoizedChart);
|
|
2851
|
-
}, [
|
|
2852
|
-
return /* @__PURE__ */ react_exports.createElement(
|
|
3312
|
+
return /* @__PURE__ */ react_exports.createElement(VizStyleWrapper_default, { backgroundColor: bgColor }, memoizedChart);
|
|
3313
|
+
}, [bgColor, memoizedChart]);
|
|
3314
|
+
return /* @__PURE__ */ react_exports.createElement(react_exports.Fragment, null, trellisEnabled && /* @__PURE__ */ react_exports.createElement(
|
|
3315
|
+
TrellisTitle,
|
|
3316
|
+
{
|
|
3317
|
+
trellisKey,
|
|
3318
|
+
backgroundColor: bgColor,
|
|
3319
|
+
fontColor: defaultFontColor
|
|
3320
|
+
}
|
|
3321
|
+
), /* @__PURE__ */ react_exports.createElement(
|
|
2853
3322
|
TimeSeriesChartContainer,
|
|
2854
3323
|
{
|
|
2855
|
-
height,
|
|
3324
|
+
height: trellisEnabled ? Number(height) - TRELLIS_TITLE_HEIGHT : height,
|
|
2856
3325
|
width,
|
|
2857
3326
|
ref: uplotContainerElement,
|
|
2858
3327
|
"data-test": "timeseries-chart-wrapper"
|
|
2859
3328
|
},
|
|
2860
3329
|
/* @__PURE__ */ react_exports.createElement(SizeAwareWrapper_default, { width, height, onResize: cachedHandleResize }),
|
|
2861
3330
|
memoizedVisualization
|
|
2862
|
-
);
|
|
3331
|
+
));
|
|
2863
3332
|
};
|
|
2864
3333
|
var TimeSeriesChartWrapper_default = TimeSeriesChartWrapper;
|
|
2865
3334
|
|
|
@@ -3172,7 +3641,12 @@ var pieOptionsSCMapping = {
|
|
|
3172
3641
|
resultLimit: "resultTruncationLimit",
|
|
3173
3642
|
seriesColorsByField: "fieldColors",
|
|
3174
3643
|
collapseThreshold: "chart.sliceCollapsingThreshold",
|
|
3175
|
-
collapseLabel: "chart.sliceCollapsingLabel"
|
|
3644
|
+
collapseLabel: "chart.sliceCollapsingLabel",
|
|
3645
|
+
legendDisplay: "legendPlacement"
|
|
3646
|
+
};
|
|
3647
|
+
var getFieldName3 = (field) => {
|
|
3648
|
+
var _a, _b;
|
|
3649
|
+
return typeof field === "string" ? field : (_b = (_a = field.name) == null ? void 0 : _a.toString()) != null ? _b : "";
|
|
3176
3650
|
};
|
|
3177
3651
|
var convertToStringValues = (options) => {
|
|
3178
3652
|
const updatedOptions = (0, propUtils_exports.convertPropsToString)({
|
|
@@ -3195,8 +3669,27 @@ var mapLabelDisplay = (_a) => {
|
|
|
3195
3669
|
}
|
|
3196
3670
|
return convertedOptions;
|
|
3197
3671
|
};
|
|
3672
|
+
var ALLOWED_LEGEND_PLACEMENTS = /* @__PURE__ */ new Set(["right", "left", "top", "bottom"]);
|
|
3673
|
+
var mapLegendDisplay = (options) => {
|
|
3674
|
+
if (!Object.hasOwn(options, "legendPlacement")) {
|
|
3675
|
+
return __spreadProps(__spreadValues({}, options), {
|
|
3676
|
+
showLegend: false
|
|
3677
|
+
});
|
|
3678
|
+
}
|
|
3679
|
+
const placement = options.legendPlacement;
|
|
3680
|
+
if (typeof placement === "string" && ALLOWED_LEGEND_PLACEMENTS.has(placement)) {
|
|
3681
|
+
return __spreadProps(__spreadValues({}, options), {
|
|
3682
|
+
legendPlacement: placement,
|
|
3683
|
+
showLegend: true
|
|
3684
|
+
});
|
|
3685
|
+
}
|
|
3686
|
+
const next = __spreadValues({}, options);
|
|
3687
|
+
delete next.legendPlacement;
|
|
3688
|
+
next.showLegend = false;
|
|
3689
|
+
return next;
|
|
3690
|
+
};
|
|
3198
3691
|
var mapToOldKey = (options) => (0, lodash_exports.mapKeys)(options, (val, key) => pieOptionsSCMapping[key] ? pieOptionsSCMapping[key] : key);
|
|
3199
|
-
var convertToPieSCProperties = (originalOptions) => (0, lodash_exports.chain)(mapToOldKey(originalOptions)).thru(convertToStringValues).thru(mapLabelDisplay).value();
|
|
3692
|
+
var convertToPieSCProperties = (originalOptions) => (0, lodash_exports.chain)(mapToOldKey(originalOptions)).thru(convertToStringValues).thru(mapLabelDisplay).thru(mapLegendDisplay).value();
|
|
3200
3693
|
var getPieMergedOptions = (options, vizConfig) => (0, hocUtils_exports.deepMergeWithArrayPrimitiveOverrides)(
|
|
3201
3694
|
{},
|
|
3202
3695
|
options,
|
|
@@ -3206,9 +3699,7 @@ var getPieOptionFieldIndex = (optionName, dataSources, options, vizConfig) => {
|
|
|
3206
3699
|
const mergedOptions = getPieMergedOptions(options, vizConfig);
|
|
3207
3700
|
const fieldName = (0, dsl_exports.getFieldsFromDSL)(mergedOptions[optionName], dataSources)[0];
|
|
3208
3701
|
const { fields } = dataSources.primary.data;
|
|
3209
|
-
const fieldIndex = fields.findIndex(
|
|
3210
|
-
(field) => (typeof field === "string" ? field : field.name.toString()) === fieldName
|
|
3211
|
-
);
|
|
3702
|
+
const fieldIndex = fields.findIndex((field) => getFieldName3(field) === fieldName);
|
|
3212
3703
|
return fieldIndex;
|
|
3213
3704
|
};
|
|
3214
3705
|
var invalidOptionField = (optionName, dataSources, options, vizConfig) => {
|
|
@@ -3522,7 +4013,8 @@ var computeVizProps = (_a) => {
|
|
|
3522
4013
|
};
|
|
3523
4014
|
const { labelField, valueField, hasEventHandlers } = otherOptions;
|
|
3524
4015
|
computedProps.options = (0, lodash_exports.chain)(otherOptions).pick(validOptions).thru(convertToPieSCProperties).thru((options) => __spreadProps(__spreadValues({}, (0, simpleXMLOptions_exports.getSimpleXMLOptionsForProps)(options)), {
|
|
3525
|
-
chart: "pie"
|
|
4016
|
+
chart: "pie",
|
|
4017
|
+
"legend.clickEnabled": false
|
|
3526
4018
|
})).value();
|
|
3527
4019
|
const truncationLimit = computedProps.options["chart.resultTruncationLimit"];
|
|
3528
4020
|
let primaryData = __spreadProps(__spreadValues({}, dataSources.primary.data), {
|