@fluentui/react-charting 5.23.76 → 5.23.78
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 +55 -1
- package/CHANGELOG.md +24 -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/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +3 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +89 -26
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.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/LineChart/eventAnnotation/LabelLink.js +1 -1
- package/lib/components/LineChart/eventAnnotation/LabelLink.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 +3 -0
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +55 -18
- 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 +8 -5
- package/lib/utilities/utilities.js +35 -43
- 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/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +3 -1
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +88 -25
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.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/LineChart/eventAnnotation/LabelLink.js +1 -1
- package/lib-amd/components/LineChart/eventAnnotation/LabelLink.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 +3 -0
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +55 -18
- 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 +8 -5
- package/lib-amd/utilities/utilities.js +37 -45
- 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/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +3 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +88 -25
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.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/LineChart/eventAnnotation/LabelLink.js +1 -1
- package/lib-commonjs/components/LineChart/eventAnnotation/LabelLink.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 +3 -0
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +55 -18
- 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 +8 -5
- package/lib-commonjs/utilities/utilities.js +37 -45
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +4 -4
- package/src/components/CommonComponents/CartesianChart.types.ts +2 -1
|
@@ -61,14 +61,14 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
61
61
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
62
62
|
_this_1._xAxisScale = '';
|
|
63
63
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
64
|
-
_this_1.
|
|
64
|
+
_this_1._yScalePrimary = '';
|
|
65
65
|
_this_1.eventLabelHeight = 36;
|
|
66
66
|
_this_1._isRTL = (0, Utilities_1.getRTL)();
|
|
67
67
|
_this_1._xMin = Number.NEGATIVE_INFINITY;
|
|
68
|
-
_this_1._yMin = Number.NEGATIVE_INFINITY;
|
|
69
68
|
_this_1._xMax = Number.POSITIVE_INFINITY;
|
|
70
69
|
_this_1._xPadding = 0;
|
|
71
|
-
_this_1.
|
|
70
|
+
_this_1._yPaddingPrimary = 0;
|
|
71
|
+
_this_1._yPaddingSecondary = 0;
|
|
72
72
|
_this_1.toImage = function (opts) {
|
|
73
73
|
var _a, _b;
|
|
74
74
|
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);
|
|
@@ -122,24 +122,31 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
122
122
|
? _this_1.props.onRenderCalloutPerDataPoint(_this_1.state.dataPointCalloutProps)
|
|
123
123
|
: null;
|
|
124
124
|
};
|
|
125
|
-
_this_1._getNumericMinMaxOfY = function (points) {
|
|
125
|
+
_this_1._getNumericMinMaxOfY = function (points, yAxisType, useSecondaryYScale) {
|
|
126
126
|
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
127
|
-
var _a = (0, index_3.findNumericMinMaxOfY)(points), startValue = _a.startValue, endValue = _a.endValue;
|
|
128
|
-
|
|
127
|
+
var _a = (0, index_3.findNumericMinMaxOfY)(points, yAxisType, useSecondaryYScale), startValue = _a.startValue, endValue = _a.endValue;
|
|
128
|
+
var yPadding = 0;
|
|
129
129
|
if (_this_1.props.lineMode === 'scatter') {
|
|
130
|
-
|
|
130
|
+
yPadding = (endValue - startValue) * 0.1;
|
|
131
|
+
if (useSecondaryYScale) {
|
|
132
|
+
_this_1._yPaddingSecondary = yPadding;
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
_this_1._yPaddingPrimary = yPadding;
|
|
136
|
+
}
|
|
131
137
|
}
|
|
132
138
|
return {
|
|
133
|
-
startValue: startValue -
|
|
134
|
-
endValue: endValue +
|
|
139
|
+
startValue: startValue - yPadding,
|
|
140
|
+
endValue: endValue + yPadding,
|
|
135
141
|
};
|
|
136
142
|
};
|
|
137
143
|
_this_1._getMargins = function (margins) {
|
|
138
144
|
_this_1.margins = margins;
|
|
139
145
|
};
|
|
140
|
-
_this_1._initializeLineChartData = function (xScale,
|
|
146
|
+
_this_1._initializeLineChartData = function (xScale, yScalePrimary, containerHeight, containerWidth, xElement, yAxisElement, yScaleSecondary) {
|
|
141
147
|
_this_1._xAxisScale = xScale;
|
|
142
|
-
_this_1.
|
|
148
|
+
_this_1._yScalePrimary = yScalePrimary;
|
|
149
|
+
_this_1._yScaleSecondary = yScaleSecondary;
|
|
143
150
|
_this_1._renderedColorFillBars = _this_1.props.colorFillBars ? _this_1._createColorFillBars(containerHeight) : [];
|
|
144
151
|
_this_1.lines = _this_1._createLines(xElement, containerHeight);
|
|
145
152
|
};
|
|
@@ -253,7 +260,9 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
253
260
|
var opacity = _this_1._legendHighlighted(colorFillBar.legend) || _this_1._noLegendHighlighted() || _this_1.state.isSelectedLegend
|
|
254
261
|
? _this_1._getColorFillBarOpacity(colorFillBar)
|
|
255
262
|
: 0.1;
|
|
256
|
-
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.
|
|
263
|
+
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) -
|
|
264
|
+
_this_1._yScalePrimary(yMinMaxValues.endValue) +
|
|
265
|
+
FILL_Y_PADDING, key: "".concat(colorFillBarId).concat(j) }));
|
|
257
266
|
}
|
|
258
267
|
}
|
|
259
268
|
return colorFillBars;
|
|
@@ -276,7 +285,7 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
276
285
|
}
|
|
277
286
|
return { isInGap: isInGap, gapIndex: gapIndex };
|
|
278
287
|
};
|
|
279
|
-
_this_1._onMouseOverLargeDataset = function (linenumber, lineHeight, mouseEvent) {
|
|
288
|
+
_this_1._onMouseOverLargeDataset = function (linenumber, lineHeight, yScale, mouseEvent) {
|
|
280
289
|
mouseEvent.persist();
|
|
281
290
|
var data = _this_1.props.data;
|
|
282
291
|
var lineChartData = data.lineChartData;
|
|
@@ -338,12 +347,12 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
338
347
|
_this_1._uniqueCallOutID = "#".concat(_this_1._staticHighlightCircle, "_").concat(linenumber);
|
|
339
348
|
(0, d3_selection_1.select)("#".concat(_this_1._staticHighlightCircle, "_").concat(linenumber))
|
|
340
349
|
.attr('cx', "".concat(_this_1._xAxisScale(pointToHighlight.x)))
|
|
341
|
-
.attr('cy', "".concat(
|
|
350
|
+
.attr('cy', "".concat(yScale(pointToHighlight.y)))
|
|
342
351
|
.attr('visibility', 'visibility');
|
|
343
352
|
(0, d3_selection_1.select)("#".concat(_this_1._verticalLine))
|
|
344
|
-
.attr('transform', function () { return "translate(".concat(_this_1._xAxisScale(pointToHighlight.x), ", ").concat(
|
|
353
|
+
.attr('transform', function () { return "translate(".concat(_this_1._xAxisScale(pointToHighlight.x), ", ").concat(yScale(pointToHighlight.y), ")"); })
|
|
345
354
|
.attr('visibility', 'visibility')
|
|
346
|
-
.attr('y2', "".concat(lineHeight -
|
|
355
|
+
.attr('y2', "".concat(lineHeight - yScale(pointToHighlight.y)));
|
|
347
356
|
_this_1.setState({
|
|
348
357
|
nearestCircleToHighlight: pointToHighlight,
|
|
349
358
|
isCalloutVisible: true,
|
|
@@ -398,7 +407,7 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
398
407
|
});
|
|
399
408
|
}
|
|
400
409
|
};
|
|
401
|
-
_this_1._handleHover = function (x, y, lineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, mouseEvent) {
|
|
410
|
+
_this_1._handleHover = function (x, y, lineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, yScale, mouseEvent) {
|
|
402
411
|
mouseEvent.persist();
|
|
403
412
|
var formattedData = x instanceof Date ? (0, index_3.formatDate)(x, _this_1.props.useUTC) : x;
|
|
404
413
|
var xVal = x instanceof Date ? x.getTime() : x;
|
|
@@ -407,9 +416,9 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
407
416
|
// if no points need to be called out then don't show vertical line and callout card
|
|
408
417
|
if (found) {
|
|
409
418
|
(0, d3_selection_1.select)("#".concat(_this_1._verticalLine))
|
|
410
|
-
.attr('transform', function () { return "translate(".concat(_this._xAxisScale(x), ", ").concat(
|
|
419
|
+
.attr('transform', function () { return "translate(".concat(_this._xAxisScale(x), ", ").concat(yScale(y), ")"); })
|
|
411
420
|
.attr('visibility', 'visibility')
|
|
412
|
-
.attr('y2', "".concat(lineHeight -
|
|
421
|
+
.attr('y2', "".concat(lineHeight - yScale(y)));
|
|
413
422
|
if (_this_1._uniqueCallOutID !== circleId) {
|
|
414
423
|
_this_1._uniqueCallOutID = circleId;
|
|
415
424
|
_this_1.setState({
|
|
@@ -695,7 +704,8 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
695
704
|
// eslint-disable-next-line react/no-children-prop
|
|
696
705
|
children: function (props) {
|
|
697
706
|
_this_1._xAxisScale = props.xScale;
|
|
698
|
-
_this_1.
|
|
707
|
+
_this_1._yScalePrimary = props.yScalePrimary;
|
|
708
|
+
_this_1._yScaleSecondary = props.yScaleSecondary;
|
|
699
709
|
return (React.createElement(React.Fragment, null,
|
|
700
710
|
React.createElement("g", null,
|
|
701
711
|
React.createElement("line", { x1: 0, y1: 0, x2: 0, y2: props.containerHeight, stroke: '#323130', id: _this_1._verticalLine, visibility: 'hidden', strokeDasharray: '5,5' }),
|
|
@@ -772,11 +782,12 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
772
782
|
: [];
|
|
773
783
|
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 })));
|
|
774
784
|
};
|
|
775
|
-
LineChartBase.prototype._getRangeForScatterMarkerSize = function () {
|
|
785
|
+
LineChartBase.prototype._getRangeForScatterMarkerSize = function (yScale, yPadding) {
|
|
776
786
|
var extraXPixels = this._isRTL
|
|
777
787
|
? this._xAxisScale(this._xMax - this._xPadding) - this._xAxisScale(this._xMax)
|
|
778
788
|
: this._xAxisScale(this._xMin + this._xPadding) - this._xAxisScale(this._xMin);
|
|
779
|
-
var
|
|
789
|
+
var yMin = yScale.domain()[0];
|
|
790
|
+
var extraYPixels = yScale(yMin) - yScale(yMin + yPadding);
|
|
780
791
|
return Math.min(extraXPixels, extraYPixels);
|
|
781
792
|
};
|
|
782
793
|
LineChartBase.prototype._createLines = function (xElement, containerHeight) {
|
|
@@ -789,7 +800,6 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
789
800
|
else {
|
|
790
801
|
this._points = this._injectIndexPropertyInLineChartData(this.props.data.lineChartData);
|
|
791
802
|
}
|
|
792
|
-
var extraMaxPixels = this.props.lineMode === 'scatter' ? this._getRangeForScatterMarkerSize() : 0;
|
|
793
803
|
var maxMarkerSize = (0, d3_array_2.max)(this._points, function (point) {
|
|
794
804
|
return (0, d3_array_2.max)(point.data, function (item) {
|
|
795
805
|
return item.markerSize;
|
|
@@ -804,6 +814,9 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
804
814
|
var activePoint = this_1.state.activePoint;
|
|
805
815
|
var theme = this_1.props.theme;
|
|
806
816
|
var verticaLineHeight = containerHeight - this_1.margins.bottom + 6;
|
|
817
|
+
var yScale = this_1._points[i].useSecondaryYScale && this_1._yScaleSecondary ? this_1._yScaleSecondary : this_1._yScalePrimary;
|
|
818
|
+
var yPadding = this_1._points[i].useSecondaryYScale && this_1._yScaleSecondary ? this_1._yPaddingSecondary : this_1._yPaddingPrimary;
|
|
819
|
+
var extraMaxPixels = this_1.props.lineMode === 'scatter' ? this_1._getRangeForScatterMarkerSize(yScale, yPadding) : 0;
|
|
807
820
|
if (this_1._points[i].data.length === 1) {
|
|
808
821
|
var _3 = this_1._points[i].data[0], x1_1 = _3.x, y1 = _3.y, xAxisCalloutData_1 = _3.xAxisCalloutData, xAxisCalloutAccessibilityData_1 = _3.xAxisCalloutAccessibilityData;
|
|
809
822
|
var circleId_1 = "".concat(this_1._circleId, "_").concat(i);
|
|
@@ -813,7 +826,7 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
813
826
|
? (currentMarkerSize * extraMaxPixels) / maxMarkerSize
|
|
814
827
|
: activePoint === circleId_1
|
|
815
828
|
? 5.5
|
|
816
|
-
: 3.5, cx: this_1._xAxisScale(x1_1), cy:
|
|
829
|
+
: 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) {
|
|
817
830
|
_this_1._refCallback(e, circleId_1);
|
|
818
831
|
}, 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))));
|
|
819
832
|
}
|
|
@@ -826,7 +839,7 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
826
839
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
827
840
|
.x(function (d) { return _this_1._xAxisScale(d[0]); })
|
|
828
841
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
829
|
-
.y(function (d) { return
|
|
842
|
+
.y(function (d) { return yScale(d[1]); })
|
|
830
843
|
.curve((0, index_3.getCurveFactory)(lineCurve));
|
|
831
844
|
var lineId = "".concat(this_1._lineId, "_").concat(i);
|
|
832
845
|
var borderId = "".concat(this_1._borderId, "_").concat(i);
|
|
@@ -848,13 +861,13 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
848
861
|
if (lineBorderWidth > 0) {
|
|
849
862
|
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 }));
|
|
850
863
|
}
|
|
851
|
-
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 })));
|
|
864
|
+
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 })));
|
|
852
865
|
}
|
|
853
866
|
else {
|
|
854
867
|
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 }));
|
|
855
868
|
}
|
|
856
869
|
var isPointHighlighted = this_1.state.activeLine !== null && this_1.state.activeLine === i;
|
|
857
|
-
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 }));
|
|
870
|
+
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 }));
|
|
858
871
|
}
|
|
859
872
|
else if (!this_1.props.optimizeLargeData) {
|
|
860
873
|
var _loop_2 = function (j) {
|
|
@@ -866,27 +879,27 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
866
879
|
var circleId = "".concat(this_1._circleId, "_").concat(i, "_").concat(j);
|
|
867
880
|
var _4 = this_1._points[i].data[j - 1], x1 = _4.x, y1 = _4.y, xAxisCalloutData = _4.xAxisCalloutData, xAxisCalloutAccessibilityData = _4.xAxisCalloutAccessibilityData;
|
|
868
881
|
var _5 = this_1._points[i].data[j], x2 = _5.x, y2 = _5.y;
|
|
869
|
-
var path = this_1._getPath(this_1._xAxisScale(x1),
|
|
882
|
+
var path = this_1._getPath(this_1._xAxisScale(x1), yScale(y1), circleId, j, false, this_1._points[i].index);
|
|
870
883
|
var strokeWidth = ((_q = this_1._points[i].lineOptions) === null || _q === void 0 ? void 0 : _q.strokeWidth) || this_1.props.strokeWidth || DEFAULT_LINE_STROKE_SIZE;
|
|
871
884
|
var isLegendSelected = this_1._legendHighlighted(legendVal) || this_1._noLegendHighlighted() || this_1.state.isSelectedLegend;
|
|
872
885
|
var currentPointHidden = this_1._points[i].hideNonActiveDots && activePoint !== circleId;
|
|
873
886
|
var currentMarkerSize = this_1._points[i].data[j - 1].markerSize;
|
|
874
|
-
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:
|
|
887
|
+
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) }))));
|
|
875
888
|
if (j + 1 === this_1._points[i].data.length) {
|
|
876
889
|
// If this is last point of the line segment.
|
|
877
890
|
var lastCircleId_1 = "".concat(circleId).concat(j, "L");
|
|
878
891
|
var hiddenHoverCircleId = "".concat(circleId).concat(j, "D");
|
|
879
892
|
var lastPointHidden = this_1._points[i].hideNonActiveDots && activePoint !== lastCircleId_1;
|
|
880
|
-
path = this_1._getPath(this_1._xAxisScale(x2),
|
|
893
|
+
path = this_1._getPath(this_1._xAxisScale(x2), yScale(y2), lastCircleId_1, j, true, this_1._points[i].index);
|
|
881
894
|
var _6 = this_1._points[i].data[j], lastCirlceXCallout_1 = _6.xAxisCalloutData, lastCirlceXCalloutAccessibilityData_1 = _6.xAxisCalloutAccessibilityData;
|
|
882
895
|
currentMarkerSize = this_1._points[i].data[j].markerSize;
|
|
883
896
|
pointsForLine.push(React.createElement(React.Fragment, { key: "".concat(lastCircleId_1, "_container") },
|
|
884
|
-
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:
|
|
897
|
+
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 () {
|
|
885
898
|
return _this_1._handleFocus(lineId, x2, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1);
|
|
886
|
-
}, 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 () {
|
|
899
|
+
}, 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 () {
|
|
887
900
|
return _this_1._handleFocus(lineId, x2, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1);
|
|
888
901
|
}, 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) }))),
|
|
889
|
-
React.createElement("circle", { id: hiddenHoverCircleId, key: hiddenHoverCircleId, r: 8, cx: this_1._xAxisScale(x2), cy:
|
|
902
|
+
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 })));
|
|
890
903
|
}
|
|
891
904
|
if (this_1.props.lineMode !== 'scatter') {
|
|
892
905
|
if (isLegendSelected) {
|
|
@@ -896,16 +909,16 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
896
909
|
? Number.parseFloat(this_1._points[i].lineOptions.lineBorderWidth.toString())
|
|
897
910
|
: 0;
|
|
898
911
|
if (lineBorderWidth > 0) {
|
|
899
|
-
bordersForLine.push(React.createElement("line", { id: borderId, key: borderId, x1: this_1._xAxisScale(x1), y1:
|
|
912
|
+
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 }));
|
|
900
913
|
}
|
|
901
|
-
linesForLine.push(React.createElement("line", tslib_1.__assign({ id: lineId, key: lineId, x1: this_1._xAxisScale(x1), y1:
|
|
914
|
+
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) {
|
|
902
915
|
_this_1._refCallback(e, lineId);
|
|
903
|
-
}, 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))));
|
|
916
|
+
}, 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))));
|
|
904
917
|
}
|
|
905
918
|
}
|
|
906
919
|
else {
|
|
907
920
|
if (!isInGap) {
|
|
908
|
-
linesForLine.push(React.createElement("line", { id: lineId, key: lineId, x1: this_1._xAxisScale(x1), y1:
|
|
921
|
+
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 }));
|
|
909
922
|
}
|
|
910
923
|
}
|
|
911
924
|
}
|