@fluentui/react-charts 0.0.0-nightly-20250827-0407.1 → 0.0.0-nightly-20250829-0406.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 +27 -2
- package/lib/components/AreaChart/AreaChart.js +3 -3
- package/lib/components/AreaChart/AreaChart.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.js +4 -4
- package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +59 -13
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/FunnelChart/funnelGeometry.js.map +1 -1
- package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
- package/lib/components/LineChart/LineChart.js +195 -250
- package/lib/components/LineChart/LineChart.js.map +1 -1
- package/lib/components/ResponsiveContainer/withResponsiveContainer.js.map +1 -1
- package/lib/components/SankeyChart/SankeyChart.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.js +30 -54
- package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.js +2 -2
- package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +2 -2
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib/types/DataPoint.js +6 -1
- package/lib/types/DataPoint.js.map +1 -1
- package/lib/utilities/Common.styles.raw.js.map +1 -1
- package/lib/utilities/image-export-utils.js.map +1 -1
- package/lib/utilities/scatterpolar-utils.js +7 -18
- package/lib/utilities/scatterpolar-utils.js.map +1 -1
- package/lib/utilities/utilities.js +130 -127
- package/lib/utilities/utilities.js.map +1 -1
- package/lib/utilities/vbc-utils.js.map +1 -1
- package/lib-commonjs/components/AreaChart/AreaChart.js +2 -2
- package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +4 -4
- package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +58 -12
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/funnelGeometry.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.js +193 -248
- package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
- package/lib-commonjs/components/ResponsiveContainer/withResponsiveContainer.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.js +28 -52
- package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib-commonjs/types/DataPoint.js +6 -1
- package/lib-commonjs/types/DataPoint.js.map +1 -1
- package/lib-commonjs/utilities/Common.styles.raw.js.map +1 -1
- package/lib-commonjs/utilities/image-export-utils.js.map +1 -1
- package/lib-commonjs/utilities/scatterpolar-utils.js +7 -18
- package/lib-commonjs/utilities/scatterpolar-utils.js.map +1 -1
- package/lib-commonjs/utilities/utilities.js +142 -118
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/lib-commonjs/utilities/vbc-utils.js.map +1 -1
- package/package.json +12 -12
|
@@ -127,11 +127,6 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
127
127
|
const _isRTL = (0, _index1.useRtl)();
|
|
128
128
|
let xAxisCalloutAccessibilityData = {};
|
|
129
129
|
const cartesianChartRef = _react.useRef(null);
|
|
130
|
-
let _xMin = Number.NEGATIVE_INFINITY;
|
|
131
|
-
let _yMin = Number.NEGATIVE_INFINITY;
|
|
132
|
-
let _xMax = Number.POSITIVE_INFINITY;
|
|
133
|
-
let _xPadding = 0;
|
|
134
|
-
let _yPadding = 0;
|
|
135
130
|
let _yScaleSecondary;
|
|
136
131
|
const _legendsRef = _react.useRef(null);
|
|
137
132
|
props.eventAnnotationProps && props.eventAnnotationProps.labelHeight && (eventLabelHeight = props.eventAnnotationProps.labelHeight);
|
|
@@ -183,14 +178,10 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
183
178
|
}, []);
|
|
184
179
|
function _getDomainNRangeValues(points, margins, width, chartType, isRTL, xAxisType, barWidth, tickValues, shiftX) {
|
|
185
180
|
let domainNRangeValue;
|
|
186
|
-
if (
|
|
187
|
-
domainNRangeValue =
|
|
188
|
-
} else if (_hasMarkersMode && xAxisType === _index1.XAxisTypes.DateAxis) {
|
|
189
|
-
domainNRangeValue = _getDomainNRangeValuesOfDateWithPadding(points, margins, width, isRTL, tickValues, chartType, barWidth);
|
|
190
|
-
} else if (xAxisType === _index1.XAxisTypes.NumericAxis) {
|
|
191
|
-
domainNRangeValue = (0, _index1.domainRangeOfNumericForAreaChart)(points, margins, width, isRTL);
|
|
181
|
+
if (xAxisType === _index1.XAxisTypes.NumericAxis) {
|
|
182
|
+
domainNRangeValue = (0, _index1.domainRangeOfNumericForAreaLineScatterCharts)(points, margins, width, isRTL, props.xScaleType, _hasMarkersMode);
|
|
192
183
|
} else if (xAxisType === _index1.XAxisTypes.DateAxis) {
|
|
193
|
-
domainNRangeValue = (0, _index1.
|
|
184
|
+
domainNRangeValue = (0, _index1.domainRangeOfDateForAreaLineScatterVerticalBarCharts)(points, margins, width, isRTL, tickValues, chartType, barWidth, _hasMarkersMode);
|
|
194
185
|
} else {
|
|
195
186
|
domainNRangeValue = {
|
|
196
187
|
dStartValue: 0,
|
|
@@ -245,16 +236,19 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
245
236
|
function _getCustomizedCallout() {
|
|
246
237
|
return props.onRenderCalloutPerStack ? props.onRenderCalloutPerStack(stackCalloutProps) : props.onRenderCalloutPerDataPoint ? props.onRenderCalloutPerDataPoint(dataPointCalloutProps) : null;
|
|
247
238
|
}
|
|
248
|
-
function _getNumericMinMaxOfY(points) {
|
|
239
|
+
function _getNumericMinMaxOfY(points, yAxisType, useSecondaryYScale) {
|
|
249
240
|
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
250
|
-
const { startValue, endValue } = (0, _index1.findNumericMinMaxOfY)(points);
|
|
251
|
-
|
|
241
|
+
const { startValue, endValue } = (0, _index1.findNumericMinMaxOfY)(points, yAxisType, useSecondaryYScale, useSecondaryYScale ? props.secondaryYScaleType : props.yScaleType);
|
|
242
|
+
let yPadding = {
|
|
243
|
+
start: 0,
|
|
244
|
+
end: 0
|
|
245
|
+
};
|
|
252
246
|
if (_hasMarkersMode) {
|
|
253
|
-
|
|
247
|
+
yPadding = (0, _index1.getDomainPaddingForMarkers)(startValue, endValue, useSecondaryYScale ? props.secondaryYScaleType : props.yScaleType);
|
|
254
248
|
}
|
|
255
249
|
return {
|
|
256
|
-
startValue: startValue -
|
|
257
|
-
endValue: endValue +
|
|
250
|
+
startValue: startValue - yPadding.start,
|
|
251
|
+
endValue: endValue + yPadding.end
|
|
258
252
|
};
|
|
259
253
|
}
|
|
260
254
|
function _getMargins(_margins) {
|
|
@@ -416,11 +410,6 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
416
410
|
}
|
|
417
411
|
}
|
|
418
412
|
}
|
|
419
|
-
function _getRangeForScatterMarkerSize(yScale, yPadding) {
|
|
420
|
-
const extraXPixels = _isRTL ? _xAxisScale(_xMax - _xPadding) - _xAxisScale(_xMax) : _xAxisScale(_xMin + _xPadding) - _xAxisScale(_xMin);
|
|
421
|
-
const extraYPixels = yScale(_yMin) - yScale(_yMin + _yPadding);
|
|
422
|
-
return Math.min(extraXPixels, extraYPixels);
|
|
423
|
-
}
|
|
424
413
|
function _createLines(xElement, containerHeight) {
|
|
425
414
|
const lines = [];
|
|
426
415
|
if (isSelectedLegend) {
|
|
@@ -428,7 +417,6 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
428
417
|
} else {
|
|
429
418
|
_points = _injectIndexPropertyInLineChartData(props.data.lineChartData);
|
|
430
419
|
}
|
|
431
|
-
const extraMaxPixels = _hasMarkersMode ? _getRangeForScatterMarkerSize(_yScalePrimary, _yPadding) : 0;
|
|
432
420
|
const maxMarkerSize = (0, _d3array.max)(_points, (point)=>{
|
|
433
421
|
return (0, _d3array.max)(point.data, (item)=>{
|
|
434
422
|
return item.markerSize;
|
|
@@ -442,49 +430,64 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
442
430
|
const legendVal = _points[i].legend;
|
|
443
431
|
const lineColor = _points[i].color;
|
|
444
432
|
const verticaLineHeight = containerHeight - margins.bottom + 6;
|
|
445
|
-
const
|
|
433
|
+
const useSecondaryYScale = !!(_points[i].useSecondaryYScale && _yScaleSecondary);
|
|
434
|
+
const yScale = useSecondaryYScale ? _yScaleSecondary : _yScalePrimary;
|
|
435
|
+
const extraMaxPixels = _hasMarkersMode ? (0, _index1.getRangeForScatterMarkerSize)({
|
|
436
|
+
data: _points,
|
|
437
|
+
xScale: _xAxisScale,
|
|
438
|
+
yScalePrimary: _yScalePrimary,
|
|
439
|
+
yScaleSecondary: _yScaleSecondary,
|
|
440
|
+
useSecondaryYScale,
|
|
441
|
+
xScaleType: props.xScaleType,
|
|
442
|
+
yScaleType: props.yScaleType,
|
|
443
|
+
secondaryYScaleType: props.secondaryYScaleType
|
|
444
|
+
}) : 0;
|
|
446
445
|
if (_points[i].data.length === 1) {
|
|
447
|
-
var _points_i_lineOptions_mode, _points_i_lineOptions1;
|
|
448
446
|
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
449
447
|
const { x: x1, y: y1, xAxisCalloutData, xAxisCalloutAccessibilityData } = _points[i].data[0];
|
|
450
|
-
const
|
|
451
|
-
const
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
448
|
+
const xPoint = _xAxisScale(x1);
|
|
449
|
+
const yPoint = yScale(y1);
|
|
450
|
+
if ((0, _index1.isPlottable)(xPoint, yPoint)) {
|
|
451
|
+
var _points_i_lineOptions_mode, _points_i_lineOptions1;
|
|
452
|
+
const circleId = `${_circleId}_${i}`;
|
|
453
|
+
const isLegendSelected = _legendHighlighted(legendVal) || _noLegendHighlighted() || isSelectedLegend;
|
|
454
|
+
const currentMarkerSize = _points[i].data[0].markerSize;
|
|
455
|
+
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');
|
|
456
|
+
const text = _points[i].data[0].text;
|
|
457
|
+
var _points_i_data__text;
|
|
458
|
+
pointsForLine.push(/*#__PURE__*/ _react.createElement(_react.Fragment, null, /*#__PURE__*/ _react.createElement(_react.Fragment, {
|
|
459
|
+
key: `${circleId}_fragment`
|
|
460
|
+
}, /*#__PURE__*/ _react.createElement("circle", {
|
|
461
|
+
id: circleId,
|
|
462
|
+
key: circleId,
|
|
463
|
+
r: currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : activePoint === circleId ? 5.5 : 3.5,
|
|
464
|
+
cx: xPoint,
|
|
465
|
+
cy: yPoint,
|
|
466
|
+
fill: activePoint === circleId ? _reacttheme.tokens.colorNeutralBackground1 : lineColor,
|
|
467
|
+
opacity: isLegendSelected ? 1 : 0.1,
|
|
468
|
+
tabIndex: isLegendSelected ? 0 : undefined,
|
|
469
|
+
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
470
|
+
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
471
|
+
onMouseOut: _handleMouseOut,
|
|
472
|
+
strokeWidth: activePoint === circleId ? DEFAULT_LINE_STROKE_SIZE : 0,
|
|
473
|
+
stroke: activePoint === circleId ? lineColor : '',
|
|
474
|
+
role: "img",
|
|
475
|
+
"aria-label": (_points_i_data__text = _points[i].data[0].text) !== null && _points_i_data__text !== void 0 ? _points_i_data__text : _getAriaLabel(i, 0),
|
|
476
|
+
"data-is-focusable": isLegendSelected,
|
|
477
|
+
ref: (e)=>{
|
|
478
|
+
_refCallback(e, circleId);
|
|
479
|
+
},
|
|
480
|
+
onFocus: (event)=>_handleFocus(event, circleId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData),
|
|
481
|
+
onBlur: _handleMouseOut,
|
|
482
|
+
..._getClickHandler(_points[i].data[0].onDataPointClick)
|
|
483
|
+
}), !_isScatterPolar && supportsTextMode && text && /*#__PURE__*/ _react.createElement("text", {
|
|
484
|
+
key: `${circleId}-label`,
|
|
485
|
+
x: xPoint,
|
|
486
|
+
y: yPoint + Math.max(currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 3.5, 4) + 12,
|
|
487
|
+
className: classes.markerLabel,
|
|
488
|
+
opacity: isLegendSelected ? 1 : 0.1
|
|
489
|
+
}, text))));
|
|
490
|
+
}
|
|
488
491
|
}
|
|
489
492
|
let gapIndex = 0;
|
|
490
493
|
var _points_i_gaps_sort;
|
|
@@ -495,7 +498,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
495
498
|
var _points_i_lineOptions2;
|
|
496
499
|
const line = (0, _d3shape.line)() // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
497
500
|
.x((d)=>_xAxisScale(d[0])) // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
498
|
-
.y((d)=>yScale(d[1])).curve((0, _index1.getCurveFactory)(lineCurve));
|
|
501
|
+
.y((d)=>yScale(d[1])).curve((0, _index1.getCurveFactory)(lineCurve)).defined((d)=>(0, _index1.isPlottable)(_xAxisScale(d[0]), yScale(d[1])));
|
|
499
502
|
const lineId = `${_lineId}_${i}`;
|
|
500
503
|
const borderId = `${_borderId}_${i}`;
|
|
501
504
|
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;
|
|
@@ -572,7 +575,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
572
575
|
}));
|
|
573
576
|
} else if (!props.optimizeLargeData) {
|
|
574
577
|
for(let j = 1; j < _points[i].data.length; j++){
|
|
575
|
-
var _points_i_lineOptions8, _points_i_lineOptions_mode1, _points_i_lineOptions9, _points_i_lineOptions_mode2, _points_i_lineOptions10
|
|
578
|
+
var _points_i_lineOptions8, _points_i_lineOptions_mode1, _points_i_lineOptions9, _points_i_lineOptions_mode2, _points_i_lineOptions10;
|
|
576
579
|
const gapResult = _checkInGap(j, gaps, gapIndex);
|
|
577
580
|
const isInGap = gapResult.isInGap;
|
|
578
581
|
gapIndex = gapResult.gapIndex;
|
|
@@ -581,132 +584,141 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
581
584
|
const circleId = `${_circleId}_${i}_${j}`;
|
|
582
585
|
const { x: x1, y: y1, xAxisCalloutData, xAxisCalloutAccessibilityData } = _points[i].data[j - 1];
|
|
583
586
|
const { x: x2, y: y2 } = _points[i].data[j];
|
|
584
|
-
|
|
587
|
+
const xPoint1 = _xAxisScale(x1);
|
|
588
|
+
const yPoint1 = yScale(y1);
|
|
589
|
+
const xPoint2 = _xAxisScale(x2);
|
|
590
|
+
const yPoint2 = yScale(y2);
|
|
585
591
|
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;
|
|
586
592
|
const isLegendSelected = _legendHighlighted(legendVal) || _noLegendHighlighted() || isSelectedLegend;
|
|
587
593
|
const currentPointHidden = _points[i].hideNonActiveDots && activePoint !== circleId;
|
|
588
594
|
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');
|
|
589
595
|
const text = _points[i].data[j - 1].text;
|
|
590
596
|
let currentMarkerSize = _points[i].data[j - 1].markerSize;
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
"data-is-focusable": isLegendSelected,
|
|
599
|
-
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
600
|
-
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
601
|
-
onMouseOut: _handleMouseOut,
|
|
602
|
-
onFocus: (event)=>_handleFocus(event, lineId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData),
|
|
603
|
-
onBlur: _handleMouseOut,
|
|
604
|
-
..._getClickHandler(_points[i].data[j - 1].onDataPointClick),
|
|
605
|
-
opacity: isLegendSelected && !currentPointHidden ? 1 : 0.01,
|
|
606
|
-
fill: _getPointFill(lineColor, circleId, j, false),
|
|
607
|
-
stroke: lineColor,
|
|
608
|
-
strokeWidth: strokeWidth,
|
|
609
|
-
role: "img",
|
|
610
|
-
"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)
|
|
611
|
-
}), !_isScatterPolar && supportsTextMode && text && /*#__PURE__*/ _react.createElement("text", {
|
|
612
|
-
key: `${circleId}-label`,
|
|
613
|
-
x: _xAxisScale(x1),
|
|
614
|
-
y: yScale(y1) + Math.max(currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 4, 4) + 12,
|
|
615
|
-
className: classes.markerLabel,
|
|
616
|
-
opacity: isLegendSelected && !currentPointHidden ? 1 : 0.01
|
|
617
|
-
}, text)) : /*#__PURE__*/ _react.createElement("path", {
|
|
618
|
-
id: circleId,
|
|
619
|
-
key: circleId,
|
|
620
|
-
d: path,
|
|
621
|
-
"data-is-focusable": isLegendSelected,
|
|
622
|
-
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
623
|
-
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
624
|
-
onMouseOut: _handleMouseOut,
|
|
625
|
-
onFocus: (event)=>_handleFocus(event, lineId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData),
|
|
626
|
-
onBlur: _handleMouseOut,
|
|
627
|
-
..._getClickHandler(_points[i].data[j - 1].onDataPointClick),
|
|
628
|
-
opacity: isLegendSelected && !currentPointHidden ? 1 : 0.01,
|
|
629
|
-
fill: _getPointFill(lineColor, circleId, j, false),
|
|
630
|
-
stroke: lineColor,
|
|
631
|
-
strokeWidth: strokeWidth,
|
|
632
|
-
role: "img",
|
|
633
|
-
"aria-label": _getAriaLabel(i, j - 1),
|
|
634
|
-
tabIndex: isLegendSelected ? 0 : undefined
|
|
635
|
-
}));
|
|
636
|
-
if (j + 1 === _points[i].data.length) {
|
|
637
|
-
var _points_i_lineOptions_mode4, _points_i_lineOptions12, _points_i_lineOptions_mode5, _points_i_lineOptions13;
|
|
638
|
-
// If this is last point of the line segment.
|
|
639
|
-
const lastCircleId = `${circleId}${j}L`;
|
|
640
|
-
const hiddenHoverCircleId = `${circleId}${j}D`;
|
|
641
|
-
const lastPointHidden = _points[i].hideNonActiveDots && activePoint !== lastCircleId;
|
|
642
|
-
path = _getPath(_xAxisScale(x2), yScale(y2), lastCircleId, j, true, _points[i].index);
|
|
643
|
-
const { xAxisCalloutData: lastCirlceXCallout, xAxisCalloutAccessibilityData: lastCirlceXCalloutAccessibilityData } = _points[i].data[j];
|
|
644
|
-
currentMarkerSize = _points[i].data[j].markerSize;
|
|
645
|
-
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');
|
|
646
|
-
const lastText = _points[i].data[j].text;
|
|
647
|
-
var _points_i_data_j_text;
|
|
648
|
-
pointsForLine.push(/*#__PURE__*/ _react.createElement(_react.Fragment, {
|
|
649
|
-
key: `${lastCircleId}_container`
|
|
650
|
-
}, ((_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", {
|
|
651
|
-
id: lastCircleId,
|
|
652
|
-
key: lastCircleId,
|
|
597
|
+
if ((0, _index1.isPlottable)(xPoint1, yPoint1)) {
|
|
598
|
+
var _points_i_lineOptions_mode3, _points_i_lineOptions11;
|
|
599
|
+
const path = _getPath(xPoint1, yPoint1, circleId, j, false, _points[i].index);
|
|
600
|
+
var _points_i_data__text1;
|
|
601
|
+
pointsForLine.push(((_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('markers')) || supportsTextMode ? /*#__PURE__*/ _react.createElement(_react.Fragment, null, /*#__PURE__*/ _react.createElement("circle", {
|
|
602
|
+
id: circleId,
|
|
603
|
+
key: circleId,
|
|
653
604
|
r: currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 4,
|
|
654
|
-
cx:
|
|
655
|
-
cy:
|
|
605
|
+
cx: xPoint1,
|
|
606
|
+
cy: yPoint1,
|
|
656
607
|
"data-is-focusable": isLegendSelected,
|
|
657
|
-
onMouseOver: (event)=>_handleHover(
|
|
658
|
-
onMouseMove: (event)=>_handleHover(
|
|
608
|
+
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
609
|
+
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
659
610
|
onMouseOut: _handleMouseOut,
|
|
660
|
-
onFocus: (event)=>_handleFocus(event, lineId,
|
|
611
|
+
onFocus: (event)=>_handleFocus(event, lineId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData),
|
|
661
612
|
onBlur: _handleMouseOut,
|
|
662
|
-
..._getClickHandler(_points[i].data[j].onDataPointClick),
|
|
663
|
-
opacity: isLegendSelected && !
|
|
664
|
-
fill: _getPointFill(lineColor,
|
|
613
|
+
..._getClickHandler(_points[i].data[j - 1].onDataPointClick),
|
|
614
|
+
opacity: isLegendSelected && !currentPointHidden ? 1 : 0.01,
|
|
615
|
+
fill: _getPointFill(lineColor, circleId, j, false),
|
|
665
616
|
stroke: lineColor,
|
|
666
617
|
strokeWidth: strokeWidth,
|
|
667
618
|
role: "img",
|
|
668
|
-
"aria-label": (
|
|
669
|
-
}), !_isScatterPolar &&
|
|
670
|
-
key: `${
|
|
671
|
-
x:
|
|
672
|
-
y:
|
|
673
|
-
className: classes.markerLabel
|
|
619
|
+
"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)
|
|
620
|
+
}), !_isScatterPolar && supportsTextMode && text && /*#__PURE__*/ _react.createElement("text", {
|
|
621
|
+
key: `${circleId}-label`,
|
|
622
|
+
x: xPoint1,
|
|
623
|
+
y: yPoint1 + Math.max(currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 4, 4) + 12,
|
|
624
|
+
className: classes.markerLabel,
|
|
625
|
+
opacity: isLegendSelected && !currentPointHidden ? 1 : 0.01
|
|
674
626
|
}, text)) : /*#__PURE__*/ _react.createElement("path", {
|
|
675
|
-
id:
|
|
676
|
-
key:
|
|
627
|
+
id: circleId,
|
|
628
|
+
key: circleId,
|
|
677
629
|
d: path,
|
|
678
630
|
"data-is-focusable": isLegendSelected,
|
|
679
|
-
onMouseOver: (event)=>_handleHover(
|
|
680
|
-
onMouseMove: (event)=>_handleHover(
|
|
631
|
+
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
632
|
+
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
681
633
|
onMouseOut: _handleMouseOut,
|
|
682
|
-
onFocus: (event)=>_handleFocus(event, lineId,
|
|
634
|
+
onFocus: (event)=>_handleFocus(event, lineId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData),
|
|
683
635
|
onBlur: _handleMouseOut,
|
|
684
|
-
..._getClickHandler(_points[i].data[j].onDataPointClick),
|
|
685
|
-
opacity: isLegendSelected && !
|
|
686
|
-
fill: _getPointFill(lineColor,
|
|
636
|
+
..._getClickHandler(_points[i].data[j - 1].onDataPointClick),
|
|
637
|
+
opacity: isLegendSelected && !currentPointHidden ? 1 : 0.01,
|
|
638
|
+
fill: _getPointFill(lineColor, circleId, j, false),
|
|
687
639
|
stroke: lineColor,
|
|
688
640
|
strokeWidth: strokeWidth,
|
|
689
641
|
role: "img",
|
|
690
|
-
"aria-label": _getAriaLabel(i, j),
|
|
642
|
+
"aria-label": _getAriaLabel(i, j - 1),
|
|
691
643
|
tabIndex: isLegendSelected ? 0 : undefined
|
|
692
|
-
})
|
|
693
|
-
id: hiddenHoverCircleId,
|
|
694
|
-
key: hiddenHoverCircleId,
|
|
695
|
-
r: 8,
|
|
696
|
-
cx: _xAxisScale(x2),
|
|
697
|
-
cy: yScale(y2),
|
|
698
|
-
opacity: 0,
|
|
699
|
-
width: 0,
|
|
700
|
-
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
701
|
-
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
702
|
-
onFocus: (event)=>_handleFocus(event, circleId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData),
|
|
703
|
-
onMouseOut: _handleMouseOut,
|
|
704
|
-
strokeWidth: 0,
|
|
705
|
-
focusable: false,
|
|
706
|
-
onBlur: _handleMouseOut
|
|
707
|
-
})));
|
|
644
|
+
}));
|
|
708
645
|
}
|
|
709
|
-
if (
|
|
646
|
+
if (j + 1 === _points[i].data.length) {
|
|
647
|
+
var _points_i_lineOptions_mode4, _points_i_lineOptions12;
|
|
648
|
+
// If this is last point of the line segment.
|
|
649
|
+
const lastCircleId = `${circleId}${j}L`;
|
|
650
|
+
const hiddenHoverCircleId = `${circleId}${j}D`;
|
|
651
|
+
const lastPointHidden = _points[i].hideNonActiveDots && activePoint !== lastCircleId;
|
|
652
|
+
const { xAxisCalloutData: lastCirlceXCallout, xAxisCalloutAccessibilityData: lastCirlceXCalloutAccessibilityData } = _points[i].data[j];
|
|
653
|
+
currentMarkerSize = _points[i].data[j].markerSize;
|
|
654
|
+
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');
|
|
655
|
+
const lastText = _points[i].data[j].text;
|
|
656
|
+
if ((0, _index1.isPlottable)(xPoint2, yPoint2)) {
|
|
657
|
+
var _points_i_lineOptions_mode5, _points_i_lineOptions13;
|
|
658
|
+
const path = _getPath(xPoint2, yPoint2, lastCircleId, j, true, _points[i].index);
|
|
659
|
+
var _points_i_data_j_text;
|
|
660
|
+
pointsForLine.push(/*#__PURE__*/ _react.createElement(_react.Fragment, {
|
|
661
|
+
key: `${lastCircleId}_container`
|
|
662
|
+
}, ((_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", {
|
|
663
|
+
id: lastCircleId,
|
|
664
|
+
key: lastCircleId,
|
|
665
|
+
r: currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 4,
|
|
666
|
+
cx: xPoint2,
|
|
667
|
+
cy: yPoint2,
|
|
668
|
+
"data-is-focusable": isLegendSelected,
|
|
669
|
+
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
670
|
+
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
671
|
+
onMouseOut: _handleMouseOut,
|
|
672
|
+
onFocus: (event)=>_handleFocus(event, lineId, x2, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData),
|
|
673
|
+
onBlur: _handleMouseOut,
|
|
674
|
+
..._getClickHandler(_points[i].data[j].onDataPointClick),
|
|
675
|
+
opacity: isLegendSelected && !lastPointHidden ? 1 : 0.01,
|
|
676
|
+
fill: _getPointFill(lineColor, lastCircleId, j, true),
|
|
677
|
+
stroke: lineColor,
|
|
678
|
+
strokeWidth: strokeWidth,
|
|
679
|
+
role: "img",
|
|
680
|
+
"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)
|
|
681
|
+
}), !_isScatterPolar && lastSupportsTextMode && lastText && /*#__PURE__*/ _react.createElement("text", {
|
|
682
|
+
key: `${lastCircleId}-label`,
|
|
683
|
+
x: xPoint2,
|
|
684
|
+
y: yPoint2 + Math.max(currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 4, 4) + 12,
|
|
685
|
+
className: classes.markerLabel
|
|
686
|
+
}, text)) : /*#__PURE__*/ _react.createElement("path", {
|
|
687
|
+
id: lastCircleId,
|
|
688
|
+
key: lastCircleId,
|
|
689
|
+
d: path,
|
|
690
|
+
"data-is-focusable": isLegendSelected,
|
|
691
|
+
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
692
|
+
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
693
|
+
onMouseOut: _handleMouseOut,
|
|
694
|
+
onFocus: (event)=>_handleFocus(event, lineId, x2, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData),
|
|
695
|
+
onBlur: _handleMouseOut,
|
|
696
|
+
..._getClickHandler(_points[i].data[j].onDataPointClick),
|
|
697
|
+
opacity: isLegendSelected && !lastPointHidden ? 1 : 0.01,
|
|
698
|
+
fill: _getPointFill(lineColor, lastCircleId, j, true),
|
|
699
|
+
stroke: lineColor,
|
|
700
|
+
strokeWidth: strokeWidth,
|
|
701
|
+
role: "img",
|
|
702
|
+
"aria-label": _getAriaLabel(i, j),
|
|
703
|
+
tabIndex: isLegendSelected ? 0 : undefined
|
|
704
|
+
}), /*#__PURE__*/ _react.createElement("circle", {
|
|
705
|
+
id: hiddenHoverCircleId,
|
|
706
|
+
key: hiddenHoverCircleId,
|
|
707
|
+
r: 8,
|
|
708
|
+
cx: xPoint2,
|
|
709
|
+
cy: yPoint2,
|
|
710
|
+
opacity: 0,
|
|
711
|
+
width: 0,
|
|
712
|
+
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
713
|
+
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
714
|
+
onMouseOut: _handleMouseOut,
|
|
715
|
+
strokeWidth: 0,
|
|
716
|
+
focusable: false,
|
|
717
|
+
onBlur: _handleMouseOut
|
|
718
|
+
})));
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
if ((0, _index1.isPlottable)(xPoint1, yPoint1) && (0, _index1.isPlottable)(xPoint2, yPoint2) && (!_hasMarkersMode || ((_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('lines')))) {
|
|
710
722
|
if (isLegendSelected) {
|
|
711
723
|
// don't draw line if it is in a gap
|
|
712
724
|
if (!isInGap) {
|
|
@@ -718,10 +730,10 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
718
730
|
bordersForLine.push(/*#__PURE__*/ _react.createElement("line", {
|
|
719
731
|
id: borderId,
|
|
720
732
|
key: borderId,
|
|
721
|
-
x1:
|
|
722
|
-
y1:
|
|
723
|
-
x2:
|
|
724
|
-
y2:
|
|
733
|
+
x1: xPoint1,
|
|
734
|
+
y1: yPoint1,
|
|
735
|
+
x2: xPoint2,
|
|
736
|
+
y2: yPoint2,
|
|
725
737
|
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',
|
|
726
738
|
strokeWidth: Number.parseFloat(strokeWidth.toString()) + lineBorderWidth,
|
|
727
739
|
stroke: ((_points_i_lineOptions19 = _points[i].lineOptions) === null || _points_i_lineOptions19 === void 0 ? void 0 : _points_i_lineOptions19.lineBorderColor) || _reacttheme.tokens.colorNeutralBackground1,
|
|
@@ -732,10 +744,10 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
732
744
|
linesForLine.push(/*#__PURE__*/ _react.createElement("line", {
|
|
733
745
|
id: lineId,
|
|
734
746
|
key: lineId,
|
|
735
|
-
x1:
|
|
736
|
-
y1:
|
|
737
|
-
x2:
|
|
738
|
-
y2:
|
|
747
|
+
x1: xPoint1,
|
|
748
|
+
y1: yPoint1,
|
|
749
|
+
x2: xPoint2,
|
|
750
|
+
y2: yPoint2,
|
|
739
751
|
strokeWidth: strokeWidth,
|
|
740
752
|
ref: (e)=>{
|
|
741
753
|
_refCallback(e, lineId);
|
|
@@ -758,10 +770,10 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
758
770
|
linesForLine.push(/*#__PURE__*/ _react.createElement("line", {
|
|
759
771
|
id: lineId,
|
|
760
772
|
key: lineId,
|
|
761
|
-
x1:
|
|
762
|
-
y1:
|
|
763
|
-
x2:
|
|
764
|
-
y2:
|
|
773
|
+
x1: xPoint1,
|
|
774
|
+
y1: yPoint1,
|
|
775
|
+
x2: xPoint2,
|
|
776
|
+
y2: yPoint2,
|
|
765
777
|
strokeWidth: strokeWidth,
|
|
766
778
|
stroke: lineColor,
|
|
767
779
|
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',
|
|
@@ -776,16 +788,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
776
788
|
}
|
|
777
789
|
if (_isScatterPolar) {
|
|
778
790
|
var _points_i;
|
|
779
|
-
// Render category labels for all series at once to avoid overlap
|
|
780
|
-
const allSeriesData = _points.map((series)=>({
|
|
781
|
-
data: series.data.filter((pt)=>typeof pt.x === 'number' && typeof pt.y === 'number').map((pt)=>({
|
|
782
|
-
x: pt.x,
|
|
783
|
-
y: pt.y,
|
|
784
|
-
text: pt.text
|
|
785
|
-
}))
|
|
786
|
-
}));
|
|
787
791
|
pointsForLine.push(...(0, _scatterpolarutils.renderScatterPolarCategoryLabels)({
|
|
788
|
-
allSeriesData,
|
|
789
792
|
xAxisScale: _xAxisScale,
|
|
790
793
|
yAxisScale: yScale,
|
|
791
794
|
className: classes.markerLabel || '',
|
|
@@ -1143,67 +1146,9 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
1143
1146
|
const yValue = point.yAxisCalloutData || point.y;
|
|
1144
1147
|
return ((_point_callOutAccessibilityData = point.callOutAccessibilityData) === null || _point_callOutAccessibilityData === void 0 ? void 0 : _point_callOutAccessibilityData.ariaLabel) || `${xValue}. ${legend}, ${yValue}.`;
|
|
1145
1148
|
}
|
|
1146
|
-
function _getDomainNRangeValuesOfDateWithPadding(points, margins, width, isRTL, tickValues = [], chartType, barWidth) {
|
|
1147
|
-
_setXMinMaxValues(points);
|
|
1148
|
-
// Include tickValues if present
|
|
1149
|
-
const sDate = tickValues && tickValues.length > 0 ? (0, _d3array.min)([
|
|
1150
|
-
...tickValues,
|
|
1151
|
-
new Date(_xMin)
|
|
1152
|
-
]) : new Date(_xMin);
|
|
1153
|
-
const lDate = tickValues && tickValues.length > 0 ? (0, _d3array.max)([
|
|
1154
|
-
...tickValues,
|
|
1155
|
-
new Date(_xMax)
|
|
1156
|
-
]) : new Date(_xMax);
|
|
1157
|
-
// Calculate time-based padding (e.g. 10% of the date range)
|
|
1158
|
-
const dateRange = lDate.getTime() - sDate.getTime();
|
|
1159
|
-
const datePadding = _hasMarkersMode ? dateRange * 0.1 : 0;
|
|
1160
|
-
const paddedSDate = new Date(sDate.getTime() - datePadding);
|
|
1161
|
-
const paddedLDate = new Date(lDate.getTime() + datePadding);
|
|
1162
|
-
const rStartValue = margins.left;
|
|
1163
|
-
const rEndValue = width - margins.right;
|
|
1164
|
-
return isRTL ? {
|
|
1165
|
-
dStartValue: paddedLDate,
|
|
1166
|
-
dEndValue: paddedSDate,
|
|
1167
|
-
rStartValue,
|
|
1168
|
-
rEndValue
|
|
1169
|
-
} : {
|
|
1170
|
-
dStartValue: paddedSDate,
|
|
1171
|
-
dEndValue: paddedLDate,
|
|
1172
|
-
rStartValue,
|
|
1173
|
-
rEndValue
|
|
1174
|
-
};
|
|
1175
|
-
}
|
|
1176
|
-
function _getDomainNRangeValuesWithPadding(points, margins, width, isRTL) {
|
|
1177
|
-
_setXMinMaxValues(points);
|
|
1178
|
-
if (_hasMarkersMode) {
|
|
1179
|
-
_xPadding = (_xMax - _xMin) * 0.1;
|
|
1180
|
-
}
|
|
1181
|
-
const rStartValue = margins.left;
|
|
1182
|
-
const rEndValue = width - margins.right;
|
|
1183
|
-
return isRTL ? {
|
|
1184
|
-
dStartValue: _xMax + _xPadding,
|
|
1185
|
-
dEndValue: _xMin - _xPadding,
|
|
1186
|
-
rStartValue,
|
|
1187
|
-
rEndValue
|
|
1188
|
-
} : {
|
|
1189
|
-
dStartValue: _xMin - _xPadding,
|
|
1190
|
-
dEndValue: _xMax + _xPadding,
|
|
1191
|
-
rStartValue,
|
|
1192
|
-
rEndValue
|
|
1193
|
-
};
|
|
1194
|
-
}
|
|
1195
1149
|
function _isChartEmpty() {
|
|
1196
1150
|
return !(props.data && props.data.lineChartData && props.data.lineChartData.length > 0 && props.data.lineChartData.filter((item)=>item.data.length).length > 0);
|
|
1197
1151
|
}
|
|
1198
|
-
function _setXMinMaxValues(points) {
|
|
1199
|
-
const getX = (item)=>_isXAxisDateType ? item.x : item.x;
|
|
1200
|
-
const minVal = (0, _d3array.min)(points, (point)=>(0, _d3array.min)(point.data, getX));
|
|
1201
|
-
const maxVal = (0, _d3array.max)(points, (point)=>(0, _d3array.max)(point.data, getX));
|
|
1202
|
-
_xMin = _isXAxisDateType ? minVal.getTime() : minVal;
|
|
1203
|
-
_xMax = _isXAxisDateType ? maxVal.getTime() : maxVal;
|
|
1204
|
-
_xMin = _xMin === Number.NEGATIVE_INFINITY || !_xMin ? 0 : _xMin;
|
|
1205
|
-
_xMax = _xMax === Number.POSITIVE_INFINITY || !_xMax ? 0 : _xMax;
|
|
1206
|
-
}
|
|
1207
1152
|
const { legendProps, tickValues, tickFormat, eventAnnotationProps } = props;
|
|
1208
1153
|
_points = _injectIndexPropertyInLineChartData(props.data.lineChartData);
|
|
1209
1154
|
_isXAxisDateType = (0, _index1.getXAxisType)(_points);
|