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