@fluentui/react-charts 0.0.0-nightly-20250826-2140.1 → 0.0.0-nightly-20250827-0407.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 +48 -15
- package/dist/index.d.ts +15 -1
- package/lib/components/AreaChart/AreaChart.js +4 -1
- 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 +3 -15
- package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
- package/lib/components/ChartTable/ChartTable.js +87 -6
- package/lib/components/ChartTable/ChartTable.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 +17 -14
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +6 -33
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +42 -16
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +20 -1
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +493 -259
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.js +6 -1
- 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 +21 -4
- package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
- package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js +8 -4
- package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +23 -4
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +4 -17
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +4 -21
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib/components/HeatMapChart/HeatMapChart.js +175 -114
- package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +26 -6
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib/components/LineChart/LineChart.js +137 -82
- package/lib/components/LineChart/LineChart.js.map +1 -1
- package/lib/components/LineChart/LineChart.types.js.map +1 -1
- package/lib/components/LineChart/useLineChartStyles.styles.js +23 -10
- package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -1
- package/lib/components/LineChart/useLineChartStyles.styles.raw.js +4 -21
- package/lib/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +12 -25
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js +2 -12
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.js +95 -59
- 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 +27 -7
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js +8 -14
- package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.js +27 -4
- package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +8 -6
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +5 -19
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +61 -44
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +7 -6
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +4 -19
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
- package/lib/utilities/Common.styles.js +47 -0
- package/lib/utilities/Common.styles.js.map +1 -0
- package/lib/utilities/Common.styles.raw.js +47 -0
- package/lib/utilities/Common.styles.raw.js.map +1 -0
- package/lib/utilities/SVGTooltipText.js.map +1 -1
- package/lib/utilities/index.js +1 -0
- package/lib/utilities/index.js.map +1 -1
- package/lib/utilities/scatterpolar-utils.js +63 -0
- package/lib/utilities/scatterpolar-utils.js.map +1 -0
- package/lib/utilities/utilities.js +32 -37
- package/lib/utilities/utilities.js.map +1 -1
- package/lib-commonjs/components/AreaChart/AreaChart.js +4 -1
- 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 +2 -14
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/ChartTable/ChartTable.js +87 -6
- package/lib-commonjs/components/ChartTable/ChartTable.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 +15 -13
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +4 -32
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +41 -15
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +23 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +500 -257
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.js +6 -1
- 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 +32 -4
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js +8 -4
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +22 -3
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +2 -19
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +3 -20
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +174 -113
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +25 -5
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.js +136 -81
- package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.types.js.map +1 -1
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +30 -9
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js +2 -20
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +23 -33
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js +1 -12
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.js +94 -58
- 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 +37 -5
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js +7 -13
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +26 -3
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +5 -3
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +3 -17
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +60 -43
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +5 -3
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +3 -18
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/utilities/Common.styles.js +71 -0
- package/lib-commonjs/utilities/Common.styles.js.map +1 -0
- package/lib-commonjs/utilities/Common.styles.raw.js +71 -0
- package/lib-commonjs/utilities/Common.styles.raw.js.map +1 -0
- package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -1
- package/lib-commonjs/utilities/index.js +1 -0
- package/lib-commonjs/utilities/index.js.map +1 -1
- package/lib-commonjs/utilities/scatterpolar-utils.js +78 -0
- package/lib-commonjs/utilities/scatterpolar-utils.js.map +1 -0
- package/lib-commonjs/utilities/utilities.js +28 -40
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +12 -12
|
@@ -10,8 +10,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, domainRangeOfDateForAreaLineVerticalBarChart, domainRangeOfNumericForAreaChart, createStringYAxis, useRtl, formatDate, getCurveFactory } from '../../utilities/index';
|
|
13
|
+
import { calloutData, ChartTypes, getXAxisType, XAxisTypes, tooltipOfAxislabels, Points, pointTypes, getTypeOfAxis, getNextColor, getColorFromToken, findNumericMinMaxOfY, createNumericYAxis, domainRangeOfDateForAreaLineVerticalBarChart, domainRangeOfNumericForAreaChart, createStringYAxis, useRtl, formatDate, getCurveFactory, isScatterPolarSeries } from '../../utilities/index';
|
|
14
14
|
import { toImage } from '../../utilities/image-export-utils';
|
|
15
|
+
import { renderScatterPolarCategoryLabels } from '../../utilities/scatterpolar-utils';
|
|
15
16
|
var PointSize = /*#__PURE__*/ function(PointSize) {
|
|
16
17
|
PointSize[PointSize["hoverSize"] = 11] = "hoverSize";
|
|
17
18
|
PointSize[PointSize["invisibleSize"] = 1] = "invisibleSize";
|
|
@@ -91,6 +92,8 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
91
92
|
*/ export const LineChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
92
93
|
var _props_legendProps_selectedLegends, _props_legendProps;
|
|
93
94
|
let _hasMarkersMode = false;
|
|
95
|
+
let _isXAxisDateType = false;
|
|
96
|
+
let _isScatterPolar = false;
|
|
94
97
|
let _points = _injectIndexPropertyInLineChartData(props.data.lineChartData);
|
|
95
98
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
96
99
|
let _calloutPoints = calloutData(_points) || [];
|
|
@@ -144,6 +147,9 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
144
147
|
y: 0
|
|
145
148
|
});
|
|
146
149
|
const [isPopoverOpen, setPopoverOpen] = React.useState(false);
|
|
150
|
+
const [YValue, setYValue] = React.useState('');
|
|
151
|
+
const [legendVal, setLegendVal] = React.useState('');
|
|
152
|
+
const [lineColor, setLineColor] = React.useState('');
|
|
147
153
|
const pointsRef = React.useRef([]);
|
|
148
154
|
const calloutPointsRef = React.useRef([]);
|
|
149
155
|
const classes = useLineChartStyles(props);
|
|
@@ -202,6 +208,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
202
208
|
var _item_lineOptions_mode_includes, _item_lineOptions_mode, _item_lineOptions;
|
|
203
209
|
return (_item_lineOptions = item.lineOptions) === null || _item_lineOptions === void 0 ? void 0 : (_item_lineOptions_mode = _item_lineOptions.mode) === null || _item_lineOptions_mode === void 0 ? void 0 : (_item_lineOptions_mode_includes = _item_lineOptions_mode.includes) === null || _item_lineOptions_mode_includes === void 0 ? void 0 : _item_lineOptions_mode_includes.call(_item_lineOptions_mode, 'markers');
|
|
204
210
|
})) !== null && _filteredData_some !== void 0 ? _filteredData_some : false;
|
|
211
|
+
_isScatterPolar = isScatterPolarSeries(filteredData);
|
|
205
212
|
return filteredData ? filteredData.map((item, index)=>{
|
|
206
213
|
let color;
|
|
207
214
|
if (typeof item.color === 'undefined') {
|
|
@@ -432,13 +439,18 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
432
439
|
const verticaLineHeight = containerHeight - margins.bottom + 6;
|
|
433
440
|
const yScale = _points[i].useSecondaryYScale && _yScaleSecondary ? _yScaleSecondary : _yScalePrimary;
|
|
434
441
|
if (_points[i].data.length === 1) {
|
|
442
|
+
var _points_i_lineOptions_mode, _points_i_lineOptions1;
|
|
435
443
|
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
436
444
|
const { x: x1, y: y1, xAxisCalloutData, xAxisCalloutAccessibilityData } = _points[i].data[0];
|
|
437
445
|
const circleId = `${_circleId}_${i}`;
|
|
438
446
|
const isLegendSelected = _legendHighlighted(legendVal) || _noLegendHighlighted() || isSelectedLegend;
|
|
439
447
|
const currentMarkerSize = _points[i].data[0].markerSize;
|
|
448
|
+
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');
|
|
449
|
+
const text = _points[i].data[0].text;
|
|
440
450
|
var _points_i_data__text;
|
|
441
|
-
pointsForLine.push(/*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(
|
|
451
|
+
pointsForLine.push(/*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(React.Fragment, {
|
|
452
|
+
key: `${circleId}_fragment`
|
|
453
|
+
}, /*#__PURE__*/ React.createElement("circle", {
|
|
442
454
|
id: circleId,
|
|
443
455
|
key: circleId,
|
|
444
456
|
r: currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : activePoint === circleId ? 5.5 : 3.5,
|
|
@@ -447,8 +459,8 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
447
459
|
fill: activePoint === circleId ? tokens.colorNeutralBackground1 : lineColor,
|
|
448
460
|
opacity: isLegendSelected ? 1 : 0.1,
|
|
449
461
|
tabIndex: isLegendSelected ? 0 : undefined,
|
|
450
|
-
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
451
|
-
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
462
|
+
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
463
|
+
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
452
464
|
onMouseOut: _handleMouseOut,
|
|
453
465
|
strokeWidth: activePoint === circleId ? DEFAULT_LINE_STROKE_SIZE : 0,
|
|
454
466
|
stroke: activePoint === circleId ? lineColor : '',
|
|
@@ -461,13 +473,13 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
461
473
|
onFocus: (event)=>_handleFocus(event, circleId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData),
|
|
462
474
|
onBlur: _handleMouseOut,
|
|
463
475
|
..._getClickHandler(_points[i].data[0].onDataPointClick)
|
|
464
|
-
}),
|
|
476
|
+
}), !_isScatterPolar && supportsTextMode && text && /*#__PURE__*/ React.createElement("text", {
|
|
465
477
|
key: `${circleId}-label`,
|
|
466
478
|
x: _xAxisScale(x1),
|
|
467
479
|
y: yScale(y1) + Math.max(currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 3.5, 4) + 12,
|
|
468
480
|
className: classes.markerLabel,
|
|
469
481
|
opacity: isLegendSelected ? 1 : 0.1
|
|
470
|
-
},
|
|
482
|
+
}, text))));
|
|
471
483
|
}
|
|
472
484
|
let gapIndex = 0;
|
|
473
485
|
var _points_i_gaps_sort;
|
|
@@ -475,13 +487,13 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
475
487
|
const lineCurve = (_points_i_lineOptions = _points[i].lineOptions) === null || _points_i_lineOptions === void 0 ? void 0 : _points_i_lineOptions.curve;
|
|
476
488
|
// Use path rendering technique for larger datasets to optimize performance.
|
|
477
489
|
if ((props.optimizeLargeData || lineCurve) && _points[i].data.length > 1) {
|
|
478
|
-
var
|
|
490
|
+
var _points_i_lineOptions2;
|
|
479
491
|
const line = d3Line()// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
480
492
|
.x((d)=>_xAxisScale(d[0]))// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
481
493
|
.y((d)=>yScale(d[1])).curve(getCurveFactory(lineCurve));
|
|
482
494
|
const lineId = `${_lineId}_${i}`;
|
|
483
495
|
const borderId = `${_borderId}_${i}`;
|
|
484
|
-
const strokeWidth = ((
|
|
496
|
+
const strokeWidth = ((_points_i_lineOptions2 = _points[i].lineOptions) === null || _points_i_lineOptions2 === void 0 ? void 0 : _points_i_lineOptions2.strokeWidth) || props.strokeWidth || DEFAULT_LINE_STROKE_SIZE;
|
|
485
497
|
const isLegendSelected = _legendHighlighted(legendVal) || _noLegendHighlighted() || isSelectedLegend;
|
|
486
498
|
const lineData = [];
|
|
487
499
|
for(let k = 0; k < _points[i].data.length; k++){
|
|
@@ -491,19 +503,19 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
491
503
|
]);
|
|
492
504
|
}
|
|
493
505
|
if (isLegendSelected) {
|
|
494
|
-
var
|
|
495
|
-
const lineBorderWidth = ((
|
|
506
|
+
var _points_i_lineOptions3, _points_i_lineOptions4;
|
|
507
|
+
const lineBorderWidth = ((_points_i_lineOptions3 = _points[i].lineOptions) === null || _points_i_lineOptions3 === void 0 ? void 0 : _points_i_lineOptions3.lineBorderWidth) ? Number.parseFloat(_points[i].lineOptions.lineBorderWidth.toString()) : 0;
|
|
496
508
|
if (lineBorderWidth > 0) {
|
|
497
|
-
var
|
|
509
|
+
var _points_i_lineOptions5, _points_i_lineOptions6;
|
|
498
510
|
var _points_i_lineOptions_strokeLinecap;
|
|
499
511
|
bordersForLine.push(/*#__PURE__*/ React.createElement("path", {
|
|
500
512
|
id: borderId,
|
|
501
513
|
key: borderId,
|
|
502
514
|
d: line(lineData),
|
|
503
515
|
fill: "transparent",
|
|
504
|
-
strokeLinecap: (_points_i_lineOptions_strokeLinecap = (
|
|
516
|
+
strokeLinecap: (_points_i_lineOptions_strokeLinecap = (_points_i_lineOptions5 = _points[i].lineOptions) === null || _points_i_lineOptions5 === void 0 ? void 0 : _points_i_lineOptions5.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap !== void 0 ? _points_i_lineOptions_strokeLinecap : 'round',
|
|
505
517
|
strokeWidth: Number.parseFloat(strokeWidth.toString()) + lineBorderWidth,
|
|
506
|
-
stroke: ((
|
|
518
|
+
stroke: ((_points_i_lineOptions6 = _points[i].lineOptions) === null || _points_i_lineOptions6 === void 0 ? void 0 : _points_i_lineOptions6.lineBorderColor) || tokens.colorNeutralBackground1,
|
|
507
519
|
opacity: 1
|
|
508
520
|
}));
|
|
509
521
|
}
|
|
@@ -516,7 +528,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
516
528
|
"data-is-focusable": true,
|
|
517
529
|
stroke: lineColor,
|
|
518
530
|
strokeWidth: strokeWidth,
|
|
519
|
-
strokeLinecap: (_points_i_lineOptions_strokeLinecap1 = (
|
|
531
|
+
strokeLinecap: (_points_i_lineOptions_strokeLinecap1 = (_points_i_lineOptions4 = _points[i].lineOptions) === null || _points_i_lineOptions4 === void 0 ? void 0 : _points_i_lineOptions4.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap1 !== void 0 ? _points_i_lineOptions_strokeLinecap1 : 'round',
|
|
520
532
|
onMouseMove: (event)=>_onMouseOverLargeDataset.bind(i, verticaLineHeight, event, yScale),
|
|
521
533
|
onMouseOver: (event)=>_onMouseOverLargeDataset.bind(i, verticaLineHeight, event, yScale),
|
|
522
534
|
onMouseOut: _handleMouseOut,
|
|
@@ -525,7 +537,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
525
537
|
tabIndex: isLegendSelected ? 0 : undefined
|
|
526
538
|
}));
|
|
527
539
|
} else {
|
|
528
|
-
var
|
|
540
|
+
var _points_i_lineOptions7;
|
|
529
541
|
var _points_i_lineOptions_strokeLinecap2;
|
|
530
542
|
linesForLine.push(/*#__PURE__*/ React.createElement("path", {
|
|
531
543
|
id: lineId,
|
|
@@ -535,7 +547,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
535
547
|
"data-is-focusable": false,
|
|
536
548
|
stroke: lineColor,
|
|
537
549
|
strokeWidth: strokeWidth,
|
|
538
|
-
strokeLinecap: (_points_i_lineOptions_strokeLinecap2 = (
|
|
550
|
+
strokeLinecap: (_points_i_lineOptions_strokeLinecap2 = (_points_i_lineOptions7 = _points[i].lineOptions) === null || _points_i_lineOptions7 === void 0 ? void 0 : _points_i_lineOptions7.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap2 !== void 0 ? _points_i_lineOptions_strokeLinecap2 : 'round',
|
|
539
551
|
opacity: 0.1
|
|
540
552
|
}));
|
|
541
553
|
}
|
|
@@ -555,7 +567,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
555
567
|
}));
|
|
556
568
|
} else if (!props.optimizeLargeData) {
|
|
557
569
|
for(let j = 1; j < _points[i].data.length; j++){
|
|
558
|
-
var
|
|
570
|
+
var _points_i_lineOptions8, _points_i_lineOptions_mode1, _points_i_lineOptions9, _points_i_lineOptions_mode2, _points_i_lineOptions10, _points_i_lineOptions_mode3, _points_i_lineOptions11;
|
|
559
571
|
const gapResult = _checkInGap(j, gaps, gapIndex);
|
|
560
572
|
const isInGap = gapResult.isInGap;
|
|
561
573
|
gapIndex = gapResult.gapIndex;
|
|
@@ -565,20 +577,22 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
565
577
|
const { x: x1, y: y1, xAxisCalloutData, xAxisCalloutAccessibilityData } = _points[i].data[j - 1];
|
|
566
578
|
const { x: x2, y: y2 } = _points[i].data[j];
|
|
567
579
|
let path = _getPath(_xAxisScale(x1), yScale(y1), circleId, j, false, _points[i].index);
|
|
568
|
-
const strokeWidth = ((
|
|
580
|
+
const strokeWidth = ((_points_i_lineOptions8 = _points[i].lineOptions) === null || _points_i_lineOptions8 === void 0 ? void 0 : _points_i_lineOptions8.strokeWidth) || props.strokeWidth || DEFAULT_LINE_STROKE_SIZE;
|
|
569
581
|
const isLegendSelected = _legendHighlighted(legendVal) || _noLegendHighlighted() || isSelectedLegend;
|
|
570
582
|
const currentPointHidden = _points[i].hideNonActiveDots && activePoint !== circleId;
|
|
583
|
+
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
|
+
const text = _points[i].data[j - 1].text;
|
|
571
585
|
let currentMarkerSize = _points[i].data[j - 1].markerSize;
|
|
572
586
|
var _points_i_data__text1;
|
|
573
|
-
pointsForLine.push(((
|
|
587
|
+
pointsForLine.push(((_points_i_lineOptions10 = _points[i].lineOptions) === null || _points_i_lineOptions10 === void 0 ? void 0 : (_points_i_lineOptions_mode2 = _points_i_lineOptions10.mode) === null || _points_i_lineOptions_mode2 === void 0 ? void 0 : _points_i_lineOptions_mode2.includes('markers')) || supportsTextMode ? /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("circle", {
|
|
574
588
|
id: circleId,
|
|
575
589
|
key: circleId,
|
|
576
590
|
r: currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 4,
|
|
577
591
|
cx: _xAxisScale(x1),
|
|
578
592
|
cy: yScale(y1),
|
|
579
593
|
"data-is-focusable": isLegendSelected,
|
|
580
|
-
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
581
|
-
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
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),
|
|
582
596
|
onMouseOut: _handleMouseOut,
|
|
583
597
|
onFocus: (event)=>_handleFocus(event, lineId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData),
|
|
584
598
|
onBlur: _handleMouseOut,
|
|
@@ -589,19 +603,19 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
589
603
|
strokeWidth: strokeWidth,
|
|
590
604
|
role: "img",
|
|
591
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)
|
|
592
|
-
}),
|
|
606
|
+
}), !_isScatterPolar && supportsTextMode && text && /*#__PURE__*/ React.createElement("text", {
|
|
593
607
|
key: `${circleId}-label`,
|
|
594
608
|
x: _xAxisScale(x1),
|
|
595
|
-
y: yScale(y1) + 12,
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
},
|
|
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", {
|
|
599
613
|
id: circleId,
|
|
600
614
|
key: circleId,
|
|
601
615
|
d: path,
|
|
602
616
|
"data-is-focusable": isLegendSelected,
|
|
603
|
-
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
604
|
-
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
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),
|
|
605
619
|
onMouseOut: _handleMouseOut,
|
|
606
620
|
onFocus: (event)=>_handleFocus(event, lineId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData),
|
|
607
621
|
onBlur: _handleMouseOut,
|
|
@@ -615,7 +629,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
615
629
|
tabIndex: isLegendSelected ? 0 : undefined
|
|
616
630
|
}));
|
|
617
631
|
if (j + 1 === _points[i].data.length) {
|
|
618
|
-
var
|
|
632
|
+
var _points_i_lineOptions_mode4, _points_i_lineOptions12, _points_i_lineOptions_mode5, _points_i_lineOptions13;
|
|
619
633
|
// If this is last point of the line segment.
|
|
620
634
|
const lastCircleId = `${circleId}${j}L`;
|
|
621
635
|
const hiddenHoverCircleId = `${circleId}${j}D`;
|
|
@@ -623,18 +637,20 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
623
637
|
path = _getPath(_xAxisScale(x2), yScale(y2), lastCircleId, j, true, _points[i].index);
|
|
624
638
|
const { xAxisCalloutData: lastCirlceXCallout, xAxisCalloutAccessibilityData: lastCirlceXCalloutAccessibilityData } = _points[i].data[j];
|
|
625
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;
|
|
626
642
|
var _points_i_data_j_text;
|
|
627
643
|
pointsForLine.push(/*#__PURE__*/ React.createElement(React.Fragment, {
|
|
628
644
|
key: `${lastCircleId}_container`
|
|
629
|
-
}, ((
|
|
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", {
|
|
630
646
|
id: lastCircleId,
|
|
631
647
|
key: lastCircleId,
|
|
632
648
|
r: currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 4,
|
|
633
649
|
cx: _xAxisScale(x2),
|
|
634
650
|
cy: yScale(y2),
|
|
635
651
|
"data-is-focusable": isLegendSelected,
|
|
636
|
-
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale),
|
|
637
|
-
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale),
|
|
652
|
+
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
653
|
+
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
638
654
|
onMouseOut: _handleMouseOut,
|
|
639
655
|
onFocus: (event)=>_handleFocus(event, lineId, x2, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData),
|
|
640
656
|
onBlur: _handleMouseOut,
|
|
@@ -645,19 +661,18 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
645
661
|
strokeWidth: strokeWidth,
|
|
646
662
|
role: "img",
|
|
647
663
|
"aria-label": (_points_i_data_j_text = _points[i].data[j].text) !== null && _points_i_data_j_text !== void 0 ? _points_i_data_j_text : _getAriaLabel(i, j)
|
|
648
|
-
}),
|
|
664
|
+
}), !_isScatterPolar && lastSupportsTextMode && lastText && /*#__PURE__*/ React.createElement("text", {
|
|
649
665
|
key: `${lastCircleId}-label`,
|
|
650
666
|
x: _xAxisScale(x2),
|
|
651
|
-
y: yScale(y2) + 12,
|
|
652
|
-
fontSize: 12,
|
|
667
|
+
y: yScale(y2) + Math.max(currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 4, 4) + 12,
|
|
653
668
|
className: classes.markerLabel
|
|
654
|
-
},
|
|
669
|
+
}, text)) : /*#__PURE__*/ React.createElement("path", {
|
|
655
670
|
id: lastCircleId,
|
|
656
671
|
key: lastCircleId,
|
|
657
672
|
d: path,
|
|
658
673
|
"data-is-focusable": isLegendSelected,
|
|
659
|
-
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale),
|
|
660
|
-
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale),
|
|
674
|
+
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
675
|
+
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
661
676
|
onMouseOut: _handleMouseOut,
|
|
662
677
|
onFocus: (event)=>_handleFocus(event, lineId, x2, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData),
|
|
663
678
|
onBlur: _handleMouseOut,
|
|
@@ -677,8 +692,8 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
677
692
|
cy: yScale(y2),
|
|
678
693
|
opacity: 0,
|
|
679
694
|
width: 0,
|
|
680
|
-
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale),
|
|
681
|
-
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale),
|
|
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),
|
|
682
697
|
onFocus: (event)=>_handleFocus(event, circleId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData),
|
|
683
698
|
onMouseOut: _handleMouseOut,
|
|
684
699
|
strokeWidth: 0,
|
|
@@ -686,14 +701,14 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
686
701
|
onBlur: _handleMouseOut
|
|
687
702
|
})));
|
|
688
703
|
}
|
|
689
|
-
if (!_hasMarkersMode || ((
|
|
704
|
+
if (!_hasMarkersMode || ((_points_i_lineOptions11 = _points[i].lineOptions) === null || _points_i_lineOptions11 === void 0 ? void 0 : (_points_i_lineOptions_mode3 = _points_i_lineOptions11.mode) === null || _points_i_lineOptions_mode3 === void 0 ? void 0 : _points_i_lineOptions_mode3.includes('lines'))) {
|
|
690
705
|
if (isLegendSelected) {
|
|
691
706
|
// don't draw line if it is in a gap
|
|
692
707
|
if (!isInGap) {
|
|
693
|
-
var
|
|
694
|
-
const lineBorderWidth = ((
|
|
708
|
+
var _points_i_lineOptions14, _points_i_lineOptions15, _points_i_lineOptions16, _points_i_lineOptions17;
|
|
709
|
+
const lineBorderWidth = ((_points_i_lineOptions14 = _points[i].lineOptions) === null || _points_i_lineOptions14 === void 0 ? void 0 : _points_i_lineOptions14.lineBorderWidth) ? Number.parseFloat(_points[i].lineOptions.lineBorderWidth.toString()) : 0;
|
|
695
710
|
if (lineBorderWidth > 0) {
|
|
696
|
-
var
|
|
711
|
+
var _points_i_lineOptions18, _points_i_lineOptions19;
|
|
697
712
|
var _points_i_lineOptions_strokeLinecap3;
|
|
698
713
|
bordersForLine.push(/*#__PURE__*/ React.createElement("line", {
|
|
699
714
|
id: borderId,
|
|
@@ -702,9 +717,9 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
702
717
|
y1: yScale(y1),
|
|
703
718
|
x2: _xAxisScale(x2),
|
|
704
719
|
y2: yScale(y2),
|
|
705
|
-
strokeLinecap: (_points_i_lineOptions_strokeLinecap3 = (
|
|
720
|
+
strokeLinecap: (_points_i_lineOptions_strokeLinecap3 = (_points_i_lineOptions18 = _points[i].lineOptions) === null || _points_i_lineOptions18 === void 0 ? void 0 : _points_i_lineOptions18.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap3 !== void 0 ? _points_i_lineOptions_strokeLinecap3 : 'round',
|
|
706
721
|
strokeWidth: Number.parseFloat(strokeWidth.toString()) + lineBorderWidth,
|
|
707
|
-
stroke: ((
|
|
722
|
+
stroke: ((_points_i_lineOptions19 = _points[i].lineOptions) === null || _points_i_lineOptions19 === void 0 ? void 0 : _points_i_lineOptions19.lineBorderColor) || tokens.colorNeutralBackground1,
|
|
708
723
|
opacity: 1
|
|
709
724
|
}));
|
|
710
725
|
}
|
|
@@ -720,20 +735,20 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
720
735
|
ref: (e)=>{
|
|
721
736
|
_refCallback(e, lineId);
|
|
722
737
|
},
|
|
723
|
-
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
724
|
-
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
738
|
+
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
739
|
+
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
725
740
|
onMouseOut: _handleMouseOut,
|
|
726
741
|
stroke: lineColor,
|
|
727
|
-
strokeLinecap: (_points_i_lineOptions_strokeLinecap4 = (
|
|
728
|
-
strokeDasharray: (
|
|
729
|
-
strokeDashoffset: (
|
|
742
|
+
strokeLinecap: (_points_i_lineOptions_strokeLinecap4 = (_points_i_lineOptions15 = _points[i].lineOptions) === null || _points_i_lineOptions15 === void 0 ? void 0 : _points_i_lineOptions15.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap4 !== void 0 ? _points_i_lineOptions_strokeLinecap4 : 'round',
|
|
743
|
+
strokeDasharray: (_points_i_lineOptions16 = _points[i].lineOptions) === null || _points_i_lineOptions16 === void 0 ? void 0 : _points_i_lineOptions16.strokeDasharray,
|
|
744
|
+
strokeDashoffset: (_points_i_lineOptions17 = _points[i].lineOptions) === null || _points_i_lineOptions17 === void 0 ? void 0 : _points_i_lineOptions17.strokeDashoffset,
|
|
730
745
|
opacity: 1,
|
|
731
746
|
..._getClickHandler(_points[i].onLineClick)
|
|
732
747
|
}));
|
|
733
748
|
}
|
|
734
749
|
} else {
|
|
735
750
|
if (!isInGap) {
|
|
736
|
-
var
|
|
751
|
+
var _points_i_lineOptions20, _points_i_lineOptions21, _points_i_lineOptions22;
|
|
737
752
|
var _points_i_lineOptions_strokeLinecap5;
|
|
738
753
|
linesForLine.push(/*#__PURE__*/ React.createElement("line", {
|
|
739
754
|
id: lineId,
|
|
@@ -744,9 +759,9 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
744
759
|
y2: yScale(y2),
|
|
745
760
|
strokeWidth: strokeWidth,
|
|
746
761
|
stroke: lineColor,
|
|
747
|
-
strokeLinecap: (_points_i_lineOptions_strokeLinecap5 = (
|
|
748
|
-
strokeDasharray: (
|
|
749
|
-
strokeDashoffset: (
|
|
762
|
+
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',
|
|
763
|
+
strokeDasharray: (_points_i_lineOptions21 = _points[i].lineOptions) === null || _points_i_lineOptions21 === void 0 ? void 0 : _points_i_lineOptions21.strokeDasharray,
|
|
764
|
+
strokeDashoffset: (_points_i_lineOptions22 = _points[i].lineOptions) === null || _points_i_lineOptions22 === void 0 ? void 0 : _points_i_lineOptions22.strokeDashoffset,
|
|
750
765
|
opacity: 0.1
|
|
751
766
|
}));
|
|
752
767
|
}
|
|
@@ -754,6 +769,24 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
754
769
|
}
|
|
755
770
|
}
|
|
756
771
|
}
|
|
772
|
+
if (_isScatterPolar) {
|
|
773
|
+
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
|
+
pointsForLine.push(...renderScatterPolarCategoryLabels({
|
|
783
|
+
allSeriesData,
|
|
784
|
+
xAxisScale: _xAxisScale,
|
|
785
|
+
yAxisScale: yScale,
|
|
786
|
+
className: classes.markerLabel || '',
|
|
787
|
+
lineOptions: (_points_i = _points[i]) === null || _points_i === void 0 ? void 0 : _points_i.lineOptions
|
|
788
|
+
}));
|
|
789
|
+
}
|
|
757
790
|
lines.push(/*#__PURE__*/ React.createElement("g", {
|
|
758
791
|
key: `line_${i}`,
|
|
759
792
|
role: "region",
|
|
@@ -951,11 +984,24 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
951
984
|
setActivePoint(circleId);
|
|
952
985
|
}
|
|
953
986
|
}
|
|
954
|
-
function _handleHover(x, y, lineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, mouseEvent, yScale) {
|
|
987
|
+
function _handleHover(x, y, lineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, mouseEvent, yScale, legendVal, lineColor) {
|
|
955
988
|
mouseEvent === null || mouseEvent === void 0 ? void 0 : mouseEvent.persist();
|
|
956
989
|
const formattedData = x instanceof Date ? formatDate(x, props.useUTC) : x;
|
|
957
990
|
const xVal = x instanceof Date ? x.getTime() : x;
|
|
991
|
+
const yVal = y instanceof Date ? y.getTime() : y;
|
|
958
992
|
const found = find(_calloutPoints, (element)=>element.x === xVal);
|
|
993
|
+
let hoverDp = undefined;
|
|
994
|
+
if (props.isCalloutForStack === false && (found === null || found === void 0 ? void 0 : found.values)) {
|
|
995
|
+
const dp = find(found.values, (val)=>(val === null || val === void 0 ? void 0 : val.y) === yVal);
|
|
996
|
+
if (dp) {
|
|
997
|
+
hoverDp = {
|
|
998
|
+
x: xVal,
|
|
999
|
+
values: [
|
|
1000
|
+
dp
|
|
1001
|
+
]
|
|
1002
|
+
};
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
959
1005
|
// if no points need to be called out then don't show vertical line and callout card
|
|
960
1006
|
if (found) {
|
|
961
1007
|
d3Select(`#${_verticalLine}`).attr('transform', ()=>`translate(${_xAxisScale(x)}, ${yScale(y)})`).attr('visibility', 'visibility').attr('y2', `${lineHeight - 5 - yScale(y)}`);
|
|
@@ -964,8 +1010,11 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
964
1010
|
updatePosition(mouseEvent.clientX, mouseEvent.clientY);
|
|
965
1011
|
xAxisCalloutData ? setHoverXValue(xAxisCalloutData) : setHoverXValue('' + formattedData);
|
|
966
1012
|
setYValueHover(found.values);
|
|
1013
|
+
setYValue(yVal);
|
|
1014
|
+
setLegendVal(legendVal);
|
|
1015
|
+
setLineColor(lineColor);
|
|
967
1016
|
setStackCalloutProps(found);
|
|
968
|
-
setDataPointCalloutProps(
|
|
1017
|
+
setDataPointCalloutProps(hoverDp);
|
|
969
1018
|
setActivePoint(circleId);
|
|
970
1019
|
setNearestCircleToHighlight(null);
|
|
971
1020
|
}
|
|
@@ -1090,23 +1139,16 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
1090
1139
|
return ((_point_callOutAccessibilityData = point.callOutAccessibilityData) === null || _point_callOutAccessibilityData === void 0 ? void 0 : _point_callOutAccessibilityData.ariaLabel) || `${xValue}. ${legend}, ${yValue}.`;
|
|
1091
1140
|
}
|
|
1092
1141
|
function _getDomainNRangeValuesOfDateWithPadding(points, margins, width, isRTL, tickValues = [], chartType, barWidth) {
|
|
1093
|
-
|
|
1094
|
-
let lDate;
|
|
1095
|
-
sDate = d3Min(points, (point)=>{
|
|
1096
|
-
return d3Min(point.data, (item)=>item.x);
|
|
1097
|
-
});
|
|
1098
|
-
lDate = d3Max(points, (point)=>{
|
|
1099
|
-
return d3Max(point.data, (item)=>item.x);
|
|
1100
|
-
});
|
|
1142
|
+
_setXMinMaxValues(points);
|
|
1101
1143
|
// Include tickValues if present
|
|
1102
|
-
sDate = d3Min([
|
|
1144
|
+
const sDate = tickValues && tickValues.length > 0 ? d3Min([
|
|
1103
1145
|
...tickValues,
|
|
1104
|
-
|
|
1105
|
-
]);
|
|
1106
|
-
lDate = d3Max([
|
|
1146
|
+
new Date(_xMin)
|
|
1147
|
+
]) : new Date(_xMin);
|
|
1148
|
+
const lDate = tickValues && tickValues.length > 0 ? d3Max([
|
|
1107
1149
|
...tickValues,
|
|
1108
|
-
|
|
1109
|
-
]);
|
|
1150
|
+
new Date(_xMax)
|
|
1151
|
+
]) : new Date(_xMax);
|
|
1110
1152
|
// Calculate time-based padding (e.g. 10% of the date range)
|
|
1111
1153
|
const dateRange = lDate.getTime() - sDate.getTime();
|
|
1112
1154
|
const datePadding = _hasMarkersMode ? dateRange * 0.1 : 0;
|
|
@@ -1127,14 +1169,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
1127
1169
|
};
|
|
1128
1170
|
}
|
|
1129
1171
|
function _getDomainNRangeValuesWithPadding(points, margins, width, isRTL) {
|
|
1130
|
-
|
|
1131
|
-
return d3Min(point.data, (item)=>item.x);
|
|
1132
|
-
});
|
|
1133
|
-
_xMax = d3Max(points, (point)=>{
|
|
1134
|
-
return d3Max(point.data, (item)=>{
|
|
1135
|
-
return item.x;
|
|
1136
|
-
});
|
|
1137
|
-
});
|
|
1172
|
+
_setXMinMaxValues(points);
|
|
1138
1173
|
if (_hasMarkersMode) {
|
|
1139
1174
|
_xPadding = (_xMax - _xMin) * 0.1;
|
|
1140
1175
|
}
|
|
@@ -1155,9 +1190,18 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
1155
1190
|
function _isChartEmpty() {
|
|
1156
1191
|
return !(props.data && props.data.lineChartData && props.data.lineChartData.length > 0 && props.data.lineChartData.filter((item)=>item.data.length).length > 0);
|
|
1157
1192
|
}
|
|
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
|
+
}
|
|
1158
1202
|
const { legendProps, tickValues, tickFormat, eventAnnotationProps } = props;
|
|
1159
1203
|
_points = _injectIndexPropertyInLineChartData(props.data.lineChartData);
|
|
1160
|
-
|
|
1204
|
+
_isXAxisDateType = getXAxisType(_points);
|
|
1161
1205
|
let points = _points;
|
|
1162
1206
|
if (legendProps && !!legendProps.canSelectMultipleLegends) {
|
|
1163
1207
|
points = selectedLegendPoints.length >= 1 ? selectedLegendPoints : _points;
|
|
@@ -1174,13 +1218,17 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
1174
1218
|
const calloutProps = {
|
|
1175
1219
|
YValueHover: YValueHover,
|
|
1176
1220
|
hoverXValue: hoverXValue,
|
|
1221
|
+
YValue: YValue,
|
|
1222
|
+
legend: legendVal,
|
|
1223
|
+
color: lineColor,
|
|
1224
|
+
XValue: hoverXValue,
|
|
1177
1225
|
descriptionMessage: props.getCalloutDescriptionMessage && stackCalloutProps ? props.getCalloutDescriptionMessage(stackCalloutProps) : undefined,
|
|
1178
1226
|
'data-is-focusable': true,
|
|
1179
1227
|
xAxisCalloutAccessibilityData: xAxisCalloutAccessibilityData,
|
|
1180
1228
|
...props.calloutProps,
|
|
1181
1229
|
clickPosition: clickPosition,
|
|
1182
1230
|
isPopoverOpen: isPopoverOpen,
|
|
1183
|
-
isCalloutForStack:
|
|
1231
|
+
isCalloutForStack: props.isCalloutForStack,
|
|
1184
1232
|
culture: (_props_culture = props.culture) !== null && _props_culture !== void 0 ? _props_culture : 'en-us',
|
|
1185
1233
|
isCartesian: true,
|
|
1186
1234
|
customCallout: {
|
|
@@ -1204,7 +1252,11 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
1204
1252
|
getmargins: _getMargins,
|
|
1205
1253
|
getMinMaxOfYAxis: _getNumericMinMaxOfY,
|
|
1206
1254
|
getGraphData: _initializeLineChartData,
|
|
1207
|
-
xAxisType:
|
|
1255
|
+
xAxisType: _isXAxisDateType ? XAxisTypes.DateAxis : XAxisTypes.NumericAxis,
|
|
1256
|
+
..._isScatterPolar ? {
|
|
1257
|
+
yMaxValue: 1,
|
|
1258
|
+
yMinValue: -1
|
|
1259
|
+
} : {},
|
|
1208
1260
|
getDomainNRangeValues: _getDomainNRangeValues,
|
|
1209
1261
|
createStringYAxis: createStringYAxis,
|
|
1210
1262
|
onChartMouseLeave: _handleChartMouseLeave,
|
|
@@ -1246,3 +1298,6 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
1246
1298
|
});
|
|
1247
1299
|
});
|
|
1248
1300
|
LineChart.displayName = 'LineChart';
|
|
1301
|
+
LineChart.defaultProps = {
|
|
1302
|
+
isCalloutForStack: true
|
|
1303
|
+
};
|