@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
|
@@ -96,6 +96,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
96
96
|
const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
97
97
|
var _props_legendProps_selectedLegends, _props_legendProps;
|
|
98
98
|
let _hasMarkersMode = false;
|
|
99
|
+
let _isXAxisDateType = false;
|
|
99
100
|
let _points = _injectIndexPropertyInLineChartData(props.data.lineChartData);
|
|
100
101
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
101
102
|
let _calloutPoints = (0, _index1.calloutData)(_points) || [];
|
|
@@ -149,6 +150,9 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
149
150
|
y: 0
|
|
150
151
|
});
|
|
151
152
|
const [isPopoverOpen, setPopoverOpen] = _react.useState(false);
|
|
153
|
+
const [YValue, setYValue] = _react.useState('');
|
|
154
|
+
const [legendVal, setLegendVal] = _react.useState('');
|
|
155
|
+
const [lineColor, setLineColor] = _react.useState('');
|
|
152
156
|
const pointsRef = _react.useRef([]);
|
|
153
157
|
const calloutPointsRef = _react.useRef([]);
|
|
154
158
|
const classes = (0, _useLineChartStylesstyles.useLineChartStyles)(props);
|
|
@@ -437,13 +441,18 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
437
441
|
const verticaLineHeight = containerHeight - margins.bottom + 6;
|
|
438
442
|
const yScale = _points[i].useSecondaryYScale && _yScaleSecondary ? _yScaleSecondary : _yScalePrimary;
|
|
439
443
|
if (_points[i].data.length === 1) {
|
|
444
|
+
var _points_i_lineOptions_mode, _points_i_lineOptions1;
|
|
440
445
|
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
441
446
|
const { x: x1, y: y1, xAxisCalloutData, xAxisCalloutAccessibilityData } = _points[i].data[0];
|
|
442
447
|
const circleId = `${_circleId}_${i}`;
|
|
443
448
|
const isLegendSelected = _legendHighlighted(legendVal) || _noLegendHighlighted() || isSelectedLegend;
|
|
444
449
|
const currentMarkerSize = _points[i].data[0].markerSize;
|
|
450
|
+
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');
|
|
451
|
+
const text = _points[i].data[0].text;
|
|
445
452
|
var _points_i_data__text;
|
|
446
|
-
pointsForLine.push(/*#__PURE__*/ _react.createElement(_react.Fragment, null, /*#__PURE__*/ _react.createElement(
|
|
453
|
+
pointsForLine.push(/*#__PURE__*/ _react.createElement(_react.Fragment, null, /*#__PURE__*/ _react.createElement(_react.Fragment, {
|
|
454
|
+
key: `${circleId}_fragment`
|
|
455
|
+
}, /*#__PURE__*/ _react.createElement("circle", {
|
|
447
456
|
id: circleId,
|
|
448
457
|
key: circleId,
|
|
449
458
|
r: currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : activePoint === circleId ? 5.5 : 3.5,
|
|
@@ -452,8 +461,8 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
452
461
|
fill: activePoint === circleId ? _reacttheme.tokens.colorNeutralBackground1 : lineColor,
|
|
453
462
|
opacity: isLegendSelected ? 1 : 0.1,
|
|
454
463
|
tabIndex: isLegendSelected ? 0 : undefined,
|
|
455
|
-
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
456
|
-
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
464
|
+
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
465
|
+
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
457
466
|
onMouseOut: _handleMouseOut,
|
|
458
467
|
strokeWidth: activePoint === circleId ? DEFAULT_LINE_STROKE_SIZE : 0,
|
|
459
468
|
stroke: activePoint === circleId ? lineColor : '',
|
|
@@ -466,13 +475,13 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
466
475
|
onFocus: (event)=>_handleFocus(event, circleId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData),
|
|
467
476
|
onBlur: _handleMouseOut,
|
|
468
477
|
..._getClickHandler(_points[i].data[0].onDataPointClick)
|
|
469
|
-
}),
|
|
478
|
+
}), supportsTextMode && text && /*#__PURE__*/ _react.createElement("text", {
|
|
470
479
|
key: `${circleId}-label`,
|
|
471
480
|
x: _xAxisScale(x1),
|
|
472
481
|
y: yScale(y1) + Math.max(currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 3.5, 4) + 12,
|
|
473
482
|
className: classes.markerLabel,
|
|
474
483
|
opacity: isLegendSelected ? 1 : 0.1
|
|
475
|
-
},
|
|
484
|
+
}, text))));
|
|
476
485
|
}
|
|
477
486
|
let gapIndex = 0;
|
|
478
487
|
var _points_i_gaps_sort;
|
|
@@ -480,13 +489,13 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
480
489
|
const lineCurve = (_points_i_lineOptions = _points[i].lineOptions) === null || _points_i_lineOptions === void 0 ? void 0 : _points_i_lineOptions.curve;
|
|
481
490
|
// Use path rendering technique for larger datasets to optimize performance.
|
|
482
491
|
if ((props.optimizeLargeData || lineCurve) && _points[i].data.length > 1) {
|
|
483
|
-
var
|
|
492
|
+
var _points_i_lineOptions2;
|
|
484
493
|
const line = (0, _d3shape.line)() // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
485
494
|
.x((d)=>_xAxisScale(d[0])) // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
486
495
|
.y((d)=>yScale(d[1])).curve((0, _index1.getCurveFactory)(lineCurve));
|
|
487
496
|
const lineId = `${_lineId}_${i}`;
|
|
488
497
|
const borderId = `${_borderId}_${i}`;
|
|
489
|
-
const strokeWidth = ((
|
|
498
|
+
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;
|
|
490
499
|
const isLegendSelected = _legendHighlighted(legendVal) || _noLegendHighlighted() || isSelectedLegend;
|
|
491
500
|
const lineData = [];
|
|
492
501
|
for(let k = 0; k < _points[i].data.length; k++){
|
|
@@ -496,19 +505,19 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
496
505
|
]);
|
|
497
506
|
}
|
|
498
507
|
if (isLegendSelected) {
|
|
499
|
-
var
|
|
500
|
-
const lineBorderWidth = ((
|
|
508
|
+
var _points_i_lineOptions3, _points_i_lineOptions4;
|
|
509
|
+
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;
|
|
501
510
|
if (lineBorderWidth > 0) {
|
|
502
|
-
var
|
|
511
|
+
var _points_i_lineOptions5, _points_i_lineOptions6;
|
|
503
512
|
var _points_i_lineOptions_strokeLinecap;
|
|
504
513
|
bordersForLine.push(/*#__PURE__*/ _react.createElement("path", {
|
|
505
514
|
id: borderId,
|
|
506
515
|
key: borderId,
|
|
507
516
|
d: line(lineData),
|
|
508
517
|
fill: "transparent",
|
|
509
|
-
strokeLinecap: (_points_i_lineOptions_strokeLinecap = (
|
|
518
|
+
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',
|
|
510
519
|
strokeWidth: Number.parseFloat(strokeWidth.toString()) + lineBorderWidth,
|
|
511
|
-
stroke: ((
|
|
520
|
+
stroke: ((_points_i_lineOptions6 = _points[i].lineOptions) === null || _points_i_lineOptions6 === void 0 ? void 0 : _points_i_lineOptions6.lineBorderColor) || _reacttheme.tokens.colorNeutralBackground1,
|
|
512
521
|
opacity: 1
|
|
513
522
|
}));
|
|
514
523
|
}
|
|
@@ -521,7 +530,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
521
530
|
"data-is-focusable": true,
|
|
522
531
|
stroke: lineColor,
|
|
523
532
|
strokeWidth: strokeWidth,
|
|
524
|
-
strokeLinecap: (_points_i_lineOptions_strokeLinecap1 = (
|
|
533
|
+
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',
|
|
525
534
|
onMouseMove: (event)=>_onMouseOverLargeDataset.bind(i, verticaLineHeight, event, yScale),
|
|
526
535
|
onMouseOver: (event)=>_onMouseOverLargeDataset.bind(i, verticaLineHeight, event, yScale),
|
|
527
536
|
onMouseOut: _handleMouseOut,
|
|
@@ -530,7 +539,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
530
539
|
tabIndex: isLegendSelected ? 0 : undefined
|
|
531
540
|
}));
|
|
532
541
|
} else {
|
|
533
|
-
var
|
|
542
|
+
var _points_i_lineOptions7;
|
|
534
543
|
var _points_i_lineOptions_strokeLinecap2;
|
|
535
544
|
linesForLine.push(/*#__PURE__*/ _react.createElement("path", {
|
|
536
545
|
id: lineId,
|
|
@@ -540,7 +549,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
540
549
|
"data-is-focusable": false,
|
|
541
550
|
stroke: lineColor,
|
|
542
551
|
strokeWidth: strokeWidth,
|
|
543
|
-
strokeLinecap: (_points_i_lineOptions_strokeLinecap2 = (
|
|
552
|
+
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',
|
|
544
553
|
opacity: 0.1
|
|
545
554
|
}));
|
|
546
555
|
}
|
|
@@ -560,7 +569,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
560
569
|
}));
|
|
561
570
|
} else if (!props.optimizeLargeData) {
|
|
562
571
|
for(let j = 1; j < _points[i].data.length; j++){
|
|
563
|
-
var
|
|
572
|
+
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;
|
|
564
573
|
const gapResult = _checkInGap(j, gaps, gapIndex);
|
|
565
574
|
const isInGap = gapResult.isInGap;
|
|
566
575
|
gapIndex = gapResult.gapIndex;
|
|
@@ -570,20 +579,22 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
570
579
|
const { x: x1, y: y1, xAxisCalloutData, xAxisCalloutAccessibilityData } = _points[i].data[j - 1];
|
|
571
580
|
const { x: x2, y: y2 } = _points[i].data[j];
|
|
572
581
|
let path = _getPath(_xAxisScale(x1), yScale(y1), circleId, j, false, _points[i].index);
|
|
573
|
-
const strokeWidth = ((
|
|
582
|
+
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;
|
|
574
583
|
const isLegendSelected = _legendHighlighted(legendVal) || _noLegendHighlighted() || isSelectedLegend;
|
|
575
584
|
const currentPointHidden = _points[i].hideNonActiveDots && activePoint !== circleId;
|
|
585
|
+
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');
|
|
586
|
+
const text = _points[i].data[j - 1].text;
|
|
576
587
|
let currentMarkerSize = _points[i].data[j - 1].markerSize;
|
|
577
588
|
var _points_i_data__text1;
|
|
578
|
-
pointsForLine.push(((
|
|
589
|
+
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", {
|
|
579
590
|
id: circleId,
|
|
580
591
|
key: circleId,
|
|
581
592
|
r: currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 4,
|
|
582
593
|
cx: _xAxisScale(x1),
|
|
583
594
|
cy: yScale(y1),
|
|
584
595
|
"data-is-focusable": isLegendSelected,
|
|
585
|
-
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
586
|
-
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
596
|
+
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
597
|
+
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
587
598
|
onMouseOut: _handleMouseOut,
|
|
588
599
|
onFocus: (event)=>_handleFocus(event, lineId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData),
|
|
589
600
|
onBlur: _handleMouseOut,
|
|
@@ -594,19 +605,19 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
594
605
|
strokeWidth: strokeWidth,
|
|
595
606
|
role: "img",
|
|
596
607
|
"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)
|
|
597
|
-
}),
|
|
608
|
+
}), supportsTextMode && text && /*#__PURE__*/ _react.createElement("text", {
|
|
598
609
|
key: `${circleId}-label`,
|
|
599
610
|
x: _xAxisScale(x1),
|
|
600
|
-
y: yScale(y1) + 12,
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
},
|
|
611
|
+
y: yScale(y1) + Math.max(currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 4, 4) + 12,
|
|
612
|
+
className: classes.markerLabel,
|
|
613
|
+
opacity: isLegendSelected && !currentPointHidden ? 1 : 0.01
|
|
614
|
+
}, text)) : /*#__PURE__*/ _react.createElement("path", {
|
|
604
615
|
id: circleId,
|
|
605
616
|
key: circleId,
|
|
606
617
|
d: path,
|
|
607
618
|
"data-is-focusable": isLegendSelected,
|
|
608
|
-
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
609
|
-
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
619
|
+
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
620
|
+
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
610
621
|
onMouseOut: _handleMouseOut,
|
|
611
622
|
onFocus: (event)=>_handleFocus(event, lineId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData),
|
|
612
623
|
onBlur: _handleMouseOut,
|
|
@@ -620,7 +631,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
620
631
|
tabIndex: isLegendSelected ? 0 : undefined
|
|
621
632
|
}));
|
|
622
633
|
if (j + 1 === _points[i].data.length) {
|
|
623
|
-
var
|
|
634
|
+
var _points_i_lineOptions_mode4, _points_i_lineOptions12, _points_i_lineOptions_mode5, _points_i_lineOptions13;
|
|
624
635
|
// If this is last point of the line segment.
|
|
625
636
|
const lastCircleId = `${circleId}${j}L`;
|
|
626
637
|
const hiddenHoverCircleId = `${circleId}${j}D`;
|
|
@@ -628,18 +639,20 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
628
639
|
path = _getPath(_xAxisScale(x2), yScale(y2), lastCircleId, j, true, _points[i].index);
|
|
629
640
|
const { xAxisCalloutData: lastCirlceXCallout, xAxisCalloutAccessibilityData: lastCirlceXCalloutAccessibilityData } = _points[i].data[j];
|
|
630
641
|
currentMarkerSize = _points[i].data[j].markerSize;
|
|
642
|
+
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');
|
|
643
|
+
const lastText = _points[i].data[j].text;
|
|
631
644
|
var _points_i_data_j_text;
|
|
632
645
|
pointsForLine.push(/*#__PURE__*/ _react.createElement(_react.Fragment, {
|
|
633
646
|
key: `${lastCircleId}_container`
|
|
634
|
-
}, ((
|
|
647
|
+
}, ((_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", {
|
|
635
648
|
id: lastCircleId,
|
|
636
649
|
key: lastCircleId,
|
|
637
650
|
r: currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 4,
|
|
638
651
|
cx: _xAxisScale(x2),
|
|
639
652
|
cy: yScale(y2),
|
|
640
653
|
"data-is-focusable": isLegendSelected,
|
|
641
|
-
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale),
|
|
642
|
-
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale),
|
|
654
|
+
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
655
|
+
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
643
656
|
onMouseOut: _handleMouseOut,
|
|
644
657
|
onFocus: (event)=>_handleFocus(event, lineId, x2, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData),
|
|
645
658
|
onBlur: _handleMouseOut,
|
|
@@ -650,19 +663,18 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
650
663
|
strokeWidth: strokeWidth,
|
|
651
664
|
role: "img",
|
|
652
665
|
"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)
|
|
653
|
-
}),
|
|
666
|
+
}), lastSupportsTextMode && lastText && /*#__PURE__*/ _react.createElement("text", {
|
|
654
667
|
key: `${lastCircleId}-label`,
|
|
655
668
|
x: _xAxisScale(x2),
|
|
656
|
-
y: yScale(y2) + 12,
|
|
657
|
-
fontSize: 12,
|
|
669
|
+
y: yScale(y2) + Math.max(currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 4, 4) + 12,
|
|
658
670
|
className: classes.markerLabel
|
|
659
|
-
},
|
|
671
|
+
}, text)) : /*#__PURE__*/ _react.createElement("path", {
|
|
660
672
|
id: lastCircleId,
|
|
661
673
|
key: lastCircleId,
|
|
662
674
|
d: path,
|
|
663
675
|
"data-is-focusable": isLegendSelected,
|
|
664
|
-
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale),
|
|
665
|
-
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale),
|
|
676
|
+
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
677
|
+
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
666
678
|
onMouseOut: _handleMouseOut,
|
|
667
679
|
onFocus: (event)=>_handleFocus(event, lineId, x2, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData),
|
|
668
680
|
onBlur: _handleMouseOut,
|
|
@@ -682,8 +694,8 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
682
694
|
cy: yScale(y2),
|
|
683
695
|
opacity: 0,
|
|
684
696
|
width: 0,
|
|
685
|
-
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale),
|
|
686
|
-
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale),
|
|
697
|
+
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
698
|
+
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
687
699
|
onFocus: (event)=>_handleFocus(event, circleId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData),
|
|
688
700
|
onMouseOut: _handleMouseOut,
|
|
689
701
|
strokeWidth: 0,
|
|
@@ -691,14 +703,14 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
691
703
|
onBlur: _handleMouseOut
|
|
692
704
|
})));
|
|
693
705
|
}
|
|
694
|
-
if (!_hasMarkersMode || ((
|
|
706
|
+
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'))) {
|
|
695
707
|
if (isLegendSelected) {
|
|
696
708
|
// don't draw line if it is in a gap
|
|
697
709
|
if (!isInGap) {
|
|
698
|
-
var
|
|
699
|
-
const lineBorderWidth = ((
|
|
710
|
+
var _points_i_lineOptions14, _points_i_lineOptions15, _points_i_lineOptions16, _points_i_lineOptions17;
|
|
711
|
+
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;
|
|
700
712
|
if (lineBorderWidth > 0) {
|
|
701
|
-
var
|
|
713
|
+
var _points_i_lineOptions18, _points_i_lineOptions19;
|
|
702
714
|
var _points_i_lineOptions_strokeLinecap3;
|
|
703
715
|
bordersForLine.push(/*#__PURE__*/ _react.createElement("line", {
|
|
704
716
|
id: borderId,
|
|
@@ -707,9 +719,9 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
707
719
|
y1: yScale(y1),
|
|
708
720
|
x2: _xAxisScale(x2),
|
|
709
721
|
y2: yScale(y2),
|
|
710
|
-
strokeLinecap: (_points_i_lineOptions_strokeLinecap3 = (
|
|
722
|
+
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',
|
|
711
723
|
strokeWidth: Number.parseFloat(strokeWidth.toString()) + lineBorderWidth,
|
|
712
|
-
stroke: ((
|
|
724
|
+
stroke: ((_points_i_lineOptions19 = _points[i].lineOptions) === null || _points_i_lineOptions19 === void 0 ? void 0 : _points_i_lineOptions19.lineBorderColor) || _reacttheme.tokens.colorNeutralBackground1,
|
|
713
725
|
opacity: 1
|
|
714
726
|
}));
|
|
715
727
|
}
|
|
@@ -725,20 +737,20 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
725
737
|
ref: (e)=>{
|
|
726
738
|
_refCallback(e, lineId);
|
|
727
739
|
},
|
|
728
|
-
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
729
|
-
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
740
|
+
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
741
|
+
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
730
742
|
onMouseOut: _handleMouseOut,
|
|
731
743
|
stroke: lineColor,
|
|
732
|
-
strokeLinecap: (_points_i_lineOptions_strokeLinecap4 = (
|
|
733
|
-
strokeDasharray: (
|
|
734
|
-
strokeDashoffset: (
|
|
744
|
+
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',
|
|
745
|
+
strokeDasharray: (_points_i_lineOptions16 = _points[i].lineOptions) === null || _points_i_lineOptions16 === void 0 ? void 0 : _points_i_lineOptions16.strokeDasharray,
|
|
746
|
+
strokeDashoffset: (_points_i_lineOptions17 = _points[i].lineOptions) === null || _points_i_lineOptions17 === void 0 ? void 0 : _points_i_lineOptions17.strokeDashoffset,
|
|
735
747
|
opacity: 1,
|
|
736
748
|
..._getClickHandler(_points[i].onLineClick)
|
|
737
749
|
}));
|
|
738
750
|
}
|
|
739
751
|
} else {
|
|
740
752
|
if (!isInGap) {
|
|
741
|
-
var
|
|
753
|
+
var _points_i_lineOptions20, _points_i_lineOptions21, _points_i_lineOptions22;
|
|
742
754
|
var _points_i_lineOptions_strokeLinecap5;
|
|
743
755
|
linesForLine.push(/*#__PURE__*/ _react.createElement("line", {
|
|
744
756
|
id: lineId,
|
|
@@ -749,9 +761,9 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
749
761
|
y2: yScale(y2),
|
|
750
762
|
strokeWidth: strokeWidth,
|
|
751
763
|
stroke: lineColor,
|
|
752
|
-
strokeLinecap: (_points_i_lineOptions_strokeLinecap5 = (
|
|
753
|
-
strokeDasharray: (
|
|
754
|
-
strokeDashoffset: (
|
|
764
|
+
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',
|
|
765
|
+
strokeDasharray: (_points_i_lineOptions21 = _points[i].lineOptions) === null || _points_i_lineOptions21 === void 0 ? void 0 : _points_i_lineOptions21.strokeDasharray,
|
|
766
|
+
strokeDashoffset: (_points_i_lineOptions22 = _points[i].lineOptions) === null || _points_i_lineOptions22 === void 0 ? void 0 : _points_i_lineOptions22.strokeDashoffset,
|
|
755
767
|
opacity: 0.1
|
|
756
768
|
}));
|
|
757
769
|
}
|
|
@@ -956,11 +968,24 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
956
968
|
setActivePoint(circleId);
|
|
957
969
|
}
|
|
958
970
|
}
|
|
959
|
-
function _handleHover(x, y, lineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, mouseEvent, yScale) {
|
|
971
|
+
function _handleHover(x, y, lineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, mouseEvent, yScale, legendVal, lineColor) {
|
|
960
972
|
mouseEvent === null || mouseEvent === void 0 ? void 0 : mouseEvent.persist();
|
|
961
973
|
const formattedData = x instanceof Date ? (0, _index1.formatDate)(x, props.useUTC) : x;
|
|
962
974
|
const xVal = x instanceof Date ? x.getTime() : x;
|
|
975
|
+
const yVal = y instanceof Date ? y.getTime() : y;
|
|
963
976
|
const found = (0, _index1.find)(_calloutPoints, (element)=>element.x === xVal);
|
|
977
|
+
let hoverDp = undefined;
|
|
978
|
+
if (props.isCalloutForStack === false && (found === null || found === void 0 ? void 0 : found.values)) {
|
|
979
|
+
const dp = (0, _index1.find)(found.values, (val)=>(val === null || val === void 0 ? void 0 : val.y) === yVal);
|
|
980
|
+
if (dp) {
|
|
981
|
+
hoverDp = {
|
|
982
|
+
x: xVal,
|
|
983
|
+
values: [
|
|
984
|
+
dp
|
|
985
|
+
]
|
|
986
|
+
};
|
|
987
|
+
}
|
|
988
|
+
}
|
|
964
989
|
// if no points need to be called out then don't show vertical line and callout card
|
|
965
990
|
if (found) {
|
|
966
991
|
(0, _d3selection.select)(`#${_verticalLine}`).attr('transform', ()=>`translate(${_xAxisScale(x)}, ${yScale(y)})`).attr('visibility', 'visibility').attr('y2', `${lineHeight - 5 - yScale(y)}`);
|
|
@@ -969,8 +994,11 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
969
994
|
updatePosition(mouseEvent.clientX, mouseEvent.clientY);
|
|
970
995
|
xAxisCalloutData ? setHoverXValue(xAxisCalloutData) : setHoverXValue('' + formattedData);
|
|
971
996
|
setYValueHover(found.values);
|
|
997
|
+
setYValue(yVal);
|
|
998
|
+
setLegendVal(legendVal);
|
|
999
|
+
setLineColor(lineColor);
|
|
972
1000
|
setStackCalloutProps(found);
|
|
973
|
-
setDataPointCalloutProps(
|
|
1001
|
+
setDataPointCalloutProps(hoverDp);
|
|
974
1002
|
setActivePoint(circleId);
|
|
975
1003
|
setNearestCircleToHighlight(null);
|
|
976
1004
|
}
|
|
@@ -1095,23 +1123,16 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
1095
1123
|
return ((_point_callOutAccessibilityData = point.callOutAccessibilityData) === null || _point_callOutAccessibilityData === void 0 ? void 0 : _point_callOutAccessibilityData.ariaLabel) || `${xValue}. ${legend}, ${yValue}.`;
|
|
1096
1124
|
}
|
|
1097
1125
|
function _getDomainNRangeValuesOfDateWithPadding(points, margins, width, isRTL, tickValues = [], chartType, barWidth) {
|
|
1098
|
-
|
|
1099
|
-
let lDate;
|
|
1100
|
-
sDate = (0, _d3array.min)(points, (point)=>{
|
|
1101
|
-
return (0, _d3array.min)(point.data, (item)=>item.x);
|
|
1102
|
-
});
|
|
1103
|
-
lDate = (0, _d3array.max)(points, (point)=>{
|
|
1104
|
-
return (0, _d3array.max)(point.data, (item)=>item.x);
|
|
1105
|
-
});
|
|
1126
|
+
_setXMinMaxValues(points);
|
|
1106
1127
|
// Include tickValues if present
|
|
1107
|
-
sDate = (0, _d3array.min)([
|
|
1128
|
+
const sDate = tickValues && tickValues.length > 0 ? (0, _d3array.min)([
|
|
1108
1129
|
...tickValues,
|
|
1109
|
-
|
|
1110
|
-
]);
|
|
1111
|
-
lDate = (0, _d3array.max)([
|
|
1130
|
+
new Date(_xMin)
|
|
1131
|
+
]) : new Date(_xMin);
|
|
1132
|
+
const lDate = tickValues && tickValues.length > 0 ? (0, _d3array.max)([
|
|
1112
1133
|
...tickValues,
|
|
1113
|
-
|
|
1114
|
-
]);
|
|
1134
|
+
new Date(_xMax)
|
|
1135
|
+
]) : new Date(_xMax);
|
|
1115
1136
|
// Calculate time-based padding (e.g. 10% of the date range)
|
|
1116
1137
|
const dateRange = lDate.getTime() - sDate.getTime();
|
|
1117
1138
|
const datePadding = _hasMarkersMode ? dateRange * 0.1 : 0;
|
|
@@ -1132,14 +1153,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
1132
1153
|
};
|
|
1133
1154
|
}
|
|
1134
1155
|
function _getDomainNRangeValuesWithPadding(points, margins, width, isRTL) {
|
|
1135
|
-
|
|
1136
|
-
return (0, _d3array.min)(point.data, (item)=>item.x);
|
|
1137
|
-
});
|
|
1138
|
-
_xMax = (0, _d3array.max)(points, (point)=>{
|
|
1139
|
-
return (0, _d3array.max)(point.data, (item)=>{
|
|
1140
|
-
return item.x;
|
|
1141
|
-
});
|
|
1142
|
-
});
|
|
1156
|
+
_setXMinMaxValues(points);
|
|
1143
1157
|
if (_hasMarkersMode) {
|
|
1144
1158
|
_xPadding = (_xMax - _xMin) * 0.1;
|
|
1145
1159
|
}
|
|
@@ -1160,9 +1174,18 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
1160
1174
|
function _isChartEmpty() {
|
|
1161
1175
|
return !(props.data && props.data.lineChartData && props.data.lineChartData.length > 0 && props.data.lineChartData.filter((item)=>item.data.length).length > 0);
|
|
1162
1176
|
}
|
|
1177
|
+
function _setXMinMaxValues(points) {
|
|
1178
|
+
const getX = (item)=>_isXAxisDateType ? item.x : item.x;
|
|
1179
|
+
const minVal = (0, _d3array.min)(points, (point)=>(0, _d3array.min)(point.data, getX));
|
|
1180
|
+
const maxVal = (0, _d3array.max)(points, (point)=>(0, _d3array.max)(point.data, getX));
|
|
1181
|
+
_xMin = _isXAxisDateType ? minVal.getTime() : minVal;
|
|
1182
|
+
_xMax = _isXAxisDateType ? maxVal.getTime() : maxVal;
|
|
1183
|
+
_xMin = _xMin === Number.NEGATIVE_INFINITY || !_xMin ? 0 : _xMin;
|
|
1184
|
+
_xMax = _xMax === Number.POSITIVE_INFINITY || !_xMax ? 0 : _xMax;
|
|
1185
|
+
}
|
|
1163
1186
|
const { legendProps, tickValues, tickFormat, eventAnnotationProps } = props;
|
|
1164
1187
|
_points = _injectIndexPropertyInLineChartData(props.data.lineChartData);
|
|
1165
|
-
|
|
1188
|
+
_isXAxisDateType = (0, _index1.getXAxisType)(_points);
|
|
1166
1189
|
let points = _points;
|
|
1167
1190
|
if (legendProps && !!legendProps.canSelectMultipleLegends) {
|
|
1168
1191
|
points = selectedLegendPoints.length >= 1 ? selectedLegendPoints : _points;
|
|
@@ -1179,13 +1202,17 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
1179
1202
|
const calloutProps = {
|
|
1180
1203
|
YValueHover: YValueHover,
|
|
1181
1204
|
hoverXValue: hoverXValue,
|
|
1205
|
+
YValue: YValue,
|
|
1206
|
+
legend: legendVal,
|
|
1207
|
+
color: lineColor,
|
|
1208
|
+
XValue: hoverXValue,
|
|
1182
1209
|
descriptionMessage: props.getCalloutDescriptionMessage && stackCalloutProps ? props.getCalloutDescriptionMessage(stackCalloutProps) : undefined,
|
|
1183
1210
|
'data-is-focusable': true,
|
|
1184
1211
|
xAxisCalloutAccessibilityData: xAxisCalloutAccessibilityData,
|
|
1185
1212
|
...props.calloutProps,
|
|
1186
1213
|
clickPosition: clickPosition,
|
|
1187
1214
|
isPopoverOpen: isPopoverOpen,
|
|
1188
|
-
isCalloutForStack:
|
|
1215
|
+
isCalloutForStack: props.isCalloutForStack,
|
|
1189
1216
|
culture: (_props_culture = props.culture) !== null && _props_culture !== void 0 ? _props_culture : 'en-us',
|
|
1190
1217
|
isCartesian: true,
|
|
1191
1218
|
customCallout: {
|
|
@@ -1209,7 +1236,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
1209
1236
|
getmargins: _getMargins,
|
|
1210
1237
|
getMinMaxOfYAxis: _getNumericMinMaxOfY,
|
|
1211
1238
|
getGraphData: _initializeLineChartData,
|
|
1212
|
-
xAxisType:
|
|
1239
|
+
xAxisType: _isXAxisDateType ? _index1.XAxisTypes.DateAxis : _index1.XAxisTypes.NumericAxis,
|
|
1213
1240
|
getDomainNRangeValues: _getDomainNRangeValues,
|
|
1214
1241
|
createStringYAxis: _index1.createStringYAxis,
|
|
1215
1242
|
onChartMouseLeave: _handleChartMouseLeave,
|
|
@@ -1251,3 +1278,6 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
1251
1278
|
});
|
|
1252
1279
|
});
|
|
1253
1280
|
LineChart.displayName = 'LineChart';
|
|
1281
|
+
LineChart.defaultProps = {
|
|
1282
|
+
isCalloutForStack: true
|
|
1283
|
+
};
|