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