@fluentui/react-charting 5.24.21 → 5.24.23
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/bundle-size/ScatterChart.fixture.js +7 -0
- package/dist/react-charting.d.ts +29 -4
- package/dist/react-charting.js +1 -1
- package/dist/react-charting.min.js +1 -1
- package/etc/react-charting.api.md +10 -4
- package/lib/components/AreaChart/AreaChart.base.js +3 -3
- package/lib/components/AreaChart/AreaChart.base.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.base.js +4 -4
- package/lib/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.d.ts +18 -3
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +2 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +10 -0
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +187 -11
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.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/HeatMapChart/HeatMapChart.styles.js +1 -8
- package/lib/components/HeatMapChart/HeatMapChart.styles.js.map +1 -1
- package/lib/components/HeatMapChart/HeatMapChart.types.d.ts +2 -2
- package/lib/components/HeatMapChart/HeatMapChart.types.js.map +1 -1
- package/lib/components/LineChart/LineChart.base.d.ts +0 -9
- package/lib/components/LineChart/LineChart.base.js +82 -138
- package/lib/components/LineChart/LineChart.base.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.base.js +37 -62
- package/lib/components/ScatterChart/ScatterChart.base.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.base.js +2 -2
- package/lib/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +2 -2
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js.map +1 -1
- package/lib/types/IDataPoint.d.ts +9 -0
- package/lib/types/IDataPoint.js.map +1 -1
- package/lib/utilities/utilities.d.ts +29 -28
- package/lib/utilities/utilities.js +127 -110
- package/lib/utilities/utilities.js.map +1 -1
- package/lib-amd/components/AreaChart/AreaChart.base.js +2 -2
- package/lib-amd/components/AreaChart/AreaChart.base.js.map +1 -1
- package/lib-amd/components/CommonComponents/CartesianChart.base.js +4 -4
- package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib-amd/components/CommonComponents/CartesianChart.types.d.ts +18 -3
- package/lib-amd/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/DeclarativeChart.js +2 -1
- package/lib-amd/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +10 -0
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +188 -11
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.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/HeatMapChart/HeatMapChart.styles.js +1 -8
- package/lib-amd/components/HeatMapChart/HeatMapChart.styles.js.map +1 -1
- package/lib-amd/components/HeatMapChart/HeatMapChart.types.d.ts +2 -2
- package/lib-amd/components/HeatMapChart/HeatMapChart.types.js.map +1 -1
- package/lib-amd/components/LineChart/LineChart.base.d.ts +0 -9
- package/lib-amd/components/LineChart/LineChart.base.js +80 -136
- package/lib-amd/components/LineChart/LineChart.base.js.map +1 -1
- package/lib-amd/components/ScatterChart/ScatterChart.base.js +35 -60
- package/lib-amd/components/ScatterChart/ScatterChart.base.js.map +1 -1
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js +1 -1
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +1 -1
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib-amd/index.d.ts +1 -1
- package/lib-amd/index.js.map +1 -1
- package/lib-amd/types/IDataPoint.d.ts +9 -0
- package/lib-amd/types/IDataPoint.js.map +1 -1
- package/lib-amd/utilities/utilities.d.ts +29 -28
- package/lib-amd/utilities/utilities.js +133 -113
- package/lib-amd/utilities/utilities.js.map +1 -1
- package/lib-commonjs/components/AreaChart/AreaChart.base.js +2 -2
- package/lib-commonjs/components/AreaChart/AreaChart.base.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.js +4 -4
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.d.ts +18 -3
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +2 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +10 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +188 -11
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.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/HeatMapChart/HeatMapChart.styles.js +1 -8
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.styles.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.types.d.ts +2 -2
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.types.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.base.d.ts +0 -9
- package/lib-commonjs/components/LineChart/LineChart.base.js +80 -136
- package/lib-commonjs/components/LineChart/LineChart.base.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.base.js +35 -60
- package/lib-commonjs/components/ScatterChart/ScatterChart.base.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib-commonjs/index.d.ts +1 -1
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/types/IDataPoint.d.ts +9 -0
- package/lib-commonjs/types/IDataPoint.js.map +1 -1
- package/lib-commonjs/utilities/utilities.d.ts +29 -28
- package/lib-commonjs/utilities/utilities.js +134 -114
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +4 -4
- package/src/components/CommonComponents/CartesianChart.types.ts +22 -2
- package/src/components/HeatMapChart/HeatMapChart.types.ts +2 -2
|
@@ -66,11 +66,6 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
66
66
|
_this_1._yScalePrimary = '';
|
|
67
67
|
_this_1.eventLabelHeight = 36;
|
|
68
68
|
_this_1._isRTL = (0, Utilities_1.getRTL)();
|
|
69
|
-
_this_1._xMin = Number.NEGATIVE_INFINITY;
|
|
70
|
-
_this_1._xMax = Number.POSITIVE_INFINITY;
|
|
71
|
-
_this_1._xPadding = 0;
|
|
72
|
-
_this_1._yPaddingPrimary = 0;
|
|
73
|
-
_this_1._yPaddingSecondary = 0;
|
|
74
69
|
_this_1._hasMarkersMode = false;
|
|
75
70
|
_this_1._isXAxisDateType = false;
|
|
76
71
|
_this_1._isScatterPolar = false;
|
|
@@ -80,17 +75,11 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
80
75
|
};
|
|
81
76
|
_this_1._getDomainNRangeValues = function (points, margins, width, chartType, isRTL, xAxisType, barWidth, tickValues, shiftX) {
|
|
82
77
|
var domainNRangeValue;
|
|
83
|
-
if (
|
|
84
|
-
domainNRangeValue =
|
|
85
|
-
}
|
|
86
|
-
else if (_this_1._hasMarkersMode && xAxisType === index_3.XAxisTypes.DateAxis) {
|
|
87
|
-
domainNRangeValue = _this_1._getDomainNRangeValuesOfDateWithPadding(points, margins, width, isRTL, tickValues, chartType, barWidth);
|
|
88
|
-
}
|
|
89
|
-
else if (xAxisType === index_3.XAxisTypes.NumericAxis) {
|
|
90
|
-
domainNRangeValue = (0, index_3.domainRangeOfNumericForAreaChart)(points, margins, width, isRTL);
|
|
78
|
+
if (xAxisType === index_3.XAxisTypes.NumericAxis) {
|
|
79
|
+
domainNRangeValue = (0, index_3.domainRangeOfNumericForAreaLineScatterCharts)(points, margins, width, isRTL, _this_1.props.xScaleType, _this_1._hasMarkersMode);
|
|
91
80
|
}
|
|
92
81
|
else if (xAxisType === index_3.XAxisTypes.DateAxis) {
|
|
93
|
-
domainNRangeValue = (0, index_3.
|
|
82
|
+
domainNRangeValue = (0, index_3.domainRangeOfDateForAreaLineScatterVerticalBarCharts)(points, margins, width, isRTL, tickValues, chartType, barWidth, _this_1._hasMarkersMode);
|
|
94
83
|
}
|
|
95
84
|
else {
|
|
96
85
|
domainNRangeValue = { dStartValue: 0, dEndValue: 0, rStartValue: 0, rEndValue: 0 };
|
|
@@ -136,20 +125,14 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
136
125
|
};
|
|
137
126
|
_this_1._getNumericMinMaxOfY = function (points, yAxisType, useSecondaryYScale) {
|
|
138
127
|
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
139
|
-
var _a = (0, index_3.findNumericMinMaxOfY)(points, yAxisType, useSecondaryYScale), startValue = _a.startValue, endValue = _a.endValue;
|
|
140
|
-
var yPadding = 0;
|
|
128
|
+
var _a = (0, index_3.findNumericMinMaxOfY)(points, yAxisType, useSecondaryYScale, useSecondaryYScale ? _this_1.props.secondaryYScaleType : _this_1.props.yScaleType), startValue = _a.startValue, endValue = _a.endValue;
|
|
129
|
+
var yPadding = { start: 0, end: 0 };
|
|
141
130
|
if (_this_1._hasMarkersMode) {
|
|
142
|
-
yPadding = (endValue
|
|
143
|
-
if (useSecondaryYScale) {
|
|
144
|
-
_this_1._yPaddingSecondary = yPadding;
|
|
145
|
-
}
|
|
146
|
-
else {
|
|
147
|
-
_this_1._yPaddingPrimary = yPadding;
|
|
148
|
-
}
|
|
131
|
+
yPadding = (0, index_3.getDomainPaddingForMarkers)(startValue, endValue, useSecondaryYScale ? _this_1.props.secondaryYScaleType : _this_1.props.yScaleType);
|
|
149
132
|
}
|
|
150
133
|
return {
|
|
151
|
-
startValue: startValue - yPadding,
|
|
152
|
-
endValue: endValue + yPadding,
|
|
134
|
+
startValue: startValue - yPadding.start,
|
|
135
|
+
endValue: endValue + yPadding.end,
|
|
153
136
|
};
|
|
154
137
|
};
|
|
155
138
|
_this_1._getMargins = function (margins) {
|
|
@@ -615,71 +598,10 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
615
598
|
var yValue = point.yAxisCalloutData || point.y;
|
|
616
599
|
return ((_a = point.callOutAccessibilityData) === null || _a === void 0 ? void 0 : _a.ariaLabel) || "".concat(xValue, ". ").concat(legend, ", ").concat(yValue, ".");
|
|
617
600
|
};
|
|
618
|
-
_this_1._getDomainNRangeValuesOfDateWithPadding = function (points, margins, width, isRTL, tickValues, chartType, barWidth) {
|
|
619
|
-
if (tickValues === void 0) { tickValues = []; }
|
|
620
|
-
_this_1._setXMinMaxValues(points);
|
|
621
|
-
// Include tickValues if present
|
|
622
|
-
var sDate = tickValues && tickValues.length > 0
|
|
623
|
-
? (0, d3_array_2.min)(tslib_1.__spreadArray(tslib_1.__spreadArray([], tickValues, true), [new Date(_this_1._xMin)], false))
|
|
624
|
-
: new Date(_this_1._xMin);
|
|
625
|
-
var lDate = tickValues && tickValues.length > 0
|
|
626
|
-
? (0, d3_array_2.max)(tslib_1.__spreadArray(tslib_1.__spreadArray([], tickValues, true), [new Date(_this_1._xMax)], false))
|
|
627
|
-
: new Date(_this_1._xMax);
|
|
628
|
-
// Calculate time-based padding (e.g. 10% of the date range)
|
|
629
|
-
var dateRange = lDate.getTime() - sDate.getTime();
|
|
630
|
-
var datePadding = _this_1._hasMarkersMode ? dateRange * 0.1 : 0;
|
|
631
|
-
var paddedSDate = new Date(sDate.getTime() - datePadding);
|
|
632
|
-
var paddedLDate = new Date(lDate.getTime() + datePadding);
|
|
633
|
-
var rStartValue = margins.left;
|
|
634
|
-
var rEndValue = width - margins.right;
|
|
635
|
-
return isRTL
|
|
636
|
-
? {
|
|
637
|
-
dStartValue: paddedLDate,
|
|
638
|
-
dEndValue: paddedSDate,
|
|
639
|
-
rStartValue: rStartValue,
|
|
640
|
-
rEndValue: rEndValue,
|
|
641
|
-
}
|
|
642
|
-
: {
|
|
643
|
-
dStartValue: paddedSDate,
|
|
644
|
-
dEndValue: paddedLDate,
|
|
645
|
-
rStartValue: rStartValue,
|
|
646
|
-
rEndValue: rEndValue,
|
|
647
|
-
};
|
|
648
|
-
};
|
|
649
|
-
_this_1._getDomainNRangeValuesWithPadding = function (points, margins, width, isRTL) {
|
|
650
|
-
_this_1._setXMinMaxValues(points);
|
|
651
|
-
if (_this_1._hasMarkersMode) {
|
|
652
|
-
_this_1._xPadding = (_this_1._xMax - _this_1._xMin) * 0.1;
|
|
653
|
-
}
|
|
654
|
-
var rStartValue = margins.left;
|
|
655
|
-
var rEndValue = width - margins.right;
|
|
656
|
-
return isRTL
|
|
657
|
-
? {
|
|
658
|
-
dStartValue: _this_1._xMax + _this_1._xPadding,
|
|
659
|
-
dEndValue: _this_1._xMin - _this_1._xPadding,
|
|
660
|
-
rStartValue: rStartValue,
|
|
661
|
-
rEndValue: rEndValue,
|
|
662
|
-
}
|
|
663
|
-
: {
|
|
664
|
-
dStartValue: _this_1._xMin - _this_1._xPadding,
|
|
665
|
-
dEndValue: _this_1._xMax + _this_1._xPadding,
|
|
666
|
-
rStartValue: rStartValue,
|
|
667
|
-
rEndValue: rEndValue,
|
|
668
|
-
};
|
|
669
|
-
};
|
|
670
601
|
_this_1._getChartTitle = function () {
|
|
671
602
|
var _a = _this_1.props.data, chartTitle = _a.chartTitle, lineChartData = _a.lineChartData;
|
|
672
603
|
return (chartTitle ? "".concat(chartTitle, ". ") : '') + "Line chart with ".concat((lineChartData === null || lineChartData === void 0 ? void 0 : lineChartData.length) || 0, " lines. ");
|
|
673
604
|
};
|
|
674
|
-
_this_1._setXMinMaxValues = function (points) {
|
|
675
|
-
var getX = function (item) { return (_this_1._isXAxisDateType ? item.x : item.x); };
|
|
676
|
-
var minVal = (0, d3_array_2.min)(points, function (point) { return (0, d3_array_2.min)(point.data, getX); });
|
|
677
|
-
var maxVal = (0, d3_array_2.max)(points, function (point) { return (0, d3_array_2.max)(point.data, getX); });
|
|
678
|
-
_this_1._xMin = _this_1._isXAxisDateType ? minVal.getTime() : minVal;
|
|
679
|
-
_this_1._xMax = _this_1._isXAxisDateType ? maxVal.getTime() : maxVal;
|
|
680
|
-
_this_1._xMin = _this_1._xMin === Number.NEGATIVE_INFINITY || !_this_1._xMin ? 0 : _this_1._xMin;
|
|
681
|
-
_this_1._xMax = _this_1._xMax === Number.POSITIVE_INFINITY || !_this_1._xMax ? 0 : _this_1._xMax;
|
|
682
|
-
};
|
|
683
605
|
(0, Utilities_1.initializeComponentRef)(_this_1);
|
|
684
606
|
_this_1.state = {
|
|
685
607
|
hoverXValue: '',
|
|
@@ -858,14 +780,6 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
858
780
|
: [];
|
|
859
781
|
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 })));
|
|
860
782
|
};
|
|
861
|
-
LineChartBase.prototype._getRangeForScatterMarkerSize = function (yScale, yPadding) {
|
|
862
|
-
var extraXPixels = this._isRTL
|
|
863
|
-
? this._xAxisScale(this._xMax - this._xPadding) - this._xAxisScale(this._xMax)
|
|
864
|
-
: this._xAxisScale(this._xMin + this._xPadding) - this._xAxisScale(this._xMin);
|
|
865
|
-
var yMin = yScale.domain()[0];
|
|
866
|
-
var extraYPixels = yScale(yMin) - yScale(yMin + yPadding);
|
|
867
|
-
return Math.min(extraXPixels, extraYPixels);
|
|
868
|
-
};
|
|
869
783
|
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
870
784
|
LineChartBase.prototype._createLines = function (xElement, containerHeight) {
|
|
871
785
|
var _this_1 = this;
|
|
@@ -898,27 +812,44 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
898
812
|
var activePoint = this_1.state.activePoint;
|
|
899
813
|
var theme = this_1.props.theme;
|
|
900
814
|
var verticaLineHeight = containerHeight - this_1.margins.bottom + 6;
|
|
901
|
-
var
|
|
902
|
-
var
|
|
903
|
-
var extraMaxPixels = this_1._hasMarkersMode
|
|
815
|
+
var useSecondaryYScale = !!(this_1._points[i].useSecondaryYScale && this_1._yScaleSecondary);
|
|
816
|
+
var yScale = useSecondaryYScale ? this_1._yScaleSecondary : this_1._yScalePrimary;
|
|
817
|
+
var extraMaxPixels = this_1._hasMarkersMode
|
|
818
|
+
? (0, index_3.getRangeForScatterMarkerSize)({
|
|
819
|
+
data: this_1._points,
|
|
820
|
+
xScale: this_1._xAxisScale,
|
|
821
|
+
yScalePrimary: this_1._yScalePrimary,
|
|
822
|
+
yScaleSecondary: this_1._yScaleSecondary,
|
|
823
|
+
useSecondaryYScale: useSecondaryYScale,
|
|
824
|
+
xScaleType: this_1.props.xScaleType,
|
|
825
|
+
yScaleType: this_1.props.yScaleType,
|
|
826
|
+
secondaryYScaleType: this_1.props.secondaryYScaleType,
|
|
827
|
+
})
|
|
828
|
+
: 0;
|
|
904
829
|
if (this_1._points[i].data.length === 1) {
|
|
905
830
|
var _18 = this_1._points[i].data[0], x1_1 = _18.x, y1 = _18.y, xAxisCalloutData_1 = _18.xAxisCalloutData, xAxisCalloutAccessibilityData_1 = _18.xAxisCalloutAccessibilityData;
|
|
906
|
-
var
|
|
907
|
-
var
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
831
|
+
var xPoint = this_1._xAxisScale(x1_1);
|
|
832
|
+
var yPoint = yScale(y1);
|
|
833
|
+
if ((0, index_3.isPlottable)(xPoint, yPoint)) {
|
|
834
|
+
var circleId_1 = "".concat(this_1._circleId, "_").concat(i);
|
|
835
|
+
var isLegendSelected = this_1._legendHighlighted(legendVal) || this_1._noLegendHighlighted() || this_1.state.isSelectedLegend;
|
|
836
|
+
var currentMarkerSize = this_1._points[i].data[0].markerSize;
|
|
837
|
+
var supportsTextMode = (_b = (_a = this_1._points[i].lineOptions) === null || _a === void 0 ? void 0 : _a.mode) === null || _b === void 0 ? void 0 : _b.includes('text');
|
|
838
|
+
var text = this_1._points[i].data[0].text;
|
|
839
|
+
pointsForLine.push(React.createElement(React.Fragment, { key: "".concat(circleId_1, "_fragment") },
|
|
840
|
+
React.createElement("circle", tslib_1.__assign({ id: circleId_1, key: circleId_1, r: currentMarkerSize
|
|
841
|
+
? (currentMarkerSize * extraMaxPixels) / maxMarkerSize
|
|
842
|
+
: activePoint === circleId_1
|
|
843
|
+
? 5.5
|
|
844
|
+
: 3.5, cx: xPoint, cy: yPoint, 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, legendVal, lineColor), onMouseMove: this_1._handleHover.bind(this_1, x1_1, y1, verticaLineHeight, xAxisCalloutData_1, circleId_1, xAxisCalloutAccessibilityData_1, yScale, legendVal, lineColor), 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) {
|
|
845
|
+
_this_1._refCallback(e, circleId_1);
|
|
846
|
+
}, onFocus: function () {
|
|
847
|
+
return _this_1._handleFocus(circleId_1, x1_1, xAxisCalloutData_1, circleId_1, xAxisCalloutAccessibilityData_1);
|
|
848
|
+
}, onBlur: this_1._handleMouseOut }, this_1._getClickHandler(this_1._points[i].data[0].onDataPointClick))),
|
|
849
|
+
!this_1._isScatterPolar && supportsTextMode && text && (React.createElement("text", { key: "".concat(circleId_1, "-label"), x: xPoint, y: yPoint +
|
|
850
|
+
Math.max(currentMarkerSize ? (currentMarkerSize * extraMaxPixels) / maxMarkerSize : 3.5, 4) +
|
|
851
|
+
12, className: classNames.markerLabel, opacity: isLegendSelected ? 1 : 0.1 }, text))));
|
|
852
|
+
}
|
|
922
853
|
}
|
|
923
854
|
var gapIndex = 0;
|
|
924
855
|
var gaps = (_d = (_c = this_1._points[i].gaps) === null || _c === void 0 ? void 0 : _c.sort(function (a, b) { return a.startIndex - b.startIndex; })) !== null && _d !== void 0 ? _d : [];
|
|
@@ -930,7 +861,8 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
930
861
|
.x(function (d) { return _this_1._xAxisScale(d[0]); })
|
|
931
862
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
932
863
|
.y(function (d) { return yScale(d[1]); })
|
|
933
|
-
.curve((0, index_3.getCurveFactory)(lineCurve))
|
|
864
|
+
.curve((0, index_3.getCurveFactory)(lineCurve))
|
|
865
|
+
.defined(function (d) { return (0, index_3.isPlottable)(_this_1._xAxisScale(d[0]), yScale(d[1])); });
|
|
934
866
|
var lineId = "".concat(this_1._lineId, "_").concat(i);
|
|
935
867
|
var borderId = "".concat(this_1._borderId, "_").concat(i);
|
|
936
868
|
var strokeWidth = ((_f = this_1._points[i].lineOptions) === null || _f === void 0 ? void 0 : _f.strokeWidth) || this_1.props.strokeWidth || DEFAULT_LINE_STROKE_SIZE;
|
|
@@ -969,43 +901,55 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
969
901
|
var circleId = "".concat(this_1._circleId, "_").concat(i, "_").concat(j);
|
|
970
902
|
var _19 = this_1._points[i].data[j - 1], x1 = _19.x, y1 = _19.y, xAxisCalloutData = _19.xAxisCalloutData, xAxisCalloutAccessibilityData = _19.xAxisCalloutAccessibilityData;
|
|
971
903
|
var _20 = this_1._points[i].data[j], x2 = _20.x, y2 = _20.y;
|
|
972
|
-
var
|
|
904
|
+
var xPoint1 = this_1._xAxisScale(x1);
|
|
905
|
+
var yPoint1 = yScale(y1);
|
|
906
|
+
var xPoint2 = this_1._xAxisScale(x2);
|
|
907
|
+
var yPoint2 = yScale(y2);
|
|
973
908
|
var strokeWidth = ((_s = this_1._points[i].lineOptions) === null || _s === void 0 ? void 0 : _s.strokeWidth) || this_1.props.strokeWidth || DEFAULT_LINE_STROKE_SIZE;
|
|
974
909
|
var isLegendSelected = this_1._legendHighlighted(legendVal) || this_1._noLegendHighlighted() || this_1.state.isSelectedLegend;
|
|
975
910
|
var currentPointHidden = this_1._points[i].hideNonActiveDots && activePoint !== circleId;
|
|
976
911
|
var supportsTextMode = (_u = (_t = this_1._points[i].lineOptions) === null || _t === void 0 ? void 0 : _t.mode) === null || _u === void 0 ? void 0 : _u.includes('text');
|
|
977
912
|
var text = this_1._points[i].data[j - 1].text;
|
|
978
913
|
var currentMarkerSize = this_1._points[i].data[j - 1].markerSize;
|
|
979
|
-
|
|
980
|
-
|
|
914
|
+
if ((0, index_3.isPlottable)(xPoint1, yPoint1)) {
|
|
915
|
+
var path = this_1._getPath(xPoint1, yPoint1, circleId, j, false, this_1._points[i].index);
|
|
916
|
+
pointsForLine.push(((_w = (_v = this_1._points[i].lineOptions) === null || _v === void 0 ? void 0 : _v.mode) === null || _w === void 0 ? void 0 : _w.includes('markers')) || supportsTextMode ? (React.createElement(React.Fragment, null,
|
|
917
|
+
React.createElement("circle", tslib_1.__assign({ id: circleId, key: circleId, r: currentMarkerSize ? (currentMarkerSize * extraMaxPixels) / maxMarkerSize : 4, cx: xPoint1, cy: yPoint1, "data-is-focusable": isLegendSelected, onMouseOver: this_1._handleHover.bind(this_1, x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, yScale, legendVal, lineColor), onMouseMove: this_1._handleHover.bind(this_1, x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, yScale, legendVal, lineColor), onMouseOut: this_1._handleMouseOut, onFocus: function () {
|
|
918
|
+
return _this_1._handleFocus(lineId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData);
|
|
919
|
+
}, 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": (_x = this_1._points[i].data[j - 1].text) !== null && _x !== void 0 ? _x : this_1._getAriaLabel(i, j - 1) })),
|
|
920
|
+
!this_1._isScatterPolar && supportsTextMode && text && (React.createElement("text", { key: "".concat(circleId, "-label"), x: xPoint1, y: yPoint1 +
|
|
921
|
+
Math.max(currentMarkerSize ? (currentMarkerSize * extraMaxPixels) / maxMarkerSize : 4, 4) +
|
|
922
|
+
12, className: classNames.markerLabel, opacity: isLegendSelected && !currentPointHidden ? 1 : 0.01 }, text)))) : (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, legendVal, lineColor), onMouseMove: this_1._handleHover.bind(this_1, x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, yScale, legendVal, lineColor), onMouseOut: this_1._handleMouseOut, onFocus: function () {
|
|
981
923
|
return _this_1._handleFocus(lineId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData);
|
|
982
|
-
}, 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":
|
|
983
|
-
|
|
984
|
-
Math.max(currentMarkerSize ? (currentMarkerSize * extraMaxPixels) / maxMarkerSize : 4, 4) +
|
|
985
|
-
12, className: classNames.markerLabel, opacity: isLegendSelected && !currentPointHidden ? 1 : 0.01 }, text)))) : (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, legendVal, lineColor), onMouseMove: this_1._handleHover.bind(this_1, x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, yScale, legendVal, lineColor), 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) }))));
|
|
924
|
+
}, 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) }))));
|
|
925
|
+
}
|
|
986
926
|
if (j + 1 === this_1._points[i].data.length) {
|
|
987
927
|
// If this is last point of the line segment.
|
|
988
928
|
var lastCircleId_1 = "".concat(circleId).concat(j, "L");
|
|
989
929
|
var hiddenHoverCircleId = "".concat(circleId).concat(j, "D");
|
|
990
930
|
var lastPointHidden = this_1._points[i].hideNonActiveDots && activePoint !== lastCircleId_1;
|
|
991
|
-
path = this_1._getPath(this_1._xAxisScale(x2), yScale(y2), lastCircleId_1, j, true, this_1._points[i].index);
|
|
992
931
|
var _21 = this_1._points[i].data[j], lastCirlceXCallout_1 = _21.xAxisCalloutData, lastCirlceXCalloutAccessibilityData_1 = _21.xAxisCalloutAccessibilityData;
|
|
993
932
|
currentMarkerSize = this_1._points[i].data[j].markerSize;
|
|
994
933
|
var lastSupportsTextMode = (_z = (_y = this_1._points[i].lineOptions) === null || _y === void 0 ? void 0 : _y.mode) === null || _z === void 0 ? void 0 : _z.includes('text');
|
|
995
934
|
var lastText = this_1._points[i].data[j].text;
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
935
|
+
if ((0, index_3.isPlottable)(xPoint2, yPoint2)) {
|
|
936
|
+
var path = this_1._getPath(xPoint2, yPoint2, lastCircleId_1, j, true, this_1._points[i].index);
|
|
937
|
+
pointsForLine.push(React.createElement(React.Fragment, { key: "".concat(lastCircleId_1, "_container") },
|
|
938
|
+
((_1 = (_0 = this_1._points[i].lineOptions) === null || _0 === void 0 ? void 0 : _0.mode) === null || _1 === void 0 ? void 0 : _1.includes('markers')) || lastSupportsTextMode ? (React.createElement(React.Fragment, null,
|
|
939
|
+
React.createElement("circle", tslib_1.__assign({ id: lastCircleId_1, key: lastCircleId_1, r: currentMarkerSize ? (currentMarkerSize * extraMaxPixels) / maxMarkerSize : 4, cx: xPoint2, cy: yPoint2, "data-is-focusable": isLegendSelected, onMouseOver: this_1._handleHover.bind(this_1, x2, y2, verticaLineHeight, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1, yScale, legendVal, lineColor), onMouseMove: this_1._handleHover.bind(this_1, x2, y2, verticaLineHeight, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1, yScale, legendVal, lineColor), onMouseOut: this_1._handleMouseOut, onFocus: function () {
|
|
940
|
+
return _this_1._handleFocus(lineId, x2, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1);
|
|
941
|
+
}, 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": (_2 = this_1._points[i].data[j].text) !== null && _2 !== void 0 ? _2 : this_1._getAriaLabel(i, j) })),
|
|
942
|
+
!this_1._isScatterPolar && lastSupportsTextMode && lastText && (React.createElement("text", { key: "".concat(lastCircleId_1, "-label"), x: xPoint2, y: yPoint2 +
|
|
943
|
+
Math.max(currentMarkerSize ? (currentMarkerSize * extraMaxPixels) / maxMarkerSize : 4, 4) +
|
|
944
|
+
12, className: classNames.markerLabel, opacity: isLegendSelected && !currentPointHidden ? 1 : 0.01 }, text)))) : (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, legendVal, lineColor), onMouseMove: this_1._handleHover.bind(this_1, x2, y2, verticaLineHeight, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1, yScale, legendVal, lineColor), onMouseOut: this_1._handleMouseOut, onFocus: function () {
|
|
999
945
|
return _this_1._handleFocus(lineId, x2, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1);
|
|
1000
|
-
}, 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":
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
12, className: classNames.markerLabel, opacity: isLegendSelected && !currentPointHidden ? 1 : 0.01 }, text)))) : (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, legendVal, lineColor), onMouseMove: this_1._handleHover.bind(this_1, x2, y2, verticaLineHeight, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1, yScale, legendVal, lineColor), onMouseOut: this_1._handleMouseOut, onFocus: function () {
|
|
1004
|
-
return _this_1._handleFocus(lineId, x2, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1);
|
|
1005
|
-
}, 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) }))),
|
|
1006
|
-
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, legendVal, lineColor), onMouseMove: this_1._handleHover.bind(this_1, x2, y2, verticaLineHeight, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1, yScale, legendVal, lineColor), onMouseOut: this_1._handleMouseOut, strokeWidth: 0, focusable: false, onBlur: this_1._handleMouseOut })));
|
|
946
|
+
}, 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) }))),
|
|
947
|
+
React.createElement("circle", { id: hiddenHoverCircleId, key: hiddenHoverCircleId, r: 8, cx: xPoint2, cy: yPoint2, opacity: 0, width: 0, onMouseOver: this_1._handleHover.bind(this_1, x2, y2, verticaLineHeight, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1, yScale, legendVal, lineColor), onMouseMove: this_1._handleHover.bind(this_1, x2, y2, verticaLineHeight, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1, yScale, legendVal, lineColor), onMouseOut: this_1._handleMouseOut, strokeWidth: 0, focusable: false, onBlur: this_1._handleMouseOut })));
|
|
948
|
+
}
|
|
1007
949
|
}
|
|
1008
|
-
if (
|
|
950
|
+
if ((0, index_3.isPlottable)(xPoint1, yPoint1) &&
|
|
951
|
+
(0, index_3.isPlottable)(xPoint2, yPoint2) &&
|
|
952
|
+
(!this_1._hasMarkersMode || ((_4 = (_3 = this_1._points[i].lineOptions) === null || _3 === void 0 ? void 0 : _3.mode) === null || _4 === void 0 ? void 0 : _4.includes('lines')))) {
|
|
1009
953
|
if (isLegendSelected) {
|
|
1010
954
|
// don't draw line if it is in a gap
|
|
1011
955
|
if (!isInGap) {
|
|
@@ -1013,16 +957,16 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
1013
957
|
? Number.parseFloat(this_1._points[i].lineOptions.lineBorderWidth.toString())
|
|
1014
958
|
: 0;
|
|
1015
959
|
if (lineBorderWidth > 0) {
|
|
1016
|
-
bordersForLine.push(React.createElement("line", { id: borderId, key: borderId, x1:
|
|
960
|
+
bordersForLine.push(React.createElement("line", { id: borderId, key: borderId, x1: xPoint1, y1: yPoint1, x2: xPoint2, y2: yPoint2, strokeLinecap: (_7 = (_6 = this_1._points[i].lineOptions) === null || _6 === void 0 ? void 0 : _6.strokeLinecap) !== null && _7 !== void 0 ? _7 : 'round', strokeWidth: Number.parseFloat(strokeWidth.toString()) + lineBorderWidth, stroke: ((_8 = this_1._points[i].lineOptions) === null || _8 === void 0 ? void 0 : _8.lineBorderColor) || theme.semanticColors.bodyBackground, opacity: 1 }));
|
|
1017
961
|
}
|
|
1018
|
-
linesForLine.push(React.createElement("line", tslib_1.__assign({ id: lineId, key: lineId, x1:
|
|
962
|
+
linesForLine.push(React.createElement("line", tslib_1.__assign({ id: lineId, key: lineId, x1: xPoint1, y1: yPoint1, x2: xPoint2, y2: yPoint2, strokeWidth: strokeWidth, ref: function (e) {
|
|
1019
963
|
_this_1._refCallback(e, lineId);
|
|
1020
964
|
}, onMouseOver: this_1._handleHover.bind(this_1, x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, yScale, legendVal, lineColor), onMouseMove: this_1._handleHover.bind(this_1, x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, yScale, legendVal, lineColor), onMouseOut: this_1._handleMouseOut, stroke: lineColor, strokeLinecap: (_10 = (_9 = this_1._points[i].lineOptions) === null || _9 === void 0 ? void 0 : _9.strokeLinecap) !== null && _10 !== void 0 ? _10 : 'round', strokeDasharray: (_11 = this_1._points[i].lineOptions) === null || _11 === void 0 ? void 0 : _11.strokeDasharray, strokeDashoffset: (_12 = this_1._points[i].lineOptions) === null || _12 === void 0 ? void 0 : _12.strokeDashoffset, opacity: 1 }, this_1._getClickHandler(this_1._points[i].onLineClick))));
|
|
1021
965
|
}
|
|
1022
966
|
}
|
|
1023
967
|
else {
|
|
1024
968
|
if (!isInGap) {
|
|
1025
|
-
linesForLine.push(React.createElement("line", { id: lineId, key: lineId, x1:
|
|
969
|
+
linesForLine.push(React.createElement("line", { id: lineId, key: lineId, x1: xPoint1, y1: yPoint1, x2: xPoint2, y2: yPoint2, strokeWidth: strokeWidth, stroke: lineColor, strokeLinecap: (_14 = (_13 = this_1._points[i].lineOptions) === null || _13 === void 0 ? void 0 : _13.strokeLinecap) !== null && _14 !== void 0 ? _14 : 'round', strokeDasharray: (_15 = this_1._points[i].lineOptions) === null || _15 === void 0 ? void 0 : _15.strokeDasharray, strokeDashoffset: (_16 = this_1._points[i].lineOptions) === null || _16 === void 0 ? void 0 : _16.strokeDashoffset, opacity: 0.1 }));
|
|
1026
970
|
}
|
|
1027
971
|
}
|
|
1028
972
|
}
|