@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
|
@@ -58,14 +58,14 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
58
58
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
59
59
|
_this_1._xAxisScale = '';
|
|
60
60
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
61
|
-
_this_1.
|
|
61
|
+
_this_1._yScalePrimary = '';
|
|
62
62
|
_this_1.eventLabelHeight = 36;
|
|
63
63
|
_this_1._isRTL = getRTL();
|
|
64
64
|
_this_1._xMin = Number.NEGATIVE_INFINITY;
|
|
65
|
-
_this_1._yMin = Number.NEGATIVE_INFINITY;
|
|
66
65
|
_this_1._xMax = Number.POSITIVE_INFINITY;
|
|
67
66
|
_this_1._xPadding = 0;
|
|
68
|
-
_this_1.
|
|
67
|
+
_this_1._yPaddingPrimary = 0;
|
|
68
|
+
_this_1._yPaddingSecondary = 0;
|
|
69
69
|
_this_1.toImage = function (opts) {
|
|
70
70
|
var _a, _b;
|
|
71
71
|
return 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);
|
|
@@ -119,24 +119,31 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
119
119
|
? _this_1.props.onRenderCalloutPerDataPoint(_this_1.state.dataPointCalloutProps)
|
|
120
120
|
: null;
|
|
121
121
|
};
|
|
122
|
-
_this_1._getNumericMinMaxOfY = function (points) {
|
|
122
|
+
_this_1._getNumericMinMaxOfY = function (points, yAxisType, useSecondaryYScale) {
|
|
123
123
|
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
124
|
-
var _a = findNumericMinMaxOfY(points), startValue = _a.startValue, endValue = _a.endValue;
|
|
125
|
-
|
|
124
|
+
var _a = findNumericMinMaxOfY(points, yAxisType, useSecondaryYScale), startValue = _a.startValue, endValue = _a.endValue;
|
|
125
|
+
var yPadding = 0;
|
|
126
126
|
if (_this_1.props.lineMode === 'scatter') {
|
|
127
|
-
|
|
127
|
+
yPadding = (endValue - startValue) * 0.1;
|
|
128
|
+
if (useSecondaryYScale) {
|
|
129
|
+
_this_1._yPaddingSecondary = yPadding;
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
_this_1._yPaddingPrimary = yPadding;
|
|
133
|
+
}
|
|
128
134
|
}
|
|
129
135
|
return {
|
|
130
|
-
startValue: startValue -
|
|
131
|
-
endValue: endValue +
|
|
136
|
+
startValue: startValue - yPadding,
|
|
137
|
+
endValue: endValue + yPadding,
|
|
132
138
|
};
|
|
133
139
|
};
|
|
134
140
|
_this_1._getMargins = function (margins) {
|
|
135
141
|
_this_1.margins = margins;
|
|
136
142
|
};
|
|
137
|
-
_this_1._initializeLineChartData = function (xScale,
|
|
143
|
+
_this_1._initializeLineChartData = function (xScale, yScalePrimary, containerHeight, containerWidth, xElement, yAxisElement, yScaleSecondary) {
|
|
138
144
|
_this_1._xAxisScale = xScale;
|
|
139
|
-
_this_1.
|
|
145
|
+
_this_1._yScalePrimary = yScalePrimary;
|
|
146
|
+
_this_1._yScaleSecondary = yScaleSecondary;
|
|
140
147
|
_this_1._renderedColorFillBars = _this_1.props.colorFillBars ? _this_1._createColorFillBars(containerHeight) : [];
|
|
141
148
|
_this_1.lines = _this_1._createLines(xElement, containerHeight);
|
|
142
149
|
};
|
|
@@ -250,7 +257,9 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
250
257
|
var opacity = _this_1._legendHighlighted(colorFillBar.legend) || _this_1._noLegendHighlighted() || _this_1.state.isSelectedLegend
|
|
251
258
|
? _this_1._getColorFillBarOpacity(colorFillBar)
|
|
252
259
|
: 0.1;
|
|
253
|
-
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.
|
|
260
|
+
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) -
|
|
261
|
+
_this_1._yScalePrimary(yMinMaxValues.endValue) +
|
|
262
|
+
FILL_Y_PADDING, key: "".concat(colorFillBarId).concat(j) }));
|
|
254
263
|
}
|
|
255
264
|
}
|
|
256
265
|
return colorFillBars;
|
|
@@ -273,7 +282,7 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
273
282
|
}
|
|
274
283
|
return { isInGap: isInGap, gapIndex: gapIndex };
|
|
275
284
|
};
|
|
276
|
-
_this_1._onMouseOverLargeDataset = function (linenumber, lineHeight, mouseEvent) {
|
|
285
|
+
_this_1._onMouseOverLargeDataset = function (linenumber, lineHeight, yScale, mouseEvent) {
|
|
277
286
|
mouseEvent.persist();
|
|
278
287
|
var data = _this_1.props.data;
|
|
279
288
|
var lineChartData = data.lineChartData;
|
|
@@ -335,12 +344,12 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
335
344
|
_this_1._uniqueCallOutID = "#".concat(_this_1._staticHighlightCircle, "_").concat(linenumber);
|
|
336
345
|
d3Select("#".concat(_this_1._staticHighlightCircle, "_").concat(linenumber))
|
|
337
346
|
.attr('cx', "".concat(_this_1._xAxisScale(pointToHighlight.x)))
|
|
338
|
-
.attr('cy', "".concat(
|
|
347
|
+
.attr('cy', "".concat(yScale(pointToHighlight.y)))
|
|
339
348
|
.attr('visibility', 'visibility');
|
|
340
349
|
d3Select("#".concat(_this_1._verticalLine))
|
|
341
|
-
.attr('transform', function () { return "translate(".concat(_this_1._xAxisScale(pointToHighlight.x), ", ").concat(
|
|
350
|
+
.attr('transform', function () { return "translate(".concat(_this_1._xAxisScale(pointToHighlight.x), ", ").concat(yScale(pointToHighlight.y), ")"); })
|
|
342
351
|
.attr('visibility', 'visibility')
|
|
343
|
-
.attr('y2', "".concat(lineHeight -
|
|
352
|
+
.attr('y2', "".concat(lineHeight - yScale(pointToHighlight.y)));
|
|
344
353
|
_this_1.setState({
|
|
345
354
|
nearestCircleToHighlight: pointToHighlight,
|
|
346
355
|
isCalloutVisible: true,
|
|
@@ -395,7 +404,7 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
395
404
|
});
|
|
396
405
|
}
|
|
397
406
|
};
|
|
398
|
-
_this_1._handleHover = function (x, y, lineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, mouseEvent) {
|
|
407
|
+
_this_1._handleHover = function (x, y, lineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, yScale, mouseEvent) {
|
|
399
408
|
mouseEvent.persist();
|
|
400
409
|
var formattedData = x instanceof Date ? formatDate(x, _this_1.props.useUTC) : x;
|
|
401
410
|
var xVal = x instanceof Date ? x.getTime() : x;
|
|
@@ -404,9 +413,9 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
404
413
|
// if no points need to be called out then don't show vertical line and callout card
|
|
405
414
|
if (found) {
|
|
406
415
|
d3Select("#".concat(_this_1._verticalLine))
|
|
407
|
-
.attr('transform', function () { return "translate(".concat(_this._xAxisScale(x), ", ").concat(
|
|
416
|
+
.attr('transform', function () { return "translate(".concat(_this._xAxisScale(x), ", ").concat(yScale(y), ")"); })
|
|
408
417
|
.attr('visibility', 'visibility')
|
|
409
|
-
.attr('y2', "".concat(lineHeight -
|
|
418
|
+
.attr('y2', "".concat(lineHeight - yScale(y)));
|
|
410
419
|
if (_this_1._uniqueCallOutID !== circleId) {
|
|
411
420
|
_this_1._uniqueCallOutID = circleId;
|
|
412
421
|
_this_1.setState({
|
|
@@ -692,7 +701,8 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
692
701
|
// eslint-disable-next-line react/no-children-prop
|
|
693
702
|
children: function (props) {
|
|
694
703
|
_this_1._xAxisScale = props.xScale;
|
|
695
|
-
_this_1.
|
|
704
|
+
_this_1._yScalePrimary = props.yScalePrimary;
|
|
705
|
+
_this_1._yScaleSecondary = props.yScaleSecondary;
|
|
696
706
|
return (React.createElement(React.Fragment, null,
|
|
697
707
|
React.createElement("g", null,
|
|
698
708
|
React.createElement("line", { x1: 0, y1: 0, x2: 0, y2: props.containerHeight, stroke: '#323130', id: _this_1._verticalLine, visibility: 'hidden', strokeDasharray: '5,5' }),
|
|
@@ -769,11 +779,12 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
769
779
|
: [];
|
|
770
780
|
return (React.createElement(Legends, __assign({ legends: __spreadArray(__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 })));
|
|
771
781
|
};
|
|
772
|
-
LineChartBase.prototype._getRangeForScatterMarkerSize = function () {
|
|
782
|
+
LineChartBase.prototype._getRangeForScatterMarkerSize = function (yScale, yPadding) {
|
|
773
783
|
var extraXPixels = this._isRTL
|
|
774
784
|
? this._xAxisScale(this._xMax - this._xPadding) - this._xAxisScale(this._xMax)
|
|
775
785
|
: this._xAxisScale(this._xMin + this._xPadding) - this._xAxisScale(this._xMin);
|
|
776
|
-
var
|
|
786
|
+
var yMin = yScale.domain()[0];
|
|
787
|
+
var extraYPixels = yScale(yMin) - yScale(yMin + yPadding);
|
|
777
788
|
return Math.min(extraXPixels, extraYPixels);
|
|
778
789
|
};
|
|
779
790
|
LineChartBase.prototype._createLines = function (xElement, containerHeight) {
|
|
@@ -786,7 +797,6 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
786
797
|
else {
|
|
787
798
|
this._points = this._injectIndexPropertyInLineChartData(this.props.data.lineChartData);
|
|
788
799
|
}
|
|
789
|
-
var extraMaxPixels = this.props.lineMode === 'scatter' ? this._getRangeForScatterMarkerSize() : 0;
|
|
790
800
|
var maxMarkerSize = d3Max(this._points, function (point) {
|
|
791
801
|
return d3Max(point.data, function (item) {
|
|
792
802
|
return item.markerSize;
|
|
@@ -801,6 +811,9 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
801
811
|
var activePoint = this_1.state.activePoint;
|
|
802
812
|
var theme = this_1.props.theme;
|
|
803
813
|
var verticaLineHeight = containerHeight - this_1.margins.bottom + 6;
|
|
814
|
+
var yScale = this_1._points[i].useSecondaryYScale && this_1._yScaleSecondary ? this_1._yScaleSecondary : this_1._yScalePrimary;
|
|
815
|
+
var yPadding = this_1._points[i].useSecondaryYScale && this_1._yScaleSecondary ? this_1._yPaddingSecondary : this_1._yPaddingPrimary;
|
|
816
|
+
var extraMaxPixels = this_1.props.lineMode === 'scatter' ? this_1._getRangeForScatterMarkerSize(yScale, yPadding) : 0;
|
|
804
817
|
if (this_1._points[i].data.length === 1) {
|
|
805
818
|
var _3 = this_1._points[i].data[0], x1_1 = _3.x, y1 = _3.y, xAxisCalloutData_1 = _3.xAxisCalloutData, xAxisCalloutAccessibilityData_1 = _3.xAxisCalloutAccessibilityData;
|
|
806
819
|
var circleId_1 = "".concat(this_1._circleId, "_").concat(i);
|
|
@@ -810,7 +823,7 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
810
823
|
? (currentMarkerSize * extraMaxPixels) / maxMarkerSize
|
|
811
824
|
: activePoint === circleId_1
|
|
812
825
|
? 5.5
|
|
813
|
-
: 3.5, cx: this_1._xAxisScale(x1_1), cy:
|
|
826
|
+
: 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) {
|
|
814
827
|
_this_1._refCallback(e, circleId_1);
|
|
815
828
|
}, 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))));
|
|
816
829
|
}
|
|
@@ -823,7 +836,7 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
823
836
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
824
837
|
.x(function (d) { return _this_1._xAxisScale(d[0]); })
|
|
825
838
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
826
|
-
.y(function (d) { return
|
|
839
|
+
.y(function (d) { return yScale(d[1]); })
|
|
827
840
|
.curve(getCurveFactory(lineCurve));
|
|
828
841
|
var lineId = "".concat(this_1._lineId, "_").concat(i);
|
|
829
842
|
var borderId = "".concat(this_1._borderId, "_").concat(i);
|
|
@@ -845,13 +858,13 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
845
858
|
if (lineBorderWidth > 0) {
|
|
846
859
|
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 }));
|
|
847
860
|
}
|
|
848
|
-
linesForLine.push(React.createElement("path", __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 })));
|
|
861
|
+
linesForLine.push(React.createElement("path", __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 })));
|
|
849
862
|
}
|
|
850
863
|
else {
|
|
851
864
|
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 }));
|
|
852
865
|
}
|
|
853
866
|
var isPointHighlighted = this_1.state.activeLine !== null && this_1.state.activeLine === i;
|
|
854
|
-
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 }));
|
|
867
|
+
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 }));
|
|
855
868
|
}
|
|
856
869
|
else if (!this_1.props.optimizeLargeData) {
|
|
857
870
|
var _loop_2 = function (j) {
|
|
@@ -863,27 +876,27 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
863
876
|
var circleId = "".concat(this_1._circleId, "_").concat(i, "_").concat(j);
|
|
864
877
|
var _4 = this_1._points[i].data[j - 1], x1 = _4.x, y1 = _4.y, xAxisCalloutData = _4.xAxisCalloutData, xAxisCalloutAccessibilityData = _4.xAxisCalloutAccessibilityData;
|
|
865
878
|
var _5 = this_1._points[i].data[j], x2 = _5.x, y2 = _5.y;
|
|
866
|
-
var path = this_1._getPath(this_1._xAxisScale(x1),
|
|
879
|
+
var path = this_1._getPath(this_1._xAxisScale(x1), yScale(y1), circleId, j, false, this_1._points[i].index);
|
|
867
880
|
var strokeWidth = ((_q = this_1._points[i].lineOptions) === null || _q === void 0 ? void 0 : _q.strokeWidth) || this_1.props.strokeWidth || DEFAULT_LINE_STROKE_SIZE;
|
|
868
881
|
var isLegendSelected = this_1._legendHighlighted(legendVal) || this_1._noLegendHighlighted() || this_1.state.isSelectedLegend;
|
|
869
882
|
var currentPointHidden = this_1._points[i].hideNonActiveDots && activePoint !== circleId;
|
|
870
883
|
var currentMarkerSize = this_1._points[i].data[j - 1].markerSize;
|
|
871
|
-
pointsForLine.push(this_1.props.lineMode === 'scatter' ? (React.createElement("circle", __assign({ id: circleId, key: circleId, r: currentMarkerSize ? (currentMarkerSize * extraMaxPixels) / maxMarkerSize : 4, cx: this_1._xAxisScale(x1), cy:
|
|
884
|
+
pointsForLine.push(this_1.props.lineMode === 'scatter' ? (React.createElement("circle", __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", __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) }))));
|
|
872
885
|
if (j + 1 === this_1._points[i].data.length) {
|
|
873
886
|
// If this is last point of the line segment.
|
|
874
887
|
var lastCircleId_1 = "".concat(circleId).concat(j, "L");
|
|
875
888
|
var hiddenHoverCircleId = "".concat(circleId).concat(j, "D");
|
|
876
889
|
var lastPointHidden = this_1._points[i].hideNonActiveDots && activePoint !== lastCircleId_1;
|
|
877
|
-
path = this_1._getPath(this_1._xAxisScale(x2),
|
|
890
|
+
path = this_1._getPath(this_1._xAxisScale(x2), yScale(y2), lastCircleId_1, j, true, this_1._points[i].index);
|
|
878
891
|
var _6 = this_1._points[i].data[j], lastCirlceXCallout_1 = _6.xAxisCalloutData, lastCirlceXCalloutAccessibilityData_1 = _6.xAxisCalloutAccessibilityData;
|
|
879
892
|
currentMarkerSize = this_1._points[i].data[j].markerSize;
|
|
880
893
|
pointsForLine.push(React.createElement(React.Fragment, { key: "".concat(lastCircleId_1, "_container") },
|
|
881
|
-
this_1.props.lineMode === 'scatter' ? (React.createElement("circle", __assign({ id: lastCircleId_1, key: lastCircleId_1, r: currentMarkerSize ? (currentMarkerSize * extraMaxPixels) / maxMarkerSize : 4, cx: this_1._xAxisScale(x2), cy:
|
|
894
|
+
this_1.props.lineMode === 'scatter' ? (React.createElement("circle", __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 () {
|
|
882
895
|
return _this_1._handleFocus(lineId, x2, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1);
|
|
883
|
-
}, 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", __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 () {
|
|
896
|
+
}, 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", __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 () {
|
|
884
897
|
return _this_1._handleFocus(lineId, x2, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1);
|
|
885
898
|
}, 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) }))),
|
|
886
|
-
React.createElement("circle", { id: hiddenHoverCircleId, key: hiddenHoverCircleId, r: 8, cx: this_1._xAxisScale(x2), cy:
|
|
899
|
+
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 })));
|
|
887
900
|
}
|
|
888
901
|
if (this_1.props.lineMode !== 'scatter') {
|
|
889
902
|
if (isLegendSelected) {
|
|
@@ -893,16 +906,16 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
893
906
|
? Number.parseFloat(this_1._points[i].lineOptions.lineBorderWidth.toString())
|
|
894
907
|
: 0;
|
|
895
908
|
if (lineBorderWidth > 0) {
|
|
896
|
-
bordersForLine.push(React.createElement("line", { id: borderId, key: borderId, x1: this_1._xAxisScale(x1), y1:
|
|
909
|
+
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 }));
|
|
897
910
|
}
|
|
898
|
-
linesForLine.push(React.createElement("line", __assign({ id: lineId, key: lineId, x1: this_1._xAxisScale(x1), y1:
|
|
911
|
+
linesForLine.push(React.createElement("line", __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) {
|
|
899
912
|
_this_1._refCallback(e, lineId);
|
|
900
|
-
}, 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))));
|
|
913
|
+
}, 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))));
|
|
901
914
|
}
|
|
902
915
|
}
|
|
903
916
|
else {
|
|
904
917
|
if (!isInGap) {
|
|
905
|
-
linesForLine.push(React.createElement("line", { id: lineId, key: lineId, x1: this_1._xAxisScale(x1), y1:
|
|
918
|
+
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 }));
|
|
906
919
|
}
|
|
907
920
|
}
|
|
908
921
|
}
|