@fluentui/react-charting 5.12.8 → 5.12.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.
@@ -4,7 +4,9 @@ exports.LineChartBase = void 0;
4
4
  var tslib_1 = require("tslib");
5
5
  var React = require("react");
6
6
  var d3_selection_1 = require("d3-selection");
7
+ var d3_array_1 = require("d3-array");
7
8
  var index_1 = require("../Legends/index");
9
+ var d3_shape_1 = require("d3-shape");
8
10
  var Utilities_1 = require("@fluentui/react/lib-commonjs/Utilities");
9
11
  var index_2 = require("../../index");
10
12
  var Callout_1 = require("@fluentui/react/lib-commonjs/Callout");
@@ -16,6 +18,8 @@ var PointSize;
16
18
  PointSize[PointSize["hoverSize"] = 11] = "hoverSize";
17
19
  PointSize[PointSize["invisibleSize"] = 1] = "invisibleSize";
18
20
  })(PointSize || (PointSize = {}));
21
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
+ var bisect = d3_array_1.bisector(function (d) { return d.x; }).left;
19
23
  var DEFAULT_LINE_STROKE_SIZE = 4;
20
24
  // The given shape of a icon must be 2.5 times bigger than line width (known as stroke width)
21
25
  var PATH_MULTIPLY_SIZE = 2.5;
@@ -212,6 +216,97 @@ var LineChartBase = /** @class */ (function (_super) {
212
216
  }
213
217
  return { isInGap: isInGap, gapIndex: gapIndex };
214
218
  };
219
+ _this_1._onMouseOverLargeDataset = function (linenumber, lineHeight, mouseEvent) {
220
+ // Run this code for different scenarios. For data and numeric data. Try to satisfy undefined d0/d1 scenario.
221
+ mouseEvent.persist();
222
+ var data = _this_1.props.data;
223
+ var lineChartData = data.lineChartData;
224
+ // This will get the value of the X when mouse is on the chart
225
+ var xOffset = _this_1._xAxisScale.invert(mouseEvent.pageX - 15); //Todo - fix this
226
+ var i = bisect(lineChartData[linenumber].data, xOffset);
227
+ var d0 = lineChartData[linenumber].data[i - 1];
228
+ var d1 = lineChartData[linenumber].data[i];
229
+ var axisType = null;
230
+ var xPointToHighlight = null;
231
+ var index = null;
232
+ if (d0 === undefined && d1 !== undefined) {
233
+ xPointToHighlight = d1.x;
234
+ index = i;
235
+ }
236
+ else if (d0 !== undefined && d1 === undefined) {
237
+ xPointToHighlight = d0.x;
238
+ index = i - 1;
239
+ }
240
+ else {
241
+ axisType = index_3.getTypeOfAxis(lineChartData[linenumber].data[0].x, true);
242
+ var x0 = void 0;
243
+ var point0 = void 0;
244
+ var point1 = void 0;
245
+ switch (axisType) {
246
+ case index_3.XAxisTypes.DateAxis:
247
+ x0 = new Date(xOffset).getTime();
248
+ point0 = d0.x.getTime();
249
+ point1 = d1.x.getTime();
250
+ xPointToHighlight = Math.abs(x0 - point0) > Math.abs(x0 - point1) ? d1.x : d0.x;
251
+ index = Math.abs(x0 - point0) > Math.abs(x0 - point1) ? i : i - 1;
252
+ break;
253
+ case index_3.XAxisTypes.NumericAxis:
254
+ x0 = xOffset;
255
+ point0 = d0.x;
256
+ point1 = d1.x;
257
+ xPointToHighlight = Math.abs(x0 - point0) > Math.abs(x0 - point1) ? d1.x : d0.x;
258
+ index = Math.abs(x0 - point0) > Math.abs(x0 - point1) ? i : i - 1;
259
+ break;
260
+ default:
261
+ break;
262
+ }
263
+ }
264
+ var _a = lineChartData[linenumber].data[index], xAxisCalloutData = _a.xAxisCalloutData, xAxisCalloutAccessibilityData = _a.xAxisCalloutAccessibilityData;
265
+ var formattedDate = xPointToHighlight instanceof Date ? xPointToHighlight.toLocaleString() : xPointToHighlight;
266
+ var modifiedXVal = xPointToHighlight instanceof Date ? xPointToHighlight.getTime() : xPointToHighlight;
267
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
268
+ var found = Utilities_1.find(_this_1._calloutPoints, function (element) {
269
+ return element.x === modifiedXVal;
270
+ });
271
+ var pointToHighlight = lineChartData[linenumber].data[index];
272
+ var pointToHighlightUpdated = _this_1.state.nearestCircleToHighlight === null ||
273
+ (_this_1.state.nearestCircleToHighlight !== null &&
274
+ pointToHighlight !== null &&
275
+ (_this_1.state.nearestCircleToHighlight.x !== pointToHighlight.x ||
276
+ _this_1.state.nearestCircleToHighlight.y !== pointToHighlight.y));
277
+ // if no points need to be called out then don't show vertical line and callout card
278
+ if (found && pointToHighlightUpdated) {
279
+ _this_1._uniqueCallOutID = "#staticHighlightCircle_" + linenumber;
280
+ d3_selection_1.select("#staticHighlightCircle_" + linenumber)
281
+ .attr('cx', "" + _this_1._xAxisScale(pointToHighlight.x))
282
+ .attr('cy', "" + _this_1._yAxisScale(pointToHighlight.y))
283
+ .attr('visibility', 'visibility');
284
+ d3_selection_1.select("#" + _this_1._verticalLine)
285
+ .attr('transform', function () { return "translate(" + _this_1._xAxisScale(pointToHighlight.x) + ", " + _this_1._yAxisScale(pointToHighlight.y) + ")"; })
286
+ .attr('visibility', 'visibility')
287
+ .attr('y2', "" + (lineHeight - _this_1._yAxisScale(pointToHighlight.y)));
288
+ _this_1.setState({
289
+ nearestCircleToHighlight: pointToHighlight,
290
+ isCalloutVisible: true,
291
+ refSelected: "#staticHighlightCircle_" + linenumber,
292
+ stackCalloutProps: found,
293
+ YValueHover: found.values,
294
+ dataPointCalloutProps: found,
295
+ hoverXValue: xAxisCalloutData ? xAxisCalloutData : formattedDate,
296
+ xAxisCalloutAccessibilityData: xAxisCalloutAccessibilityData,
297
+ activePoint: '',
298
+ activeLine: linenumber,
299
+ });
300
+ }
301
+ if (!found) {
302
+ _this_1.setState({
303
+ isCalloutVisible: false,
304
+ nearestCircleToHighlight: pointToHighlight,
305
+ activePoint: '',
306
+ activeLine: linenumber,
307
+ });
308
+ }
309
+ };
215
310
  _this_1._handleFocus = function (lineId, x, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData) {
216
311
  _this_1._uniqueCallOutID = circleId;
217
312
  var formattedData = x instanceof Date ? x.toLocaleDateString() : x;
@@ -268,12 +363,16 @@ var LineChartBase = /** @class */ (function (_super) {
268
363
  dataPointCalloutProps: found,
269
364
  activePoint: circleId,
270
365
  xAxisCalloutAccessibilityData: xAxisCalloutAccessibilityData,
366
+ nearestCircleToHighlight: null,
367
+ activeLine: null,
271
368
  });
272
369
  }
273
370
  }
274
371
  else {
275
372
  _this_1.setState({
276
373
  activePoint: circleId,
374
+ nearestCircleToHighlight: null,
375
+ activeLine: null,
277
376
  });
278
377
  }
279
378
  };
@@ -295,6 +394,7 @@ var LineChartBase = /** @class */ (function (_super) {
295
394
  _this_1.setState({
296
395
  isCalloutVisible: false,
297
396
  activePoint: '',
397
+ activeLine: null,
298
398
  });
299
399
  };
300
400
  _this_1._handleLegendClick = function (lineChartItem, selectedLegend) {
@@ -400,6 +500,8 @@ var LineChartBase = /** @class */ (function (_super) {
400
500
  selectedColorBarLegend: [],
401
501
  isSelectedLegend: false,
402
502
  activePoint: '',
503
+ nearestCircleToHighlight: null,
504
+ activeLine: null,
403
505
  };
404
506
  _this_1._refArray = [];
405
507
  _this_1._points = _this_1._injectIndexPropertyInLineChartData(_this_1.props.data.lineChartData);
@@ -517,7 +619,7 @@ var LineChartBase = /** @class */ (function (_super) {
517
619
  };
518
620
  LineChartBase.prototype._createLines = function (xElement, containerHeight) {
519
621
  var _this_1 = this;
520
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
622
+ 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;
521
623
  var lines = [];
522
624
  if (this.state.isSelectedLegend) {
523
625
  this._points = this.state.selectedLegendPoints;
@@ -525,7 +627,7 @@ var LineChartBase = /** @class */ (function (_super) {
525
627
  else {
526
628
  this._points = this._injectIndexPropertyInLineChartData(this.props.data.lineChartData);
527
629
  }
528
- for (var i = 0; i < this._points.length; i++) {
630
+ for (var i = this._points.length - 1; i >= 0; i--) {
529
631
  var linesForLine = [];
530
632
  var bordersForLine = [];
531
633
  var pointsForLine = [];
@@ -535,59 +637,98 @@ var LineChartBase = /** @class */ (function (_super) {
535
637
  var theme = this.props.theme;
536
638
  var verticaLineHeight = containerHeight - this.margins.bottom + 6;
537
639
  if (this._points[i].data.length === 1) {
538
- var _r = this._points[i].data[0], x1 = _r.x, y1 = _r.y, xAxisCalloutData = _r.xAxisCalloutData, xAxisCalloutAccessibilityData = _r.xAxisCalloutAccessibilityData;
640
+ var _0 = this._points[i].data[0], x1 = _0.x, y1 = _0.y, xAxisCalloutData = _0.xAxisCalloutData, xAxisCalloutAccessibilityData = _0.xAxisCalloutAccessibilityData;
539
641
  var circleId = "" + this._circleId + i;
540
642
  pointsForLine.push(React.createElement("circle", { id: "" + this._circleId + i, key: "" + this._circleId + i, r: activePoint === circleId ? 5.5 : 3.5, cx: this._xAxisScale(x1), cy: this._yAxisScale(y1), fill: activePoint === circleId ? theme.palette.white : lineColor, onMouseOver: this._handleHover.bind(this, x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData), onMouseMove: this._handleHover.bind(this, x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData), onMouseOut: this._handleMouseOut, strokeWidth: activePoint === circleId ? DEFAULT_LINE_STROKE_SIZE : 0, stroke: activePoint === circleId ? lineColor : '' }));
541
643
  }
542
644
  var gapIndex = 0;
543
645
  var gaps = (_b = (_a = this._points[i].gaps) === null || _a === void 0 ? void 0 : _a.sort(function (a, b) { return a.startIndex - b.startIndex; })) !== null && _b !== void 0 ? _b : [];
544
- var _loop_1 = function (j) {
545
- var gapResult = this_1._checkInGap(j, gaps, gapIndex);
546
- var isInGap = gapResult.isInGap;
547
- gapIndex = gapResult.gapIndex;
548
- var lineId = "" + this_1._lineId + i + j;
549
- var borderId = "" + this_1._borderId + i + j;
550
- var circleId = "" + this_1._circleId + i + j;
551
- var _s = this_1._points[i].data[j - 1], x1 = _s.x, y1 = _s.y, xAxisCalloutData = _s.xAxisCalloutData, xAxisCalloutAccessibilityData = _s.xAxisCalloutAccessibilityData;
552
- var _t = this_1._points[i].data[j], x2 = _t.x, y2 = _t.y;
553
- var path = this_1._getPath(this_1._xAxisScale(x1), this_1._yAxisScale(y1), circleId, j, false, this_1._points[i].index);
554
- var strokeWidth = ((_c = this_1._points[i].lineOptions) === null || _c === void 0 ? void 0 : _c.strokeWidth) || this_1.props.strokeWidth || DEFAULT_LINE_STROKE_SIZE;
555
- var isLegendSelected = this_1.state.activeLegend === legendVal || this_1.state.activeLegend === '' || this_1.state.isSelectedLegend;
556
- var currentPointHidden = this_1._points[i].hideNonActiveDots && activePoint !== circleId;
557
- pointsForLine.push(React.createElement("path", { id: circleId, key: circleId, d: path, "data-is-focusable": true, 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, onFocus: function () { return _this_1._handleFocus(lineId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData); }, onBlur: this_1._handleMouseOut, onClick: this_1._onDataPointClick.bind(this_1, 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 }));
558
- if (j + 1 === this_1._points[i].data.length) {
559
- var lastCircleId_1 = "" + circleId + j + "L";
560
- var lastPointHidden = this_1._points[i].hideNonActiveDots && activePoint !== lastCircleId_1;
561
- path = this_1._getPath(this_1._xAxisScale(x2), this_1._yAxisScale(y2), lastCircleId_1, j, true, this_1._points[i].index);
562
- var _u = this_1._points[i].data[j], lastCirlceXCallout_1 = _u.xAxisCalloutData, lastCirlceXCalloutAccessibilityData_1 = _u.xAxisCalloutAccessibilityData;
563
- pointsForLine.push(React.createElement("path", { id: lastCircleId_1, key: lastCircleId_1, d: path, "data-is-focusable": true, 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 () {
564
- return _this_1._handleFocus(lineId, x2, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1);
565
- }, onBlur: this_1._handleMouseOut, onClick: this_1._onDataPointClick.bind(this_1, 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 }));
566
- /* eslint-enable react/jsx-no-bind */
646
+ // Use path rendering technique for larger datasets to optimize performance.
647
+ if (this._points[i].data.length >= 1000 || this.props.optimizeLargeData) {
648
+ var line = d3_shape_1.line()
649
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
650
+ .x(function (d) { return _this_1._xAxisScale(d[0]); })
651
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
652
+ .y(function (d) { return _this_1._yAxisScale(d[1]); })
653
+ .curve(d3_shape_1.curveLinear);
654
+ var lineId = "" + this._lineId + i;
655
+ var borderId = "" + this._borderId + i;
656
+ var strokeWidth = ((_c = this._points[i].lineOptions) === null || _c === void 0 ? void 0 : _c.strokeWidth) || this.props.strokeWidth || DEFAULT_LINE_STROKE_SIZE;
657
+ var isLegendSelected = this.state.activeLegend === legendVal || this.state.activeLegend === '' || this.state.isSelectedLegend;
658
+ var lineData = [];
659
+ for (var k = 0; k < this._points[i].data.length; k++) {
660
+ lineData.push([
661
+ this._points[i].data[k].x instanceof Date
662
+ ? this._points[i].data[k].x.getTime()
663
+ : this._points[i].data[k].x,
664
+ this._points[i].data[k].y,
665
+ ]);
567
666
  }
568
667
  if (isLegendSelected) {
569
- // don't draw line if it is in a gap
570
- if (!isInGap) {
571
- var lineBorderWidth = ((_d = this_1._points[i].lineOptions) === null || _d === void 0 ? void 0 : _d.lineBorderWidth)
572
- ? Number.parseFloat(this_1._points[i].lineOptions.lineBorderWidth.toString())
573
- : 0;
574
- if (lineBorderWidth > 0) {
575
- bordersForLine.push(React.createElement("line", { id: borderId, key: borderId, x1: this_1._xAxisScale(x1), y1: this_1._yAxisScale(y1), x2: this_1._xAxisScale(x2), y2: this_1._yAxisScale(y2), strokeLinecap: (_f = (_e = this_1._points[i].lineOptions) === null || _e === void 0 ? void 0 : _e.strokeLinecap) !== null && _f !== void 0 ? _f : 'round', strokeWidth: Number.parseFloat(strokeWidth.toString()) + lineBorderWidth, stroke: ((_g = this_1._points[i].lineOptions) === null || _g === void 0 ? void 0 : _g.lineBorderColor) || theme.palette.white, opacity: 1 }));
576
- }
577
- linesForLine.push(React.createElement("line", { id: lineId, key: lineId, x1: this_1._xAxisScale(x1), y1: this_1._yAxisScale(y1), x2: this_1._xAxisScale(x2), y2: this_1._yAxisScale(y2), strokeWidth: strokeWidth, ref: function (e) {
578
- _this_1._refCallback(e, lineId);
579
- }, 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: (_j = (_h = this_1._points[i].lineOptions) === null || _h === void 0 ? void 0 : _h.strokeLinecap) !== null && _j !== void 0 ? _j : 'round', strokeDasharray: (_k = this_1._points[i].lineOptions) === null || _k === void 0 ? void 0 : _k.strokeDasharray, strokeDashoffset: (_l = this_1._points[i].lineOptions) === null || _l === void 0 ? void 0 : _l.strokeDashoffset, opacity: 1, onClick: this_1._onLineClick.bind(this_1, this_1._points[i].onLineClick) }));
668
+ var lineBorderWidth = ((_d = this._points[i].lineOptions) === null || _d === void 0 ? void 0 : _d.lineBorderWidth)
669
+ ? Number.parseFloat(this._points[i].lineOptions.lineBorderWidth.toString())
670
+ : 0;
671
+ if (lineBorderWidth > 0) {
672
+ bordersForLine.push(React.createElement("path", { id: borderId, key: borderId, d: line(lineData), fill: "transparent", strokeLinecap: (_f = (_e = this._points[i].lineOptions) === null || _e === void 0 ? void 0 : _e.strokeLinecap) !== null && _f !== void 0 ? _f : 'round', strokeWidth: Number.parseFloat(strokeWidth.toString()) + lineBorderWidth, stroke: ((_g = this._points[i].lineOptions) === null || _g === void 0 ? void 0 : _g.lineBorderColor) || theme.palette.white, opacity: 1 }));
580
673
  }
674
+ linesForLine.push(React.createElement("path", { id: lineId, key: lineId, d: line(lineData), fill: "transparent", "data-is-focusable": true, stroke: lineColor, strokeWidth: strokeWidth, strokeLinecap: (_j = (_h = this._points[i].lineOptions) === null || _h === void 0 ? void 0 : _h.strokeLinecap) !== null && _j !== void 0 ? _j : 'round', onMouseMove: this._onMouseOverLargeDataset.bind(this, i, verticaLineHeight), onMouseOver: this._onMouseOverLargeDataset.bind(this, i, verticaLineHeight), onMouseOut: this._handleMouseOut, onClick: this._onLineClick.bind(this, this._points[i].onLineClick), opacity: 1 }));
581
675
  }
582
676
  else {
583
- if (!isInGap) {
584
- linesForLine.push(React.createElement("line", { id: lineId, key: lineId, x1: this_1._xAxisScale(x1), y1: this_1._yAxisScale(y1), x2: this_1._xAxisScale(x2), y2: this_1._yAxisScale(y2), strokeWidth: strokeWidth, stroke: lineColor, 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, strokeDashoffset: (_q = this_1._points[i].lineOptions) === null || _q === void 0 ? void 0 : _q.strokeDashoffset, opacity: 0.1 }));
677
+ linesForLine.push(React.createElement("path", { id: lineId, key: lineId, d: line(lineData), fill: "transparent", "data-is-focusable": true, stroke: lineColor, strokeWidth: strokeWidth, strokeLinecap: (_l = (_k = this._points[i].lineOptions) === null || _k === void 0 ? void 0 : _k.strokeLinecap) !== null && _l !== void 0 ? _l : 'round', opacity: 0.1 }));
678
+ }
679
+ var isPointHighlighted = this.state.activeLine !== null && this.state.activeLine === i;
680
+ pointsForLine.push(React.createElement("circle", { id: "staticHighlightCircle_" + i, key: "staticHighlightCircle_" + i, r: 5.5, cx: 0, cy: 0, fill: theme.palette.white, "data-is-focusable": true, strokeWidth: DEFAULT_LINE_STROKE_SIZE, stroke: lineColor, visibility: isPointHighlighted ? 'visibility' : 'hidden', onMouseMove: this._onMouseOverLargeDataset.bind(this, i, verticaLineHeight), onMouseOver: this._onMouseOverLargeDataset.bind(this, i, verticaLineHeight), onMouseOut: this._handleMouseOut }));
681
+ }
682
+ else {
683
+ var _loop_1 = function (j) {
684
+ var gapResult = this_1._checkInGap(j, gaps, gapIndex);
685
+ var isInGap = gapResult.isInGap;
686
+ gapIndex = gapResult.gapIndex;
687
+ var lineId = "" + this_1._lineId + i + j;
688
+ var borderId = "" + this_1._borderId + i + j;
689
+ var circleId = "" + this_1._circleId + i + j;
690
+ var _1 = this_1._points[i].data[j - 1], x1 = _1.x, y1 = _1.y, xAxisCalloutData = _1.xAxisCalloutData, xAxisCalloutAccessibilityData = _1.xAxisCalloutAccessibilityData;
691
+ var _2 = this_1._points[i].data[j], x2 = _2.x, y2 = _2.y;
692
+ var path = this_1._getPath(this_1._xAxisScale(x1), this_1._yAxisScale(y1), circleId, j, false, this_1._points[i].index);
693
+ var strokeWidth = ((_m = this_1._points[i].lineOptions) === null || _m === void 0 ? void 0 : _m.strokeWidth) || this_1.props.strokeWidth || DEFAULT_LINE_STROKE_SIZE;
694
+ var isLegendSelected = this_1.state.activeLegend === legendVal || this_1.state.activeLegend === '' || this_1.state.isSelectedLegend;
695
+ var currentPointHidden = this_1._points[i].hideNonActiveDots && activePoint !== circleId;
696
+ pointsForLine.push(React.createElement("path", { id: circleId, key: circleId, d: path, "data-is-focusable": true, 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, onFocus: function () { return _this_1._handleFocus(lineId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData); }, onBlur: this_1._handleMouseOut, onClick: this_1._onDataPointClick.bind(this_1, 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 }));
697
+ if (j + 1 === this_1._points[i].data.length) {
698
+ // If this is last point of the line segment.
699
+ var lastCircleId_1 = "" + circleId + j + "L";
700
+ var lastPointHidden = this_1._points[i].hideNonActiveDots && activePoint !== lastCircleId_1;
701
+ path = this_1._getPath(this_1._xAxisScale(x2), this_1._yAxisScale(y2), lastCircleId_1, j, true, this_1._points[i].index);
702
+ var _3 = this_1._points[i].data[j], lastCirlceXCallout_1 = _3.xAxisCalloutData, lastCirlceXCalloutAccessibilityData_1 = _3.xAxisCalloutAccessibilityData;
703
+ pointsForLine.push(React.createElement("path", { id: lastCircleId_1, key: lastCircleId_1, d: path, "data-is-focusable": true, 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 () {
704
+ return _this_1._handleFocus(lineId, x2, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1);
705
+ }, onBlur: this_1._handleMouseOut, onClick: this_1._onDataPointClick.bind(this_1, 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 }));
706
+ /* eslint-enable react/jsx-no-bind */
585
707
  }
708
+ if (isLegendSelected) {
709
+ // don't draw line if it is in a gap
710
+ if (!isInGap) {
711
+ var lineBorderWidth = ((_o = this_1._points[i].lineOptions) === null || _o === void 0 ? void 0 : _o.lineBorderWidth)
712
+ ? Number.parseFloat(this_1._points[i].lineOptions.lineBorderWidth.toString())
713
+ : 0;
714
+ if (lineBorderWidth > 0) {
715
+ bordersForLine.push(React.createElement("line", { id: borderId, key: borderId, x1: this_1._xAxisScale(x1), y1: this_1._yAxisScale(y1), x2: this_1._xAxisScale(x2), y2: this_1._yAxisScale(y2), strokeLinecap: (_q = (_p = this_1._points[i].lineOptions) === null || _p === void 0 ? void 0 : _p.strokeLinecap) !== null && _q !== void 0 ? _q : 'round', strokeWidth: Number.parseFloat(strokeWidth.toString()) + lineBorderWidth, stroke: ((_r = this_1._points[i].lineOptions) === null || _r === void 0 ? void 0 : _r.lineBorderColor) || theme.palette.white, opacity: 1 }));
716
+ }
717
+ linesForLine.push(React.createElement("line", { id: lineId, key: lineId, x1: this_1._xAxisScale(x1), y1: this_1._yAxisScale(y1), x2: this_1._xAxisScale(x2), y2: this_1._yAxisScale(y2), strokeWidth: strokeWidth, ref: function (e) {
718
+ _this_1._refCallback(e, lineId);
719
+ }, 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: (_t = (_s = this_1._points[i].lineOptions) === null || _s === void 0 ? void 0 : _s.strokeLinecap) !== null && _t !== void 0 ? _t : 'round', strokeDasharray: (_u = this_1._points[i].lineOptions) === null || _u === void 0 ? void 0 : _u.strokeDasharray, strokeDashoffset: (_v = this_1._points[i].lineOptions) === null || _v === void 0 ? void 0 : _v.strokeDashoffset, opacity: 1, onClick: this_1._onLineClick.bind(this_1, this_1._points[i].onLineClick) }));
720
+ }
721
+ }
722
+ else {
723
+ if (!isInGap) {
724
+ linesForLine.push(React.createElement("line", { id: lineId, key: lineId, x1: this_1._xAxisScale(x1), y1: this_1._yAxisScale(y1), x2: this_1._xAxisScale(x2), y2: this_1._yAxisScale(y2), strokeWidth: strokeWidth, stroke: lineColor, strokeLinecap: (_x = (_w = this_1._points[i].lineOptions) === null || _w === void 0 ? void 0 : _w.strokeLinecap) !== null && _x !== void 0 ? _x : 'round', strokeDasharray: (_y = this_1._points[i].lineOptions) === null || _y === void 0 ? void 0 : _y.strokeDasharray, strokeDashoffset: (_z = this_1._points[i].lineOptions) === null || _z === void 0 ? void 0 : _z.strokeDashoffset, opacity: 0.1 }));
725
+ }
726
+ }
727
+ };
728
+ var this_1 = this;
729
+ for (var j = 1; j < this._points[i].data.length; j++) {
730
+ _loop_1(j);
586
731
  }
587
- };
588
- var this_1 = this;
589
- for (var j = 1; j < this._points[i].data.length; j++) {
590
- _loop_1(j);
591
732
  }
592
733
  lines.push.apply(lines, tslib_1.__spreadArray(tslib_1.__spreadArray(tslib_1.__spreadArray([], bordersForLine), linesForLine), pointsForLine));
593
734
  }