@splunk/visualizations 28.3.0 → 28.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Area/Area.d.ts.map +1 -1
- package/Area.config.js +0 -1
- package/Area.config.js.map +2 -2
- package/Area.js +495 -99
- package/Area.js.map +3 -3
- package/Bar/Bar.d.ts.map +1 -1
- package/Bar.config.js +0 -1
- package/Bar.config.js.map +2 -2
- package/Bar.js +505 -99
- package/Bar.js.map +3 -3
- package/Bubble.config.js +0 -1
- package/Bubble.config.js.map +2 -2
- package/Bubble.js +494 -86
- package/Bubble.js.map +3 -3
- package/CHANGELOG.external.md +76 -0
- package/ChoroplethSvg/ChoroplethSvg.d.ts +4 -3
- package/ChoroplethSvg/ChoroplethSvg.d.ts.map +1 -1
- package/ChoroplethSvg.config.js +1 -3
- package/ChoroplethSvg.config.js.map +2 -2
- package/ChoroplethSvg.js +539 -103
- package/ChoroplethSvg.js.map +4 -4
- package/Column/Column.d.ts.map +1 -1
- package/Column.config.js +0 -1
- package/Column.config.js.map +2 -2
- package/Column.js +495 -99
- package/Column.js.map +3 -3
- package/Ellipse.js +528 -104
- package/Ellipse.js.map +4 -4
- package/Events/PureEvents/PureEvents.d.ts.map +1 -1
- package/Events.js +612 -149
- package/Events.js.map +4 -4
- package/FillerGauge/FillerGauge.d.ts.map +1 -1
- package/FillerGauge/PureFillerGauge/FillerGauge.d.ts.map +1 -1
- package/FillerGauge.js +535 -140
- package/FillerGauge.js.map +4 -4
- package/Image/Image.d.ts.map +1 -1
- package/Image.js +564 -108
- package/Image.js.map +4 -4
- package/Line/Line.d.ts.map +1 -1
- package/Line/lineUtils.d.ts.map +1 -1
- package/Line/mockdata/LineData.d.ts +59 -0
- package/Line/mockdata/LineData.d.ts.map +1 -1
- package/Line.config.js +0 -1
- package/Line.config.js.map +2 -2
- package/Line.js +601 -100
- package/Line.js.map +3 -3
- package/LinkGraph/PureLinkGraph/PureLinkGraph.d.ts +5 -0
- package/LinkGraph/PureLinkGraph/PureLinkGraph.d.ts.map +1 -1
- package/LinkGraph/PureLinkGraph/PureLinkGraphUtils.d.ts.map +1 -1
- package/LinkGraph/PureLinkGraph/components/Graph.d.ts +9 -1
- package/LinkGraph/PureLinkGraph/components/Graph.d.ts.map +1 -1
- package/LinkGraph/PureLinkGraph/components/GraphStyles.d.ts.map +1 -1
- package/LinkGraph/PureLinkGraph/components/Node.d.ts +1 -0
- package/LinkGraph/PureLinkGraph/components/Node.d.ts.map +1 -1
- package/LinkGraph/PureLinkGraph/components/Nodes.d.ts +1 -0
- package/LinkGraph/PureLinkGraph/components/Nodes.d.ts.map +1 -1
- package/LinkGraph/PureLinkGraph/measurementUtils.d.ts +16 -0
- package/LinkGraph/PureLinkGraph/measurementUtils.d.ts.map +1 -0
- package/LinkGraph/PureLinkGraph/utils/iconLoader.d.ts.map +1 -1
- package/LinkGraph/config.d.ts.map +1 -1
- package/LinkGraph.config.js +15 -1
- package/LinkGraph.config.js.map +2 -2
- package/LinkGraph.js +1355 -654
- package/LinkGraph.js.map +4 -4
- package/Map/Map.d.ts +2 -2
- package/Map/Map.d.ts.map +1 -1
- package/Map/PureMap/BubbleLayer.d.ts +5 -0
- package/Map/PureMap/BubbleLayer.d.ts.map +1 -1
- package/Map/PureMap/LocalChoroplethLayer.d.ts.map +1 -1
- package/Map/PureMap/PureMap.d.ts.map +1 -1
- package/Map/PureMap/PureMapContainer.d.ts.map +1 -1
- package/Map/PureMap/Tooltip.d.ts.map +1 -1
- package/Map/config.d.ts.map +1 -1
- package/Map.config.js +0 -1
- package/Map.config.js.map +2 -2
- package/Map.js +738 -228
- package/Map.js.map +4 -4
- package/Markdown/Markdown.d.ts.map +1 -1
- package/Markdown.js +548 -95
- package/Markdown.js.map +4 -4
- package/MarkerGauge/MarkerGauge.d.ts +5 -1
- package/MarkerGauge/MarkerGauge.d.ts.map +1 -1
- package/MarkerGauge/PureMarkerGauge/MarkerGauge.d.ts +4 -0
- package/MarkerGauge/PureMarkerGauge/MarkerGauge.d.ts.map +1 -1
- package/MarkerGauge/config.d.ts.map +1 -1
- package/MarkerGauge.config.js +121 -3
- package/MarkerGauge.config.js.map +3 -3
- package/MarkerGauge.js +1318 -142
- package/MarkerGauge.js.map +4 -4
- package/NetworkGraph/NetworkGraph.d.ts +22 -0
- package/NetworkGraph/NetworkGraph.d.ts.map +1 -0
- package/NetworkGraph/PureNetworkGraph/PureNetworkGraph.d.ts +60 -0
- package/NetworkGraph/PureNetworkGraph/PureNetworkGraph.d.ts.map +1 -0
- package/NetworkGraph/PureNetworkGraph/components/Link.d.ts +19 -0
- package/NetworkGraph/PureNetworkGraph/components/Link.d.ts.map +1 -0
- package/NetworkGraph/PureNetworkGraph/components/NetworkGraphSvg.d.ts +29 -0
- package/NetworkGraph/PureNetworkGraph/components/NetworkGraphSvg.d.ts.map +1 -0
- package/NetworkGraph/PureNetworkGraph/components/Node.d.ts +27 -0
- package/NetworkGraph/PureNetworkGraph/components/Node.d.ts.map +1 -0
- package/NetworkGraph/PureNetworkGraph/components/Tooltip.d.ts +12 -0
- package/NetworkGraph/PureNetworkGraph/components/Tooltip.d.ts.map +1 -0
- package/NetworkGraph/PureNetworkGraph/components/ZoomControls.d.ts +13 -0
- package/NetworkGraph/PureNetworkGraph/components/ZoomControls.d.ts.map +1 -0
- package/NetworkGraph/PureNetworkGraph/mockdata/data.d.ts +140 -0
- package/NetworkGraph/PureNetworkGraph/mockdata/data.d.ts.map +1 -0
- package/NetworkGraph/PureNetworkGraph/mockdata/datasource.d.ts +89 -0
- package/NetworkGraph/PureNetworkGraph/mockdata/datasource.d.ts.map +1 -0
- package/NetworkGraph/PureNetworkGraph/utils/forceLayout.d.ts +47 -0
- package/NetworkGraph/PureNetworkGraph/utils/forceLayout.d.ts.map +1 -0
- package/NetworkGraph/PureNetworkGraph/utils/iconLoader.d.ts +78 -0
- package/NetworkGraph/PureNetworkGraph/utils/iconLoader.d.ts.map +1 -0
- package/NetworkGraph/PureNetworkGraph/utils/networkGraphShared.d.ts +111 -0
- package/NetworkGraph/PureNetworkGraph/utils/networkGraphShared.d.ts.map +1 -0
- package/NetworkGraph/PureNetworkGraph/utils/networkGraphUtils.d.ts +123 -0
- package/NetworkGraph/PureNetworkGraph/utils/networkGraphUtils.d.ts.map +1 -0
- package/NetworkGraph/config.d.ts +4 -0
- package/NetworkGraph/config.d.ts.map +1 -0
- package/NetworkGraph/index.d.ts +3 -0
- package/NetworkGraph/index.d.ts.map +1 -0
- package/NetworkGraph.config.js +938 -0
- package/NetworkGraph.config.js.map +7 -0
- package/NetworkGraph.js +6793 -0
- package/NetworkGraph.js.map +7 -0
- package/ParallelCoordinates.js +532 -93
- package/ParallelCoordinates.js.map +4 -4
- package/Pie/Pie.d.ts.map +1 -1
- package/Pie/pieUtils.d.ts.map +1 -1
- package/Pie.js +510 -101
- package/Pie.js.map +3 -3
- package/Punchcard.js +523 -84
- package/Punchcard.js.map +4 -4
- package/Rectangle.js +537 -113
- package/Rectangle.js.map +4 -4
- package/Sankey/PureSankey/SankeyTooltip.d.ts.map +1 -1
- package/Sankey.js +562 -111
- package/Sankey.js.map +4 -4
- package/Scatter/Scatter.d.ts.map +1 -1
- package/Scatter.config.js +0 -1
- package/Scatter.config.js.map +2 -2
- package/Scatter.js +505 -99
- package/Scatter.js.map +3 -3
- package/SingleValue/SingleValue.d.ts.map +1 -1
- package/SingleValue/config.d.ts.map +1 -1
- package/SingleValue.config.js +15 -2
- package/SingleValue.config.js.map +2 -2
- package/SingleValue.js +656 -173
- package/SingleValue.js.map +3 -3
- package/SingleValueBasic.js.map +1 -1
- package/SingleValueIcon/SingleValueIcon.d.ts.map +1 -1
- package/SingleValueIcon/config.d.ts.map +1 -1
- package/SingleValueIcon.config.js +0 -1
- package/SingleValueIcon.config.js.map +2 -2
- package/SingleValueIcon.js +512 -124
- package/SingleValueIcon.js.map +3 -3
- package/SingleValueRadial/PureSingleValueRadial/utils/gaugeUtils.d.ts +0 -8
- package/SingleValueRadial/PureSingleValueRadial/utils/gaugeUtils.d.ts.map +1 -1
- package/SingleValueRadial/SingleValueRadial.d.ts.map +1 -1
- package/SingleValueRadial.config.js +0 -1
- package/SingleValueRadial.config.js.map +2 -2
- package/SingleValueRadial.js +517 -124
- package/SingleValueRadial.js.map +4 -4
- package/SparkLine.js +46 -8
- package/SparkLine.js.map +2 -2
- package/Table/PureTable.d.ts +10 -0
- package/Table/PureTable.d.ts.map +1 -1
- package/Table/cells/SparklineCell.d.ts.map +1 -1
- package/Table/config.d.ts.map +1 -1
- package/Table/hooks.d.ts +4 -0
- package/Table/hooks.d.ts.map +1 -1
- package/Table.config.js +1 -1
- package/Table.config.js.map +2 -2
- package/Table.js +760 -223
- package/Table.js.map +4 -4
- package/Timeline/PureTimeline/src/CursorPlugin.d.ts.map +1 -1
- package/Timeline/PureTimeline/src/TimelineLegend.d.ts.map +1 -1
- package/Timeline/config.d.ts.map +1 -1
- package/Timeline.config.js +31 -12
- package/Timeline.config.js.map +4 -4
- package/Timeline.js +649 -211
- package/Timeline.js.map +4 -4
- package/common/Charting.d.ts +5 -0
- package/common/Charting.d.ts.map +1 -1
- package/common/Charting.js +12 -0
- package/common/Charting.js.map +2 -2
- package/common/OptionsDoc.js.map +1 -1
- package/common/ThemesDoc.js +0 -1
- package/common/ThemesDoc.js.map +2 -2
- package/common/TimeSeriesChartWrapper.d.ts +24 -11
- package/common/TimeSeriesChartWrapper.d.ts.map +1 -1
- package/common/TimeSeriesChartWrapper.js +561 -83
- package/common/TimeSeriesChartWrapper.js.map +4 -4
- package/common/chartingUtils.d.ts +45 -5
- package/common/chartingUtils.d.ts.map +1 -1
- package/common/chartingUtils.js +102 -8
- package/common/chartingUtils.js.map +3 -3
- package/common/editorConfig/AxesChartDataConfig.d.ts.map +1 -1
- package/common/hocs/withTrellis.d.ts.map +1 -1
- package/common/interfaces/DashboardVizProps.d.ts +0 -3
- package/common/interfaces/DashboardVizProps.d.ts.map +1 -1
- package/common/interfaces/DataSource.d.ts +1 -1
- package/common/interfaces/DataSource.d.ts.map +1 -1
- package/common/shapeUtils.js +5 -20
- package/common/shapeUtils.js.map +2 -2
- package/common/utils/dataUtils.d.ts.map +1 -1
- package/common/utils/dataUtils.js +5 -4
- package/common/utils/dataUtils.js.map +2 -2
- package/common/utils/mapUtils.js +16 -9
- package/common/utils/mapUtils.js.map +2 -2
- package/common/utils/singleValueUtils.js +17 -18
- package/common/utils/singleValueUtils.js.map +2 -2
- package/common/utils/textUtils.d.ts +20 -0
- package/common/utils/textUtils.d.ts.map +1 -0
- package/common/utils/textUtils.js +76 -0
- package/common/utils/textUtils.js.map +7 -0
- package/common/utils/trellisUtils.d.ts.map +1 -1
- package/common/utils/trellisUtils.js +12 -14
- package/common/utils/trellisUtils.js.map +2 -2
- package/common/withDashboardViz.d.ts.map +1 -1
- package/common/withDashboardViz.js +544 -84
- package/common/withDashboardViz.js.map +4 -4
- package/package.json +33 -26
- package/common/utils/styleUtils.d.ts +0 -2
- package/common/utils/styleUtils.d.ts.map +0 -1
- package/common/utils/styleUtils.js +0 -30
- package/common/utils/styleUtils.js.map +0 -7
package/Punchcard.js
CHANGED
|
@@ -754,7 +754,7 @@ var Cover = styled_components_default.div`
|
|
|
754
754
|
bottom: 0;
|
|
755
755
|
`;
|
|
756
756
|
var Blocker = styled_components_default.div.attrs({
|
|
757
|
-
"data-splunk-visualization-version": "28.
|
|
757
|
+
"data-splunk-visualization-version": "28.4.0 - 002bd482f"
|
|
758
758
|
})`
|
|
759
759
|
position: relative;
|
|
760
760
|
width: 100%;
|
|
@@ -844,7 +844,7 @@ var withFixedSizeContainer = (Viz) => {
|
|
|
844
844
|
FixSizeItem,
|
|
845
845
|
{
|
|
846
846
|
"data-test": "fix-size-item",
|
|
847
|
-
"data-splunk-visualization-version": "28.
|
|
847
|
+
"data-splunk-visualization-version": "28.4.0 - 002bd482f",
|
|
848
848
|
width,
|
|
849
849
|
height,
|
|
850
850
|
backgroundColor
|
|
@@ -940,6 +940,7 @@ __reExport(numberUtils_exports, require("@splunk/visualizations-shared/numberUti
|
|
|
940
940
|
var numberUtils_default = "default" in defaultImport27 ? defaultImport27.default : defaultImport27;
|
|
941
941
|
|
|
942
942
|
// src/common/utils/dataUtils.ts
|
|
943
|
+
var getFieldName = (field) => typeof field === "string" ? field : field.name;
|
|
943
944
|
var largestTriangleThreeBuckets = (data, threshold, preferredDownsampleIndices) => {
|
|
944
945
|
const dataLength = data.length;
|
|
945
946
|
const downsampledIndices = [];
|
|
@@ -1056,9 +1057,9 @@ var tryToCoerceAllDisplayedFields = (ds, xField, yFields, fieldTypes, options) =
|
|
|
1056
1057
|
let xColumn = [];
|
|
1057
1058
|
const yColumns = [];
|
|
1058
1059
|
const canDownsample = !ds.data.fields.some((field, index) => {
|
|
1059
|
-
var _a
|
|
1060
|
-
const fieldName = (
|
|
1061
|
-
const fieldType = (
|
|
1060
|
+
var _a;
|
|
1061
|
+
const fieldName = getFieldName(field);
|
|
1062
|
+
const fieldType = (_a = fieldTypes[index]) != null ? _a : "unknown";
|
|
1062
1063
|
const column = ds.data.columns[index];
|
|
1063
1064
|
let hasDisplayedColumnThatCantBeDownsampled = false;
|
|
1064
1065
|
if (fieldName === xField) {
|
|
@@ -1423,6 +1424,16 @@ var mapToValues = (optionValuesSCMapping) => (options) => {
|
|
|
1423
1424
|
});
|
|
1424
1425
|
return convertedOptions;
|
|
1425
1426
|
};
|
|
1427
|
+
var shouldEnableSearchZoom = (eventHandlers = [], xField = "") => {
|
|
1428
|
+
const rangeSelectEventHandler = eventHandlers.find(
|
|
1429
|
+
(eventHandler) => {
|
|
1430
|
+
var _a;
|
|
1431
|
+
return (_a = eventHandler.options.events) == null ? void 0 : _a.includes("range.select");
|
|
1432
|
+
}
|
|
1433
|
+
);
|
|
1434
|
+
const xAxisIsTime = xField === "_time";
|
|
1435
|
+
return !!rangeSelectEventHandler && xAxisIsTime;
|
|
1436
|
+
};
|
|
1426
1437
|
var canvasSupportedTimeSeriesCharts = ["splunk.line"];
|
|
1427
1438
|
var isTimeSeriesCanvasRenderSupported = (vizConfigKey) => {
|
|
1428
1439
|
return canvasSupportedTimeSeriesCharts.indexOf(vizConfigKey) > -1;
|
|
@@ -1443,16 +1454,31 @@ var filterChartDataFromInternalFields = (chartData) => {
|
|
|
1443
1454
|
var convert2DArrayToNumbers = (arr) => {
|
|
1444
1455
|
return arr.map((subArray) => subArray.map((element) => parseFloat(element)));
|
|
1445
1456
|
};
|
|
1457
|
+
var parseAxisValue = (val) => {
|
|
1458
|
+
if (val === void 0 || val === null || val === "auto" || val === "") {
|
|
1459
|
+
return void 0;
|
|
1460
|
+
}
|
|
1461
|
+
const num = typeof val === "number" ? val : Number.parseFloat(val);
|
|
1462
|
+
return Number.isNaN(num) ? void 0 : num;
|
|
1463
|
+
};
|
|
1446
1464
|
var SideLegendWidth = 75;
|
|
1447
|
-
var
|
|
1465
|
+
var SeriesCompareLegendWidth = 200;
|
|
1448
1466
|
var getLegend = (props) => {
|
|
1449
1467
|
const legendPlacement = props == null ? void 0 : props.legendDisplay;
|
|
1468
|
+
const { isSeriesCompare } = props;
|
|
1469
|
+
const commonLegendProps = {
|
|
1470
|
+
center: true,
|
|
1471
|
+
fontSize: 12,
|
|
1472
|
+
largerTiles: true,
|
|
1473
|
+
hideSeriesValue: !isSeriesCompare
|
|
1474
|
+
// Show values if in seriesCompare mode
|
|
1475
|
+
};
|
|
1450
1476
|
switch (legendPlacement) {
|
|
1451
1477
|
case "off":
|
|
1452
1478
|
return false;
|
|
1453
1479
|
case "left":
|
|
1454
1480
|
return (0, visualization_canvas_exports.LeftLegendFactory)(__spreadValues({
|
|
1455
|
-
width: SideLegendWidth
|
|
1481
|
+
width: isSeriesCompare ? SeriesCompareLegendWidth : SideLegendWidth
|
|
1456
1482
|
}, commonLegendProps));
|
|
1457
1483
|
case "bottom":
|
|
1458
1484
|
return (0, visualization_canvas_exports.BottomLegendFactory)(__spreadValues({
|
|
@@ -1464,7 +1490,7 @@ var getLegend = (props) => {
|
|
|
1464
1490
|
}, commonLegendProps));
|
|
1465
1491
|
default:
|
|
1466
1492
|
return (0, visualization_canvas_exports.SideLegendFactory)(__spreadValues({
|
|
1467
|
-
width: SideLegendWidth
|
|
1493
|
+
width: isSeriesCompare ? SeriesCompareLegendWidth : SideLegendWidth
|
|
1468
1494
|
}, commonLegendProps));
|
|
1469
1495
|
}
|
|
1470
1496
|
};
|
|
@@ -1500,22 +1526,25 @@ var ellipsisAxisTitle = (axisTitle, containerSpacing, fontSize = 12) => {
|
|
|
1500
1526
|
const end = axisTitle.slice(-halfChars);
|
|
1501
1527
|
return `${start}...${end}`;
|
|
1502
1528
|
};
|
|
1503
|
-
var
|
|
1529
|
+
var getFieldName2 = (field) => {
|
|
1504
1530
|
const fieldName = typeof field === "object" ? field == null ? void 0 : field.name : field;
|
|
1505
1531
|
return fieldName;
|
|
1506
1532
|
};
|
|
1507
1533
|
var getFieldNames = (fields) => {
|
|
1508
|
-
return fields.map((field) =>
|
|
1534
|
+
return fields.map((field) => getFieldName2(field));
|
|
1509
1535
|
};
|
|
1510
|
-
var getXScaleConfig = (label, xAxisLabelVisibility) => {
|
|
1536
|
+
var getXScaleConfig = (label, xAxisLabelVisibility, xAxisLabelRotation) => {
|
|
1511
1537
|
const xConfig = { x: {} };
|
|
1512
1538
|
xConfig.x.label = label;
|
|
1513
1539
|
if (xAxisLabelVisibility === "hide") {
|
|
1514
1540
|
xConfig.x.hideLabels = true;
|
|
1515
1541
|
}
|
|
1542
|
+
if (xAxisLabelRotation !== void 0) {
|
|
1543
|
+
xConfig.x.labelRotation = xAxisLabelRotation;
|
|
1544
|
+
}
|
|
1516
1545
|
return xConfig;
|
|
1517
1546
|
};
|
|
1518
|
-
var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility) => {
|
|
1547
|
+
var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility, yAxisMin, yAxisMax) => {
|
|
1519
1548
|
const scaleType = yAxisScale != null ? yAxisScale : "linear";
|
|
1520
1549
|
const yConfig = { y: {} };
|
|
1521
1550
|
yConfig.y.label = label;
|
|
@@ -1531,14 +1560,20 @@ var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibilit
|
|
|
1531
1560
|
if (yAxisLabelVisibility === "hide") {
|
|
1532
1561
|
yConfig.y.hideLabels = true;
|
|
1533
1562
|
}
|
|
1563
|
+
if (yAxisMin !== void 0 || yAxisMax !== void 0) {
|
|
1564
|
+
yConfig.y.range = (u, dataMin, dataMax) => {
|
|
1565
|
+
const min = yAxisMin != null ? yAxisMin : dataMin;
|
|
1566
|
+
const max = yAxisMax != null ? yAxisMax : dataMax;
|
|
1567
|
+
return [min, max];
|
|
1568
|
+
};
|
|
1569
|
+
}
|
|
1534
1570
|
return yConfig;
|
|
1535
1571
|
};
|
|
1536
|
-
var getY2ScaleConfig = (label, axisAbbreviation, axisScale, roundAxisLabelsToInteger, y2AxisLabelVisibility) => {
|
|
1572
|
+
var getY2ScaleConfig = (label, axisAbbreviation, axisScale, roundAxisLabelsToInteger, y2AxisLabelVisibility, y2AxisMin, y2AxisMax) => {
|
|
1537
1573
|
const y2Config = { y2: {} };
|
|
1538
1574
|
const scaleType = axisScale != null ? axisScale : "linear";
|
|
1539
1575
|
y2Config.y2.label = label;
|
|
1540
1576
|
y2Config.y2.side = "right";
|
|
1541
|
-
y2Config.y2.showGrid = false;
|
|
1542
1577
|
y2Config.y2.type = scaleType;
|
|
1543
1578
|
if (axisAbbreviation !== "none") {
|
|
1544
1579
|
y2Config.y2.tickFmt = (v) => (0, visualization_canvas_exports.shortenNumber)(v, 1, roundAxisLabelsToInteger);
|
|
@@ -1548,9 +1583,16 @@ var getY2ScaleConfig = (label, axisAbbreviation, axisScale, roundAxisLabelsToInt
|
|
|
1548
1583
|
if (y2AxisLabelVisibility === "hide") {
|
|
1549
1584
|
y2Config.y2.hideLabels = true;
|
|
1550
1585
|
}
|
|
1586
|
+
if (y2AxisMin !== void 0 || y2AxisMax !== void 0) {
|
|
1587
|
+
y2Config.y2.range = (u, dataMin, dataMax) => {
|
|
1588
|
+
const min = y2AxisMin != null ? y2AxisMin : dataMin;
|
|
1589
|
+
const max = y2AxisMax != null ? y2AxisMax : dataMax;
|
|
1590
|
+
return [min, max];
|
|
1591
|
+
};
|
|
1592
|
+
}
|
|
1551
1593
|
return y2Config;
|
|
1552
1594
|
};
|
|
1553
|
-
var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled, nullValueMode, markerDisplay) => {
|
|
1595
|
+
var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled, nullValueMode, markerDisplay, lineDashStyle, lineDashStylesByField) => {
|
|
1554
1596
|
const seriesConfig = {};
|
|
1555
1597
|
let spanGaps;
|
|
1556
1598
|
let replaceNullsWithZero;
|
|
@@ -1585,12 +1627,87 @@ var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled
|
|
|
1585
1627
|
if (markerDisplay !== void 0) {
|
|
1586
1628
|
seriesConfig[field].markerDisplay = markerDisplay;
|
|
1587
1629
|
}
|
|
1630
|
+
const fieldDashStyle = (lineDashStylesByField == null ? void 0 : lineDashStylesByField[field]) || lineDashStyle;
|
|
1631
|
+
if (fieldDashStyle) {
|
|
1632
|
+
seriesConfig[field].lineDashStyle = fieldDashStyle;
|
|
1633
|
+
}
|
|
1588
1634
|
if (replaceNullsWithZero !== void 0) {
|
|
1589
1635
|
seriesConfig[field].replaceNullsWithZero = replaceNullsWithZero;
|
|
1590
1636
|
}
|
|
1591
1637
|
});
|
|
1592
1638
|
return seriesConfig;
|
|
1593
1639
|
};
|
|
1640
|
+
var findRangeIndices = (xData, startValue, endValue) => {
|
|
1641
|
+
let startXIndex = -1;
|
|
1642
|
+
let endXIndex = -1;
|
|
1643
|
+
const xDataEpoch = xData.map((val) => {
|
|
1644
|
+
if (typeof val === "string") {
|
|
1645
|
+
return new Date(val).getTime() / 1e3;
|
|
1646
|
+
}
|
|
1647
|
+
return val;
|
|
1648
|
+
});
|
|
1649
|
+
for (let i = 0; i < xDataEpoch.length; i += 1) {
|
|
1650
|
+
if (xDataEpoch[i] >= startValue) {
|
|
1651
|
+
startXIndex = i;
|
|
1652
|
+
break;
|
|
1653
|
+
}
|
|
1654
|
+
}
|
|
1655
|
+
if (startXIndex === -1 && xDataEpoch.length > 0) {
|
|
1656
|
+
startXIndex = xDataEpoch.length - 1;
|
|
1657
|
+
}
|
|
1658
|
+
for (let i = xDataEpoch.length - 1; i >= 0; i -= 1) {
|
|
1659
|
+
if (xDataEpoch[i] <= endValue) {
|
|
1660
|
+
endXIndex = i;
|
|
1661
|
+
break;
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1664
|
+
if (endXIndex === -1 && xDataEpoch.length > 0) {
|
|
1665
|
+
endXIndex = 0;
|
|
1666
|
+
}
|
|
1667
|
+
return { startXIndex, endXIndex };
|
|
1668
|
+
};
|
|
1669
|
+
|
|
1670
|
+
// src/common/hooks/useTrellisEnabled.ts
|
|
1671
|
+
var useTrellisFeatureFlagOn = () => {
|
|
1672
|
+
const context = (0, react_exports.useContext)(FeatureFlagContext_default);
|
|
1673
|
+
return Boolean(context == null ? void 0 : context.visualizations_enableTrellis);
|
|
1674
|
+
};
|
|
1675
|
+
var useTrellisEnabled = (layoutType = visualization_schemas_exports.LAYOUT_TYPE.Off) => {
|
|
1676
|
+
const trellisFeatureEnabled = useTrellisFeatureFlagOn();
|
|
1677
|
+
return trellisFeatureEnabled && layoutType === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
|
|
1678
|
+
};
|
|
1679
|
+
|
|
1680
|
+
// src/common/components/TrellisTitle.tsx
|
|
1681
|
+
var TRELLIS_TITLE_HEIGHT = 28;
|
|
1682
|
+
var TrellisTitleText = styled_components_default.div`
|
|
1683
|
+
margin-left: 10px;
|
|
1684
|
+
margin-right: 10px;
|
|
1685
|
+
padding-top: 8px;
|
|
1686
|
+
text-overflow: ellipsis;
|
|
1687
|
+
white-space: nowrap;
|
|
1688
|
+
overflow: hidden;
|
|
1689
|
+
`;
|
|
1690
|
+
var TrellisTitleDiv = styled_components_default.div`
|
|
1691
|
+
height: ${TRELLIS_TITLE_HEIGHT}px;
|
|
1692
|
+
font-size: 14px;
|
|
1693
|
+
font-weight: 700;
|
|
1694
|
+
color: ${(props) => props.fontColor};
|
|
1695
|
+
background-color: ${(props) => props.backgroundColor};
|
|
1696
|
+
box-shadow: 0 1px ${(props) => props.backgroundColor}; // this is added to avoid a 1px gap between title and viz divs that showed up intermittently because of pixel rounding error in chrome.
|
|
1697
|
+
`;
|
|
1698
|
+
var TrellisTitle = (props) => {
|
|
1699
|
+
const titleText = String(props.trellisKey).toString();
|
|
1700
|
+
return /* @__PURE__ */ react_exports.createElement(
|
|
1701
|
+
TrellisTitleDiv,
|
|
1702
|
+
{
|
|
1703
|
+
fontColor: props.fontColor,
|
|
1704
|
+
backgroundColor: props.backgroundColor,
|
|
1705
|
+
"data-test": "trellis-title",
|
|
1706
|
+
title: titleText
|
|
1707
|
+
},
|
|
1708
|
+
/* @__PURE__ */ react_exports.createElement(TrellisTitleText, null, titleText)
|
|
1709
|
+
);
|
|
1710
|
+
};
|
|
1594
1711
|
|
|
1595
1712
|
// src/common/TimeSeriesChartWrapper.tsx
|
|
1596
1713
|
var TimeSeriesChartContainer = styled_components_default.div`
|
|
@@ -1601,38 +1718,123 @@ var TimeSeriesChartContainer = styled_components_default.div`
|
|
|
1601
1718
|
position: absolute !important; // This is needed for canvas element export pdf/png to work correctly
|
|
1602
1719
|
}
|
|
1603
1720
|
`;
|
|
1604
|
-
var
|
|
1721
|
+
var appendTrellisToPayload = (payload, trellisKey, trellisSplitBy) => {
|
|
1722
|
+
const result = __spreadValues({}, payload);
|
|
1723
|
+
if (trellisSplitBy) {
|
|
1724
|
+
result["trellis.name"] = trellisSplitBy;
|
|
1725
|
+
}
|
|
1726
|
+
if (trellisKey) {
|
|
1727
|
+
result["trellis.value"] = trellisKey;
|
|
1728
|
+
}
|
|
1729
|
+
return result;
|
|
1730
|
+
};
|
|
1731
|
+
var hasMouseoverPayloadChanged = (currentPayload, previousPayload) => {
|
|
1732
|
+
if (!previousPayload) {
|
|
1733
|
+
return true;
|
|
1734
|
+
}
|
|
1735
|
+
if (currentPayload.index !== previousPayload.index) {
|
|
1736
|
+
return true;
|
|
1737
|
+
}
|
|
1738
|
+
if (currentPayload.seriesIndex !== previousPayload.seriesIndex) {
|
|
1739
|
+
return true;
|
|
1740
|
+
}
|
|
1741
|
+
if (currentPayload["trellis.name"] !== previousPayload["trellis.name"]) {
|
|
1742
|
+
return true;
|
|
1743
|
+
}
|
|
1744
|
+
if (currentPayload["trellis.value"] !== previousPayload["trellis.value"]) {
|
|
1745
|
+
return true;
|
|
1746
|
+
}
|
|
1747
|
+
return false;
|
|
1748
|
+
};
|
|
1749
|
+
var handleClick = (chartEvent, onClick, trellisKey, trellisSplitBy) => {
|
|
1605
1750
|
const payload = __spreadProps(__spreadValues({}, (0, lodash_exports.pick)(chartEvent, "value", "seriesKey")), {
|
|
1606
1751
|
name: chartEvent.seriesKey
|
|
1607
1752
|
});
|
|
1608
1753
|
delete payload.seriesKey;
|
|
1609
1754
|
if (chartEvent.rowContext) {
|
|
1610
|
-
Object.
|
|
1611
|
-
payload
|
|
1612
|
-
|
|
1755
|
+
Object.assign(
|
|
1756
|
+
payload,
|
|
1757
|
+
Object.keys(chartEvent.rowContext).reduce((acc, fieldName) => {
|
|
1758
|
+
acc[`row.${fieldName}.value`] = chartEvent.rowContext[fieldName];
|
|
1759
|
+
return acc;
|
|
1760
|
+
}, {})
|
|
1761
|
+
);
|
|
1613
1762
|
}
|
|
1763
|
+
const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
|
|
1614
1764
|
if (onClick) {
|
|
1615
1765
|
onClick({
|
|
1616
1766
|
type: "point.click",
|
|
1617
1767
|
originalEvent: chartEvent,
|
|
1618
|
-
payload
|
|
1768
|
+
payload: updatedPayload
|
|
1619
1769
|
});
|
|
1620
1770
|
}
|
|
1621
1771
|
};
|
|
1622
|
-
var handleLegendClick = (chartEvent, onClick) => {
|
|
1772
|
+
var handleLegendClick = (chartEvent, onClick, trellisKey, trellisSplitBy) => {
|
|
1623
1773
|
const payload = {
|
|
1624
1774
|
name: chartEvent
|
|
1625
1775
|
};
|
|
1776
|
+
const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
|
|
1626
1777
|
if (onClick) {
|
|
1627
1778
|
onClick({
|
|
1628
1779
|
type: "legend.click",
|
|
1629
1780
|
originalEvent: chartEvent,
|
|
1630
|
-
payload
|
|
1781
|
+
payload: updatedPayload
|
|
1782
|
+
});
|
|
1783
|
+
}
|
|
1784
|
+
};
|
|
1785
|
+
var handleRangeSelection = (rangeEvent, onSelect, chartData, trellisKey, trellisSplitBy) => {
|
|
1786
|
+
var _a;
|
|
1787
|
+
if (!rangeEvent) {
|
|
1788
|
+
return;
|
|
1789
|
+
}
|
|
1790
|
+
const xData = ((_a = chartData == null ? void 0 : chartData.columns) == null ? void 0 : _a[0]) || [];
|
|
1791
|
+
const { startXIndex, endXIndex } = findRangeIndices(xData, rangeEvent.start, rangeEvent.end);
|
|
1792
|
+
const payload = {
|
|
1793
|
+
startXIndex,
|
|
1794
|
+
startXValue: rangeEvent.start,
|
|
1795
|
+
endXIndex,
|
|
1796
|
+
endXValue: rangeEvent.end
|
|
1797
|
+
};
|
|
1798
|
+
const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
|
|
1799
|
+
if (onSelect) {
|
|
1800
|
+
onSelect({
|
|
1801
|
+
type: "range.selectBeforeZoom",
|
|
1802
|
+
originalEvent: rangeEvent,
|
|
1803
|
+
payload: updatedPayload
|
|
1804
|
+
});
|
|
1805
|
+
}
|
|
1806
|
+
};
|
|
1807
|
+
var handleRangeZoom = (rangeEvent, onSelect, chartData, trellisKey, trellisSplitBy) => {
|
|
1808
|
+
var _a;
|
|
1809
|
+
const xData = ((_a = chartData == null ? void 0 : chartData.columns) == null ? void 0 : _a[0]) || [];
|
|
1810
|
+
const { startXIndex, endXIndex } = findRangeIndices(xData, rangeEvent.start, rangeEvent.end);
|
|
1811
|
+
const payload = {
|
|
1812
|
+
startXIndex,
|
|
1813
|
+
startXValue: rangeEvent.start,
|
|
1814
|
+
endXIndex,
|
|
1815
|
+
endXValue: rangeEvent.end
|
|
1816
|
+
};
|
|
1817
|
+
const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
|
|
1818
|
+
if (onSelect) {
|
|
1819
|
+
onSelect({
|
|
1820
|
+
type: "range.select",
|
|
1821
|
+
originalEvent: rangeEvent,
|
|
1822
|
+
payload: updatedPayload
|
|
1631
1823
|
});
|
|
1632
1824
|
}
|
|
1633
1825
|
};
|
|
1826
|
+
var parseArrayOption = (value) => {
|
|
1827
|
+
if (Array.isArray(value)) {
|
|
1828
|
+
return value;
|
|
1829
|
+
}
|
|
1830
|
+
if (value) {
|
|
1831
|
+
return JSON.parse(value);
|
|
1832
|
+
}
|
|
1833
|
+
return void 0;
|
|
1834
|
+
};
|
|
1634
1835
|
var TimeSeriesChartWrapper = (props) => {
|
|
1635
|
-
|
|
1836
|
+
var _b, _c, _d;
|
|
1837
|
+
const _a = props, {
|
|
1636
1838
|
width,
|
|
1637
1839
|
height,
|
|
1638
1840
|
chartData,
|
|
@@ -1645,12 +1847,49 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
1645
1847
|
markerDisplay,
|
|
1646
1848
|
onClick,
|
|
1647
1849
|
onPointMouseOver,
|
|
1648
|
-
onPointMouseOut
|
|
1649
|
-
|
|
1650
|
-
|
|
1850
|
+
onPointMouseOut,
|
|
1851
|
+
onSelect,
|
|
1852
|
+
splitByLayout,
|
|
1853
|
+
trellisKey,
|
|
1854
|
+
trellisSplitBy,
|
|
1651
1855
|
backgroundColor,
|
|
1856
|
+
defaultFontColor,
|
|
1857
|
+
additionalTooltipValues,
|
|
1858
|
+
showYAxisWithZero: showYAxisWithZeroFromProps,
|
|
1859
|
+
showY2AxisWithZero: showY2AxisWithZeroFromProps
|
|
1860
|
+
} = _a, otherOptions = __objRest(_a, [
|
|
1861
|
+
"width",
|
|
1862
|
+
"height",
|
|
1863
|
+
"chartData",
|
|
1864
|
+
"options",
|
|
1865
|
+
"userLocale",
|
|
1866
|
+
"annotationX",
|
|
1867
|
+
"annotationLabel",
|
|
1868
|
+
"annotationColor",
|
|
1869
|
+
"legendDisplay",
|
|
1870
|
+
"markerDisplay",
|
|
1871
|
+
"onClick",
|
|
1872
|
+
"onPointMouseOver",
|
|
1873
|
+
"onPointMouseOut",
|
|
1874
|
+
"onSelect",
|
|
1875
|
+
"splitByLayout",
|
|
1876
|
+
"trellisKey",
|
|
1877
|
+
"trellisSplitBy",
|
|
1878
|
+
"backgroundColor",
|
|
1879
|
+
"defaultFontColor",
|
|
1880
|
+
"additionalTooltipValues",
|
|
1881
|
+
// Extract showYAxisWithZero directly from props for accelerated render mode
|
|
1882
|
+
"showYAxisWithZero",
|
|
1883
|
+
"showY2AxisWithZero"
|
|
1884
|
+
]);
|
|
1885
|
+
const { eventHandlers, xField: xFieldFromProps } = otherOptions;
|
|
1886
|
+
const trellisEnabled = useTrellisEnabled(splitByLayout);
|
|
1887
|
+
const {
|
|
1888
|
+
backgroundColor: bgColorFromOptions,
|
|
1652
1889
|
seriesColors: seriesColorsStr,
|
|
1653
1890
|
fieldColors,
|
|
1891
|
+
legendLabels: legendLabelsStr,
|
|
1892
|
+
legendMode,
|
|
1654
1893
|
"axisTitleX.text": xAxisTitleText,
|
|
1655
1894
|
"axisTitleY.text": yAxisTitleText,
|
|
1656
1895
|
"axisTitleY2.text": y2AxisTitleText,
|
|
@@ -1658,8 +1897,11 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
1658
1897
|
"axisTitleY.visibility": yAxisTitleVisibility,
|
|
1659
1898
|
"axisTitleY2.visibility": y2AxisTitleVisibility,
|
|
1660
1899
|
"axisLabelsX.majorLabelVisibility": xAxisLabelVisibility,
|
|
1900
|
+
"axisLabelsX.majorLabelStyle.rotation": xAxisLabelRotation,
|
|
1661
1901
|
"axisLabelsY.majorLabelVisibility": yAxisLabelVisibility,
|
|
1902
|
+
"axisLabelsY.majorUnit": yAxisMajorUnitFromSimpleXML,
|
|
1662
1903
|
"axisLabelsY2.majorLabelVisibility": y2AxisLabelVisibility,
|
|
1904
|
+
"axisLabelsY2.majorUnit": y2AxisMajorUnitFromSimpleXML,
|
|
1663
1905
|
"axisY.abbreviation": yAxisAbbreviation,
|
|
1664
1906
|
"axisY.scale": yAxisScale,
|
|
1665
1907
|
"axisY2.abbreviation": y2AxisAbbreviation,
|
|
@@ -1669,10 +1911,63 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
1669
1911
|
"axisLabelsY2.integerUnits": y2IntegerUnits,
|
|
1670
1912
|
"chart.overlayFields": overlayFieldsStr,
|
|
1671
1913
|
"chart.nullValueMode": nullValueMode,
|
|
1672
|
-
|
|
1914
|
+
"chart.showDataLabels": showDataLabels,
|
|
1915
|
+
lineWidth,
|
|
1916
|
+
lineDashStyle,
|
|
1917
|
+
fieldDashStyles: lineDashStylesByFieldStr,
|
|
1918
|
+
yAxisMin: yAxisMinRaw,
|
|
1919
|
+
yAxisMax: yAxisMaxRaw,
|
|
1920
|
+
y2AxisMin: y2AxisMinRaw,
|
|
1921
|
+
y2AxisMax: y2AxisMaxRaw,
|
|
1922
|
+
showXMajorGridLines,
|
|
1923
|
+
showYMajorGridLines,
|
|
1924
|
+
showY2MajorGridLines,
|
|
1925
|
+
showYMinorGridLines,
|
|
1926
|
+
showY2MinorGridLines,
|
|
1927
|
+
showLineSmoothing,
|
|
1928
|
+
yAxisMajorTickVisibility,
|
|
1929
|
+
y2AxisMajorTickVisibility,
|
|
1930
|
+
yAxisMajorTickSize,
|
|
1931
|
+
y2AxisMajorTickSize,
|
|
1932
|
+
yAxisMajorTickInterval,
|
|
1933
|
+
y2AxisMajorTickInterval,
|
|
1934
|
+
yAxisMinorTickVisibility,
|
|
1935
|
+
y2AxisMinorTickVisibility,
|
|
1936
|
+
yAxisMinorTickSize,
|
|
1937
|
+
y2AxisMinorTickSize,
|
|
1938
|
+
showYAxisWithZero: showYAxisWithZeroFromOptions,
|
|
1939
|
+
showY2AxisWithZero: showY2AxisWithZeroFromOptions
|
|
1673
1940
|
} = options;
|
|
1941
|
+
const dataValuesDisplay = showDataLabels === "none" ? "off" : showDataLabels;
|
|
1942
|
+
const showYAxisWithZero = showYAxisWithZeroFromProps != null ? showYAxisWithZeroFromProps : showYAxisWithZeroFromOptions;
|
|
1943
|
+
const showY2AxisWithZero = showY2AxisWithZeroFromProps != null ? showY2AxisWithZeroFromProps : showY2AxisWithZeroFromOptions;
|
|
1944
|
+
const showYMajorTicks = yAxisMajorTickVisibility === "show";
|
|
1945
|
+
const showY2MajorTicks = y2AxisMajorTickVisibility === "show";
|
|
1946
|
+
const showYMinorTicks = yAxisMinorTickVisibility === "show";
|
|
1947
|
+
const showY2MinorTicks = y2AxisMinorTickVisibility === "show";
|
|
1948
|
+
const yAxisMin = parseAxisValue(yAxisMinRaw);
|
|
1949
|
+
const yAxisMax = parseAxisValue(yAxisMaxRaw);
|
|
1950
|
+
const y2AxisMin = parseAxisValue(y2AxisMinRaw);
|
|
1951
|
+
const y2AxisMax = parseAxisValue(y2AxisMaxRaw);
|
|
1952
|
+
const parseTickInterval = (simpleXMLValue, canvasValue) => {
|
|
1953
|
+
if (simpleXMLValue) return Number(simpleXMLValue);
|
|
1954
|
+
if (canvasValue) return Number(canvasValue);
|
|
1955
|
+
return void 0;
|
|
1956
|
+
};
|
|
1957
|
+
const yAxisMajorTickIntervalNum = parseTickInterval(yAxisMajorUnitFromSimpleXML, yAxisMajorTickInterval);
|
|
1958
|
+
const y2AxisMajorTickIntervalNum = parseTickInterval(
|
|
1959
|
+
y2AxisMajorUnitFromSimpleXML,
|
|
1960
|
+
y2AxisMajorTickInterval
|
|
1961
|
+
);
|
|
1962
|
+
const yAxisMajorTickSizeNum = yAxisMajorTickSize ? Number(yAxisMajorTickSize) : void 0;
|
|
1963
|
+
const y2AxisMajorTickSizeNum = y2AxisMajorTickSize ? Number(y2AxisMajorTickSize) : void 0;
|
|
1964
|
+
const yAxisMinorTickSizeNum = yAxisMinorTickSize ? Number(yAxisMinorTickSize) : void 0;
|
|
1965
|
+
const y2AxisMinorTickSizeNum = y2AxisMinorTickSize ? Number(y2AxisMinorTickSize) : void 0;
|
|
1674
1966
|
const seriesColors = seriesColorsStr ? JSON.parse(seriesColorsStr) : void 0;
|
|
1675
1967
|
const seriesColorsByField = fieldColors ? JSON.parse(fieldColors) : void 0;
|
|
1968
|
+
const lineDashStylesByField = lineDashStylesByFieldStr ? JSON.parse(lineDashStylesByFieldStr) : void 0;
|
|
1969
|
+
const legendLabels = parseArrayOption(legendLabelsStr);
|
|
1970
|
+
const bgColor = backgroundColor || bgColorFromOptions;
|
|
1676
1971
|
const [containerWidth, setContainerWidth] = react_exports.useState(Number(props.width));
|
|
1677
1972
|
const [containerHeight, setContainerHeight] = react_exports.useState(Number(props.height));
|
|
1678
1973
|
const cachedHandleResize = react_exports.useCallback((w, h) => {
|
|
@@ -1683,31 +1978,64 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
1683
1978
|
fields: chartData.fields,
|
|
1684
1979
|
columns: chartData.seriesList
|
|
1685
1980
|
});
|
|
1686
|
-
const xField =
|
|
1981
|
+
const xField = getFieldName2(filteredChartData.fields[0]);
|
|
1687
1982
|
const yFields = getFieldNames(
|
|
1688
1983
|
filteredChartData.fields.length > 1 ? filteredChartData.fields.slice(1) : []
|
|
1689
1984
|
);
|
|
1690
|
-
const y2Fields =
|
|
1691
|
-
|
|
1985
|
+
const y2Fields = (0, react_exports.useMemo)(
|
|
1986
|
+
() => y2FieldsStr ? y2FieldsStr.split(",").map((f) => f.trim()) : [],
|
|
1987
|
+
[y2FieldsStr]
|
|
1988
|
+
);
|
|
1989
|
+
const overlayFields = (0, react_exports.useMemo)(
|
|
1990
|
+
() => overlayFieldsStr ? overlayFieldsStr.split(",").map((f) => f.trim()) : [],
|
|
1991
|
+
[overlayFieldsStr]
|
|
1992
|
+
);
|
|
1692
1993
|
let xAxisTitle = getComputedAxisTitles(xAxisTitleText, [xField], xAxisTitleVisibility);
|
|
1693
1994
|
xAxisTitle = ellipsisAxisTitle(xAxisTitle, containerWidth);
|
|
1694
|
-
|
|
1995
|
+
const yFieldsForTitle = y2Enabled ? yFields.filter((field) => !y2Fields.includes(field)) : yFields;
|
|
1996
|
+
let yAxisTitle = getComputedAxisTitles(yAxisTitleText, yFieldsForTitle, yAxisTitleVisibility);
|
|
1695
1997
|
yAxisTitle = ellipsisAxisTitle(yAxisTitle, containerHeight);
|
|
1696
1998
|
const fieldsForY2Axis = y2Fields.length > 0 ? y2Fields : overlayFields;
|
|
1697
1999
|
let y2AxisTitle = getComputedAxisTitles(y2AxisTitleText, fieldsForY2Axis, y2AxisTitleVisibility);
|
|
1698
2000
|
y2AxisTitle = ellipsisAxisTitle(y2AxisTitle, containerHeight);
|
|
1699
|
-
const xScaleConfig =
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
2001
|
+
const xScaleConfig = (0, react_exports.useMemo)(
|
|
2002
|
+
() => getXScaleConfig(xAxisTitle, xAxisLabelVisibility, xAxisLabelRotation),
|
|
2003
|
+
[xAxisTitle, xAxisLabelVisibility, xAxisLabelRotation]
|
|
2004
|
+
);
|
|
2005
|
+
const yScaleConfig = (0, react_exports.useMemo)(
|
|
2006
|
+
() => getYScaleConfig(
|
|
2007
|
+
yAxisTitle,
|
|
2008
|
+
yAxisAbbreviation,
|
|
2009
|
+
yAxisScale,
|
|
2010
|
+
yAxisLabelVisibility,
|
|
2011
|
+
yAxisMin,
|
|
2012
|
+
yAxisMax
|
|
2013
|
+
),
|
|
2014
|
+
[yAxisTitle, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility, yAxisMin, yAxisMax]
|
|
2015
|
+
);
|
|
2016
|
+
const y2ScaleConfig = (0, react_exports.useMemo)(() => {
|
|
2017
|
+
if (y2Enabled) {
|
|
2018
|
+
return getY2ScaleConfig(
|
|
2019
|
+
y2AxisTitle,
|
|
2020
|
+
y2AxisAbbreviation,
|
|
2021
|
+
y2AxisScale,
|
|
2022
|
+
y2IntegerUnits,
|
|
2023
|
+
y2AxisLabelVisibility,
|
|
2024
|
+
y2AxisMin,
|
|
2025
|
+
y2AxisMax
|
|
2026
|
+
);
|
|
2027
|
+
}
|
|
2028
|
+
return {};
|
|
2029
|
+
}, [
|
|
2030
|
+
y2Enabled,
|
|
2031
|
+
y2AxisTitle,
|
|
2032
|
+
y2AxisAbbreviation,
|
|
2033
|
+
y2AxisScale,
|
|
2034
|
+
y2IntegerUnits,
|
|
2035
|
+
y2AxisLabelVisibility,
|
|
2036
|
+
y2AxisMin,
|
|
2037
|
+
y2AxisMax
|
|
2038
|
+
]);
|
|
1711
2039
|
const uplotContainerElement = (0, react_exports.useRef)(null);
|
|
1712
2040
|
const seriesDataFormatted = [
|
|
1713
2041
|
filteredChartData.columns[0],
|
|
@@ -1723,9 +2051,21 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
1723
2051
|
overlayFields,
|
|
1724
2052
|
y2Enabled,
|
|
1725
2053
|
nullValueMode,
|
|
1726
|
-
markerDisplay
|
|
2054
|
+
markerDisplay,
|
|
2055
|
+
lineDashStyle,
|
|
2056
|
+
lineDashStylesByField
|
|
1727
2057
|
),
|
|
1728
|
-
[
|
|
2058
|
+
[
|
|
2059
|
+
yFields,
|
|
2060
|
+
y2Fields,
|
|
2061
|
+
lineWidth,
|
|
2062
|
+
overlayFields,
|
|
2063
|
+
y2Enabled,
|
|
2064
|
+
nullValueMode,
|
|
2065
|
+
markerDisplay,
|
|
2066
|
+
lineDashStyle,
|
|
2067
|
+
lineDashStylesByField
|
|
2068
|
+
]
|
|
1729
2069
|
);
|
|
1730
2070
|
const chartingEventAnnotations = (0, react_exports.useMemo)(
|
|
1731
2071
|
() => getAnnotationsForCanvas({
|
|
@@ -1739,25 +2079,54 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
1739
2079
|
() => __spreadValues(__spreadValues(__spreadValues({}, xScaleConfig), yScaleConfig), y2ScaleConfig),
|
|
1740
2080
|
[xScaleConfig, yScaleConfig, y2ScaleConfig]
|
|
1741
2081
|
);
|
|
1742
|
-
const legend = (0, react_exports.useMemo)(
|
|
2082
|
+
const legend = (0, react_exports.useMemo)(
|
|
2083
|
+
() => getLegend({ legendDisplay, isSeriesCompare: legendMode === "seriesCompare" }),
|
|
2084
|
+
[legendDisplay, legendMode]
|
|
2085
|
+
);
|
|
1743
2086
|
const handleChartClick = react_exports.useCallback(
|
|
1744
2087
|
(event) => {
|
|
1745
2088
|
if (onClick) {
|
|
1746
|
-
handleClick(event, onClick);
|
|
2089
|
+
handleClick(event, onClick, trellisKey, trellisSplitBy);
|
|
1747
2090
|
}
|
|
1748
2091
|
},
|
|
1749
|
-
[onClick]
|
|
2092
|
+
[onClick, trellisKey, trellisSplitBy]
|
|
1750
2093
|
);
|
|
1751
2094
|
const handleChartLegendClick = react_exports.useCallback(
|
|
1752
2095
|
(event) => {
|
|
1753
2096
|
if (onClick) {
|
|
1754
|
-
handleLegendClick(event, onClick);
|
|
2097
|
+
handleLegendClick(event, onClick, trellisKey, trellisSplitBy);
|
|
1755
2098
|
}
|
|
1756
2099
|
},
|
|
1757
|
-
[onClick]
|
|
2100
|
+
[onClick, trellisKey, trellisSplitBy]
|
|
2101
|
+
);
|
|
2102
|
+
const handleChartRangeSelection = react_exports.useCallback(
|
|
2103
|
+
(range3) => {
|
|
2104
|
+
if (onSelect) {
|
|
2105
|
+
handleRangeSelection(range3, onSelect, chartData, trellisKey, trellisSplitBy);
|
|
2106
|
+
}
|
|
2107
|
+
},
|
|
2108
|
+
[onSelect, chartData, trellisKey, trellisSplitBy]
|
|
2109
|
+
);
|
|
2110
|
+
const handleChartRangeZoom = react_exports.useCallback(
|
|
2111
|
+
(range3) => {
|
|
2112
|
+
if (onSelect) {
|
|
2113
|
+
handleRangeZoom(range3, onSelect, chartData, trellisKey, trellisSplitBy);
|
|
2114
|
+
}
|
|
2115
|
+
},
|
|
2116
|
+
[onSelect, chartData, trellisKey, trellisSplitBy]
|
|
2117
|
+
);
|
|
2118
|
+
const xFieldToUse = xFieldFromProps || xField;
|
|
2119
|
+
const enableSearchZoom = react_exports.useMemo(
|
|
2120
|
+
() => shouldEnableSearchZoom(eventHandlers, xFieldToUse),
|
|
2121
|
+
[eventHandlers, xFieldToUse]
|
|
1758
2122
|
);
|
|
1759
2123
|
const lastPayloadRef = react_exports.useRef(null);
|
|
1760
2124
|
const lastOriginalEventRef = react_exports.useRef(null);
|
|
2125
|
+
const previousMouseoverPayloadRef = react_exports.useRef(null);
|
|
2126
|
+
const additionalTooltipValuesRef = react_exports.useRef(additionalTooltipValues);
|
|
2127
|
+
react_exports.useEffect(() => {
|
|
2128
|
+
additionalTooltipValuesRef.current = additionalTooltipValues;
|
|
2129
|
+
}, [additionalTooltipValues]);
|
|
1761
2130
|
const handleChartCrosshairChange = react_exports.useCallback(
|
|
1762
2131
|
(event) => {
|
|
1763
2132
|
if (onPointMouseOver || onPointMouseOut) {
|
|
@@ -1769,6 +2138,7 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
1769
2138
|
payload: lastPayloadRef.current
|
|
1770
2139
|
});
|
|
1771
2140
|
}
|
|
2141
|
+
previousMouseoverPayloadRef.current = null;
|
|
1772
2142
|
return;
|
|
1773
2143
|
}
|
|
1774
2144
|
const payload = __spreadProps(__spreadValues({}, (0, lodash_exports.pick)(event, "value", "seriesKey", "time", "index", "seriesIndex")), {
|
|
@@ -1776,25 +2146,36 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
1776
2146
|
});
|
|
1777
2147
|
delete payload.seriesKey;
|
|
1778
2148
|
if (event.rowContext) {
|
|
1779
|
-
Object.
|
|
1780
|
-
payload
|
|
1781
|
-
|
|
2149
|
+
Object.assign(
|
|
2150
|
+
payload,
|
|
2151
|
+
Object.keys(event.rowContext).reduce((acc, fieldName) => {
|
|
2152
|
+
acc[`row.${fieldName}.value`] = event.rowContext[fieldName];
|
|
2153
|
+
return acc;
|
|
2154
|
+
}, {})
|
|
2155
|
+
);
|
|
1782
2156
|
}
|
|
1783
|
-
|
|
2157
|
+
const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
|
|
2158
|
+
if (!hasMouseoverPayloadChanged(updatedPayload, previousMouseoverPayloadRef.current)) {
|
|
2159
|
+
return;
|
|
2160
|
+
}
|
|
2161
|
+
lastPayloadRef.current = updatedPayload;
|
|
1784
2162
|
lastOriginalEventRef.current = event;
|
|
2163
|
+
previousMouseoverPayloadRef.current = __spreadValues({}, updatedPayload);
|
|
1785
2164
|
if (onPointMouseOver) {
|
|
1786
2165
|
onPointMouseOver({
|
|
1787
2166
|
type: "point.mouseover",
|
|
1788
2167
|
originalEvent: event,
|
|
1789
|
-
payload
|
|
2168
|
+
payload: updatedPayload
|
|
1790
2169
|
});
|
|
1791
2170
|
}
|
|
1792
2171
|
}
|
|
1793
2172
|
},
|
|
1794
|
-
[onPointMouseOver, onPointMouseOut]
|
|
2173
|
+
[onPointMouseOver, onPointMouseOut, trellisKey, trellisSplitBy]
|
|
1795
2174
|
);
|
|
1796
|
-
const
|
|
1797
|
-
|
|
2175
|
+
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}`;
|
|
2176
|
+
const memoizedChart = (0, react_exports.useMemo)(() => {
|
|
2177
|
+
const computedOnRangeZoom = onSelect ? handleChartRangeZoom : void 0;
|
|
2178
|
+
return /* @__PURE__ */ react_exports.createElement(visualization_canvas_exports.RangeSelectionProvider, { key: dataKey }, /* @__PURE__ */ react_exports.createElement(
|
|
1798
2179
|
visualization_canvas_exports.TimeSeriesChart,
|
|
1799
2180
|
{
|
|
1800
2181
|
data: chartData,
|
|
@@ -1804,49 +2185,107 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
1804
2185
|
seriesColorsByField,
|
|
1805
2186
|
seriesConfig: seriesOverrides,
|
|
1806
2187
|
legend,
|
|
2188
|
+
legendLabels,
|
|
2189
|
+
isSeriesCompare: legendMode === "seriesCompare",
|
|
2190
|
+
maxSeriesFocus: legendMode === "seriesCompare" ? 0 : void 0,
|
|
1807
2191
|
scaleConfig,
|
|
1808
2192
|
timestampFormat: "expanded",
|
|
1809
2193
|
onCrosshairClick: onClick ? handleChartClick : void 0,
|
|
1810
2194
|
onCrosshairChange: onPointMouseOver || onPointMouseOut ? handleChartCrosshairChange : void 0,
|
|
1811
2195
|
onSeriesClick: onClick ? handleChartLegendClick : void 0,
|
|
2196
|
+
onRangeSelection: handleChartRangeSelection,
|
|
2197
|
+
onRangeZoom: computedOnRangeZoom,
|
|
2198
|
+
serverSideZoom: enableSearchZoom,
|
|
1812
2199
|
userLocale,
|
|
1813
2200
|
events: chartingEventAnnotations,
|
|
1814
|
-
eventsConfig: { renderer: triangleEventAnnotationRenderer }
|
|
2201
|
+
eventsConfig: { renderer: triangleEventAnnotationRenderer },
|
|
2202
|
+
additionalTooltipValuesRef,
|
|
2203
|
+
showXMajorGridLines,
|
|
2204
|
+
showYMajorGridLines,
|
|
2205
|
+
showY2MajorGridLines,
|
|
2206
|
+
showYMinorGridLines,
|
|
2207
|
+
showY2MinorGridLines,
|
|
2208
|
+
showLineSmoothing,
|
|
2209
|
+
dataValuesDisplay,
|
|
2210
|
+
showYMajorTicks,
|
|
2211
|
+
showY2MajorTicks,
|
|
2212
|
+
yAxisMajorTickSize: yAxisMajorTickSizeNum,
|
|
2213
|
+
y2AxisMajorTickSize: y2AxisMajorTickSizeNum,
|
|
2214
|
+
yAxisMajorTickInterval: yAxisMajorTickIntervalNum,
|
|
2215
|
+
y2AxisMajorTickInterval: y2AxisMajorTickIntervalNum,
|
|
2216
|
+
showYMinorTicks,
|
|
2217
|
+
showY2MinorTicks,
|
|
2218
|
+
yAxisMinorTickSize: yAxisMinorTickSizeNum,
|
|
2219
|
+
y2AxisMinorTickSize: y2AxisMinorTickSizeNum,
|
|
2220
|
+
showYAxisWithZero,
|
|
2221
|
+
showY2AxisWithZero
|
|
1815
2222
|
}
|
|
1816
|
-
)
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
2223
|
+
));
|
|
2224
|
+
}, [
|
|
2225
|
+
onSelect,
|
|
2226
|
+
handleChartRangeZoom,
|
|
2227
|
+
dataKey,
|
|
2228
|
+
chartData,
|
|
2229
|
+
containerWidth,
|
|
2230
|
+
containerHeight,
|
|
2231
|
+
seriesColors,
|
|
2232
|
+
seriesColorsByField,
|
|
2233
|
+
seriesOverrides,
|
|
2234
|
+
legend,
|
|
2235
|
+
legendLabels,
|
|
2236
|
+
scaleConfig,
|
|
2237
|
+
onClick,
|
|
2238
|
+
handleChartClick,
|
|
2239
|
+
onPointMouseOver,
|
|
2240
|
+
onPointMouseOut,
|
|
2241
|
+
handleChartCrosshairChange,
|
|
2242
|
+
handleChartLegendClick,
|
|
2243
|
+
handleChartRangeSelection,
|
|
2244
|
+
enableSearchZoom,
|
|
2245
|
+
userLocale,
|
|
2246
|
+
chartingEventAnnotations,
|
|
2247
|
+
showXMajorGridLines,
|
|
2248
|
+
showYMajorGridLines,
|
|
2249
|
+
showY2MajorGridLines,
|
|
2250
|
+
showYMinorGridLines,
|
|
2251
|
+
showY2MinorGridLines,
|
|
2252
|
+
showLineSmoothing,
|
|
2253
|
+
dataValuesDisplay,
|
|
2254
|
+
showYMajorTicks,
|
|
2255
|
+
showY2MajorTicks,
|
|
2256
|
+
yAxisMajorTickSizeNum,
|
|
2257
|
+
y2AxisMajorTickSizeNum,
|
|
2258
|
+
yAxisMajorTickIntervalNum,
|
|
2259
|
+
y2AxisMajorTickIntervalNum,
|
|
2260
|
+
showYMinorTicks,
|
|
2261
|
+
showY2MinorTicks,
|
|
2262
|
+
yAxisMinorTickSizeNum,
|
|
2263
|
+
y2AxisMinorTickSizeNum,
|
|
2264
|
+
showYAxisWithZero,
|
|
2265
|
+
showY2AxisWithZero,
|
|
2266
|
+
legendMode
|
|
2267
|
+
]);
|
|
1836
2268
|
const memoizedVisualization = (0, react_exports.useMemo)(() => {
|
|
1837
|
-
return /* @__PURE__ */ react_exports.createElement(VizStyleWrapper_default, { backgroundColor }, memoizedChart);
|
|
1838
|
-
}, [
|
|
1839
|
-
return /* @__PURE__ */ react_exports.createElement(
|
|
2269
|
+
return /* @__PURE__ */ react_exports.createElement(VizStyleWrapper_default, { backgroundColor: bgColor }, memoizedChart);
|
|
2270
|
+
}, [bgColor, memoizedChart]);
|
|
2271
|
+
return /* @__PURE__ */ react_exports.createElement(react_exports.Fragment, null, trellisEnabled && /* @__PURE__ */ react_exports.createElement(
|
|
2272
|
+
TrellisTitle,
|
|
2273
|
+
{
|
|
2274
|
+
trellisKey,
|
|
2275
|
+
backgroundColor: bgColor,
|
|
2276
|
+
fontColor: defaultFontColor
|
|
2277
|
+
}
|
|
2278
|
+
), /* @__PURE__ */ react_exports.createElement(
|
|
1840
2279
|
TimeSeriesChartContainer,
|
|
1841
2280
|
{
|
|
1842
|
-
height,
|
|
2281
|
+
height: trellisEnabled ? Number(height) - TRELLIS_TITLE_HEIGHT : height,
|
|
1843
2282
|
width,
|
|
1844
2283
|
ref: uplotContainerElement,
|
|
1845
2284
|
"data-test": "timeseries-chart-wrapper"
|
|
1846
2285
|
},
|
|
1847
2286
|
/* @__PURE__ */ react_exports.createElement(SizeAwareWrapper_default, { width, height, onResize: cachedHandleResize }),
|
|
1848
2287
|
memoizedVisualization
|
|
1849
|
-
);
|
|
2288
|
+
));
|
|
1850
2289
|
};
|
|
1851
2290
|
var TimeSeriesChartWrapper_default = TimeSeriesChartWrapper;
|
|
1852
2291
|
|