@fluentui/react-charts 9.3.6 → 9.3.8
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 +46 -2
- package/dist/index.d.ts +70 -17
- package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js +2 -16
- package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -1
- package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js.map +1 -1
- package/lib/components/AreaChart/AreaChart.js +3 -43
- package/lib/components/AreaChart/AreaChart.js.map +1 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.js +1 -2
- package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
- package/lib/components/ChartTable/ChartTable.js +8 -11
- package/lib/components/ChartTable/ChartTable.js.map +1 -1
- package/lib/components/ChartTable/ChartTable.types.js.map +1 -1
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js +107 -67
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
- package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +7 -1
- package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -1
- package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +7 -1
- package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.js +52 -32
- package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/CommonComponents/ChartPopover.js +1 -2
- package/lib/components/CommonComponents/ChartPopover.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +9 -7
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +8 -5
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
- package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js +0 -2
- package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +48 -25
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +309 -209
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.js +9 -15
- package/lib/components/DonutChart/DonutChart.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib/components/DonutChart/Pie/Pie.js +4 -2
- package/lib/components/DonutChart/Pie/Pie.js.map +1 -1
- package/lib/components/FunnelChart/FunnelChart.js +8 -13
- package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
- package/lib/components/FunnelChart/FunnelChart.types.js.map +1 -1
- package/lib/components/GanttChart/GanttChart.js +4 -17
- package/lib/components/GanttChart/GanttChart.js.map +1 -1
- package/lib/components/GaugeChart/GaugeChart.js +8 -13
- package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
- package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +24 -36
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +1 -2
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
- package/lib/components/HeatMapChart/HeatMapChart.js +3 -16
- package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +5 -25
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib/components/Legends/Legends.js +3 -4
- package/lib/components/Legends/Legends.js.map +1 -1
- package/lib/components/Legends/Legends.types.js.map +1 -1
- package/lib/components/Legends/OverflowMenu.js.map +1 -1
- package/lib/components/Legends/useLegendsStyles.styles.raw.js.map +1 -1
- package/lib/components/LineChart/LineChart.js +68 -75
- package/lib/components/LineChart/LineChart.js.map +1 -1
- package/lib/components/LineChart/LineChart.types.js +1 -1
- package/lib/components/LineChart/LineChart.types.js.map +1 -1
- package/lib/components/LineChart/eventAnnotation/EventAnnotation.js +3 -4
- package/lib/components/LineChart/eventAnnotation/EventAnnotation.js.map +1 -1
- package/lib/components/LineChart/useLineChartStyles.styles.js +1 -2
- package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -1
- package/lib/components/SankeyChart/SankeyChart.js +4 -10
- package/lib/components/SankeyChart/SankeyChart.js.map +1 -1
- package/lib/components/SankeyChart/SankeyChart.types.js.map +1 -1
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +1 -2
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.js +41 -49
- package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js +1 -2
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib/components/Sparkline/Sparkline.js +11 -7
- package/lib/components/Sparkline/Sparkline.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.js +15 -92
- package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +1 -2
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +28 -49
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +1 -2
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/lib/types/ChartAnnotation.js.map +1 -1
- package/lib/types/DataPoint.js.map +1 -1
- package/lib/utilities/Common.styles.js +0 -1
- package/lib/utilities/Common.styles.js.map +1 -1
- package/lib/utilities/Common.styles.raw.js +0 -1
- package/lib/utilities/Common.styles.raw.js.map +1 -1
- package/lib/utilities/FocusableTooltipText.js +1 -1
- package/lib/utilities/FocusableTooltipText.js.map +1 -1
- package/lib/utilities/getWindow.js +0 -1
- package/lib/utilities/getWindow.js.map +1 -1
- package/lib/utilities/hooks.js +34 -0
- package/lib/utilities/hooks.js.map +1 -0
- package/lib/utilities/image-export-utils.js +118 -78
- package/lib/utilities/image-export-utils.js.map +1 -1
- package/lib/utilities/utilities.js +243 -102
- package/lib/utilities/utilities.js.map +1 -1
- package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js +2 -16
- package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -1
- package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js.map +1 -1
- package/lib-commonjs/components/AreaChart/AreaChart.js +2 -41
- package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +0 -2
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ChartTable/ChartTable.js +9 -11
- package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -1
- package/lib-commonjs/components/ChartTable/ChartTable.types.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js +107 -67
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +7 -1
- package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +7 -1
- package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +51 -31
- package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/ChartPopover.js +1 -2
- package/lib-commonjs/components/CommonComponents/ChartPopover.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +7 -6
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +7 -4
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js +0 -2
- package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +48 -25
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +309 -208
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.js +7 -13
- 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/Pie/Pie.js +4 -2
- package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/FunnelChart.js +7 -12
- package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/FunnelChart.types.js.map +1 -1
- package/lib-commonjs/components/GanttChart/GanttChart.js +3 -16
- package/lib-commonjs/components/GanttChart/GanttChart.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.js +7 -12
- package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +22 -34
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +0 -2
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +2 -15
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +4 -23
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib-commonjs/components/Legends/Legends.js +3 -4
- package/lib-commonjs/components/Legends/Legends.js.map +1 -1
- package/lib-commonjs/components/Legends/Legends.types.js.map +1 -1
- package/lib-commonjs/components/Legends/OverflowMenu.js.map +1 -1
- package/lib-commonjs/components/Legends/useLegendsStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.js +67 -74
- package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.types.js +1 -1
- package/lib-commonjs/components/LineChart/LineChart.types.js.map +1 -1
- package/lib-commonjs/components/LineChart/eventAnnotation/EventAnnotation.js +2 -2
- package/lib-commonjs/components/LineChart/eventAnnotation/EventAnnotation.js.map +1 -1
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +0 -2
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/SankeyChart.js +4 -10
- package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/SankeyChart.types.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +0 -2
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.js +38 -46
- 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 +0 -2
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/Sparkline/Sparkline.js +11 -7
- package/lib-commonjs/components/Sparkline/Sparkline.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +14 -91
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +0 -2
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +26 -47
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +0 -2
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/types/ChartAnnotation.js.map +1 -1
- package/lib-commonjs/types/DataPoint.js.map +1 -1
- package/lib-commonjs/utilities/Common.styles.js +0 -1
- package/lib-commonjs/utilities/Common.styles.js.map +1 -1
- package/lib-commonjs/utilities/Common.styles.raw.js +0 -1
- package/lib-commonjs/utilities/Common.styles.raw.js.map +1 -1
- package/lib-commonjs/utilities/FocusableTooltipText.js.map +1 -1
- package/lib-commonjs/utilities/getWindow.js +0 -1
- package/lib-commonjs/utilities/getWindow.js.map +1 -1
- package/lib-commonjs/utilities/hooks.js +45 -0
- package/lib-commonjs/utilities/hooks.js.map +1 -0
- package/lib-commonjs/utilities/image-export-utils.js +119 -79
- package/lib-commonjs/utilities/image-export-utils.js.map +1 -1
- package/lib-commonjs/utilities/utilities.js +253 -101
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +9 -9
- package/lib/components/DeclarativeChart/imageExporter.js +0 -223
- package/lib/components/DeclarativeChart/imageExporter.js.map +0 -1
- package/lib-commonjs/components/DeclarativeChart/imageExporter.js +0 -233
- package/lib-commonjs/components/DeclarativeChart/imageExporter.js.map +0 -1
|
@@ -21,9 +21,9 @@ const _index1 = require("../../utilities/index");
|
|
|
21
21
|
const _index2 = require("../../index");
|
|
22
22
|
const _EventAnnotation = require("./eventAnnotation/EventAnnotation");
|
|
23
23
|
const _reacttheme = require("@fluentui/react-theme");
|
|
24
|
-
const _imageexportutils = require("../../utilities/image-export-utils");
|
|
25
24
|
const _scatterpolarutils = require("../../utilities/scatterpolar-utils");
|
|
26
25
|
const _chartutilities = require("@fluentui/chart-utilities");
|
|
26
|
+
const _hooks = require("../../utilities/hooks");
|
|
27
27
|
var PointSize = /*#__PURE__*/ function(PointSize) {
|
|
28
28
|
PointSize[PointSize["hoverSize"] = 11] = "hoverSize";
|
|
29
29
|
PointSize[PointSize["invisibleSize"] = 1] = "invisibleSize";
|
|
@@ -122,7 +122,6 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
|
|
|
122
122
|
let lines;
|
|
123
123
|
let _renderedColorFillBars;
|
|
124
124
|
const _colorFillBars = _react.useRef([]);
|
|
125
|
-
let _tooltipId = (0, _reactutilities.useId)('LineChartTooltipId_');
|
|
126
125
|
let _rectId = (0, _reactutilities.useId)('containerRectLD');
|
|
127
126
|
let _staticHighlightCircle = (0, _reactutilities.useId)('staticHighlightCircle');
|
|
128
127
|
let _firstRenderOptimization = true;
|
|
@@ -130,9 +129,8 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
|
|
|
130
129
|
const _colorFillBarId = (0, _reactutilities.useId)('_colorFillBarId');
|
|
131
130
|
const _isRTL = (0, _index1.useRtl)();
|
|
132
131
|
let xAxisCalloutAccessibilityData = {};
|
|
133
|
-
const cartesianChartRef =
|
|
132
|
+
const { cartesianChartRef, legendsRef: _legendsRef } = (0, _hooks.useImageExport)(props.componentRef, props.hideLegend);
|
|
134
133
|
let _yScaleSecondary;
|
|
135
|
-
const _legendsRef = _react.useRef(null);
|
|
136
134
|
props.eventAnnotationProps && props.eventAnnotationProps.labelHeight && (eventLabelHeight = props.eventAnnotationProps.labelHeight);
|
|
137
135
|
const [hoverXValue, setHoverXValue] = _react.useState('');
|
|
138
136
|
const [activeLegend, setActiveLegend] = _react.useState('');
|
|
@@ -170,21 +168,10 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
|
|
|
170
168
|
props.width,
|
|
171
169
|
props.data
|
|
172
170
|
]);
|
|
173
|
-
_react.useImperativeHandle(props.componentRef, ()=>{
|
|
174
|
-
var _cartesianChartRef_current;
|
|
175
|
-
var _cartesianChartRef_current_chartContainer;
|
|
176
|
-
return {
|
|
177
|
-
chartContainer: (_cartesianChartRef_current_chartContainer = (_cartesianChartRef_current = cartesianChartRef.current) === null || _cartesianChartRef_current === void 0 ? void 0 : _cartesianChartRef_current.chartContainer) !== null && _cartesianChartRef_current_chartContainer !== void 0 ? _cartesianChartRef_current_chartContainer : null,
|
|
178
|
-
toImage: (opts)=>{
|
|
179
|
-
var _cartesianChartRef_current, _legendsRef_current;
|
|
180
|
-
return (0, _imageexportutils.toImage)((_cartesianChartRef_current = cartesianChartRef.current) === null || _cartesianChartRef_current === void 0 ? void 0 : _cartesianChartRef_current.chartContainer, (_legendsRef_current = _legendsRef.current) === null || _legendsRef_current === void 0 ? void 0 : _legendsRef_current.toSVG, _isRTL, opts);
|
|
181
|
-
}
|
|
182
|
-
};
|
|
183
|
-
}, []);
|
|
184
171
|
function _getDomainNRangeValues(points, margins, width, chartType, isRTL, xAxisType, barWidth, tickValues) {
|
|
185
172
|
let domainNRangeValue;
|
|
186
173
|
if (xAxisType === _index1.XAxisTypes.NumericAxis) {
|
|
187
|
-
domainNRangeValue = (0, _index1.domainRangeOfNumericForAreaLineScatterCharts)(points, margins, width, isRTL, props.xScaleType, _hasMarkersMode);
|
|
174
|
+
domainNRangeValue = (0, _index1.domainRangeOfNumericForAreaLineScatterCharts)(points, margins, width, isRTL, props.xScaleType, _hasMarkersMode, props.xMinValue, props.xMaxValue);
|
|
188
175
|
} else if (xAxisType === _index1.XAxisTypes.DateAxis) {
|
|
189
176
|
domainNRangeValue = (0, _index1.domainRangeOfDateForAreaLineScatterVerticalBarCharts)(points, margins, width, isRTL, tickValues, chartType, barWidth, _hasMarkersMode);
|
|
190
177
|
} else {
|
|
@@ -242,7 +229,6 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
|
|
|
242
229
|
return props.onRenderCalloutPerStack ? props.onRenderCalloutPerStack(stackCalloutProps) : props.onRenderCalloutPerDataPoint ? props.onRenderCalloutPerDataPoint(dataPointCalloutProps) : null;
|
|
243
230
|
}
|
|
244
231
|
function _getNumericMinMaxOfY(points, yAxisType, useSecondaryYScale) {
|
|
245
|
-
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
246
232
|
const { startValue, endValue } = (0, _index1.findNumericMinMaxOfY)(points, yAxisType, useSecondaryYScale, useSecondaryYScale ? props.secondaryYScaleType : props.yScaleType);
|
|
247
233
|
let yPadding = {
|
|
248
234
|
start: 0,
|
|
@@ -445,10 +431,13 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
|
|
|
445
431
|
useSecondaryYScale,
|
|
446
432
|
xScaleType: props.xScaleType,
|
|
447
433
|
yScaleType: props.yScaleType,
|
|
448
|
-
secondaryYScaleType: props.secondaryYScaleType
|
|
434
|
+
secondaryYScaleType: props.secondaryYScaleType,
|
|
435
|
+
xMinValue: props.xMinValue,
|
|
436
|
+
xMaxValue: props.xMaxValue,
|
|
437
|
+
yMinValue: props.yMinValue,
|
|
438
|
+
yMaxValue: props.yMaxValue
|
|
449
439
|
}) : 0;
|
|
450
440
|
if (_points[i].data.length === 1) {
|
|
451
|
-
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
452
441
|
const { x: x1, y: y1, xAxisCalloutData, xAxisCalloutAccessibilityData } = _points[i].data[0];
|
|
453
442
|
const xPoint = _xAxisScale(x1);
|
|
454
443
|
const yPoint = yScale(y1);
|
|
@@ -479,7 +468,6 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
|
|
|
479
468
|
stroke: activePoint === circleId ? lineColor : '',
|
|
480
469
|
role: "img",
|
|
481
470
|
"aria-label": (_points_i_data__text = _points[i].data[0].text) !== null && _points_i_data__text !== void 0 ? _points_i_data__text : _getAriaLabel(i, 0),
|
|
482
|
-
"data-is-focusable": isLegendSelected,
|
|
483
471
|
ref: (e)=>{
|
|
484
472
|
_refCallback(e, circleId);
|
|
485
473
|
},
|
|
@@ -542,7 +530,6 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
|
|
|
542
530
|
key: lineId,
|
|
543
531
|
d: line(lineData),
|
|
544
532
|
fill: "transparent",
|
|
545
|
-
"data-is-focusable": true,
|
|
546
533
|
stroke: lineColor,
|
|
547
534
|
strokeWidth: strokeWidth,
|
|
548
535
|
strokeLinecap: (_points_i_lineOptions_strokeLinecap1 = (_points_i_lineOptions6 = _points[i].lineOptions) === null || _points_i_lineOptions6 === void 0 ? void 0 : _points_i_lineOptions6.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap1 !== void 0 ? _points_i_lineOptions_strokeLinecap1 : 'round',
|
|
@@ -562,7 +549,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
|
|
|
562
549
|
key: lineId,
|
|
563
550
|
d: line(lineData),
|
|
564
551
|
fill: "transparent",
|
|
565
|
-
|
|
552
|
+
tabIndex: -1,
|
|
566
553
|
stroke: lineColor,
|
|
567
554
|
strokeWidth: strokeWidth,
|
|
568
555
|
strokeLinecap: (_points_i_lineOptions_strokeLinecap2 = (_points_i_lineOptions10 = _points[i].lineOptions) === null || _points_i_lineOptions10 === void 0 ? void 0 : _points_i_lineOptions10.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap2 !== void 0 ? _points_i_lineOptions_strokeLinecap2 : 'round',
|
|
@@ -579,6 +566,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
|
|
|
579
566
|
cy: 0,
|
|
580
567
|
fill: _reacttheme.tokens.colorNeutralBackground1,
|
|
581
568
|
strokeWidth: DEFAULT_LINE_STROKE_SIZE,
|
|
569
|
+
tabIndex: isLegendSelected ? 0 : undefined,
|
|
582
570
|
stroke: lineColor,
|
|
583
571
|
visibility: 'hidden',
|
|
584
572
|
onMouseMove: (event)=>_onMouseOverLargeDataset(i, verticaLineHeight, event, yScale),
|
|
@@ -602,11 +590,13 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
|
|
|
602
590
|
cx: xPoint,
|
|
603
591
|
cy: yPoint,
|
|
604
592
|
fill: activePoint === _circleId ? _reacttheme.tokens.colorNeutralBackground1 : perPointColor || ((_points_i = _points[i]) === null || _points_i === void 0 ? void 0 : _points_i.color) || lineColor,
|
|
593
|
+
tabIndex: isLegendSelected ? 0 : undefined,
|
|
605
594
|
stroke: perPointColor || lineColor,
|
|
606
595
|
strokeWidth: 1,
|
|
607
596
|
opacity: isLegendSelected ? 1 : 0.1,
|
|
608
|
-
onMouseMove: _onMouseOverLargeDataset
|
|
609
|
-
onMouseOver: _onMouseOverLargeDataset
|
|
597
|
+
onMouseMove: (event)=>_onMouseOverLargeDataset(i, verticaLineHeight, event, yScale),
|
|
598
|
+
onMouseOver: (event)=>_onMouseOverLargeDataset(i, verticaLineHeight, event, yScale),
|
|
599
|
+
onFocus: (event)=>_onFocusLargeDataset(i, verticaLineHeight, event, yScale, k),
|
|
610
600
|
onMouseOut: _handleMouseOut
|
|
611
601
|
}));
|
|
612
602
|
}
|
|
@@ -644,7 +634,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
|
|
|
644
634
|
r: currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 4,
|
|
645
635
|
cx: xPoint1,
|
|
646
636
|
cy: yPoint1,
|
|
647
|
-
|
|
637
|
+
tabIndex: isLegendSelected ? 0 : undefined,
|
|
648
638
|
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
|
|
649
639
|
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
|
|
650
640
|
onMouseOut: _handleMouseOut,
|
|
@@ -667,7 +657,6 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
|
|
|
667
657
|
id: circleId,
|
|
668
658
|
key: circleId,
|
|
669
659
|
d: path,
|
|
670
|
-
"data-is-focusable": isLegendSelected,
|
|
671
660
|
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
|
|
672
661
|
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
|
|
673
662
|
onMouseOut: _handleMouseOut,
|
|
@@ -706,7 +695,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
|
|
|
706
695
|
r: currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 4,
|
|
707
696
|
cx: xPoint2,
|
|
708
697
|
cy: yPoint2,
|
|
709
|
-
|
|
698
|
+
tabIndex: isLegendSelected ? 0 : undefined,
|
|
710
699
|
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
|
|
711
700
|
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
|
|
712
701
|
onMouseOut: _handleMouseOut,
|
|
@@ -728,7 +717,6 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
|
|
|
728
717
|
id: lastCircleId,
|
|
729
718
|
key: lastCircleId,
|
|
730
719
|
d: path,
|
|
731
|
-
"data-is-focusable": isLegendSelected,
|
|
732
720
|
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
|
|
733
721
|
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
|
|
734
722
|
onMouseOut: _handleMouseOut,
|
|
@@ -863,27 +851,6 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
|
|
|
863
851
|
"aria-label": `${legendVal}, line ${i + 1} of ${_points.length} with ${_points[i].data.length} data points.`
|
|
864
852
|
}, bordersForLine, linesForLine, pointsForLine));
|
|
865
853
|
}
|
|
866
|
-
// Removing un wanted tooltip div from DOM, when prop not provided.
|
|
867
|
-
if (!props.showXAxisLablesTooltip) {
|
|
868
|
-
try {
|
|
869
|
-
document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
|
|
870
|
-
// eslint-disable-next-line no-empty
|
|
871
|
-
} catch (e) {}
|
|
872
|
-
}
|
|
873
|
-
// Used to display tooltip at x axis labels.
|
|
874
|
-
if (!props.wrapXAxisLables && props.showXAxisLablesTooltip) {
|
|
875
|
-
const xAxisElement = (0, _d3selection.select)(xElement).call(_xAxisScale);
|
|
876
|
-
try {
|
|
877
|
-
document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
|
|
878
|
-
// eslint-disable-next-line no-empty
|
|
879
|
-
} catch (e) {}
|
|
880
|
-
const tooltipProps = {
|
|
881
|
-
tooltipCls: classes.tooltip,
|
|
882
|
-
id: _tooltipId,
|
|
883
|
-
axis: xAxisElement
|
|
884
|
-
};
|
|
885
|
-
xAxisElement && (0, _index1.tooltipOfAxislabels)(tooltipProps);
|
|
886
|
-
}
|
|
887
854
|
return lines;
|
|
888
855
|
}
|
|
889
856
|
function _createColorFillBars(containerHeight) {
|
|
@@ -956,6 +923,50 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
|
|
|
956
923
|
refElement: element
|
|
957
924
|
});
|
|
958
925
|
}
|
|
926
|
+
// Helper function to update highlight circle, vertical line, and callout for large datasets
|
|
927
|
+
const _updateLargeDatasetHighlightAndCallout = (linenumber, lineHeight, pointToHighlight, xAxisCalloutData, formattedDate, yScale)=>{
|
|
928
|
+
// Check if this point is plottable. If not, close the popover and return.
|
|
929
|
+
const xPoint = _xAxisScale(pointToHighlight.x);
|
|
930
|
+
const yPoint = yScale(pointToHighlight.y);
|
|
931
|
+
if (!(0, _index1.isPlottable)(xPoint, yPoint)) {
|
|
932
|
+
return;
|
|
933
|
+
}
|
|
934
|
+
const found = (0, _index1.findCalloutPoints)(calloutPointsRef.current, pointToHighlight.x);
|
|
935
|
+
const pointToHighlightUpdated = nearestCircleToHighlight === null || nearestCircleToHighlight !== null && pointToHighlight !== null && (nearestCircleToHighlight.x !== pointToHighlight.x || nearestCircleToHighlight.y !== pointToHighlight.y);
|
|
936
|
+
// if no points need to be called out then don't show vertical line and callout card
|
|
937
|
+
if (found && pointToHighlightUpdated) {
|
|
938
|
+
_uniqueCallOutID = `#${_staticHighlightCircle}_${linenumber}`;
|
|
939
|
+
(0, _d3selection.select)(`#${_staticHighlightCircle}_${linenumber}`).attr('cx', `${xPoint}`).attr('cy', `${yPoint}`).attr('visibility', 'visibility');
|
|
940
|
+
(0, _d3selection.select)(`#${_verticalLine}`).attr('transform', ()=>`translate(${xPoint}, ${yPoint})`).attr('visibility', 'visibility').attr('y2', `${lineHeight - 5 - yPoint}`);
|
|
941
|
+
const targetElement = document.getElementById(`${_staticHighlightCircle}_${linenumber}`);
|
|
942
|
+
const rect = targetElement.getBoundingClientRect();
|
|
943
|
+
setNearestCircleToHighlight(pointToHighlight);
|
|
944
|
+
updatePosition(rect.x, rect.y);
|
|
945
|
+
setStackCalloutProps(found);
|
|
946
|
+
setYValueHover(found.values);
|
|
947
|
+
setDataPointCalloutProps(found);
|
|
948
|
+
xAxisCalloutData ? setHoverXValue(xAxisCalloutData) : setHoverXValue(formattedDate);
|
|
949
|
+
setActivePoint('');
|
|
950
|
+
}
|
|
951
|
+
if (!found) {
|
|
952
|
+
setPopoverOpen(false);
|
|
953
|
+
setNearestCircleToHighlight(pointToHighlight);
|
|
954
|
+
setActivePoint('');
|
|
955
|
+
}
|
|
956
|
+
};
|
|
957
|
+
const _onFocusLargeDataset = (linenumber, lineHeight, focusEvent, yScale, pointIndex)=>{
|
|
958
|
+
focusEvent.persist();
|
|
959
|
+
const { data } = props;
|
|
960
|
+
const { lineChartData } = data;
|
|
961
|
+
// For focus events, we use the provided point index directly
|
|
962
|
+
const pointToHighlight = lineChartData[linenumber].data[pointIndex];
|
|
963
|
+
if (!pointToHighlight) {
|
|
964
|
+
return;
|
|
965
|
+
}
|
|
966
|
+
const { xAxisCalloutData } = pointToHighlight;
|
|
967
|
+
const formattedDate = pointToHighlight.x instanceof Date ? (0, _chartutilities.formatDateToLocaleString)(pointToHighlight.x, props.culture, props.useUTC) : pointToHighlight.x;
|
|
968
|
+
_updateLargeDatasetHighlightAndCallout(linenumber, lineHeight, pointToHighlight, xAxisCalloutData, formattedDate, yScale);
|
|
969
|
+
};
|
|
959
970
|
const _onMouseOverLargeDataset = (linenumber, lineHeight, mouseEvent, yScale)=>{
|
|
960
971
|
mouseEvent.persist();
|
|
961
972
|
const { data } = props;
|
|
@@ -1000,29 +1011,8 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
|
|
|
1000
1011
|
}
|
|
1001
1012
|
const { xAxisCalloutData } = lineChartData[linenumber].data[index];
|
|
1002
1013
|
const formattedDate = xPointToHighlight instanceof Date ? (0, _chartutilities.formatDateToLocaleString)(xPointToHighlight, props.culture, props.useUTC) : xPointToHighlight;
|
|
1003
|
-
const found = (0, _index1.findCalloutPoints)(calloutPointsRef.current, xPointToHighlight);
|
|
1004
1014
|
const pointToHighlight = lineChartData[linenumber].data[index];
|
|
1005
|
-
|
|
1006
|
-
// if no points need to be called out then don't show vertical line and callout card
|
|
1007
|
-
if (found && pointToHighlightUpdated) {
|
|
1008
|
-
_uniqueCallOutID = `#${_staticHighlightCircle}_${linenumber}`;
|
|
1009
|
-
(0, _d3selection.select)(`#${_staticHighlightCircle}_${linenumber}`).attr('cx', `${_xAxisScale(pointToHighlight.x)}`).attr('cy', `${yScale(pointToHighlight.y)}`).attr('visibility', 'visibility');
|
|
1010
|
-
(0, _d3selection.select)(`#${_verticalLine}`).attr('transform', ()=>`translate(${_xAxisScale(pointToHighlight.x)}, ${yScale(pointToHighlight.y)})`).attr('visibility', 'visibility').attr('y2', `${lineHeight - 5 - yScale(pointToHighlight.y)}`);
|
|
1011
|
-
const targetElement = document.getElementById(`${_staticHighlightCircle}_${linenumber}`);
|
|
1012
|
-
const rect = targetElement.getBoundingClientRect();
|
|
1013
|
-
setNearestCircleToHighlight(pointToHighlight);
|
|
1014
|
-
updatePosition(rect.x, rect.y);
|
|
1015
|
-
setStackCalloutProps(found);
|
|
1016
|
-
setYValueHover(found.values);
|
|
1017
|
-
setDataPointCalloutProps(found);
|
|
1018
|
-
xAxisCalloutData ? setHoverXValue(xAxisCalloutData) : setHoverXValue(formattedDate);
|
|
1019
|
-
setActivePoint('');
|
|
1020
|
-
}
|
|
1021
|
-
if (!found) {
|
|
1022
|
-
setPopoverOpen(false);
|
|
1023
|
-
setNearestCircleToHighlight(pointToHighlight);
|
|
1024
|
-
setActivePoint('');
|
|
1025
|
-
}
|
|
1015
|
+
_updateLargeDatasetHighlightAndCallout(linenumber, lineHeight, pointToHighlight, xAxisCalloutData, formattedDate, yScale);
|
|
1026
1016
|
};
|
|
1027
1017
|
function _handleFocus(event, lineId, x, xAxisCalloutData, circleId, targetElement, xAxisCalloutAccessibilityData) {
|
|
1028
1018
|
_uniqueCallOutID = circleId;
|
|
@@ -1199,6 +1189,10 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
|
|
|
1199
1189
|
const yValue = point.yAxisCalloutData || point.y;
|
|
1200
1190
|
return ((_point_callOutAccessibilityData = point.callOutAccessibilityData) === null || _point_callOutAccessibilityData === void 0 ? void 0 : _point_callOutAccessibilityData.ariaLabel) || `${xValue}. ${legend}, ${yValue}.`;
|
|
1201
1191
|
}
|
|
1192
|
+
function _getChartTitle() {
|
|
1193
|
+
const { chartTitle, lineChartData } = props.data;
|
|
1194
|
+
return (chartTitle ? `${chartTitle}. ` : '') + `Line chart with ${(lineChartData === null || lineChartData === void 0 ? void 0 : lineChartData.length) || 0} lines. `;
|
|
1195
|
+
}
|
|
1202
1196
|
function _isChartEmpty() {
|
|
1203
1197
|
return !(props.data && props.data.lineChartData && props.data.lineChartData.length > 0 && props.data.lineChartData.filter((item)=>item.data.length).length > 0);
|
|
1204
1198
|
}
|
|
@@ -1225,7 +1219,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
|
|
|
1225
1219
|
color: lineColor,
|
|
1226
1220
|
XValue: hoverXValue,
|
|
1227
1221
|
descriptionMessage: props.getCalloutDescriptionMessage && stackCalloutProps ? props.getCalloutDescriptionMessage(stackCalloutProps) : undefined,
|
|
1228
|
-
|
|
1222
|
+
tabIndex: 0,
|
|
1229
1223
|
xAxisCalloutAccessibilityData: xAxisCalloutAccessibilityData,
|
|
1230
1224
|
...props.calloutProps,
|
|
1231
1225
|
isPopoverOpen: isPopoverOpen,
|
|
@@ -1247,7 +1241,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
|
|
|
1247
1241
|
};
|
|
1248
1242
|
return !_isChartEmpty() ? /*#__PURE__*/ _react.createElement(_index2.CartesianChart, {
|
|
1249
1243
|
...props,
|
|
1250
|
-
chartTitle:
|
|
1244
|
+
chartTitle: _getChartTitle(),
|
|
1251
1245
|
points: points,
|
|
1252
1246
|
chartType: _index1.ChartTypes.LineChart,
|
|
1253
1247
|
calloutProps: calloutProps,
|
|
@@ -1267,7 +1261,6 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
|
|
|
1267
1261
|
onChartMouseLeave: _handleChartMouseLeave,
|
|
1268
1262
|
enableFirstRenderOptimization: props.enablePerfOptimization && _firstRenderOptimization,
|
|
1269
1263
|
componentRef: cartesianChartRef,
|
|
1270
|
-
/* eslint-disable react/jsx-no-bind */ // eslint-disable-next-line react/no-children-prop
|
|
1271
1264
|
children: (props)=>{
|
|
1272
1265
|
_xAxisScale = props.xScale;
|
|
1273
1266
|
_yScalePrimary = props.yScalePrimary;
|