@fluentui/react-charts 0.0.0-nightly-20250825-0406.1 → 0.0.0-nightly-20250826-0412.1
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.md +15 -15
- package/dist/index.d.ts +6 -0
- package/lib/components/AreaChart/useAreaChartStyles.styles.js +2 -2
- package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js +3 -15
- package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.js +16 -20
- package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +17 -14
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +6 -33
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +1 -0
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/useDonutChartStyles.styles.js +3 -3
- package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
- package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js +2 -11
- package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +4 -17
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +4 -21
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib/components/LineChart/LineChart.js +111 -81
- package/lib/components/LineChart/LineChart.js.map +1 -1
- package/lib/components/LineChart/LineChart.types.js.map +1 -1
- package/lib/components/LineChart/useLineChartStyles.styles.js +23 -10
- package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -1
- package/lib/components/LineChart/useLineChartStyles.styles.raw.js +4 -21
- package/lib/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +12 -25
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js +2 -12
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js +11 -7
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js +4 -22
- package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +8 -6
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +5 -19
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +7 -6
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +4 -19
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
- package/lib/utilities/Common.styles.js +47 -0
- package/lib/utilities/Common.styles.js.map +1 -0
- package/lib/utilities/Common.styles.raw.js +47 -0
- package/lib/utilities/Common.styles.raw.js.map +1 -0
- package/lib/utilities/SVGTooltipText.js.map +1 -1
- package/lib/utilities/index.js +1 -0
- package/lib/utilities/index.js.map +1 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js +2 -14
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +16 -20
- package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +15 -13
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +4 -32
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +1 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js +2 -2
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js +2 -11
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +2 -19
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +3 -20
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.js +111 -81
- package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.types.js.map +1 -1
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +30 -9
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js +2 -20
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +23 -33
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js +1 -12
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +13 -7
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js +2 -20
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +5 -3
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +3 -17
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +5 -3
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +3 -18
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/utilities/Common.styles.js +71 -0
- package/lib-commonjs/utilities/Common.styles.js.map +1 -0
- package/lib-commonjs/utilities/Common.styles.raw.js +71 -0
- package/lib-commonjs/utilities/Common.styles.raw.js.map +1 -0
- package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -1
- package/lib-commonjs/utilities/index.js +1 -0
- package/lib-commonjs/utilities/index.js.map +1 -1
- package/package.json +12 -12
|
@@ -91,6 +91,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
91
91
|
*/ export const LineChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
92
92
|
var _props_legendProps_selectedLegends, _props_legendProps;
|
|
93
93
|
let _hasMarkersMode = false;
|
|
94
|
+
let _isXAxisDateType = false;
|
|
94
95
|
let _points = _injectIndexPropertyInLineChartData(props.data.lineChartData);
|
|
95
96
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
96
97
|
let _calloutPoints = calloutData(_points) || [];
|
|
@@ -144,6 +145,9 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
144
145
|
y: 0
|
|
145
146
|
});
|
|
146
147
|
const [isPopoverOpen, setPopoverOpen] = React.useState(false);
|
|
148
|
+
const [YValue, setYValue] = React.useState('');
|
|
149
|
+
const [legendVal, setLegendVal] = React.useState('');
|
|
150
|
+
const [lineColor, setLineColor] = React.useState('');
|
|
147
151
|
const pointsRef = React.useRef([]);
|
|
148
152
|
const calloutPointsRef = React.useRef([]);
|
|
149
153
|
const classes = useLineChartStyles(props);
|
|
@@ -432,13 +436,18 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
432
436
|
const verticaLineHeight = containerHeight - margins.bottom + 6;
|
|
433
437
|
const yScale = _points[i].useSecondaryYScale && _yScaleSecondary ? _yScaleSecondary : _yScalePrimary;
|
|
434
438
|
if (_points[i].data.length === 1) {
|
|
439
|
+
var _points_i_lineOptions_mode, _points_i_lineOptions1;
|
|
435
440
|
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
436
441
|
const { x: x1, y: y1, xAxisCalloutData, xAxisCalloutAccessibilityData } = _points[i].data[0];
|
|
437
442
|
const circleId = `${_circleId}_${i}`;
|
|
438
443
|
const isLegendSelected = _legendHighlighted(legendVal) || _noLegendHighlighted() || isSelectedLegend;
|
|
439
444
|
const currentMarkerSize = _points[i].data[0].markerSize;
|
|
445
|
+
const supportsTextMode = (_points_i_lineOptions1 = _points[i].lineOptions) === null || _points_i_lineOptions1 === void 0 ? void 0 : (_points_i_lineOptions_mode = _points_i_lineOptions1.mode) === null || _points_i_lineOptions_mode === void 0 ? void 0 : _points_i_lineOptions_mode.includes('text');
|
|
446
|
+
const text = _points[i].data[0].text;
|
|
440
447
|
var _points_i_data__text;
|
|
441
|
-
pointsForLine.push(/*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(
|
|
448
|
+
pointsForLine.push(/*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(React.Fragment, {
|
|
449
|
+
key: `${circleId}_fragment`
|
|
450
|
+
}, /*#__PURE__*/ React.createElement("circle", {
|
|
442
451
|
id: circleId,
|
|
443
452
|
key: circleId,
|
|
444
453
|
r: currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : activePoint === circleId ? 5.5 : 3.5,
|
|
@@ -447,8 +456,8 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
447
456
|
fill: activePoint === circleId ? tokens.colorNeutralBackground1 : lineColor,
|
|
448
457
|
opacity: isLegendSelected ? 1 : 0.1,
|
|
449
458
|
tabIndex: isLegendSelected ? 0 : undefined,
|
|
450
|
-
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
451
|
-
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
459
|
+
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
460
|
+
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
452
461
|
onMouseOut: _handleMouseOut,
|
|
453
462
|
strokeWidth: activePoint === circleId ? DEFAULT_LINE_STROKE_SIZE : 0,
|
|
454
463
|
stroke: activePoint === circleId ? lineColor : '',
|
|
@@ -461,13 +470,13 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
461
470
|
onFocus: (event)=>_handleFocus(event, circleId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData),
|
|
462
471
|
onBlur: _handleMouseOut,
|
|
463
472
|
..._getClickHandler(_points[i].data[0].onDataPointClick)
|
|
464
|
-
}),
|
|
473
|
+
}), supportsTextMode && text && /*#__PURE__*/ React.createElement("text", {
|
|
465
474
|
key: `${circleId}-label`,
|
|
466
475
|
x: _xAxisScale(x1),
|
|
467
476
|
y: yScale(y1) + Math.max(currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 3.5, 4) + 12,
|
|
468
477
|
className: classes.markerLabel,
|
|
469
478
|
opacity: isLegendSelected ? 1 : 0.1
|
|
470
|
-
},
|
|
479
|
+
}, text))));
|
|
471
480
|
}
|
|
472
481
|
let gapIndex = 0;
|
|
473
482
|
var _points_i_gaps_sort;
|
|
@@ -475,13 +484,13 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
475
484
|
const lineCurve = (_points_i_lineOptions = _points[i].lineOptions) === null || _points_i_lineOptions === void 0 ? void 0 : _points_i_lineOptions.curve;
|
|
476
485
|
// Use path rendering technique for larger datasets to optimize performance.
|
|
477
486
|
if ((props.optimizeLargeData || lineCurve) && _points[i].data.length > 1) {
|
|
478
|
-
var
|
|
487
|
+
var _points_i_lineOptions2;
|
|
479
488
|
const line = d3Line()// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
480
489
|
.x((d)=>_xAxisScale(d[0]))// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
481
490
|
.y((d)=>yScale(d[1])).curve(getCurveFactory(lineCurve));
|
|
482
491
|
const lineId = `${_lineId}_${i}`;
|
|
483
492
|
const borderId = `${_borderId}_${i}`;
|
|
484
|
-
const strokeWidth = ((
|
|
493
|
+
const strokeWidth = ((_points_i_lineOptions2 = _points[i].lineOptions) === null || _points_i_lineOptions2 === void 0 ? void 0 : _points_i_lineOptions2.strokeWidth) || props.strokeWidth || DEFAULT_LINE_STROKE_SIZE;
|
|
485
494
|
const isLegendSelected = _legendHighlighted(legendVal) || _noLegendHighlighted() || isSelectedLegend;
|
|
486
495
|
const lineData = [];
|
|
487
496
|
for(let k = 0; k < _points[i].data.length; k++){
|
|
@@ -491,19 +500,19 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
491
500
|
]);
|
|
492
501
|
}
|
|
493
502
|
if (isLegendSelected) {
|
|
494
|
-
var
|
|
495
|
-
const lineBorderWidth = ((
|
|
503
|
+
var _points_i_lineOptions3, _points_i_lineOptions4;
|
|
504
|
+
const lineBorderWidth = ((_points_i_lineOptions3 = _points[i].lineOptions) === null || _points_i_lineOptions3 === void 0 ? void 0 : _points_i_lineOptions3.lineBorderWidth) ? Number.parseFloat(_points[i].lineOptions.lineBorderWidth.toString()) : 0;
|
|
496
505
|
if (lineBorderWidth > 0) {
|
|
497
|
-
var
|
|
506
|
+
var _points_i_lineOptions5, _points_i_lineOptions6;
|
|
498
507
|
var _points_i_lineOptions_strokeLinecap;
|
|
499
508
|
bordersForLine.push(/*#__PURE__*/ React.createElement("path", {
|
|
500
509
|
id: borderId,
|
|
501
510
|
key: borderId,
|
|
502
511
|
d: line(lineData),
|
|
503
512
|
fill: "transparent",
|
|
504
|
-
strokeLinecap: (_points_i_lineOptions_strokeLinecap = (
|
|
513
|
+
strokeLinecap: (_points_i_lineOptions_strokeLinecap = (_points_i_lineOptions5 = _points[i].lineOptions) === null || _points_i_lineOptions5 === void 0 ? void 0 : _points_i_lineOptions5.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap !== void 0 ? _points_i_lineOptions_strokeLinecap : 'round',
|
|
505
514
|
strokeWidth: Number.parseFloat(strokeWidth.toString()) + lineBorderWidth,
|
|
506
|
-
stroke: ((
|
|
515
|
+
stroke: ((_points_i_lineOptions6 = _points[i].lineOptions) === null || _points_i_lineOptions6 === void 0 ? void 0 : _points_i_lineOptions6.lineBorderColor) || tokens.colorNeutralBackground1,
|
|
507
516
|
opacity: 1
|
|
508
517
|
}));
|
|
509
518
|
}
|
|
@@ -516,7 +525,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
516
525
|
"data-is-focusable": true,
|
|
517
526
|
stroke: lineColor,
|
|
518
527
|
strokeWidth: strokeWidth,
|
|
519
|
-
strokeLinecap: (_points_i_lineOptions_strokeLinecap1 = (
|
|
528
|
+
strokeLinecap: (_points_i_lineOptions_strokeLinecap1 = (_points_i_lineOptions4 = _points[i].lineOptions) === null || _points_i_lineOptions4 === void 0 ? void 0 : _points_i_lineOptions4.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap1 !== void 0 ? _points_i_lineOptions_strokeLinecap1 : 'round',
|
|
520
529
|
onMouseMove: (event)=>_onMouseOverLargeDataset.bind(i, verticaLineHeight, event, yScale),
|
|
521
530
|
onMouseOver: (event)=>_onMouseOverLargeDataset.bind(i, verticaLineHeight, event, yScale),
|
|
522
531
|
onMouseOut: _handleMouseOut,
|
|
@@ -525,7 +534,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
525
534
|
tabIndex: isLegendSelected ? 0 : undefined
|
|
526
535
|
}));
|
|
527
536
|
} else {
|
|
528
|
-
var
|
|
537
|
+
var _points_i_lineOptions7;
|
|
529
538
|
var _points_i_lineOptions_strokeLinecap2;
|
|
530
539
|
linesForLine.push(/*#__PURE__*/ React.createElement("path", {
|
|
531
540
|
id: lineId,
|
|
@@ -535,7 +544,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
535
544
|
"data-is-focusable": false,
|
|
536
545
|
stroke: lineColor,
|
|
537
546
|
strokeWidth: strokeWidth,
|
|
538
|
-
strokeLinecap: (_points_i_lineOptions_strokeLinecap2 = (
|
|
547
|
+
strokeLinecap: (_points_i_lineOptions_strokeLinecap2 = (_points_i_lineOptions7 = _points[i].lineOptions) === null || _points_i_lineOptions7 === void 0 ? void 0 : _points_i_lineOptions7.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap2 !== void 0 ? _points_i_lineOptions_strokeLinecap2 : 'round',
|
|
539
548
|
opacity: 0.1
|
|
540
549
|
}));
|
|
541
550
|
}
|
|
@@ -555,7 +564,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
555
564
|
}));
|
|
556
565
|
} else if (!props.optimizeLargeData) {
|
|
557
566
|
for(let j = 1; j < _points[i].data.length; j++){
|
|
558
|
-
var
|
|
567
|
+
var _points_i_lineOptions8, _points_i_lineOptions_mode1, _points_i_lineOptions9, _points_i_lineOptions_mode2, _points_i_lineOptions10, _points_i_lineOptions_mode3, _points_i_lineOptions11;
|
|
559
568
|
const gapResult = _checkInGap(j, gaps, gapIndex);
|
|
560
569
|
const isInGap = gapResult.isInGap;
|
|
561
570
|
gapIndex = gapResult.gapIndex;
|
|
@@ -565,20 +574,22 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
565
574
|
const { x: x1, y: y1, xAxisCalloutData, xAxisCalloutAccessibilityData } = _points[i].data[j - 1];
|
|
566
575
|
const { x: x2, y: y2 } = _points[i].data[j];
|
|
567
576
|
let path = _getPath(_xAxisScale(x1), yScale(y1), circleId, j, false, _points[i].index);
|
|
568
|
-
const strokeWidth = ((
|
|
577
|
+
const strokeWidth = ((_points_i_lineOptions8 = _points[i].lineOptions) === null || _points_i_lineOptions8 === void 0 ? void 0 : _points_i_lineOptions8.strokeWidth) || props.strokeWidth || DEFAULT_LINE_STROKE_SIZE;
|
|
569
578
|
const isLegendSelected = _legendHighlighted(legendVal) || _noLegendHighlighted() || isSelectedLegend;
|
|
570
579
|
const currentPointHidden = _points[i].hideNonActiveDots && activePoint !== circleId;
|
|
580
|
+
const supportsTextMode = (_points_i_lineOptions9 = _points[i].lineOptions) === null || _points_i_lineOptions9 === void 0 ? void 0 : (_points_i_lineOptions_mode1 = _points_i_lineOptions9.mode) === null || _points_i_lineOptions_mode1 === void 0 ? void 0 : _points_i_lineOptions_mode1.includes('text');
|
|
581
|
+
const text = _points[i].data[j - 1].text;
|
|
571
582
|
let currentMarkerSize = _points[i].data[j - 1].markerSize;
|
|
572
583
|
var _points_i_data__text1;
|
|
573
|
-
pointsForLine.push(((
|
|
584
|
+
pointsForLine.push(((_points_i_lineOptions10 = _points[i].lineOptions) === null || _points_i_lineOptions10 === void 0 ? void 0 : (_points_i_lineOptions_mode2 = _points_i_lineOptions10.mode) === null || _points_i_lineOptions_mode2 === void 0 ? void 0 : _points_i_lineOptions_mode2.includes('markers')) || supportsTextMode ? /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("circle", {
|
|
574
585
|
id: circleId,
|
|
575
586
|
key: circleId,
|
|
576
587
|
r: currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 4,
|
|
577
588
|
cx: _xAxisScale(x1),
|
|
578
589
|
cy: yScale(y1),
|
|
579
590
|
"data-is-focusable": isLegendSelected,
|
|
580
|
-
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
581
|
-
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
591
|
+
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
592
|
+
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
582
593
|
onMouseOut: _handleMouseOut,
|
|
583
594
|
onFocus: (event)=>_handleFocus(event, lineId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData),
|
|
584
595
|
onBlur: _handleMouseOut,
|
|
@@ -589,19 +600,19 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
589
600
|
strokeWidth: strokeWidth,
|
|
590
601
|
role: "img",
|
|
591
602
|
"aria-label": (_points_i_data__text1 = _points[i].data[j - 1].text) !== null && _points_i_data__text1 !== void 0 ? _points_i_data__text1 : _getAriaLabel(i, j - 1)
|
|
592
|
-
}),
|
|
603
|
+
}), supportsTextMode && text && /*#__PURE__*/ React.createElement("text", {
|
|
593
604
|
key: `${circleId}-label`,
|
|
594
605
|
x: _xAxisScale(x1),
|
|
595
|
-
y: yScale(y1) + 12,
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
},
|
|
606
|
+
y: yScale(y1) + Math.max(currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 4, 4) + 12,
|
|
607
|
+
className: classes.markerLabel,
|
|
608
|
+
opacity: isLegendSelected && !currentPointHidden ? 1 : 0.01
|
|
609
|
+
}, text)) : /*#__PURE__*/ React.createElement("path", {
|
|
599
610
|
id: circleId,
|
|
600
611
|
key: circleId,
|
|
601
612
|
d: path,
|
|
602
613
|
"data-is-focusable": isLegendSelected,
|
|
603
|
-
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
604
|
-
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
614
|
+
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
615
|
+
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
605
616
|
onMouseOut: _handleMouseOut,
|
|
606
617
|
onFocus: (event)=>_handleFocus(event, lineId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData),
|
|
607
618
|
onBlur: _handleMouseOut,
|
|
@@ -615,7 +626,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
615
626
|
tabIndex: isLegendSelected ? 0 : undefined
|
|
616
627
|
}));
|
|
617
628
|
if (j + 1 === _points[i].data.length) {
|
|
618
|
-
var
|
|
629
|
+
var _points_i_lineOptions_mode4, _points_i_lineOptions12, _points_i_lineOptions_mode5, _points_i_lineOptions13;
|
|
619
630
|
// If this is last point of the line segment.
|
|
620
631
|
const lastCircleId = `${circleId}${j}L`;
|
|
621
632
|
const hiddenHoverCircleId = `${circleId}${j}D`;
|
|
@@ -623,18 +634,20 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
623
634
|
path = _getPath(_xAxisScale(x2), yScale(y2), lastCircleId, j, true, _points[i].index);
|
|
624
635
|
const { xAxisCalloutData: lastCirlceXCallout, xAxisCalloutAccessibilityData: lastCirlceXCalloutAccessibilityData } = _points[i].data[j];
|
|
625
636
|
currentMarkerSize = _points[i].data[j].markerSize;
|
|
637
|
+
const lastSupportsTextMode = (_points_i_lineOptions12 = _points[i].lineOptions) === null || _points_i_lineOptions12 === void 0 ? void 0 : (_points_i_lineOptions_mode4 = _points_i_lineOptions12.mode) === null || _points_i_lineOptions_mode4 === void 0 ? void 0 : _points_i_lineOptions_mode4.includes('text');
|
|
638
|
+
const lastText = _points[i].data[j].text;
|
|
626
639
|
var _points_i_data_j_text;
|
|
627
640
|
pointsForLine.push(/*#__PURE__*/ React.createElement(React.Fragment, {
|
|
628
641
|
key: `${lastCircleId}_container`
|
|
629
|
-
}, ((
|
|
642
|
+
}, ((_points_i_lineOptions13 = _points[i].lineOptions) === null || _points_i_lineOptions13 === void 0 ? void 0 : (_points_i_lineOptions_mode5 = _points_i_lineOptions13.mode) === null || _points_i_lineOptions_mode5 === void 0 ? void 0 : _points_i_lineOptions_mode5.includes('markers')) || lastSupportsTextMode ? /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("circle", {
|
|
630
643
|
id: lastCircleId,
|
|
631
644
|
key: lastCircleId,
|
|
632
645
|
r: currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 4,
|
|
633
646
|
cx: _xAxisScale(x2),
|
|
634
647
|
cy: yScale(y2),
|
|
635
648
|
"data-is-focusable": isLegendSelected,
|
|
636
|
-
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale),
|
|
637
|
-
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale),
|
|
649
|
+
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
650
|
+
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
638
651
|
onMouseOut: _handleMouseOut,
|
|
639
652
|
onFocus: (event)=>_handleFocus(event, lineId, x2, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData),
|
|
640
653
|
onBlur: _handleMouseOut,
|
|
@@ -645,19 +658,18 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
645
658
|
strokeWidth: strokeWidth,
|
|
646
659
|
role: "img",
|
|
647
660
|
"aria-label": (_points_i_data_j_text = _points[i].data[j].text) !== null && _points_i_data_j_text !== void 0 ? _points_i_data_j_text : _getAriaLabel(i, j)
|
|
648
|
-
}),
|
|
661
|
+
}), lastSupportsTextMode && lastText && /*#__PURE__*/ React.createElement("text", {
|
|
649
662
|
key: `${lastCircleId}-label`,
|
|
650
663
|
x: _xAxisScale(x2),
|
|
651
|
-
y: yScale(y2) + 12,
|
|
652
|
-
fontSize: 12,
|
|
664
|
+
y: yScale(y2) + Math.max(currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 4, 4) + 12,
|
|
653
665
|
className: classes.markerLabel
|
|
654
|
-
},
|
|
666
|
+
}, text)) : /*#__PURE__*/ React.createElement("path", {
|
|
655
667
|
id: lastCircleId,
|
|
656
668
|
key: lastCircleId,
|
|
657
669
|
d: path,
|
|
658
670
|
"data-is-focusable": isLegendSelected,
|
|
659
|
-
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale),
|
|
660
|
-
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale),
|
|
671
|
+
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
672
|
+
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
661
673
|
onMouseOut: _handleMouseOut,
|
|
662
674
|
onFocus: (event)=>_handleFocus(event, lineId, x2, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData),
|
|
663
675
|
onBlur: _handleMouseOut,
|
|
@@ -677,8 +689,8 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
677
689
|
cy: yScale(y2),
|
|
678
690
|
opacity: 0,
|
|
679
691
|
width: 0,
|
|
680
|
-
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale),
|
|
681
|
-
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale),
|
|
692
|
+
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
693
|
+
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
682
694
|
onFocus: (event)=>_handleFocus(event, circleId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData),
|
|
683
695
|
onMouseOut: _handleMouseOut,
|
|
684
696
|
strokeWidth: 0,
|
|
@@ -686,14 +698,14 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
686
698
|
onBlur: _handleMouseOut
|
|
687
699
|
})));
|
|
688
700
|
}
|
|
689
|
-
if (!_hasMarkersMode || ((
|
|
701
|
+
if (!_hasMarkersMode || ((_points_i_lineOptions11 = _points[i].lineOptions) === null || _points_i_lineOptions11 === void 0 ? void 0 : (_points_i_lineOptions_mode3 = _points_i_lineOptions11.mode) === null || _points_i_lineOptions_mode3 === void 0 ? void 0 : _points_i_lineOptions_mode3.includes('lines'))) {
|
|
690
702
|
if (isLegendSelected) {
|
|
691
703
|
// don't draw line if it is in a gap
|
|
692
704
|
if (!isInGap) {
|
|
693
|
-
var
|
|
694
|
-
const lineBorderWidth = ((
|
|
705
|
+
var _points_i_lineOptions14, _points_i_lineOptions15, _points_i_lineOptions16, _points_i_lineOptions17;
|
|
706
|
+
const lineBorderWidth = ((_points_i_lineOptions14 = _points[i].lineOptions) === null || _points_i_lineOptions14 === void 0 ? void 0 : _points_i_lineOptions14.lineBorderWidth) ? Number.parseFloat(_points[i].lineOptions.lineBorderWidth.toString()) : 0;
|
|
695
707
|
if (lineBorderWidth > 0) {
|
|
696
|
-
var
|
|
708
|
+
var _points_i_lineOptions18, _points_i_lineOptions19;
|
|
697
709
|
var _points_i_lineOptions_strokeLinecap3;
|
|
698
710
|
bordersForLine.push(/*#__PURE__*/ React.createElement("line", {
|
|
699
711
|
id: borderId,
|
|
@@ -702,9 +714,9 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
702
714
|
y1: yScale(y1),
|
|
703
715
|
x2: _xAxisScale(x2),
|
|
704
716
|
y2: yScale(y2),
|
|
705
|
-
strokeLinecap: (_points_i_lineOptions_strokeLinecap3 = (
|
|
717
|
+
strokeLinecap: (_points_i_lineOptions_strokeLinecap3 = (_points_i_lineOptions18 = _points[i].lineOptions) === null || _points_i_lineOptions18 === void 0 ? void 0 : _points_i_lineOptions18.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap3 !== void 0 ? _points_i_lineOptions_strokeLinecap3 : 'round',
|
|
706
718
|
strokeWidth: Number.parseFloat(strokeWidth.toString()) + lineBorderWidth,
|
|
707
|
-
stroke: ((
|
|
719
|
+
stroke: ((_points_i_lineOptions19 = _points[i].lineOptions) === null || _points_i_lineOptions19 === void 0 ? void 0 : _points_i_lineOptions19.lineBorderColor) || tokens.colorNeutralBackground1,
|
|
708
720
|
opacity: 1
|
|
709
721
|
}));
|
|
710
722
|
}
|
|
@@ -720,20 +732,20 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
720
732
|
ref: (e)=>{
|
|
721
733
|
_refCallback(e, lineId);
|
|
722
734
|
},
|
|
723
|
-
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
724
|
-
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
735
|
+
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
736
|
+
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
725
737
|
onMouseOut: _handleMouseOut,
|
|
726
738
|
stroke: lineColor,
|
|
727
|
-
strokeLinecap: (_points_i_lineOptions_strokeLinecap4 = (
|
|
728
|
-
strokeDasharray: (
|
|
729
|
-
strokeDashoffset: (
|
|
739
|
+
strokeLinecap: (_points_i_lineOptions_strokeLinecap4 = (_points_i_lineOptions15 = _points[i].lineOptions) === null || _points_i_lineOptions15 === void 0 ? void 0 : _points_i_lineOptions15.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap4 !== void 0 ? _points_i_lineOptions_strokeLinecap4 : 'round',
|
|
740
|
+
strokeDasharray: (_points_i_lineOptions16 = _points[i].lineOptions) === null || _points_i_lineOptions16 === void 0 ? void 0 : _points_i_lineOptions16.strokeDasharray,
|
|
741
|
+
strokeDashoffset: (_points_i_lineOptions17 = _points[i].lineOptions) === null || _points_i_lineOptions17 === void 0 ? void 0 : _points_i_lineOptions17.strokeDashoffset,
|
|
730
742
|
opacity: 1,
|
|
731
743
|
..._getClickHandler(_points[i].onLineClick)
|
|
732
744
|
}));
|
|
733
745
|
}
|
|
734
746
|
} else {
|
|
735
747
|
if (!isInGap) {
|
|
736
|
-
var
|
|
748
|
+
var _points_i_lineOptions20, _points_i_lineOptions21, _points_i_lineOptions22;
|
|
737
749
|
var _points_i_lineOptions_strokeLinecap5;
|
|
738
750
|
linesForLine.push(/*#__PURE__*/ React.createElement("line", {
|
|
739
751
|
id: lineId,
|
|
@@ -744,9 +756,9 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
744
756
|
y2: yScale(y2),
|
|
745
757
|
strokeWidth: strokeWidth,
|
|
746
758
|
stroke: lineColor,
|
|
747
|
-
strokeLinecap: (_points_i_lineOptions_strokeLinecap5 = (
|
|
748
|
-
strokeDasharray: (
|
|
749
|
-
strokeDashoffset: (
|
|
759
|
+
strokeLinecap: (_points_i_lineOptions_strokeLinecap5 = (_points_i_lineOptions20 = _points[i].lineOptions) === null || _points_i_lineOptions20 === void 0 ? void 0 : _points_i_lineOptions20.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap5 !== void 0 ? _points_i_lineOptions_strokeLinecap5 : 'round',
|
|
760
|
+
strokeDasharray: (_points_i_lineOptions21 = _points[i].lineOptions) === null || _points_i_lineOptions21 === void 0 ? void 0 : _points_i_lineOptions21.strokeDasharray,
|
|
761
|
+
strokeDashoffset: (_points_i_lineOptions22 = _points[i].lineOptions) === null || _points_i_lineOptions22 === void 0 ? void 0 : _points_i_lineOptions22.strokeDashoffset,
|
|
750
762
|
opacity: 0.1
|
|
751
763
|
}));
|
|
752
764
|
}
|
|
@@ -951,11 +963,24 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
951
963
|
setActivePoint(circleId);
|
|
952
964
|
}
|
|
953
965
|
}
|
|
954
|
-
function _handleHover(x, y, lineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, mouseEvent, yScale) {
|
|
966
|
+
function _handleHover(x, y, lineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, mouseEvent, yScale, legendVal, lineColor) {
|
|
955
967
|
mouseEvent === null || mouseEvent === void 0 ? void 0 : mouseEvent.persist();
|
|
956
968
|
const formattedData = x instanceof Date ? formatDate(x, props.useUTC) : x;
|
|
957
969
|
const xVal = x instanceof Date ? x.getTime() : x;
|
|
970
|
+
const yVal = y instanceof Date ? y.getTime() : y;
|
|
958
971
|
const found = find(_calloutPoints, (element)=>element.x === xVal);
|
|
972
|
+
let hoverDp = undefined;
|
|
973
|
+
if (props.isCalloutForStack === false && (found === null || found === void 0 ? void 0 : found.values)) {
|
|
974
|
+
const dp = find(found.values, (val)=>(val === null || val === void 0 ? void 0 : val.y) === yVal);
|
|
975
|
+
if (dp) {
|
|
976
|
+
hoverDp = {
|
|
977
|
+
x: xVal,
|
|
978
|
+
values: [
|
|
979
|
+
dp
|
|
980
|
+
]
|
|
981
|
+
};
|
|
982
|
+
}
|
|
983
|
+
}
|
|
959
984
|
// if no points need to be called out then don't show vertical line and callout card
|
|
960
985
|
if (found) {
|
|
961
986
|
d3Select(`#${_verticalLine}`).attr('transform', ()=>`translate(${_xAxisScale(x)}, ${yScale(y)})`).attr('visibility', 'visibility').attr('y2', `${lineHeight - 5 - yScale(y)}`);
|
|
@@ -964,8 +989,11 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
964
989
|
updatePosition(mouseEvent.clientX, mouseEvent.clientY);
|
|
965
990
|
xAxisCalloutData ? setHoverXValue(xAxisCalloutData) : setHoverXValue('' + formattedData);
|
|
966
991
|
setYValueHover(found.values);
|
|
992
|
+
setYValue(yVal);
|
|
993
|
+
setLegendVal(legendVal);
|
|
994
|
+
setLineColor(lineColor);
|
|
967
995
|
setStackCalloutProps(found);
|
|
968
|
-
setDataPointCalloutProps(
|
|
996
|
+
setDataPointCalloutProps(hoverDp);
|
|
969
997
|
setActivePoint(circleId);
|
|
970
998
|
setNearestCircleToHighlight(null);
|
|
971
999
|
}
|
|
@@ -1090,23 +1118,16 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
1090
1118
|
return ((_point_callOutAccessibilityData = point.callOutAccessibilityData) === null || _point_callOutAccessibilityData === void 0 ? void 0 : _point_callOutAccessibilityData.ariaLabel) || `${xValue}. ${legend}, ${yValue}.`;
|
|
1091
1119
|
}
|
|
1092
1120
|
function _getDomainNRangeValuesOfDateWithPadding(points, margins, width, isRTL, tickValues = [], chartType, barWidth) {
|
|
1093
|
-
|
|
1094
|
-
let lDate;
|
|
1095
|
-
sDate = d3Min(points, (point)=>{
|
|
1096
|
-
return d3Min(point.data, (item)=>item.x);
|
|
1097
|
-
});
|
|
1098
|
-
lDate = d3Max(points, (point)=>{
|
|
1099
|
-
return d3Max(point.data, (item)=>item.x);
|
|
1100
|
-
});
|
|
1121
|
+
_setXMinMaxValues(points);
|
|
1101
1122
|
// Include tickValues if present
|
|
1102
|
-
sDate = d3Min([
|
|
1123
|
+
const sDate = tickValues && tickValues.length > 0 ? d3Min([
|
|
1103
1124
|
...tickValues,
|
|
1104
|
-
|
|
1105
|
-
]);
|
|
1106
|
-
lDate = d3Max([
|
|
1125
|
+
new Date(_xMin)
|
|
1126
|
+
]) : new Date(_xMin);
|
|
1127
|
+
const lDate = tickValues && tickValues.length > 0 ? d3Max([
|
|
1107
1128
|
...tickValues,
|
|
1108
|
-
|
|
1109
|
-
]);
|
|
1129
|
+
new Date(_xMax)
|
|
1130
|
+
]) : new Date(_xMax);
|
|
1110
1131
|
// Calculate time-based padding (e.g. 10% of the date range)
|
|
1111
1132
|
const dateRange = lDate.getTime() - sDate.getTime();
|
|
1112
1133
|
const datePadding = _hasMarkersMode ? dateRange * 0.1 : 0;
|
|
@@ -1127,14 +1148,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
1127
1148
|
};
|
|
1128
1149
|
}
|
|
1129
1150
|
function _getDomainNRangeValuesWithPadding(points, margins, width, isRTL) {
|
|
1130
|
-
|
|
1131
|
-
return d3Min(point.data, (item)=>item.x);
|
|
1132
|
-
});
|
|
1133
|
-
_xMax = d3Max(points, (point)=>{
|
|
1134
|
-
return d3Max(point.data, (item)=>{
|
|
1135
|
-
return item.x;
|
|
1136
|
-
});
|
|
1137
|
-
});
|
|
1151
|
+
_setXMinMaxValues(points);
|
|
1138
1152
|
if (_hasMarkersMode) {
|
|
1139
1153
|
_xPadding = (_xMax - _xMin) * 0.1;
|
|
1140
1154
|
}
|
|
@@ -1155,9 +1169,18 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
1155
1169
|
function _isChartEmpty() {
|
|
1156
1170
|
return !(props.data && props.data.lineChartData && props.data.lineChartData.length > 0 && props.data.lineChartData.filter((item)=>item.data.length).length > 0);
|
|
1157
1171
|
}
|
|
1172
|
+
function _setXMinMaxValues(points) {
|
|
1173
|
+
const getX = (item)=>_isXAxisDateType ? item.x : item.x;
|
|
1174
|
+
const minVal = d3Min(points, (point)=>d3Min(point.data, getX));
|
|
1175
|
+
const maxVal = d3Max(points, (point)=>d3Max(point.data, getX));
|
|
1176
|
+
_xMin = _isXAxisDateType ? minVal.getTime() : minVal;
|
|
1177
|
+
_xMax = _isXAxisDateType ? maxVal.getTime() : maxVal;
|
|
1178
|
+
_xMin = _xMin === Number.NEGATIVE_INFINITY || !_xMin ? 0 : _xMin;
|
|
1179
|
+
_xMax = _xMax === Number.POSITIVE_INFINITY || !_xMax ? 0 : _xMax;
|
|
1180
|
+
}
|
|
1158
1181
|
const { legendProps, tickValues, tickFormat, eventAnnotationProps } = props;
|
|
1159
1182
|
_points = _injectIndexPropertyInLineChartData(props.data.lineChartData);
|
|
1160
|
-
|
|
1183
|
+
_isXAxisDateType = getXAxisType(_points);
|
|
1161
1184
|
let points = _points;
|
|
1162
1185
|
if (legendProps && !!legendProps.canSelectMultipleLegends) {
|
|
1163
1186
|
points = selectedLegendPoints.length >= 1 ? selectedLegendPoints : _points;
|
|
@@ -1174,13 +1197,17 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
1174
1197
|
const calloutProps = {
|
|
1175
1198
|
YValueHover: YValueHover,
|
|
1176
1199
|
hoverXValue: hoverXValue,
|
|
1200
|
+
YValue: YValue,
|
|
1201
|
+
legend: legendVal,
|
|
1202
|
+
color: lineColor,
|
|
1203
|
+
XValue: hoverXValue,
|
|
1177
1204
|
descriptionMessage: props.getCalloutDescriptionMessage && stackCalloutProps ? props.getCalloutDescriptionMessage(stackCalloutProps) : undefined,
|
|
1178
1205
|
'data-is-focusable': true,
|
|
1179
1206
|
xAxisCalloutAccessibilityData: xAxisCalloutAccessibilityData,
|
|
1180
1207
|
...props.calloutProps,
|
|
1181
1208
|
clickPosition: clickPosition,
|
|
1182
1209
|
isPopoverOpen: isPopoverOpen,
|
|
1183
|
-
isCalloutForStack:
|
|
1210
|
+
isCalloutForStack: props.isCalloutForStack,
|
|
1184
1211
|
culture: (_props_culture = props.culture) !== null && _props_culture !== void 0 ? _props_culture : 'en-us',
|
|
1185
1212
|
isCartesian: true,
|
|
1186
1213
|
customCallout: {
|
|
@@ -1204,7 +1231,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
1204
1231
|
getmargins: _getMargins,
|
|
1205
1232
|
getMinMaxOfYAxis: _getNumericMinMaxOfY,
|
|
1206
1233
|
getGraphData: _initializeLineChartData,
|
|
1207
|
-
xAxisType:
|
|
1234
|
+
xAxisType: _isXAxisDateType ? XAxisTypes.DateAxis : XAxisTypes.NumericAxis,
|
|
1208
1235
|
getDomainNRangeValues: _getDomainNRangeValues,
|
|
1209
1236
|
createStringYAxis: createStringYAxis,
|
|
1210
1237
|
onChartMouseLeave: _handleChartMouseLeave,
|
|
@@ -1246,3 +1273,6 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
1246
1273
|
});
|
|
1247
1274
|
});
|
|
1248
1275
|
LineChart.displayName = 'LineChart';
|
|
1276
|
+
LineChart.defaultProps = {
|
|
1277
|
+
isCalloutForStack: true
|
|
1278
|
+
};
|