@fluentui/react-charting 5.24.7 → 5.24.9
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 +37 -1
- package/CHANGELOG.md +21 -2
- package/dist/react-charting.d.ts +1 -1
- package/dist/react-charting.js +1 -1
- package/dist/react-charting.min.js +1 -1
- package/etc/react-charting.api.md +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +3 -2
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/LineChart/LineChart.base.d.ts +2 -0
- package/lib/components/LineChart/LineChart.base.js +65 -51
- package/lib/components/LineChart/LineChart.base.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.base.js +22 -23
- package/lib/components/ScatterChart/ScatterChart.base.js.map +1 -1
- package/lib/types/IDataPoint.d.ts +1 -1
- package/lib/types/IDataPoint.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +3 -2
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-amd/components/LineChart/LineChart.base.d.ts +2 -0
- package/lib-amd/components/LineChart/LineChart.base.js +65 -51
- package/lib-amd/components/LineChart/LineChart.base.js.map +1 -1
- package/lib-amd/components/ScatterChart/ScatterChart.base.js +22 -23
- package/lib-amd/components/ScatterChart/ScatterChart.base.js.map +1 -1
- package/lib-amd/types/IDataPoint.d.ts +1 -1
- package/lib-amd/types/IDataPoint.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +3 -2
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.base.d.ts +2 -0
- package/lib-commonjs/components/LineChart/LineChart.base.js +65 -51
- package/lib-commonjs/components/LineChart/LineChart.base.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.base.js +22 -23
- package/lib-commonjs/components/ScatterChart/ScatterChart.base.js.map +1 -1
- package/lib-commonjs/types/IDataPoint.d.ts +1 -1
- package/lib-commonjs/types/IDataPoint.js.map +1 -1
- package/package.json +2 -2
|
@@ -49,6 +49,7 @@ export declare class LineChartBase extends React.Component<ILineChartProps, ILin
|
|
|
49
49
|
private _yScaleSecondary;
|
|
50
50
|
private _yPaddingSecondary;
|
|
51
51
|
private _hasMarkersMode;
|
|
52
|
+
private _isXAxisDateType;
|
|
52
53
|
constructor(props: ILineChartProps);
|
|
53
54
|
componentDidUpdate(prevProps: ILineChartProps): void;
|
|
54
55
|
render(): JSX.Element;
|
|
@@ -104,5 +105,6 @@ export declare class LineChartBase extends React.Component<ILineChartProps, ILin
|
|
|
104
105
|
private _getDomainNRangeValuesWithPadding;
|
|
105
106
|
private _isChartEmpty;
|
|
106
107
|
private _getChartTitle;
|
|
108
|
+
private _setXMinMaxValues;
|
|
107
109
|
}
|
|
108
110
|
export {};
|
|
@@ -68,6 +68,7 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
68
68
|
_this_1._yPaddingPrimary = 0;
|
|
69
69
|
_this_1._yPaddingSecondary = 0;
|
|
70
70
|
_this_1._hasMarkersMode = false;
|
|
71
|
+
_this_1._isXAxisDateType = false;
|
|
71
72
|
_this_1.toImage = function (opts) {
|
|
72
73
|
var _a, _b;
|
|
73
74
|
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);
|
|
@@ -595,17 +596,14 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
595
596
|
};
|
|
596
597
|
_this_1._getDomainNRangeValuesOfDateWithPadding = function (points, margins, width, isRTL, tickValues, chartType, barWidth) {
|
|
597
598
|
if (tickValues === void 0) { tickValues = []; }
|
|
598
|
-
|
|
599
|
-
var lDate;
|
|
600
|
-
sDate = d3Min(points, function (point) {
|
|
601
|
-
return d3Min(point.data, function (item) { return item.x; });
|
|
602
|
-
});
|
|
603
|
-
lDate = d3Max(points, function (point) {
|
|
604
|
-
return d3Max(point.data, function (item) { return item.x; });
|
|
605
|
-
});
|
|
599
|
+
_this_1._setXMinMaxValues(points);
|
|
606
600
|
// Include tickValues if present
|
|
607
|
-
sDate =
|
|
608
|
-
|
|
601
|
+
var sDate = tickValues && tickValues.length > 0
|
|
602
|
+
? d3Min(__spreadArray(__spreadArray([], tickValues, true), [new Date(_this_1._xMin)], false))
|
|
603
|
+
: new Date(_this_1._xMin);
|
|
604
|
+
var lDate = tickValues && tickValues.length > 0
|
|
605
|
+
? d3Max(__spreadArray(__spreadArray([], tickValues, true), [new Date(_this_1._xMax)], false))
|
|
606
|
+
: new Date(_this_1._xMax);
|
|
609
607
|
// Calculate time-based padding (e.g. 10% of the date range)
|
|
610
608
|
var dateRange = lDate.getTime() - sDate.getTime();
|
|
611
609
|
var datePadding = _this_1._hasMarkersMode ? dateRange * 0.1 : 0;
|
|
@@ -628,14 +626,7 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
628
626
|
};
|
|
629
627
|
};
|
|
630
628
|
_this_1._getDomainNRangeValuesWithPadding = function (points, margins, width, isRTL) {
|
|
631
|
-
_this_1.
|
|
632
|
-
return d3Min(point.data, function (item) { return item.x; });
|
|
633
|
-
});
|
|
634
|
-
_this_1._xMax = d3Max(points, function (point) {
|
|
635
|
-
return d3Max(point.data, function (item) {
|
|
636
|
-
return item.x;
|
|
637
|
-
});
|
|
638
|
-
});
|
|
629
|
+
_this_1._setXMinMaxValues(points);
|
|
639
630
|
if (_this_1._hasMarkersMode) {
|
|
640
631
|
_this_1._xPadding = (_this_1._xMax - _this_1._xMin) * 0.1;
|
|
641
632
|
}
|
|
@@ -659,6 +650,15 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
659
650
|
var _a = _this_1.props.data, chartTitle = _a.chartTitle, lineChartData = _a.lineChartData;
|
|
660
651
|
return (chartTitle ? "".concat(chartTitle, ". ") : '') + "Line chart with ".concat((lineChartData === null || lineChartData === void 0 ? void 0 : lineChartData.length) || 0, " lines. ");
|
|
661
652
|
};
|
|
653
|
+
_this_1._setXMinMaxValues = function (points) {
|
|
654
|
+
var getX = function (item) { return (_this_1._isXAxisDateType ? item.x : item.x); };
|
|
655
|
+
var minVal = d3Min(points, function (point) { return d3Min(point.data, getX); });
|
|
656
|
+
var maxVal = d3Max(points, function (point) { return d3Max(point.data, getX); });
|
|
657
|
+
_this_1._xMin = _this_1._isXAxisDateType ? minVal.getTime() : minVal;
|
|
658
|
+
_this_1._xMax = _this_1._isXAxisDateType ? maxVal.getTime() : maxVal;
|
|
659
|
+
_this_1._xMin = _this_1._xMin === Number.NEGATIVE_INFINITY || !_this_1._xMin ? 0 : _this_1._xMin;
|
|
660
|
+
_this_1._xMax = _this_1._xMax === Number.POSITIVE_INFINITY || !_this_1._xMax ? 0 : _this_1._xMax;
|
|
661
|
+
};
|
|
662
662
|
initializeComponentRef(_this_1);
|
|
663
663
|
_this_1.state = {
|
|
664
664
|
hoverXValue: '',
|
|
@@ -720,7 +720,7 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
720
720
|
var _this_1 = this;
|
|
721
721
|
var _a = this.props, tickValues = _a.tickValues, tickFormat = _a.tickFormat, eventAnnotationProps = _a.eventAnnotationProps, legendProps = _a.legendProps, data = _a.data;
|
|
722
722
|
this._points = this._injectIndexPropertyInLineChartData(data.lineChartData);
|
|
723
|
-
|
|
723
|
+
this._isXAxisDateType = getXAxisType(this._points);
|
|
724
724
|
var points = this._points;
|
|
725
725
|
if (legendProps && !!legendProps.canSelectMultipleLegends) {
|
|
726
726
|
points = this.state.selectedLegendPoints.length >= 1 ? this.state.selectedLegendPoints : this._points;
|
|
@@ -740,7 +740,7 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
740
740
|
tickValues: tickValues,
|
|
741
741
|
tickFormat: tickFormat,
|
|
742
742
|
};
|
|
743
|
-
return !this._isChartEmpty() ? (React.createElement(CartesianChart, __assign({}, this.props, { chartTitle: this._getChartTitle(), points: points, chartType: ChartTypes.LineChart, isCalloutForStack: true, calloutProps: calloutProps, tickParams: tickParams, legendBars: legendBars, createYAxis: createNumericYAxis, getmargins: this._getMargins, getMinMaxOfYAxis: this._getNumericMinMaxOfY, getGraphData: this._initializeLineChartData, xAxisType:
|
|
743
|
+
return !this._isChartEmpty() ? (React.createElement(CartesianChart, __assign({}, this.props, { chartTitle: this._getChartTitle(), points: points, chartType: ChartTypes.LineChart, isCalloutForStack: true, calloutProps: calloutProps, tickParams: tickParams, legendBars: legendBars, createYAxis: createNumericYAxis, getmargins: this._getMargins, getMinMaxOfYAxis: this._getNumericMinMaxOfY, getGraphData: this._initializeLineChartData, xAxisType: this._isXAxisDateType ? XAxisTypes.DateAxis : XAxisTypes.NumericAxis, customizedCallout: this._getCustomizedCallout(), getDomainNRangeValues: this._getDomainNRangeValues, createStringYAxis: createStringYAxis, onChartMouseLeave: this._handleChartMouseLeave, enableFirstRenderOptimization: this.props.enablePerfOptimization && this._firstRenderOptimization, ref: this._cartesianChartRef,
|
|
744
744
|
/* eslint-disable react/jsx-no-bind */
|
|
745
745
|
// eslint-disable-next-line react/no-children-prop
|
|
746
746
|
children: function (props) {
|
|
@@ -843,7 +843,7 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
843
843
|
};
|
|
844
844
|
LineChartBase.prototype._createLines = function (xElement, containerHeight) {
|
|
845
845
|
var _this_1 = this;
|
|
846
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10;
|
|
846
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16;
|
|
847
847
|
var lines = [];
|
|
848
848
|
if (this.state.isSelectedLegend) {
|
|
849
849
|
this._points = this.state.selectedLegendPoints;
|
|
@@ -872,21 +872,27 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
872
872
|
var yPadding = this_1._points[i].useSecondaryYScale && this_1._yScaleSecondary ? this_1._yPaddingSecondary : this_1._yPaddingPrimary;
|
|
873
873
|
var extraMaxPixels = this_1._hasMarkersMode ? this_1._getRangeForScatterMarkerSize(yScale, yPadding) : 0;
|
|
874
874
|
if (this_1._points[i].data.length === 1) {
|
|
875
|
-
var
|
|
875
|
+
var _17 = this_1._points[i].data[0], x1_1 = _17.x, y1 = _17.y, xAxisCalloutData_1 = _17.xAxisCalloutData, xAxisCalloutAccessibilityData_1 = _17.xAxisCalloutAccessibilityData;
|
|
876
876
|
var circleId_1 = "".concat(this_1._circleId, "_").concat(i);
|
|
877
877
|
var isLegendSelected = this_1._legendHighlighted(legendVal) || this_1._noLegendHighlighted() || this_1.state.isSelectedLegend;
|
|
878
878
|
var currentMarkerSize = this_1._points[i].data[0].markerSize;
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
879
|
+
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');
|
|
880
|
+
var text = this_1._points[i].data[0].text;
|
|
881
|
+
pointsForLine.push(React.createElement(React.Fragment, { key: "".concat(circleId_1, "_fragment") },
|
|
882
|
+
React.createElement("circle", __assign({ id: circleId_1, key: circleId_1, r: currentMarkerSize
|
|
883
|
+
? (currentMarkerSize * extraMaxPixels) / maxMarkerSize
|
|
884
|
+
: activePoint === circleId_1
|
|
885
|
+
? 5.5
|
|
886
|
+
: 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) {
|
|
887
|
+
_this_1._refCallback(e, circleId_1);
|
|
888
|
+
}, 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))),
|
|
889
|
+
supportsTextMode && text && (React.createElement("text", { key: "".concat(circleId_1, "-label"), x: this_1._xAxisScale(x1_1), y: yScale(y1) +
|
|
890
|
+
Math.max(currentMarkerSize ? (currentMarkerSize * extraMaxPixels) / maxMarkerSize : 3.5, 4) +
|
|
891
|
+
12, className: classNames.markerLabel, opacity: isLegendSelected ? 1 : 0.1 }, text))));
|
|
886
892
|
}
|
|
887
893
|
var gapIndex = 0;
|
|
888
|
-
var gaps = (
|
|
889
|
-
var lineCurve = (
|
|
894
|
+
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 : [];
|
|
895
|
+
var lineCurve = (_e = this_1._points[i].lineOptions) === null || _e === void 0 ? void 0 : _e.curve;
|
|
890
896
|
// Use path rendering technique for larger datasets to optimize performance.
|
|
891
897
|
if ((this_1.props.optimizeLargeData || lineCurve) && this_1._points[i].data.length > 1) {
|
|
892
898
|
var line = d3Line()
|
|
@@ -897,7 +903,7 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
897
903
|
.curve(getCurveFactory(lineCurve));
|
|
898
904
|
var lineId = "".concat(this_1._lineId, "_").concat(i);
|
|
899
905
|
var borderId = "".concat(this_1._borderId, "_").concat(i);
|
|
900
|
-
var strokeWidth = ((
|
|
906
|
+
var strokeWidth = ((_f = this_1._points[i].lineOptions) === null || _f === void 0 ? void 0 : _f.strokeWidth) || this_1.props.strokeWidth || DEFAULT_LINE_STROKE_SIZE;
|
|
901
907
|
var isLegendSelected = this_1._legendHighlighted(legendVal) || this_1._noLegendHighlighted() || this_1.state.isSelectedLegend;
|
|
902
908
|
var lineData = [];
|
|
903
909
|
for (var k = 0; k < this_1._points[i].data.length; k++) {
|
|
@@ -909,16 +915,16 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
909
915
|
]);
|
|
910
916
|
}
|
|
911
917
|
if (isLegendSelected) {
|
|
912
|
-
var lineBorderWidth = ((
|
|
918
|
+
var lineBorderWidth = ((_g = this_1._points[i].lineOptions) === null || _g === void 0 ? void 0 : _g.lineBorderWidth)
|
|
913
919
|
? Number.parseFloat(this_1._points[i].lineOptions.lineBorderWidth.toString())
|
|
914
920
|
: 0;
|
|
915
921
|
if (lineBorderWidth > 0) {
|
|
916
|
-
bordersForLine.push(React.createElement("path", { id: borderId, key: borderId, d: line(lineData), fill: "transparent", strokeLinecap: (
|
|
922
|
+
bordersForLine.push(React.createElement("path", { id: borderId, key: borderId, d: line(lineData), fill: "transparent", strokeLinecap: (_j = (_h = this_1._points[i].lineOptions) === null || _h === void 0 ? void 0 : _h.strokeLinecap) !== null && _j !== void 0 ? _j : 'round', strokeWidth: Number.parseFloat(strokeWidth.toString()) + lineBorderWidth, stroke: ((_k = this_1._points[i].lineOptions) === null || _k === void 0 ? void 0 : _k.lineBorderColor) || theme.semanticColors.bodyBackground, opacity: 1 }));
|
|
917
923
|
}
|
|
918
|
-
linesForLine.push(React.createElement("path", __assign({ id: lineId, key: lineId, d: line(lineData), fill: "transparent", "data-is-focusable": true, stroke: lineColor, strokeWidth: strokeWidth, strokeLinecap: (
|
|
924
|
+
linesForLine.push(React.createElement("path", __assign({ id: lineId, key: lineId, d: line(lineData), fill: "transparent", "data-is-focusable": true, stroke: lineColor, strokeWidth: strokeWidth, strokeLinecap: (_m = (_l = this_1._points[i].lineOptions) === null || _l === void 0 ? void 0 : _l.strokeLinecap) !== null && _m !== void 0 ? _m : 'round', strokeDasharray: (_o = this_1._points[i].lineOptions) === null || _o === void 0 ? void 0 : _o.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 })));
|
|
919
925
|
}
|
|
920
926
|
else {
|
|
921
|
-
linesForLine.push(React.createElement("path", { id: lineId, key: lineId, d: line(lineData), fill: "transparent", "data-is-focusable": false, stroke: lineColor, strokeWidth: strokeWidth, strokeLinecap: (
|
|
927
|
+
linesForLine.push(React.createElement("path", { id: lineId, key: lineId, d: line(lineData), fill: "transparent", "data-is-focusable": false, stroke: lineColor, strokeWidth: strokeWidth, strokeLinecap: (_q = (_p = this_1._points[i].lineOptions) === null || _p === void 0 ? void 0 : _p.strokeLinecap) !== null && _q !== void 0 ? _q : 'round', strokeDasharray: (_r = this_1._points[i].lineOptions) === null || _r === void 0 ? void 0 : _r.strokeDasharray, opacity: 0.1 }));
|
|
922
928
|
}
|
|
923
929
|
var isPointHighlighted = this_1.state.activeLine !== null && this_1.state.activeLine === i;
|
|
924
930
|
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 }));
|
|
@@ -931,54 +937,62 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
931
937
|
var lineId = "".concat(this_1._lineId, "_").concat(i, "_").concat(j);
|
|
932
938
|
var borderId = "".concat(this_1._borderId, "_").concat(i, "_").concat(j);
|
|
933
939
|
var circleId = "".concat(this_1._circleId, "_").concat(i, "_").concat(j);
|
|
934
|
-
var
|
|
935
|
-
var
|
|
940
|
+
var _18 = this_1._points[i].data[j - 1], x1 = _18.x, y1 = _18.y, xAxisCalloutData = _18.xAxisCalloutData, xAxisCalloutAccessibilityData = _18.xAxisCalloutAccessibilityData;
|
|
941
|
+
var _19 = this_1._points[i].data[j], x2 = _19.x, y2 = _19.y;
|
|
936
942
|
var path = this_1._getPath(this_1._xAxisScale(x1), yScale(y1), circleId, j, false, this_1._points[i].index);
|
|
937
|
-
var strokeWidth = ((
|
|
943
|
+
var strokeWidth = ((_s = this_1._points[i].lineOptions) === null || _s === void 0 ? void 0 : _s.strokeWidth) || this_1.props.strokeWidth || DEFAULT_LINE_STROKE_SIZE;
|
|
938
944
|
var isLegendSelected = this_1._legendHighlighted(legendVal) || this_1._noLegendHighlighted() || this_1.state.isSelectedLegend;
|
|
939
945
|
var currentPointHidden = this_1._points[i].hideNonActiveDots && activePoint !== circleId;
|
|
946
|
+
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');
|
|
947
|
+
var text = this_1._points[i].data[j - 1].text;
|
|
940
948
|
var currentMarkerSize = this_1._points[i].data[j - 1].markerSize;
|
|
941
|
-
pointsForLine.push(((
|
|
949
|
+
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,
|
|
942
950
|
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 () {
|
|
943
951
|
return _this_1._handleFocus(lineId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData);
|
|
944
|
-
}, 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": (
|
|
945
|
-
|
|
952
|
+
}, 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) })),
|
|
953
|
+
supportsTextMode && text && (React.createElement("text", { key: "".concat(circleId, "-label"), x: this_1._xAxisScale(x1), y: yScale(y1) +
|
|
954
|
+
Math.max(currentMarkerSize ? (currentMarkerSize * extraMaxPixels) / maxMarkerSize : 4, 4) +
|
|
955
|
+
12, className: classNames.markerLabel, opacity: isLegendSelected && !currentPointHidden ? 1 : 0.01 }, text)))) : (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) }))));
|
|
946
956
|
if (j + 1 === this_1._points[i].data.length) {
|
|
947
957
|
// If this is last point of the line segment.
|
|
948
958
|
var lastCircleId_1 = "".concat(circleId).concat(j, "L");
|
|
949
959
|
var hiddenHoverCircleId = "".concat(circleId).concat(j, "D");
|
|
950
960
|
var lastPointHidden = this_1._points[i].hideNonActiveDots && activePoint !== lastCircleId_1;
|
|
951
961
|
path = this_1._getPath(this_1._xAxisScale(x2), yScale(y2), lastCircleId_1, j, true, this_1._points[i].index);
|
|
952
|
-
var
|
|
962
|
+
var _20 = this_1._points[i].data[j], lastCirlceXCallout_1 = _20.xAxisCalloutData, lastCirlceXCalloutAccessibilityData_1 = _20.xAxisCalloutAccessibilityData;
|
|
953
963
|
currentMarkerSize = this_1._points[i].data[j].markerSize;
|
|
964
|
+
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');
|
|
965
|
+
var lastText = this_1._points[i].data[j].text;
|
|
954
966
|
pointsForLine.push(React.createElement(React.Fragment, { key: "".concat(lastCircleId_1, "_container") },
|
|
955
|
-
((
|
|
967
|
+
((_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,
|
|
956
968
|
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 () {
|
|
957
969
|
return _this_1._handleFocus(lineId, x2, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1);
|
|
958
|
-
}, 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": (
|
|
959
|
-
|
|
970
|
+
}, 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) })),
|
|
971
|
+
lastSupportsTextMode && lastText && (React.createElement("text", { key: "".concat(lastCircleId_1, "-label"), x: this_1._xAxisScale(x2), y: yScale(y2) +
|
|
972
|
+
Math.max(currentMarkerSize ? (currentMarkerSize * extraMaxPixels) / maxMarkerSize : 4, 4) +
|
|
973
|
+
12, className: classNames.markerLabel, opacity: isLegendSelected && !currentPointHidden ? 1 : 0.01 }, text)))) : (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 () {
|
|
960
974
|
return _this_1._handleFocus(lineId, x2, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1);
|
|
961
975
|
}, 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) }))),
|
|
962
976
|
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 })));
|
|
963
977
|
}
|
|
964
|
-
if (!this_1._hasMarkersMode || ((
|
|
978
|
+
if (!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'))) {
|
|
965
979
|
if (isLegendSelected) {
|
|
966
980
|
// don't draw line if it is in a gap
|
|
967
981
|
if (!isInGap) {
|
|
968
|
-
var lineBorderWidth = ((
|
|
982
|
+
var lineBorderWidth = ((_5 = this_1._points[i].lineOptions) === null || _5 === void 0 ? void 0 : _5.lineBorderWidth)
|
|
969
983
|
? Number.parseFloat(this_1._points[i].lineOptions.lineBorderWidth.toString())
|
|
970
984
|
: 0;
|
|
971
985
|
if (lineBorderWidth > 0) {
|
|
972
|
-
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: (
|
|
986
|
+
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: (_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 }));
|
|
973
987
|
}
|
|
974
988
|
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) {
|
|
975
989
|
_this_1._refCallback(e, lineId);
|
|
976
|
-
}, 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: (
|
|
990
|
+
}, 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: (_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))));
|
|
977
991
|
}
|
|
978
992
|
}
|
|
979
993
|
else {
|
|
980
994
|
if (!isInGap) {
|
|
981
|
-
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: (
|
|
995
|
+
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: (_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 }));
|
|
982
996
|
}
|
|
983
997
|
}
|
|
984
998
|
}
|