@fluentui/react-charting 5.23.75 → 5.23.77
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/CHANGELOG.json +43 -1
- package/CHANGELOG.md +22 -2
- package/dist/react-charting.d.ts +12 -2
- package/dist/react-charting.js +1 -1
- package/dist/react-charting.min.js +1 -1
- package/etc/react-charting.api.md +4 -2
- package/lib/components/AreaChart/AreaChart.base.d.ts +2 -0
- package/lib/components/AreaChart/AreaChart.base.js +20 -6
- package/lib/components/AreaChart/AreaChart.base.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.base.js +18 -14
- package/lib/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.d.ts +2 -2
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +52 -92
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +0 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +23 -14
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib/components/HeatMapChart/HeatMapChart.base.js +1 -1
- package/lib/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
- package/lib/components/Legends/Legends.styles.js +3 -0
- package/lib/components/Legends/Legends.styles.js.map +1 -1
- package/lib/components/LineChart/LineChart.base.d.ts +4 -3
- package/lib/components/LineChart/LineChart.base.js +50 -37
- package/lib/components/LineChart/LineChart.base.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.base.js +4 -4
- package/lib/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +1 -0
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +26 -7
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib/types/IDataPoint.d.ts +10 -0
- package/lib/types/IDataPoint.js.map +1 -1
- package/lib/utilities/utilities.d.ts +2 -2
- package/lib/utilities/utilities.js +19 -32
- package/lib/utilities/utilities.js.map +1 -1
- package/lib-amd/components/AreaChart/AreaChart.base.d.ts +2 -0
- package/lib-amd/components/AreaChart/AreaChart.base.js +20 -6
- package/lib-amd/components/AreaChart/AreaChart.base.js.map +1 -1
- package/lib-amd/components/CommonComponents/CartesianChart.base.js +18 -14
- package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib-amd/components/CommonComponents/CartesianChart.types.d.ts +2 -2
- package/lib-amd/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +52 -92
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +0 -1
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +21 -12
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib-amd/components/HeatMapChart/HeatMapChart.base.js +1 -1
- package/lib-amd/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
- package/lib-amd/components/Legends/Legends.styles.js +3 -0
- package/lib-amd/components/Legends/Legends.styles.js.map +1 -1
- package/lib-amd/components/LineChart/LineChart.base.d.ts +4 -3
- package/lib-amd/components/LineChart/LineChart.base.js +50 -37
- package/lib-amd/components/LineChart/LineChart.base.js.map +1 -1
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js +4 -4
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +1 -0
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +26 -7
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib-amd/types/IDataPoint.d.ts +10 -0
- package/lib-amd/types/IDataPoint.js.map +1 -1
- package/lib-amd/utilities/utilities.d.ts +2 -2
- package/lib-amd/utilities/utilities.js +19 -32
- package/lib-amd/utilities/utilities.js.map +1 -1
- package/lib-commonjs/components/AreaChart/AreaChart.base.d.ts +2 -0
- package/lib-commonjs/components/AreaChart/AreaChart.base.js +20 -6
- package/lib-commonjs/components/AreaChart/AreaChart.base.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.js +18 -14
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.d.ts +2 -2
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +52 -92
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +0 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +21 -12
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.base.js +1 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
- package/lib-commonjs/components/Legends/Legends.styles.js +3 -0
- package/lib-commonjs/components/Legends/Legends.styles.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.base.d.ts +4 -3
- package/lib-commonjs/components/LineChart/LineChart.base.js +50 -37
- package/lib-commonjs/components/LineChart/LineChart.base.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js +4 -4
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +1 -0
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +26 -7
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib-commonjs/types/IDataPoint.d.ts +10 -0
- package/lib-commonjs/types/IDataPoint.js.map +1 -1
- package/lib-commonjs/utilities/utilities.d.ts +2 -2
- package/lib-commonjs/utilities/utilities.js +19 -32
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +4 -4
- package/src/components/CommonComponents/CartesianChart.types.ts +2 -1
|
@@ -49,14 +49,14 @@ define(["require", "exports", "tslib", "react", "d3-selection", "d3-array", "../
|
|
|
49
49
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
50
50
|
_this_1._xAxisScale = '';
|
|
51
51
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
52
|
-
_this_1.
|
|
52
|
+
_this_1._yScalePrimary = '';
|
|
53
53
|
_this_1.eventLabelHeight = 36;
|
|
54
54
|
_this_1._isRTL = (0, Utilities_1.getRTL)();
|
|
55
55
|
_this_1._xMin = Number.NEGATIVE_INFINITY;
|
|
56
|
-
_this_1._yMin = Number.NEGATIVE_INFINITY;
|
|
57
56
|
_this_1._xMax = Number.POSITIVE_INFINITY;
|
|
58
57
|
_this_1._xPadding = 0;
|
|
59
|
-
_this_1.
|
|
58
|
+
_this_1._yPaddingPrimary = 0;
|
|
59
|
+
_this_1._yPaddingSecondary = 0;
|
|
60
60
|
_this_1.toImage = function (opts) {
|
|
61
61
|
var _a, _b;
|
|
62
62
|
return (0, image_export_utils_1.toImage)((_a = _this_1._cartesianChartRef.current) === null || _a === void 0 ? void 0 : _a.chartContainer, (_b = _this_1._legendsRef.current) === null || _b === void 0 ? void 0 : _b.toSVG, _this_1._isRTL, opts);
|
|
@@ -110,24 +110,31 @@ define(["require", "exports", "tslib", "react", "d3-selection", "d3-array", "../
|
|
|
110
110
|
? _this_1.props.onRenderCalloutPerDataPoint(_this_1.state.dataPointCalloutProps)
|
|
111
111
|
: null;
|
|
112
112
|
};
|
|
113
|
-
_this_1._getNumericMinMaxOfY = function (points) {
|
|
113
|
+
_this_1._getNumericMinMaxOfY = function (points, yAxisType, useSecondaryYScale) {
|
|
114
114
|
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
115
|
-
var _a = (0, index_3.findNumericMinMaxOfY)(points), startValue = _a.startValue, endValue = _a.endValue;
|
|
116
|
-
|
|
115
|
+
var _a = (0, index_3.findNumericMinMaxOfY)(points, yAxisType, useSecondaryYScale), startValue = _a.startValue, endValue = _a.endValue;
|
|
116
|
+
var yPadding = 0;
|
|
117
117
|
if (_this_1.props.lineMode === 'scatter') {
|
|
118
|
-
|
|
118
|
+
yPadding = (endValue - startValue) * 0.1;
|
|
119
|
+
if (useSecondaryYScale) {
|
|
120
|
+
_this_1._yPaddingSecondary = yPadding;
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
_this_1._yPaddingPrimary = yPadding;
|
|
124
|
+
}
|
|
119
125
|
}
|
|
120
126
|
return {
|
|
121
|
-
startValue: startValue -
|
|
122
|
-
endValue: endValue +
|
|
127
|
+
startValue: startValue - yPadding,
|
|
128
|
+
endValue: endValue + yPadding,
|
|
123
129
|
};
|
|
124
130
|
};
|
|
125
131
|
_this_1._getMargins = function (margins) {
|
|
126
132
|
_this_1.margins = margins;
|
|
127
133
|
};
|
|
128
|
-
_this_1._initializeLineChartData = function (xScale,
|
|
134
|
+
_this_1._initializeLineChartData = function (xScale, yScalePrimary, containerHeight, containerWidth, xElement, yAxisElement, yScaleSecondary) {
|
|
129
135
|
_this_1._xAxisScale = xScale;
|
|
130
|
-
_this_1.
|
|
136
|
+
_this_1._yScalePrimary = yScalePrimary;
|
|
137
|
+
_this_1._yScaleSecondary = yScaleSecondary;
|
|
131
138
|
_this_1._renderedColorFillBars = _this_1.props.colorFillBars ? _this_1._createColorFillBars(containerHeight) : [];
|
|
132
139
|
_this_1.lines = _this_1._createLines(xElement, containerHeight);
|
|
133
140
|
};
|
|
@@ -241,7 +248,9 @@ define(["require", "exports", "tslib", "react", "d3-selection", "d3-array", "../
|
|
|
241
248
|
var opacity = _this_1._legendHighlighted(colorFillBar.legend) || _this_1._noLegendHighlighted() || _this_1.state.isSelectedLegend
|
|
242
249
|
? _this_1._getColorFillBarOpacity(colorFillBar)
|
|
243
250
|
: 0.1;
|
|
244
|
-
colorFillBars.push(React.createElement("rect", { fill: colorFillBar.applyPattern ? "url(#".concat(_this_1._colorFillBarPatternId, "_").concat(i, ")") : color, fillOpacity: opacity, x: _this_1._isRTL ? _this_1._xAxisScale(endX) : _this_1._xAxisScale(startX), y: _this_1.
|
|
251
|
+
colorFillBars.push(React.createElement("rect", { fill: colorFillBar.applyPattern ? "url(#".concat(_this_1._colorFillBarPatternId, "_").concat(i, ")") : color, fillOpacity: opacity, x: _this_1._isRTL ? _this_1._xAxisScale(endX) : _this_1._xAxisScale(startX), y: _this_1._yScalePrimary(yMinMaxValues.endValue) - FILL_Y_PADDING, width: Math.abs(_this_1._xAxisScale(endX) - _this_1._xAxisScale(startX)), height: _this_1._yScalePrimary(_this_1.props.yMinValue || 0) -
|
|
252
|
+
_this_1._yScalePrimary(yMinMaxValues.endValue) +
|
|
253
|
+
FILL_Y_PADDING, key: "".concat(colorFillBarId).concat(j) }));
|
|
245
254
|
}
|
|
246
255
|
}
|
|
247
256
|
return colorFillBars;
|
|
@@ -264,7 +273,7 @@ define(["require", "exports", "tslib", "react", "d3-selection", "d3-array", "../
|
|
|
264
273
|
}
|
|
265
274
|
return { isInGap: isInGap, gapIndex: gapIndex };
|
|
266
275
|
};
|
|
267
|
-
_this_1._onMouseOverLargeDataset = function (linenumber, lineHeight, mouseEvent) {
|
|
276
|
+
_this_1._onMouseOverLargeDataset = function (linenumber, lineHeight, yScale, mouseEvent) {
|
|
268
277
|
mouseEvent.persist();
|
|
269
278
|
var data = _this_1.props.data;
|
|
270
279
|
var lineChartData = data.lineChartData;
|
|
@@ -326,12 +335,12 @@ define(["require", "exports", "tslib", "react", "d3-selection", "d3-array", "../
|
|
|
326
335
|
_this_1._uniqueCallOutID = "#".concat(_this_1._staticHighlightCircle, "_").concat(linenumber);
|
|
327
336
|
(0, d3_selection_1.select)("#".concat(_this_1._staticHighlightCircle, "_").concat(linenumber))
|
|
328
337
|
.attr('cx', "".concat(_this_1._xAxisScale(pointToHighlight.x)))
|
|
329
|
-
.attr('cy', "".concat(
|
|
338
|
+
.attr('cy', "".concat(yScale(pointToHighlight.y)))
|
|
330
339
|
.attr('visibility', 'visibility');
|
|
331
340
|
(0, d3_selection_1.select)("#".concat(_this_1._verticalLine))
|
|
332
|
-
.attr('transform', function () { return "translate(".concat(_this_1._xAxisScale(pointToHighlight.x), ", ").concat(
|
|
341
|
+
.attr('transform', function () { return "translate(".concat(_this_1._xAxisScale(pointToHighlight.x), ", ").concat(yScale(pointToHighlight.y), ")"); })
|
|
333
342
|
.attr('visibility', 'visibility')
|
|
334
|
-
.attr('y2', "".concat(lineHeight -
|
|
343
|
+
.attr('y2', "".concat(lineHeight - yScale(pointToHighlight.y)));
|
|
335
344
|
_this_1.setState({
|
|
336
345
|
nearestCircleToHighlight: pointToHighlight,
|
|
337
346
|
isCalloutVisible: true,
|
|
@@ -386,7 +395,7 @@ define(["require", "exports", "tslib", "react", "d3-selection", "d3-array", "../
|
|
|
386
395
|
});
|
|
387
396
|
}
|
|
388
397
|
};
|
|
389
|
-
_this_1._handleHover = function (x, y, lineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, mouseEvent) {
|
|
398
|
+
_this_1._handleHover = function (x, y, lineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, yScale, mouseEvent) {
|
|
390
399
|
mouseEvent.persist();
|
|
391
400
|
var formattedData = x instanceof Date ? (0, index_3.formatDate)(x, _this_1.props.useUTC) : x;
|
|
392
401
|
var xVal = x instanceof Date ? x.getTime() : x;
|
|
@@ -395,9 +404,9 @@ define(["require", "exports", "tslib", "react", "d3-selection", "d3-array", "../
|
|
|
395
404
|
// if no points need to be called out then don't show vertical line and callout card
|
|
396
405
|
if (found) {
|
|
397
406
|
(0, d3_selection_1.select)("#".concat(_this_1._verticalLine))
|
|
398
|
-
.attr('transform', function () { return "translate(".concat(_this._xAxisScale(x), ", ").concat(
|
|
407
|
+
.attr('transform', function () { return "translate(".concat(_this._xAxisScale(x), ", ").concat(yScale(y), ")"); })
|
|
399
408
|
.attr('visibility', 'visibility')
|
|
400
|
-
.attr('y2', "".concat(lineHeight -
|
|
409
|
+
.attr('y2', "".concat(lineHeight - yScale(y)));
|
|
401
410
|
if (_this_1._uniqueCallOutID !== circleId) {
|
|
402
411
|
_this_1._uniqueCallOutID = circleId;
|
|
403
412
|
_this_1.setState({
|
|
@@ -683,7 +692,8 @@ define(["require", "exports", "tslib", "react", "d3-selection", "d3-array", "../
|
|
|
683
692
|
// eslint-disable-next-line react/no-children-prop
|
|
684
693
|
children: function (props) {
|
|
685
694
|
_this_1._xAxisScale = props.xScale;
|
|
686
|
-
_this_1.
|
|
695
|
+
_this_1._yScalePrimary = props.yScalePrimary;
|
|
696
|
+
_this_1._yScaleSecondary = props.yScaleSecondary;
|
|
687
697
|
return (React.createElement(React.Fragment, null,
|
|
688
698
|
React.createElement("g", null,
|
|
689
699
|
React.createElement("line", { x1: 0, y1: 0, x2: 0, y2: props.containerHeight, stroke: '#323130', id: _this_1._verticalLine, visibility: 'hidden', strokeDasharray: '5,5' }),
|
|
@@ -760,11 +770,12 @@ define(["require", "exports", "tslib", "react", "d3-selection", "d3-array", "../
|
|
|
760
770
|
: [];
|
|
761
771
|
return (React.createElement(index_1.Legends, tslib_1.__assign({ legends: tslib_1.__spreadArray(tslib_1.__spreadArray([], legendDataItems, true), colorFillBarsLegendDataItems, true), enabledWrapLines: this.props.enabledLegendsWrapLines, overflowProps: this.props.legendsOverflowProps, focusZonePropsInHoverCard: this.props.focusZonePropsForLegendsInHoverCard, overflowText: this.props.legendsOverflowText }, (isLegendMultiSelectEnabled && { onLegendHoverCardLeave: this._onHoverCardHide }), this.props.legendProps, { ref: this._legendsRef })));
|
|
762
772
|
};
|
|
763
|
-
LineChartBase.prototype._getRangeForScatterMarkerSize = function () {
|
|
773
|
+
LineChartBase.prototype._getRangeForScatterMarkerSize = function (yScale, yPadding) {
|
|
764
774
|
var extraXPixels = this._isRTL
|
|
765
775
|
? this._xAxisScale(this._xMax - this._xPadding) - this._xAxisScale(this._xMax)
|
|
766
776
|
: this._xAxisScale(this._xMin + this._xPadding) - this._xAxisScale(this._xMin);
|
|
767
|
-
var
|
|
777
|
+
var yMin = yScale.domain()[0];
|
|
778
|
+
var extraYPixels = yScale(yMin) - yScale(yMin + yPadding);
|
|
768
779
|
return Math.min(extraXPixels, extraYPixels);
|
|
769
780
|
};
|
|
770
781
|
LineChartBase.prototype._createLines = function (xElement, containerHeight) {
|
|
@@ -777,7 +788,6 @@ define(["require", "exports", "tslib", "react", "d3-selection", "d3-array", "../
|
|
|
777
788
|
else {
|
|
778
789
|
this._points = this._injectIndexPropertyInLineChartData(this.props.data.lineChartData);
|
|
779
790
|
}
|
|
780
|
-
var extraMaxPixels = this.props.lineMode === 'scatter' ? this._getRangeForScatterMarkerSize() : 0;
|
|
781
791
|
var maxMarkerSize = (0, d3_array_2.max)(this._points, function (point) {
|
|
782
792
|
return (0, d3_array_2.max)(point.data, function (item) {
|
|
783
793
|
return item.markerSize;
|
|
@@ -792,6 +802,9 @@ define(["require", "exports", "tslib", "react", "d3-selection", "d3-array", "../
|
|
|
792
802
|
var activePoint = this_1.state.activePoint;
|
|
793
803
|
var theme = this_1.props.theme;
|
|
794
804
|
var verticaLineHeight = containerHeight - this_1.margins.bottom + 6;
|
|
805
|
+
var yScale = this_1._points[i].useSecondaryYScale && this_1._yScaleSecondary ? this_1._yScaleSecondary : this_1._yScalePrimary;
|
|
806
|
+
var yPadding = this_1._points[i].useSecondaryYScale && this_1._yScaleSecondary ? this_1._yPaddingSecondary : this_1._yPaddingPrimary;
|
|
807
|
+
var extraMaxPixels = this_1.props.lineMode === 'scatter' ? this_1._getRangeForScatterMarkerSize(yScale, yPadding) : 0;
|
|
795
808
|
if (this_1._points[i].data.length === 1) {
|
|
796
809
|
var _3 = this_1._points[i].data[0], x1_1 = _3.x, y1 = _3.y, xAxisCalloutData_1 = _3.xAxisCalloutData, xAxisCalloutAccessibilityData_1 = _3.xAxisCalloutAccessibilityData;
|
|
797
810
|
var circleId_1 = "".concat(this_1._circleId, "_").concat(i);
|
|
@@ -801,7 +814,7 @@ define(["require", "exports", "tslib", "react", "d3-selection", "d3-array", "../
|
|
|
801
814
|
? (currentMarkerSize * extraMaxPixels) / maxMarkerSize
|
|
802
815
|
: activePoint === circleId_1
|
|
803
816
|
? 5.5
|
|
804
|
-
: 3.5, cx: this_1._xAxisScale(x1_1), cy:
|
|
817
|
+
: 3.5, cx: this_1._xAxisScale(x1_1), cy: yScale(y1), fill: activePoint === circleId_1 ? theme.semanticColors.bodyBackground : lineColor, opacity: isLegendSelected ? 1 : 0.1, onMouseOver: this_1._handleHover.bind(this_1, x1_1, y1, verticaLineHeight, xAxisCalloutData_1, circleId_1, xAxisCalloutAccessibilityData_1, yScale), onMouseMove: this_1._handleHover.bind(this_1, x1_1, y1, verticaLineHeight, xAxisCalloutData_1, circleId_1, xAxisCalloutAccessibilityData_1, yScale), onMouseOut: this_1._handleMouseOut, strokeWidth: activePoint === circleId_1 ? DEFAULT_LINE_STROKE_SIZE : 0, stroke: activePoint === circleId_1 ? lineColor : '', role: "img", "aria-label": this_1._getAriaLabel(i, 0), "data-is-focusable": isLegendSelected, ref: function (e) {
|
|
805
818
|
_this_1._refCallback(e, circleId_1);
|
|
806
819
|
}, onFocus: function () { return _this_1._handleFocus(circleId_1, x1_1, xAxisCalloutData_1, circleId_1, xAxisCalloutAccessibilityData_1); }, onBlur: this_1._handleMouseOut }, this_1._getClickHandler(this_1._points[i].data[0].onDataPointClick))));
|
|
807
820
|
}
|
|
@@ -814,7 +827,7 @@ define(["require", "exports", "tslib", "react", "d3-selection", "d3-array", "../
|
|
|
814
827
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
815
828
|
.x(function (d) { return _this_1._xAxisScale(d[0]); })
|
|
816
829
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
817
|
-
.y(function (d) { return
|
|
830
|
+
.y(function (d) { return yScale(d[1]); })
|
|
818
831
|
.curve((0, index_3.getCurveFactory)(lineCurve));
|
|
819
832
|
var lineId = "".concat(this_1._lineId, "_").concat(i);
|
|
820
833
|
var borderId = "".concat(this_1._borderId, "_").concat(i);
|
|
@@ -836,13 +849,13 @@ define(["require", "exports", "tslib", "react", "d3-selection", "d3-array", "../
|
|
|
836
849
|
if (lineBorderWidth > 0) {
|
|
837
850
|
bordersForLine.push(React.createElement("path", { id: borderId, key: borderId, d: line(lineData), fill: "transparent", strokeLinecap: (_g = (_f = this_1._points[i].lineOptions) === null || _f === void 0 ? void 0 : _f.strokeLinecap) !== null && _g !== void 0 ? _g : 'round', strokeWidth: Number.parseFloat(strokeWidth.toString()) + lineBorderWidth, stroke: ((_h = this_1._points[i].lineOptions) === null || _h === void 0 ? void 0 : _h.lineBorderColor) || theme.semanticColors.bodyBackground, opacity: 1 }));
|
|
838
851
|
}
|
|
839
|
-
linesForLine.push(React.createElement("path", tslib_1.__assign({ id: lineId, key: lineId, d: line(lineData), fill: "transparent", "data-is-focusable": true, stroke: lineColor, strokeWidth: strokeWidth, strokeLinecap: (_k = (_j = this_1._points[i].lineOptions) === null || _j === void 0 ? void 0 : _j.strokeLinecap) !== null && _k !== void 0 ? _k : 'round', strokeDasharray: (_l = this_1._points[i].lineOptions) === null || _l === void 0 ? void 0 : _l.strokeDasharray, onMouseMove: this_1._onMouseOverLargeDataset.bind(this_1, i, verticaLineHeight), onMouseOver: this_1._onMouseOverLargeDataset.bind(this_1, i, verticaLineHeight), onMouseOut: this_1._handleMouseOut }, this_1._getClickHandler(this_1._points[i].onLineClick), { opacity: 1 })));
|
|
852
|
+
linesForLine.push(React.createElement("path", tslib_1.__assign({ id: lineId, key: lineId, d: line(lineData), fill: "transparent", "data-is-focusable": true, stroke: lineColor, strokeWidth: strokeWidth, strokeLinecap: (_k = (_j = this_1._points[i].lineOptions) === null || _j === void 0 ? void 0 : _j.strokeLinecap) !== null && _k !== void 0 ? _k : 'round', strokeDasharray: (_l = this_1._points[i].lineOptions) === null || _l === void 0 ? void 0 : _l.strokeDasharray, onMouseMove: this_1._onMouseOverLargeDataset.bind(this_1, i, verticaLineHeight, yScale), onMouseOver: this_1._onMouseOverLargeDataset.bind(this_1, i, verticaLineHeight, yScale), onMouseOut: this_1._handleMouseOut }, this_1._getClickHandler(this_1._points[i].onLineClick), { opacity: 1 })));
|
|
840
853
|
}
|
|
841
854
|
else {
|
|
842
855
|
linesForLine.push(React.createElement("path", { id: lineId, key: lineId, d: line(lineData), fill: "transparent", "data-is-focusable": false, stroke: lineColor, strokeWidth: strokeWidth, strokeLinecap: (_o = (_m = this_1._points[i].lineOptions) === null || _m === void 0 ? void 0 : _m.strokeLinecap) !== null && _o !== void 0 ? _o : 'round', strokeDasharray: (_p = this_1._points[i].lineOptions) === null || _p === void 0 ? void 0 : _p.strokeDasharray, opacity: 0.1 }));
|
|
843
856
|
}
|
|
844
857
|
var isPointHighlighted = this_1.state.activeLine !== null && this_1.state.activeLine === i;
|
|
845
|
-
pointsForLine.push(React.createElement("circle", { id: "".concat(this_1._staticHighlightCircle, "_").concat(i), key: "".concat(this_1._staticHighlightCircle, "_").concat(i), r: 5.5, cx: 0, cy: 0, fill: theme.semanticColors.bodyBackground, strokeWidth: DEFAULT_LINE_STROKE_SIZE, stroke: lineColor, visibility: isPointHighlighted ? 'visibility' : 'hidden', onMouseMove: this_1._onMouseOverLargeDataset.bind(this_1, i, verticaLineHeight), onMouseOver: this_1._onMouseOverLargeDataset.bind(this_1, i, verticaLineHeight), onMouseOut: this_1._handleMouseOut }));
|
|
858
|
+
pointsForLine.push(React.createElement("circle", { id: "".concat(this_1._staticHighlightCircle, "_").concat(i), key: "".concat(this_1._staticHighlightCircle, "_").concat(i), r: 5.5, cx: 0, cy: 0, fill: theme.semanticColors.bodyBackground, strokeWidth: DEFAULT_LINE_STROKE_SIZE, stroke: lineColor, visibility: isPointHighlighted ? 'visibility' : 'hidden', onMouseMove: this_1._onMouseOverLargeDataset.bind(this_1, i, verticaLineHeight, yScale), onMouseOver: this_1._onMouseOverLargeDataset.bind(this_1, i, verticaLineHeight, yScale), onMouseOut: this_1._handleMouseOut }));
|
|
846
859
|
}
|
|
847
860
|
else if (!this_1.props.optimizeLargeData) {
|
|
848
861
|
var _loop_2 = function (j) {
|
|
@@ -854,27 +867,27 @@ define(["require", "exports", "tslib", "react", "d3-selection", "d3-array", "../
|
|
|
854
867
|
var circleId = "".concat(this_1._circleId, "_").concat(i, "_").concat(j);
|
|
855
868
|
var _4 = this_1._points[i].data[j - 1], x1 = _4.x, y1 = _4.y, xAxisCalloutData = _4.xAxisCalloutData, xAxisCalloutAccessibilityData = _4.xAxisCalloutAccessibilityData;
|
|
856
869
|
var _5 = this_1._points[i].data[j], x2 = _5.x, y2 = _5.y;
|
|
857
|
-
var path = this_1._getPath(this_1._xAxisScale(x1),
|
|
870
|
+
var path = this_1._getPath(this_1._xAxisScale(x1), yScale(y1), circleId, j, false, this_1._points[i].index);
|
|
858
871
|
var strokeWidth = ((_q = this_1._points[i].lineOptions) === null || _q === void 0 ? void 0 : _q.strokeWidth) || this_1.props.strokeWidth || DEFAULT_LINE_STROKE_SIZE;
|
|
859
872
|
var isLegendSelected = this_1._legendHighlighted(legendVal) || this_1._noLegendHighlighted() || this_1.state.isSelectedLegend;
|
|
860
873
|
var currentPointHidden = this_1._points[i].hideNonActiveDots && activePoint !== circleId;
|
|
861
874
|
var currentMarkerSize = this_1._points[i].data[j - 1].markerSize;
|
|
862
|
-
pointsForLine.push(this_1.props.lineMode === 'scatter' ? (React.createElement("circle", tslib_1.__assign({ id: circleId, key: circleId, r: currentMarkerSize ? (currentMarkerSize * extraMaxPixels) / maxMarkerSize : 4, cx: this_1._xAxisScale(x1), cy:
|
|
875
|
+
pointsForLine.push(this_1.props.lineMode === 'scatter' ? (React.createElement("circle", tslib_1.__assign({ id: circleId, key: circleId, r: currentMarkerSize ? (currentMarkerSize * extraMaxPixels) / maxMarkerSize : 4, cx: this_1._xAxisScale(x1), cy: yScale(y1), "data-is-focusable": isLegendSelected, onMouseOver: this_1._handleHover.bind(this_1, x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, yScale), onMouseMove: this_1._handleHover.bind(this_1, x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, yScale), onMouseOut: this_1._handleMouseOut, onFocus: function () { return _this_1._handleFocus(lineId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData); }, onBlur: this_1._handleMouseOut }, this_1._getClickHandler(this_1._points[i].data[j - 1].onDataPointClick), { opacity: isLegendSelected && !currentPointHidden ? 1 : 0.01, fill: this_1._getPointFill(lineColor, circleId, j, false), stroke: lineColor, strokeWidth: strokeWidth, role: "img", "aria-label": this_1._getAriaLabel(i, j - 1) }))) : (React.createElement("path", tslib_1.__assign({ id: circleId, key: circleId, d: path, "data-is-focusable": isLegendSelected, onMouseOver: this_1._handleHover.bind(this_1, x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, yScale), onMouseMove: this_1._handleHover.bind(this_1, x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, yScale), onMouseOut: this_1._handleMouseOut, onFocus: function () { return _this_1._handleFocus(lineId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData); }, onBlur: this_1._handleMouseOut }, this_1._getClickHandler(this_1._points[i].data[j - 1].onDataPointClick), { opacity: isLegendSelected && !currentPointHidden ? 1 : 0.01, fill: this_1._getPointFill(lineColor, circleId, j, false), stroke: lineColor, strokeWidth: strokeWidth, role: "img", "aria-label": this_1._getAriaLabel(i, j - 1) }))));
|
|
863
876
|
if (j + 1 === this_1._points[i].data.length) {
|
|
864
877
|
// If this is last point of the line segment.
|
|
865
878
|
var lastCircleId_1 = "".concat(circleId).concat(j, "L");
|
|
866
879
|
var hiddenHoverCircleId = "".concat(circleId).concat(j, "D");
|
|
867
880
|
var lastPointHidden = this_1._points[i].hideNonActiveDots && activePoint !== lastCircleId_1;
|
|
868
|
-
path = this_1._getPath(this_1._xAxisScale(x2),
|
|
881
|
+
path = this_1._getPath(this_1._xAxisScale(x2), yScale(y2), lastCircleId_1, j, true, this_1._points[i].index);
|
|
869
882
|
var _6 = this_1._points[i].data[j], lastCirlceXCallout_1 = _6.xAxisCalloutData, lastCirlceXCalloutAccessibilityData_1 = _6.xAxisCalloutAccessibilityData;
|
|
870
883
|
currentMarkerSize = this_1._points[i].data[j].markerSize;
|
|
871
884
|
pointsForLine.push(React.createElement(React.Fragment, { key: "".concat(lastCircleId_1, "_container") },
|
|
872
|
-
this_1.props.lineMode === 'scatter' ? (React.createElement("circle", tslib_1.__assign({ id: lastCircleId_1, key: lastCircleId_1, r: currentMarkerSize ? (currentMarkerSize * extraMaxPixels) / maxMarkerSize : 4, cx: this_1._xAxisScale(x2), cy:
|
|
885
|
+
this_1.props.lineMode === 'scatter' ? (React.createElement("circle", tslib_1.__assign({ id: lastCircleId_1, key: lastCircleId_1, r: currentMarkerSize ? (currentMarkerSize * extraMaxPixels) / maxMarkerSize : 4, cx: this_1._xAxisScale(x2), cy: yScale(y2), "data-is-focusable": isLegendSelected, onMouseOver: this_1._handleHover.bind(this_1, x2, y2, verticaLineHeight, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1, yScale), onMouseMove: this_1._handleHover.bind(this_1, x2, y2, verticaLineHeight, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1, yScale), onMouseOut: this_1._handleMouseOut, onFocus: function () {
|
|
873
886
|
return _this_1._handleFocus(lineId, x2, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1);
|
|
874
|
-
}, onBlur: this_1._handleMouseOut }, this_1._getClickHandler(this_1._points[i].data[j].onDataPointClick), { opacity: isLegendSelected && !lastPointHidden ? 1 : 0.01, fill: this_1._getPointFill(lineColor, lastCircleId_1, j, true), stroke: lineColor, strokeWidth: strokeWidth, role: "img", "aria-label": this_1._getAriaLabel(i, j) }))) : (React.createElement("path", tslib_1.__assign({ id: lastCircleId_1, key: lastCircleId_1, d: path, "data-is-focusable": isLegendSelected, onMouseOver: this_1._handleHover.bind(this_1, x2, y2, verticaLineHeight, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1), onMouseMove: this_1._handleHover.bind(this_1, x2, y2, verticaLineHeight, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1), onMouseOut: this_1._handleMouseOut, onFocus: function () {
|
|
887
|
+
}, onBlur: this_1._handleMouseOut }, this_1._getClickHandler(this_1._points[i].data[j].onDataPointClick), { opacity: isLegendSelected && !lastPointHidden ? 1 : 0.01, fill: this_1._getPointFill(lineColor, lastCircleId_1, j, true), stroke: lineColor, strokeWidth: strokeWidth, role: "img", "aria-label": this_1._getAriaLabel(i, j) }))) : (React.createElement("path", tslib_1.__assign({ id: lastCircleId_1, key: lastCircleId_1, d: path, "data-is-focusable": isLegendSelected, onMouseOver: this_1._handleHover.bind(this_1, x2, y2, verticaLineHeight, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1, yScale), onMouseMove: this_1._handleHover.bind(this_1, x2, y2, verticaLineHeight, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1, yScale), onMouseOut: this_1._handleMouseOut, onFocus: function () {
|
|
875
888
|
return _this_1._handleFocus(lineId, x2, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1);
|
|
876
889
|
}, onBlur: this_1._handleMouseOut }, this_1._getClickHandler(this_1._points[i].data[j].onDataPointClick), { opacity: isLegendSelected && !lastPointHidden ? 1 : 0.01, fill: this_1._getPointFill(lineColor, lastCircleId_1, j, true), stroke: lineColor, strokeWidth: strokeWidth, role: "img", "aria-label": this_1._getAriaLabel(i, j) }))),
|
|
877
|
-
React.createElement("circle", { id: hiddenHoverCircleId, key: hiddenHoverCircleId, r: 8, cx: this_1._xAxisScale(x2), cy:
|
|
890
|
+
React.createElement("circle", { id: hiddenHoverCircleId, key: hiddenHoverCircleId, r: 8, cx: this_1._xAxisScale(x2), cy: yScale(y2), opacity: 0, width: 0, onMouseOver: this_1._handleHover.bind(this_1, x2, y2, verticaLineHeight, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1, yScale), onMouseMove: this_1._handleHover.bind(this_1, x2, y2, verticaLineHeight, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1, yScale), onMouseOut: this_1._handleMouseOut, strokeWidth: 0, focusable: false, onBlur: this_1._handleMouseOut })));
|
|
878
891
|
}
|
|
879
892
|
if (this_1.props.lineMode !== 'scatter') {
|
|
880
893
|
if (isLegendSelected) {
|
|
@@ -884,16 +897,16 @@ define(["require", "exports", "tslib", "react", "d3-selection", "d3-array", "../
|
|
|
884
897
|
? Number.parseFloat(this_1._points[i].lineOptions.lineBorderWidth.toString())
|
|
885
898
|
: 0;
|
|
886
899
|
if (lineBorderWidth > 0) {
|
|
887
|
-
bordersForLine.push(React.createElement("line", { id: borderId, key: borderId, x1: this_1._xAxisScale(x1), y1:
|
|
900
|
+
bordersForLine.push(React.createElement("line", { id: borderId, key: borderId, x1: this_1._xAxisScale(x1), y1: yScale(y1), x2: this_1._xAxisScale(x2), y2: yScale(y2), strokeLinecap: (_t = (_s = this_1._points[i].lineOptions) === null || _s === void 0 ? void 0 : _s.strokeLinecap) !== null && _t !== void 0 ? _t : 'round', strokeWidth: Number.parseFloat(strokeWidth.toString()) + lineBorderWidth, stroke: ((_u = this_1._points[i].lineOptions) === null || _u === void 0 ? void 0 : _u.lineBorderColor) || theme.semanticColors.bodyBackground, opacity: 1 }));
|
|
888
901
|
}
|
|
889
|
-
linesForLine.push(React.createElement("line", tslib_1.__assign({ id: lineId, key: lineId, x1: this_1._xAxisScale(x1), y1:
|
|
902
|
+
linesForLine.push(React.createElement("line", tslib_1.__assign({ id: lineId, key: lineId, x1: this_1._xAxisScale(x1), y1: yScale(y1), x2: this_1._xAxisScale(x2), y2: yScale(y2), strokeWidth: strokeWidth, ref: function (e) {
|
|
890
903
|
_this_1._refCallback(e, lineId);
|
|
891
|
-
}, onMouseOver: this_1._handleHover.bind(this_1, x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData), onMouseMove: this_1._handleHover.bind(this_1, x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData), onMouseOut: this_1._handleMouseOut, stroke: lineColor, strokeLinecap: (_w = (_v = this_1._points[i].lineOptions) === null || _v === void 0 ? void 0 : _v.strokeLinecap) !== null && _w !== void 0 ? _w : 'round', strokeDasharray: (_x = this_1._points[i].lineOptions) === null || _x === void 0 ? void 0 : _x.strokeDasharray, strokeDashoffset: (_y = this_1._points[i].lineOptions) === null || _y === void 0 ? void 0 : _y.strokeDashoffset, opacity: 1 }, this_1._getClickHandler(this_1._points[i].onLineClick))));
|
|
904
|
+
}, onMouseOver: this_1._handleHover.bind(this_1, x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, yScale), onMouseMove: this_1._handleHover.bind(this_1, x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, yScale), onMouseOut: this_1._handleMouseOut, stroke: lineColor, strokeLinecap: (_w = (_v = this_1._points[i].lineOptions) === null || _v === void 0 ? void 0 : _v.strokeLinecap) !== null && _w !== void 0 ? _w : 'round', strokeDasharray: (_x = this_1._points[i].lineOptions) === null || _x === void 0 ? void 0 : _x.strokeDasharray, strokeDashoffset: (_y = this_1._points[i].lineOptions) === null || _y === void 0 ? void 0 : _y.strokeDashoffset, opacity: 1 }, this_1._getClickHandler(this_1._points[i].onLineClick))));
|
|
892
905
|
}
|
|
893
906
|
}
|
|
894
907
|
else {
|
|
895
908
|
if (!isInGap) {
|
|
896
|
-
linesForLine.push(React.createElement("line", { id: lineId, key: lineId, x1: this_1._xAxisScale(x1), y1:
|
|
909
|
+
linesForLine.push(React.createElement("line", { id: lineId, key: lineId, x1: this_1._xAxisScale(x1), y1: yScale(y1), x2: this_1._xAxisScale(x2), y2: yScale(y2), strokeWidth: strokeWidth, stroke: lineColor, strokeLinecap: (_0 = (_z = this_1._points[i].lineOptions) === null || _z === void 0 ? void 0 : _z.strokeLinecap) !== null && _0 !== void 0 ? _0 : 'round', strokeDasharray: (_1 = this_1._points[i].lineOptions) === null || _1 === void 0 ? void 0 : _1.strokeDasharray, strokeDashoffset: (_2 = this_1._points[i].lineOptions) === null || _2 === void 0 ? void 0 : _2.strokeDashoffset, opacity: 0.1 }));
|
|
897
910
|
}
|
|
898
911
|
}
|
|
899
912
|
}
|