@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
|
@@ -21,6 +21,7 @@ const _index2 = require("../../index");
|
|
|
21
21
|
const _EventAnnotation = require("./eventAnnotation/EventAnnotation");
|
|
22
22
|
const _reacttheme = require("@fluentui/react-theme");
|
|
23
23
|
const _imageexportutils = require("../../utilities/image-export-utils");
|
|
24
|
+
const _scatterpolarutils = require("../../utilities/scatterpolar-utils");
|
|
24
25
|
var PointSize = /*#__PURE__*/ function(PointSize) {
|
|
25
26
|
PointSize[PointSize["hoverSize"] = 11] = "hoverSize";
|
|
26
27
|
PointSize[PointSize["invisibleSize"] = 1] = "invisibleSize";
|
|
@@ -96,6 +97,8 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
96
97
|
const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
97
98
|
var _props_legendProps_selectedLegends, _props_legendProps;
|
|
98
99
|
let _hasMarkersMode = false;
|
|
100
|
+
let _isXAxisDateType = false;
|
|
101
|
+
let _isScatterPolar = false;
|
|
99
102
|
let _points = _injectIndexPropertyInLineChartData(props.data.lineChartData);
|
|
100
103
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
101
104
|
let _calloutPoints = (0, _index1.calloutData)(_points) || [];
|
|
@@ -149,6 +152,9 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
149
152
|
y: 0
|
|
150
153
|
});
|
|
151
154
|
const [isPopoverOpen, setPopoverOpen] = _react.useState(false);
|
|
155
|
+
const [YValue, setYValue] = _react.useState('');
|
|
156
|
+
const [legendVal, setLegendVal] = _react.useState('');
|
|
157
|
+
const [lineColor, setLineColor] = _react.useState('');
|
|
152
158
|
const pointsRef = _react.useRef([]);
|
|
153
159
|
const calloutPointsRef = _react.useRef([]);
|
|
154
160
|
const classes = (0, _useLineChartStylesstyles.useLineChartStyles)(props);
|
|
@@ -207,6 +213,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
207
213
|
var _item_lineOptions_mode_includes, _item_lineOptions_mode, _item_lineOptions;
|
|
208
214
|
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');
|
|
209
215
|
})) !== null && _filteredData_some !== void 0 ? _filteredData_some : false;
|
|
216
|
+
_isScatterPolar = (0, _index1.isScatterPolarSeries)(filteredData);
|
|
210
217
|
return filteredData ? filteredData.map((item, index)=>{
|
|
211
218
|
let color;
|
|
212
219
|
if (typeof item.color === 'undefined') {
|
|
@@ -437,13 +444,18 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
437
444
|
const verticaLineHeight = containerHeight - margins.bottom + 6;
|
|
438
445
|
const yScale = _points[i].useSecondaryYScale && _yScaleSecondary ? _yScaleSecondary : _yScalePrimary;
|
|
439
446
|
if (_points[i].data.length === 1) {
|
|
447
|
+
var _points_i_lineOptions_mode, _points_i_lineOptions1;
|
|
440
448
|
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
441
449
|
const { x: x1, y: y1, xAxisCalloutData, xAxisCalloutAccessibilityData } = _points[i].data[0];
|
|
442
450
|
const circleId = `${_circleId}_${i}`;
|
|
443
451
|
const isLegendSelected = _legendHighlighted(legendVal) || _noLegendHighlighted() || isSelectedLegend;
|
|
444
452
|
const currentMarkerSize = _points[i].data[0].markerSize;
|
|
453
|
+
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');
|
|
454
|
+
const text = _points[i].data[0].text;
|
|
445
455
|
var _points_i_data__text;
|
|
446
|
-
pointsForLine.push(/*#__PURE__*/ _react.createElement(_react.Fragment, null, /*#__PURE__*/ _react.createElement(
|
|
456
|
+
pointsForLine.push(/*#__PURE__*/ _react.createElement(_react.Fragment, null, /*#__PURE__*/ _react.createElement(_react.Fragment, {
|
|
457
|
+
key: `${circleId}_fragment`
|
|
458
|
+
}, /*#__PURE__*/ _react.createElement("circle", {
|
|
447
459
|
id: circleId,
|
|
448
460
|
key: circleId,
|
|
449
461
|
r: currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : activePoint === circleId ? 5.5 : 3.5,
|
|
@@ -452,8 +464,8 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
452
464
|
fill: activePoint === circleId ? _reacttheme.tokens.colorNeutralBackground1 : lineColor,
|
|
453
465
|
opacity: isLegendSelected ? 1 : 0.1,
|
|
454
466
|
tabIndex: isLegendSelected ? 0 : undefined,
|
|
455
|
-
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
456
|
-
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
467
|
+
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
468
|
+
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
457
469
|
onMouseOut: _handleMouseOut,
|
|
458
470
|
strokeWidth: activePoint === circleId ? DEFAULT_LINE_STROKE_SIZE : 0,
|
|
459
471
|
stroke: activePoint === circleId ? lineColor : '',
|
|
@@ -466,13 +478,13 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
466
478
|
onFocus: (event)=>_handleFocus(event, circleId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData),
|
|
467
479
|
onBlur: _handleMouseOut,
|
|
468
480
|
..._getClickHandler(_points[i].data[0].onDataPointClick)
|
|
469
|
-
}),
|
|
481
|
+
}), !_isScatterPolar && supportsTextMode && text && /*#__PURE__*/ _react.createElement("text", {
|
|
470
482
|
key: `${circleId}-label`,
|
|
471
483
|
x: _xAxisScale(x1),
|
|
472
484
|
y: yScale(y1) + Math.max(currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 3.5, 4) + 12,
|
|
473
485
|
className: classes.markerLabel,
|
|
474
486
|
opacity: isLegendSelected ? 1 : 0.1
|
|
475
|
-
},
|
|
487
|
+
}, text))));
|
|
476
488
|
}
|
|
477
489
|
let gapIndex = 0;
|
|
478
490
|
var _points_i_gaps_sort;
|
|
@@ -480,13 +492,13 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
480
492
|
const lineCurve = (_points_i_lineOptions = _points[i].lineOptions) === null || _points_i_lineOptions === void 0 ? void 0 : _points_i_lineOptions.curve;
|
|
481
493
|
// Use path rendering technique for larger datasets to optimize performance.
|
|
482
494
|
if ((props.optimizeLargeData || lineCurve) && _points[i].data.length > 1) {
|
|
483
|
-
var
|
|
495
|
+
var _points_i_lineOptions2;
|
|
484
496
|
const line = (0, _d3shape.line)() // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
485
497
|
.x((d)=>_xAxisScale(d[0])) // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
486
498
|
.y((d)=>yScale(d[1])).curve((0, _index1.getCurveFactory)(lineCurve));
|
|
487
499
|
const lineId = `${_lineId}_${i}`;
|
|
488
500
|
const borderId = `${_borderId}_${i}`;
|
|
489
|
-
const strokeWidth = ((
|
|
501
|
+
const strokeWidth = ((_points_i_lineOptions2 = _points[i].lineOptions) === null || _points_i_lineOptions2 === void 0 ? void 0 : _points_i_lineOptions2.strokeWidth) || props.strokeWidth || DEFAULT_LINE_STROKE_SIZE;
|
|
490
502
|
const isLegendSelected = _legendHighlighted(legendVal) || _noLegendHighlighted() || isSelectedLegend;
|
|
491
503
|
const lineData = [];
|
|
492
504
|
for(let k = 0; k < _points[i].data.length; k++){
|
|
@@ -496,19 +508,19 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
496
508
|
]);
|
|
497
509
|
}
|
|
498
510
|
if (isLegendSelected) {
|
|
499
|
-
var
|
|
500
|
-
const lineBorderWidth = ((
|
|
511
|
+
var _points_i_lineOptions3, _points_i_lineOptions4;
|
|
512
|
+
const lineBorderWidth = ((_points_i_lineOptions3 = _points[i].lineOptions) === null || _points_i_lineOptions3 === void 0 ? void 0 : _points_i_lineOptions3.lineBorderWidth) ? Number.parseFloat(_points[i].lineOptions.lineBorderWidth.toString()) : 0;
|
|
501
513
|
if (lineBorderWidth > 0) {
|
|
502
|
-
var
|
|
514
|
+
var _points_i_lineOptions5, _points_i_lineOptions6;
|
|
503
515
|
var _points_i_lineOptions_strokeLinecap;
|
|
504
516
|
bordersForLine.push(/*#__PURE__*/ _react.createElement("path", {
|
|
505
517
|
id: borderId,
|
|
506
518
|
key: borderId,
|
|
507
519
|
d: line(lineData),
|
|
508
520
|
fill: "transparent",
|
|
509
|
-
strokeLinecap: (_points_i_lineOptions_strokeLinecap = (
|
|
521
|
+
strokeLinecap: (_points_i_lineOptions_strokeLinecap = (_points_i_lineOptions5 = _points[i].lineOptions) === null || _points_i_lineOptions5 === void 0 ? void 0 : _points_i_lineOptions5.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap !== void 0 ? _points_i_lineOptions_strokeLinecap : 'round',
|
|
510
522
|
strokeWidth: Number.parseFloat(strokeWidth.toString()) + lineBorderWidth,
|
|
511
|
-
stroke: ((
|
|
523
|
+
stroke: ((_points_i_lineOptions6 = _points[i].lineOptions) === null || _points_i_lineOptions6 === void 0 ? void 0 : _points_i_lineOptions6.lineBorderColor) || _reacttheme.tokens.colorNeutralBackground1,
|
|
512
524
|
opacity: 1
|
|
513
525
|
}));
|
|
514
526
|
}
|
|
@@ -521,7 +533,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
521
533
|
"data-is-focusable": true,
|
|
522
534
|
stroke: lineColor,
|
|
523
535
|
strokeWidth: strokeWidth,
|
|
524
|
-
strokeLinecap: (_points_i_lineOptions_strokeLinecap1 = (
|
|
536
|
+
strokeLinecap: (_points_i_lineOptions_strokeLinecap1 = (_points_i_lineOptions4 = _points[i].lineOptions) === null || _points_i_lineOptions4 === void 0 ? void 0 : _points_i_lineOptions4.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap1 !== void 0 ? _points_i_lineOptions_strokeLinecap1 : 'round',
|
|
525
537
|
onMouseMove: (event)=>_onMouseOverLargeDataset.bind(i, verticaLineHeight, event, yScale),
|
|
526
538
|
onMouseOver: (event)=>_onMouseOverLargeDataset.bind(i, verticaLineHeight, event, yScale),
|
|
527
539
|
onMouseOut: _handleMouseOut,
|
|
@@ -530,7 +542,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
530
542
|
tabIndex: isLegendSelected ? 0 : undefined
|
|
531
543
|
}));
|
|
532
544
|
} else {
|
|
533
|
-
var
|
|
545
|
+
var _points_i_lineOptions7;
|
|
534
546
|
var _points_i_lineOptions_strokeLinecap2;
|
|
535
547
|
linesForLine.push(/*#__PURE__*/ _react.createElement("path", {
|
|
536
548
|
id: lineId,
|
|
@@ -540,7 +552,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
540
552
|
"data-is-focusable": false,
|
|
541
553
|
stroke: lineColor,
|
|
542
554
|
strokeWidth: strokeWidth,
|
|
543
|
-
strokeLinecap: (_points_i_lineOptions_strokeLinecap2 = (
|
|
555
|
+
strokeLinecap: (_points_i_lineOptions_strokeLinecap2 = (_points_i_lineOptions7 = _points[i].lineOptions) === null || _points_i_lineOptions7 === void 0 ? void 0 : _points_i_lineOptions7.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap2 !== void 0 ? _points_i_lineOptions_strokeLinecap2 : 'round',
|
|
544
556
|
opacity: 0.1
|
|
545
557
|
}));
|
|
546
558
|
}
|
|
@@ -560,7 +572,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
560
572
|
}));
|
|
561
573
|
} else if (!props.optimizeLargeData) {
|
|
562
574
|
for(let j = 1; j < _points[i].data.length; j++){
|
|
563
|
-
var
|
|
575
|
+
var _points_i_lineOptions8, _points_i_lineOptions_mode1, _points_i_lineOptions9, _points_i_lineOptions_mode2, _points_i_lineOptions10, _points_i_lineOptions_mode3, _points_i_lineOptions11;
|
|
564
576
|
const gapResult = _checkInGap(j, gaps, gapIndex);
|
|
565
577
|
const isInGap = gapResult.isInGap;
|
|
566
578
|
gapIndex = gapResult.gapIndex;
|
|
@@ -570,20 +582,22 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
570
582
|
const { x: x1, y: y1, xAxisCalloutData, xAxisCalloutAccessibilityData } = _points[i].data[j - 1];
|
|
571
583
|
const { x: x2, y: y2 } = _points[i].data[j];
|
|
572
584
|
let path = _getPath(_xAxisScale(x1), yScale(y1), circleId, j, false, _points[i].index);
|
|
573
|
-
const strokeWidth = ((
|
|
585
|
+
const strokeWidth = ((_points_i_lineOptions8 = _points[i].lineOptions) === null || _points_i_lineOptions8 === void 0 ? void 0 : _points_i_lineOptions8.strokeWidth) || props.strokeWidth || DEFAULT_LINE_STROKE_SIZE;
|
|
574
586
|
const isLegendSelected = _legendHighlighted(legendVal) || _noLegendHighlighted() || isSelectedLegend;
|
|
575
587
|
const currentPointHidden = _points[i].hideNonActiveDots && activePoint !== circleId;
|
|
588
|
+
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
|
+
const text = _points[i].data[j - 1].text;
|
|
576
590
|
let currentMarkerSize = _points[i].data[j - 1].markerSize;
|
|
577
591
|
var _points_i_data__text1;
|
|
578
|
-
pointsForLine.push(((
|
|
592
|
+
pointsForLine.push(((_points_i_lineOptions10 = _points[i].lineOptions) === null || _points_i_lineOptions10 === void 0 ? void 0 : (_points_i_lineOptions_mode2 = _points_i_lineOptions10.mode) === null || _points_i_lineOptions_mode2 === void 0 ? void 0 : _points_i_lineOptions_mode2.includes('markers')) || supportsTextMode ? /*#__PURE__*/ _react.createElement(_react.Fragment, null, /*#__PURE__*/ _react.createElement("circle", {
|
|
579
593
|
id: circleId,
|
|
580
594
|
key: circleId,
|
|
581
595
|
r: currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 4,
|
|
582
596
|
cx: _xAxisScale(x1),
|
|
583
597
|
cy: yScale(y1),
|
|
584
598
|
"data-is-focusable": isLegendSelected,
|
|
585
|
-
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
586
|
-
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
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),
|
|
587
601
|
onMouseOut: _handleMouseOut,
|
|
588
602
|
onFocus: (event)=>_handleFocus(event, lineId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData),
|
|
589
603
|
onBlur: _handleMouseOut,
|
|
@@ -594,19 +608,19 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
594
608
|
strokeWidth: strokeWidth,
|
|
595
609
|
role: "img",
|
|
596
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)
|
|
597
|
-
}),
|
|
611
|
+
}), !_isScatterPolar && supportsTextMode && text && /*#__PURE__*/ _react.createElement("text", {
|
|
598
612
|
key: `${circleId}-label`,
|
|
599
613
|
x: _xAxisScale(x1),
|
|
600
|
-
y: yScale(y1) + 12,
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
},
|
|
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", {
|
|
604
618
|
id: circleId,
|
|
605
619
|
key: circleId,
|
|
606
620
|
d: path,
|
|
607
621
|
"data-is-focusable": isLegendSelected,
|
|
608
|
-
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
609
|
-
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
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),
|
|
610
624
|
onMouseOut: _handleMouseOut,
|
|
611
625
|
onFocus: (event)=>_handleFocus(event, lineId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData),
|
|
612
626
|
onBlur: _handleMouseOut,
|
|
@@ -620,7 +634,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
620
634
|
tabIndex: isLegendSelected ? 0 : undefined
|
|
621
635
|
}));
|
|
622
636
|
if (j + 1 === _points[i].data.length) {
|
|
623
|
-
var
|
|
637
|
+
var _points_i_lineOptions_mode4, _points_i_lineOptions12, _points_i_lineOptions_mode5, _points_i_lineOptions13;
|
|
624
638
|
// If this is last point of the line segment.
|
|
625
639
|
const lastCircleId = `${circleId}${j}L`;
|
|
626
640
|
const hiddenHoverCircleId = `${circleId}${j}D`;
|
|
@@ -628,18 +642,20 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
628
642
|
path = _getPath(_xAxisScale(x2), yScale(y2), lastCircleId, j, true, _points[i].index);
|
|
629
643
|
const { xAxisCalloutData: lastCirlceXCallout, xAxisCalloutAccessibilityData: lastCirlceXCalloutAccessibilityData } = _points[i].data[j];
|
|
630
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;
|
|
631
647
|
var _points_i_data_j_text;
|
|
632
648
|
pointsForLine.push(/*#__PURE__*/ _react.createElement(_react.Fragment, {
|
|
633
649
|
key: `${lastCircleId}_container`
|
|
634
|
-
}, ((
|
|
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", {
|
|
635
651
|
id: lastCircleId,
|
|
636
652
|
key: lastCircleId,
|
|
637
653
|
r: currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 4,
|
|
638
654
|
cx: _xAxisScale(x2),
|
|
639
655
|
cy: yScale(y2),
|
|
640
656
|
"data-is-focusable": isLegendSelected,
|
|
641
|
-
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale),
|
|
642
|
-
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale),
|
|
657
|
+
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
658
|
+
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
643
659
|
onMouseOut: _handleMouseOut,
|
|
644
660
|
onFocus: (event)=>_handleFocus(event, lineId, x2, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData),
|
|
645
661
|
onBlur: _handleMouseOut,
|
|
@@ -650,19 +666,18 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
650
666
|
strokeWidth: strokeWidth,
|
|
651
667
|
role: "img",
|
|
652
668
|
"aria-label": (_points_i_data_j_text = _points[i].data[j].text) !== null && _points_i_data_j_text !== void 0 ? _points_i_data_j_text : _getAriaLabel(i, j)
|
|
653
|
-
}),
|
|
669
|
+
}), !_isScatterPolar && lastSupportsTextMode && lastText && /*#__PURE__*/ _react.createElement("text", {
|
|
654
670
|
key: `${lastCircleId}-label`,
|
|
655
671
|
x: _xAxisScale(x2),
|
|
656
|
-
y: yScale(y2) + 12,
|
|
657
|
-
fontSize: 12,
|
|
672
|
+
y: yScale(y2) + Math.max(currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 4, 4) + 12,
|
|
658
673
|
className: classes.markerLabel
|
|
659
|
-
},
|
|
674
|
+
}, text)) : /*#__PURE__*/ _react.createElement("path", {
|
|
660
675
|
id: lastCircleId,
|
|
661
676
|
key: lastCircleId,
|
|
662
677
|
d: path,
|
|
663
678
|
"data-is-focusable": isLegendSelected,
|
|
664
|
-
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale),
|
|
665
|
-
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale),
|
|
679
|
+
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
680
|
+
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
666
681
|
onMouseOut: _handleMouseOut,
|
|
667
682
|
onFocus: (event)=>_handleFocus(event, lineId, x2, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData),
|
|
668
683
|
onBlur: _handleMouseOut,
|
|
@@ -682,8 +697,8 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
682
697
|
cy: yScale(y2),
|
|
683
698
|
opacity: 0,
|
|
684
699
|
width: 0,
|
|
685
|
-
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale),
|
|
686
|
-
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale),
|
|
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),
|
|
687
702
|
onFocus: (event)=>_handleFocus(event, circleId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData),
|
|
688
703
|
onMouseOut: _handleMouseOut,
|
|
689
704
|
strokeWidth: 0,
|
|
@@ -691,14 +706,14 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
691
706
|
onBlur: _handleMouseOut
|
|
692
707
|
})));
|
|
693
708
|
}
|
|
694
|
-
if (!_hasMarkersMode || ((
|
|
709
|
+
if (!_hasMarkersMode || ((_points_i_lineOptions11 = _points[i].lineOptions) === null || _points_i_lineOptions11 === void 0 ? void 0 : (_points_i_lineOptions_mode3 = _points_i_lineOptions11.mode) === null || _points_i_lineOptions_mode3 === void 0 ? void 0 : _points_i_lineOptions_mode3.includes('lines'))) {
|
|
695
710
|
if (isLegendSelected) {
|
|
696
711
|
// don't draw line if it is in a gap
|
|
697
712
|
if (!isInGap) {
|
|
698
|
-
var
|
|
699
|
-
const lineBorderWidth = ((
|
|
713
|
+
var _points_i_lineOptions14, _points_i_lineOptions15, _points_i_lineOptions16, _points_i_lineOptions17;
|
|
714
|
+
const lineBorderWidth = ((_points_i_lineOptions14 = _points[i].lineOptions) === null || _points_i_lineOptions14 === void 0 ? void 0 : _points_i_lineOptions14.lineBorderWidth) ? Number.parseFloat(_points[i].lineOptions.lineBorderWidth.toString()) : 0;
|
|
700
715
|
if (lineBorderWidth > 0) {
|
|
701
|
-
var
|
|
716
|
+
var _points_i_lineOptions18, _points_i_lineOptions19;
|
|
702
717
|
var _points_i_lineOptions_strokeLinecap3;
|
|
703
718
|
bordersForLine.push(/*#__PURE__*/ _react.createElement("line", {
|
|
704
719
|
id: borderId,
|
|
@@ -707,9 +722,9 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
707
722
|
y1: yScale(y1),
|
|
708
723
|
x2: _xAxisScale(x2),
|
|
709
724
|
y2: yScale(y2),
|
|
710
|
-
strokeLinecap: (_points_i_lineOptions_strokeLinecap3 = (
|
|
725
|
+
strokeLinecap: (_points_i_lineOptions_strokeLinecap3 = (_points_i_lineOptions18 = _points[i].lineOptions) === null || _points_i_lineOptions18 === void 0 ? void 0 : _points_i_lineOptions18.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap3 !== void 0 ? _points_i_lineOptions_strokeLinecap3 : 'round',
|
|
711
726
|
strokeWidth: Number.parseFloat(strokeWidth.toString()) + lineBorderWidth,
|
|
712
|
-
stroke: ((
|
|
727
|
+
stroke: ((_points_i_lineOptions19 = _points[i].lineOptions) === null || _points_i_lineOptions19 === void 0 ? void 0 : _points_i_lineOptions19.lineBorderColor) || _reacttheme.tokens.colorNeutralBackground1,
|
|
713
728
|
opacity: 1
|
|
714
729
|
}));
|
|
715
730
|
}
|
|
@@ -725,20 +740,20 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
725
740
|
ref: (e)=>{
|
|
726
741
|
_refCallback(e, lineId);
|
|
727
742
|
},
|
|
728
|
-
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
729
|
-
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
743
|
+
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
744
|
+
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
730
745
|
onMouseOut: _handleMouseOut,
|
|
731
746
|
stroke: lineColor,
|
|
732
|
-
strokeLinecap: (_points_i_lineOptions_strokeLinecap4 = (
|
|
733
|
-
strokeDasharray: (
|
|
734
|
-
strokeDashoffset: (
|
|
747
|
+
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',
|
|
748
|
+
strokeDasharray: (_points_i_lineOptions16 = _points[i].lineOptions) === null || _points_i_lineOptions16 === void 0 ? void 0 : _points_i_lineOptions16.strokeDasharray,
|
|
749
|
+
strokeDashoffset: (_points_i_lineOptions17 = _points[i].lineOptions) === null || _points_i_lineOptions17 === void 0 ? void 0 : _points_i_lineOptions17.strokeDashoffset,
|
|
735
750
|
opacity: 1,
|
|
736
751
|
..._getClickHandler(_points[i].onLineClick)
|
|
737
752
|
}));
|
|
738
753
|
}
|
|
739
754
|
} else {
|
|
740
755
|
if (!isInGap) {
|
|
741
|
-
var
|
|
756
|
+
var _points_i_lineOptions20, _points_i_lineOptions21, _points_i_lineOptions22;
|
|
742
757
|
var _points_i_lineOptions_strokeLinecap5;
|
|
743
758
|
linesForLine.push(/*#__PURE__*/ _react.createElement("line", {
|
|
744
759
|
id: lineId,
|
|
@@ -749,9 +764,9 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
749
764
|
y2: yScale(y2),
|
|
750
765
|
strokeWidth: strokeWidth,
|
|
751
766
|
stroke: lineColor,
|
|
752
|
-
strokeLinecap: (_points_i_lineOptions_strokeLinecap5 = (
|
|
753
|
-
strokeDasharray: (
|
|
754
|
-
strokeDashoffset: (
|
|
767
|
+
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',
|
|
768
|
+
strokeDasharray: (_points_i_lineOptions21 = _points[i].lineOptions) === null || _points_i_lineOptions21 === void 0 ? void 0 : _points_i_lineOptions21.strokeDasharray,
|
|
769
|
+
strokeDashoffset: (_points_i_lineOptions22 = _points[i].lineOptions) === null || _points_i_lineOptions22 === void 0 ? void 0 : _points_i_lineOptions22.strokeDashoffset,
|
|
755
770
|
opacity: 0.1
|
|
756
771
|
}));
|
|
757
772
|
}
|
|
@@ -759,6 +774,24 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
759
774
|
}
|
|
760
775
|
}
|
|
761
776
|
}
|
|
777
|
+
if (_isScatterPolar) {
|
|
778
|
+
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
|
+
pointsForLine.push(...(0, _scatterpolarutils.renderScatterPolarCategoryLabels)({
|
|
788
|
+
allSeriesData,
|
|
789
|
+
xAxisScale: _xAxisScale,
|
|
790
|
+
yAxisScale: yScale,
|
|
791
|
+
className: classes.markerLabel || '',
|
|
792
|
+
lineOptions: (_points_i = _points[i]) === null || _points_i === void 0 ? void 0 : _points_i.lineOptions
|
|
793
|
+
}));
|
|
794
|
+
}
|
|
762
795
|
lines.push(/*#__PURE__*/ _react.createElement("g", {
|
|
763
796
|
key: `line_${i}`,
|
|
764
797
|
role: "region",
|
|
@@ -956,11 +989,24 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
956
989
|
setActivePoint(circleId);
|
|
957
990
|
}
|
|
958
991
|
}
|
|
959
|
-
function _handleHover(x, y, lineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, mouseEvent, yScale) {
|
|
992
|
+
function _handleHover(x, y, lineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, mouseEvent, yScale, legendVal, lineColor) {
|
|
960
993
|
mouseEvent === null || mouseEvent === void 0 ? void 0 : mouseEvent.persist();
|
|
961
994
|
const formattedData = x instanceof Date ? (0, _index1.formatDate)(x, props.useUTC) : x;
|
|
962
995
|
const xVal = x instanceof Date ? x.getTime() : x;
|
|
996
|
+
const yVal = y instanceof Date ? y.getTime() : y;
|
|
963
997
|
const found = (0, _index1.find)(_calloutPoints, (element)=>element.x === xVal);
|
|
998
|
+
let hoverDp = undefined;
|
|
999
|
+
if (props.isCalloutForStack === false && (found === null || found === void 0 ? void 0 : found.values)) {
|
|
1000
|
+
const dp = (0, _index1.find)(found.values, (val)=>(val === null || val === void 0 ? void 0 : val.y) === yVal);
|
|
1001
|
+
if (dp) {
|
|
1002
|
+
hoverDp = {
|
|
1003
|
+
x: xVal,
|
|
1004
|
+
values: [
|
|
1005
|
+
dp
|
|
1006
|
+
]
|
|
1007
|
+
};
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
964
1010
|
// if no points need to be called out then don't show vertical line and callout card
|
|
965
1011
|
if (found) {
|
|
966
1012
|
(0, _d3selection.select)(`#${_verticalLine}`).attr('transform', ()=>`translate(${_xAxisScale(x)}, ${yScale(y)})`).attr('visibility', 'visibility').attr('y2', `${lineHeight - 5 - yScale(y)}`);
|
|
@@ -969,8 +1015,11 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
969
1015
|
updatePosition(mouseEvent.clientX, mouseEvent.clientY);
|
|
970
1016
|
xAxisCalloutData ? setHoverXValue(xAxisCalloutData) : setHoverXValue('' + formattedData);
|
|
971
1017
|
setYValueHover(found.values);
|
|
1018
|
+
setYValue(yVal);
|
|
1019
|
+
setLegendVal(legendVal);
|
|
1020
|
+
setLineColor(lineColor);
|
|
972
1021
|
setStackCalloutProps(found);
|
|
973
|
-
setDataPointCalloutProps(
|
|
1022
|
+
setDataPointCalloutProps(hoverDp);
|
|
974
1023
|
setActivePoint(circleId);
|
|
975
1024
|
setNearestCircleToHighlight(null);
|
|
976
1025
|
}
|
|
@@ -1095,23 +1144,16 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
1095
1144
|
return ((_point_callOutAccessibilityData = point.callOutAccessibilityData) === null || _point_callOutAccessibilityData === void 0 ? void 0 : _point_callOutAccessibilityData.ariaLabel) || `${xValue}. ${legend}, ${yValue}.`;
|
|
1096
1145
|
}
|
|
1097
1146
|
function _getDomainNRangeValuesOfDateWithPadding(points, margins, width, isRTL, tickValues = [], chartType, barWidth) {
|
|
1098
|
-
|
|
1099
|
-
let lDate;
|
|
1100
|
-
sDate = (0, _d3array.min)(points, (point)=>{
|
|
1101
|
-
return (0, _d3array.min)(point.data, (item)=>item.x);
|
|
1102
|
-
});
|
|
1103
|
-
lDate = (0, _d3array.max)(points, (point)=>{
|
|
1104
|
-
return (0, _d3array.max)(point.data, (item)=>item.x);
|
|
1105
|
-
});
|
|
1147
|
+
_setXMinMaxValues(points);
|
|
1106
1148
|
// Include tickValues if present
|
|
1107
|
-
sDate = (0, _d3array.min)([
|
|
1149
|
+
const sDate = tickValues && tickValues.length > 0 ? (0, _d3array.min)([
|
|
1108
1150
|
...tickValues,
|
|
1109
|
-
|
|
1110
|
-
]);
|
|
1111
|
-
lDate = (0, _d3array.max)([
|
|
1151
|
+
new Date(_xMin)
|
|
1152
|
+
]) : new Date(_xMin);
|
|
1153
|
+
const lDate = tickValues && tickValues.length > 0 ? (0, _d3array.max)([
|
|
1112
1154
|
...tickValues,
|
|
1113
|
-
|
|
1114
|
-
]);
|
|
1155
|
+
new Date(_xMax)
|
|
1156
|
+
]) : new Date(_xMax);
|
|
1115
1157
|
// Calculate time-based padding (e.g. 10% of the date range)
|
|
1116
1158
|
const dateRange = lDate.getTime() - sDate.getTime();
|
|
1117
1159
|
const datePadding = _hasMarkersMode ? dateRange * 0.1 : 0;
|
|
@@ -1132,14 +1174,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
1132
1174
|
};
|
|
1133
1175
|
}
|
|
1134
1176
|
function _getDomainNRangeValuesWithPadding(points, margins, width, isRTL) {
|
|
1135
|
-
|
|
1136
|
-
return (0, _d3array.min)(point.data, (item)=>item.x);
|
|
1137
|
-
});
|
|
1138
|
-
_xMax = (0, _d3array.max)(points, (point)=>{
|
|
1139
|
-
return (0, _d3array.max)(point.data, (item)=>{
|
|
1140
|
-
return item.x;
|
|
1141
|
-
});
|
|
1142
|
-
});
|
|
1177
|
+
_setXMinMaxValues(points);
|
|
1143
1178
|
if (_hasMarkersMode) {
|
|
1144
1179
|
_xPadding = (_xMax - _xMin) * 0.1;
|
|
1145
1180
|
}
|
|
@@ -1160,9 +1195,18 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
1160
1195
|
function _isChartEmpty() {
|
|
1161
1196
|
return !(props.data && props.data.lineChartData && props.data.lineChartData.length > 0 && props.data.lineChartData.filter((item)=>item.data.length).length > 0);
|
|
1162
1197
|
}
|
|
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
|
+
}
|
|
1163
1207
|
const { legendProps, tickValues, tickFormat, eventAnnotationProps } = props;
|
|
1164
1208
|
_points = _injectIndexPropertyInLineChartData(props.data.lineChartData);
|
|
1165
|
-
|
|
1209
|
+
_isXAxisDateType = (0, _index1.getXAxisType)(_points);
|
|
1166
1210
|
let points = _points;
|
|
1167
1211
|
if (legendProps && !!legendProps.canSelectMultipleLegends) {
|
|
1168
1212
|
points = selectedLegendPoints.length >= 1 ? selectedLegendPoints : _points;
|
|
@@ -1179,13 +1223,17 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
1179
1223
|
const calloutProps = {
|
|
1180
1224
|
YValueHover: YValueHover,
|
|
1181
1225
|
hoverXValue: hoverXValue,
|
|
1226
|
+
YValue: YValue,
|
|
1227
|
+
legend: legendVal,
|
|
1228
|
+
color: lineColor,
|
|
1229
|
+
XValue: hoverXValue,
|
|
1182
1230
|
descriptionMessage: props.getCalloutDescriptionMessage && stackCalloutProps ? props.getCalloutDescriptionMessage(stackCalloutProps) : undefined,
|
|
1183
1231
|
'data-is-focusable': true,
|
|
1184
1232
|
xAxisCalloutAccessibilityData: xAxisCalloutAccessibilityData,
|
|
1185
1233
|
...props.calloutProps,
|
|
1186
1234
|
clickPosition: clickPosition,
|
|
1187
1235
|
isPopoverOpen: isPopoverOpen,
|
|
1188
|
-
isCalloutForStack:
|
|
1236
|
+
isCalloutForStack: props.isCalloutForStack,
|
|
1189
1237
|
culture: (_props_culture = props.culture) !== null && _props_culture !== void 0 ? _props_culture : 'en-us',
|
|
1190
1238
|
isCartesian: true,
|
|
1191
1239
|
customCallout: {
|
|
@@ -1209,7 +1257,11 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
1209
1257
|
getmargins: _getMargins,
|
|
1210
1258
|
getMinMaxOfYAxis: _getNumericMinMaxOfY,
|
|
1211
1259
|
getGraphData: _initializeLineChartData,
|
|
1212
|
-
xAxisType:
|
|
1260
|
+
xAxisType: _isXAxisDateType ? _index1.XAxisTypes.DateAxis : _index1.XAxisTypes.NumericAxis,
|
|
1261
|
+
..._isScatterPolar ? {
|
|
1262
|
+
yMaxValue: 1,
|
|
1263
|
+
yMinValue: -1
|
|
1264
|
+
} : {},
|
|
1213
1265
|
getDomainNRangeValues: _getDomainNRangeValues,
|
|
1214
1266
|
createStringYAxis: _index1.createStringYAxis,
|
|
1215
1267
|
onChartMouseLeave: _handleChartMouseLeave,
|
|
@@ -1251,3 +1303,6 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
1251
1303
|
});
|
|
1252
1304
|
});
|
|
1253
1305
|
LineChart.displayName = 'LineChart';
|
|
1306
|
+
LineChart.defaultProps = {
|
|
1307
|
+
isCalloutForStack: true
|
|
1308
|
+
};
|