@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
|
@@ -11,10 +11,10 @@ import { find, findCalloutPoints } from '../../utilities/index';
|
|
|
11
11
|
import { CartesianChart } from '../../index';
|
|
12
12
|
import { EventsAnnotation } from './eventAnnotation/EventAnnotation';
|
|
13
13
|
import { tokens } from '@fluentui/react-theme';
|
|
14
|
-
import { calloutData, ChartTypes, getXAxisType, XAxisTypes,
|
|
15
|
-
import { toImage } from '../../utilities/image-export-utils';
|
|
14
|
+
import { calloutData, ChartTypes, getXAxisType, XAxisTypes, Points, pointTypes, getTypeOfAxis, getNextColor, getColorFromToken, findNumericMinMaxOfY, createNumericYAxis, domainRangeOfDateForAreaLineScatterVerticalBarCharts, domainRangeOfNumericForAreaLineScatterCharts, createStringYAxis, useRtl, getCurveFactory, isScatterPolarSeries, getDomainPaddingForMarkers, isPlottable, getRangeForScatterMarkerSize } from '../../utilities/index';
|
|
16
15
|
import { renderScatterPolarCategoryLabels } from '../../utilities/scatterpolar-utils';
|
|
17
16
|
import { formatDateToLocaleString } from '@fluentui/chart-utilities';
|
|
17
|
+
import { useImageExport } from '../../utilities/hooks';
|
|
18
18
|
var PointSize = /*#__PURE__*/ function(PointSize) {
|
|
19
19
|
PointSize[PointSize["hoverSize"] = 11] = "hoverSize";
|
|
20
20
|
PointSize[PointSize["invisibleSize"] = 1] = "invisibleSize";
|
|
@@ -117,7 +117,6 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
117
117
|
let lines;
|
|
118
118
|
let _renderedColorFillBars;
|
|
119
119
|
const _colorFillBars = React.useRef([]);
|
|
120
|
-
let _tooltipId = useId('LineChartTooltipId_');
|
|
121
120
|
let _rectId = useId('containerRectLD');
|
|
122
121
|
let _staticHighlightCircle = useId('staticHighlightCircle');
|
|
123
122
|
let _firstRenderOptimization = true;
|
|
@@ -125,9 +124,8 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
125
124
|
const _colorFillBarId = useId('_colorFillBarId');
|
|
126
125
|
const _isRTL = useRtl();
|
|
127
126
|
let xAxisCalloutAccessibilityData = {};
|
|
128
|
-
const cartesianChartRef =
|
|
127
|
+
const { cartesianChartRef, legendsRef: _legendsRef } = useImageExport(props.componentRef, props.hideLegend);
|
|
129
128
|
let _yScaleSecondary;
|
|
130
|
-
const _legendsRef = React.useRef(null);
|
|
131
129
|
props.eventAnnotationProps && props.eventAnnotationProps.labelHeight && (eventLabelHeight = props.eventAnnotationProps.labelHeight);
|
|
132
130
|
const [hoverXValue, setHoverXValue] = React.useState('');
|
|
133
131
|
const [activeLegend, setActiveLegend] = React.useState('');
|
|
@@ -165,21 +163,10 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
165
163
|
props.width,
|
|
166
164
|
props.data
|
|
167
165
|
]);
|
|
168
|
-
React.useImperativeHandle(props.componentRef, ()=>{
|
|
169
|
-
var _cartesianChartRef_current;
|
|
170
|
-
var _cartesianChartRef_current_chartContainer;
|
|
171
|
-
return {
|
|
172
|
-
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,
|
|
173
|
-
toImage: (opts)=>{
|
|
174
|
-
var _cartesianChartRef_current, _legendsRef_current;
|
|
175
|
-
return 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);
|
|
176
|
-
}
|
|
177
|
-
};
|
|
178
|
-
}, []);
|
|
179
166
|
function _getDomainNRangeValues(points, margins, width, chartType, isRTL, xAxisType, barWidth, tickValues) {
|
|
180
167
|
let domainNRangeValue;
|
|
181
168
|
if (xAxisType === XAxisTypes.NumericAxis) {
|
|
182
|
-
domainNRangeValue = domainRangeOfNumericForAreaLineScatterCharts(points, margins, width, isRTL, props.xScaleType, _hasMarkersMode);
|
|
169
|
+
domainNRangeValue = domainRangeOfNumericForAreaLineScatterCharts(points, margins, width, isRTL, props.xScaleType, _hasMarkersMode, props.xMinValue, props.xMaxValue);
|
|
183
170
|
} else if (xAxisType === XAxisTypes.DateAxis) {
|
|
184
171
|
domainNRangeValue = domainRangeOfDateForAreaLineScatterVerticalBarCharts(points, margins, width, isRTL, tickValues, chartType, barWidth, _hasMarkersMode);
|
|
185
172
|
} else {
|
|
@@ -237,7 +224,6 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
237
224
|
return props.onRenderCalloutPerStack ? props.onRenderCalloutPerStack(stackCalloutProps) : props.onRenderCalloutPerDataPoint ? props.onRenderCalloutPerDataPoint(dataPointCalloutProps) : null;
|
|
238
225
|
}
|
|
239
226
|
function _getNumericMinMaxOfY(points, yAxisType, useSecondaryYScale) {
|
|
240
|
-
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
241
227
|
const { startValue, endValue } = findNumericMinMaxOfY(points, yAxisType, useSecondaryYScale, useSecondaryYScale ? props.secondaryYScaleType : props.yScaleType);
|
|
242
228
|
let yPadding = {
|
|
243
229
|
start: 0,
|
|
@@ -440,10 +426,13 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
440
426
|
useSecondaryYScale,
|
|
441
427
|
xScaleType: props.xScaleType,
|
|
442
428
|
yScaleType: props.yScaleType,
|
|
443
|
-
secondaryYScaleType: props.secondaryYScaleType
|
|
429
|
+
secondaryYScaleType: props.secondaryYScaleType,
|
|
430
|
+
xMinValue: props.xMinValue,
|
|
431
|
+
xMaxValue: props.xMaxValue,
|
|
432
|
+
yMinValue: props.yMinValue,
|
|
433
|
+
yMaxValue: props.yMaxValue
|
|
444
434
|
}) : 0;
|
|
445
435
|
if (_points[i].data.length === 1) {
|
|
446
|
-
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
447
436
|
const { x: x1, y: y1, xAxisCalloutData, xAxisCalloutAccessibilityData } = _points[i].data[0];
|
|
448
437
|
const xPoint = _xAxisScale(x1);
|
|
449
438
|
const yPoint = yScale(y1);
|
|
@@ -474,7 +463,6 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
474
463
|
stroke: activePoint === circleId ? lineColor : '',
|
|
475
464
|
role: "img",
|
|
476
465
|
"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),
|
|
477
|
-
"data-is-focusable": isLegendSelected,
|
|
478
466
|
ref: (e)=>{
|
|
479
467
|
_refCallback(e, circleId);
|
|
480
468
|
},
|
|
@@ -537,7 +525,6 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
537
525
|
key: lineId,
|
|
538
526
|
d: line(lineData),
|
|
539
527
|
fill: "transparent",
|
|
540
|
-
"data-is-focusable": true,
|
|
541
528
|
stroke: lineColor,
|
|
542
529
|
strokeWidth: strokeWidth,
|
|
543
530
|
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',
|
|
@@ -557,7 +544,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
557
544
|
key: lineId,
|
|
558
545
|
d: line(lineData),
|
|
559
546
|
fill: "transparent",
|
|
560
|
-
|
|
547
|
+
tabIndex: -1,
|
|
561
548
|
stroke: lineColor,
|
|
562
549
|
strokeWidth: strokeWidth,
|
|
563
550
|
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',
|
|
@@ -574,6 +561,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
574
561
|
cy: 0,
|
|
575
562
|
fill: tokens.colorNeutralBackground1,
|
|
576
563
|
strokeWidth: DEFAULT_LINE_STROKE_SIZE,
|
|
564
|
+
tabIndex: isLegendSelected ? 0 : undefined,
|
|
577
565
|
stroke: lineColor,
|
|
578
566
|
visibility: 'hidden',
|
|
579
567
|
onMouseMove: (event)=>_onMouseOverLargeDataset(i, verticaLineHeight, event, yScale),
|
|
@@ -597,11 +585,13 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
597
585
|
cx: xPoint,
|
|
598
586
|
cy: yPoint,
|
|
599
587
|
fill: activePoint === _circleId ? tokens.colorNeutralBackground1 : perPointColor || ((_points_i = _points[i]) === null || _points_i === void 0 ? void 0 : _points_i.color) || lineColor,
|
|
588
|
+
tabIndex: isLegendSelected ? 0 : undefined,
|
|
600
589
|
stroke: perPointColor || lineColor,
|
|
601
590
|
strokeWidth: 1,
|
|
602
591
|
opacity: isLegendSelected ? 1 : 0.1,
|
|
603
|
-
onMouseMove: _onMouseOverLargeDataset
|
|
604
|
-
onMouseOver: _onMouseOverLargeDataset
|
|
592
|
+
onMouseMove: (event)=>_onMouseOverLargeDataset(i, verticaLineHeight, event, yScale),
|
|
593
|
+
onMouseOver: (event)=>_onMouseOverLargeDataset(i, verticaLineHeight, event, yScale),
|
|
594
|
+
onFocus: (event)=>_onFocusLargeDataset(i, verticaLineHeight, event, yScale, k),
|
|
605
595
|
onMouseOut: _handleMouseOut
|
|
606
596
|
}));
|
|
607
597
|
}
|
|
@@ -639,7 +629,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
639
629
|
r: currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 4,
|
|
640
630
|
cx: xPoint1,
|
|
641
631
|
cy: yPoint1,
|
|
642
|
-
|
|
632
|
+
tabIndex: isLegendSelected ? 0 : undefined,
|
|
643
633
|
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
|
|
644
634
|
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
|
|
645
635
|
onMouseOut: _handleMouseOut,
|
|
@@ -662,7 +652,6 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
662
652
|
id: circleId,
|
|
663
653
|
key: circleId,
|
|
664
654
|
d: path,
|
|
665
|
-
"data-is-focusable": isLegendSelected,
|
|
666
655
|
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
|
|
667
656
|
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
|
|
668
657
|
onMouseOut: _handleMouseOut,
|
|
@@ -701,7 +690,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
701
690
|
r: currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 4,
|
|
702
691
|
cx: xPoint2,
|
|
703
692
|
cy: yPoint2,
|
|
704
|
-
|
|
693
|
+
tabIndex: isLegendSelected ? 0 : undefined,
|
|
705
694
|
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
|
|
706
695
|
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
|
|
707
696
|
onMouseOut: _handleMouseOut,
|
|
@@ -723,7 +712,6 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
723
712
|
id: lastCircleId,
|
|
724
713
|
key: lastCircleId,
|
|
725
714
|
d: path,
|
|
726
|
-
"data-is-focusable": isLegendSelected,
|
|
727
715
|
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
|
|
728
716
|
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
|
|
729
717
|
onMouseOut: _handleMouseOut,
|
|
@@ -858,27 +846,6 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
858
846
|
"aria-label": `${legendVal}, line ${i + 1} of ${_points.length} with ${_points[i].data.length} data points.`
|
|
859
847
|
}, bordersForLine, linesForLine, pointsForLine));
|
|
860
848
|
}
|
|
861
|
-
// Removing un wanted tooltip div from DOM, when prop not provided.
|
|
862
|
-
if (!props.showXAxisLablesTooltip) {
|
|
863
|
-
try {
|
|
864
|
-
document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
|
|
865
|
-
// eslint-disable-next-line no-empty
|
|
866
|
-
} catch (e) {}
|
|
867
|
-
}
|
|
868
|
-
// Used to display tooltip at x axis labels.
|
|
869
|
-
if (!props.wrapXAxisLables && props.showXAxisLablesTooltip) {
|
|
870
|
-
const xAxisElement = d3Select(xElement).call(_xAxisScale);
|
|
871
|
-
try {
|
|
872
|
-
document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
|
|
873
|
-
// eslint-disable-next-line no-empty
|
|
874
|
-
} catch (e) {}
|
|
875
|
-
const tooltipProps = {
|
|
876
|
-
tooltipCls: classes.tooltip,
|
|
877
|
-
id: _tooltipId,
|
|
878
|
-
axis: xAxisElement
|
|
879
|
-
};
|
|
880
|
-
xAxisElement && tooltipOfAxislabels(tooltipProps);
|
|
881
|
-
}
|
|
882
849
|
return lines;
|
|
883
850
|
}
|
|
884
851
|
function _createColorFillBars(containerHeight) {
|
|
@@ -951,6 +918,50 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
951
918
|
refElement: element
|
|
952
919
|
});
|
|
953
920
|
}
|
|
921
|
+
// Helper function to update highlight circle, vertical line, and callout for large datasets
|
|
922
|
+
const _updateLargeDatasetHighlightAndCallout = (linenumber, lineHeight, pointToHighlight, xAxisCalloutData, formattedDate, yScale)=>{
|
|
923
|
+
// Check if this point is plottable. If not, close the popover and return.
|
|
924
|
+
const xPoint = _xAxisScale(pointToHighlight.x);
|
|
925
|
+
const yPoint = yScale(pointToHighlight.y);
|
|
926
|
+
if (!isPlottable(xPoint, yPoint)) {
|
|
927
|
+
return;
|
|
928
|
+
}
|
|
929
|
+
const found = findCalloutPoints(calloutPointsRef.current, pointToHighlight.x);
|
|
930
|
+
const pointToHighlightUpdated = nearestCircleToHighlight === null || nearestCircleToHighlight !== null && pointToHighlight !== null && (nearestCircleToHighlight.x !== pointToHighlight.x || nearestCircleToHighlight.y !== pointToHighlight.y);
|
|
931
|
+
// if no points need to be called out then don't show vertical line and callout card
|
|
932
|
+
if (found && pointToHighlightUpdated) {
|
|
933
|
+
_uniqueCallOutID = `#${_staticHighlightCircle}_${linenumber}`;
|
|
934
|
+
d3Select(`#${_staticHighlightCircle}_${linenumber}`).attr('cx', `${xPoint}`).attr('cy', `${yPoint}`).attr('visibility', 'visibility');
|
|
935
|
+
d3Select(`#${_verticalLine}`).attr('transform', ()=>`translate(${xPoint}, ${yPoint})`).attr('visibility', 'visibility').attr('y2', `${lineHeight - 5 - yPoint}`);
|
|
936
|
+
const targetElement = document.getElementById(`${_staticHighlightCircle}_${linenumber}`);
|
|
937
|
+
const rect = targetElement.getBoundingClientRect();
|
|
938
|
+
setNearestCircleToHighlight(pointToHighlight);
|
|
939
|
+
updatePosition(rect.x, rect.y);
|
|
940
|
+
setStackCalloutProps(found);
|
|
941
|
+
setYValueHover(found.values);
|
|
942
|
+
setDataPointCalloutProps(found);
|
|
943
|
+
xAxisCalloutData ? setHoverXValue(xAxisCalloutData) : setHoverXValue(formattedDate);
|
|
944
|
+
setActivePoint('');
|
|
945
|
+
}
|
|
946
|
+
if (!found) {
|
|
947
|
+
setPopoverOpen(false);
|
|
948
|
+
setNearestCircleToHighlight(pointToHighlight);
|
|
949
|
+
setActivePoint('');
|
|
950
|
+
}
|
|
951
|
+
};
|
|
952
|
+
const _onFocusLargeDataset = (linenumber, lineHeight, focusEvent, yScale, pointIndex)=>{
|
|
953
|
+
focusEvent.persist();
|
|
954
|
+
const { data } = props;
|
|
955
|
+
const { lineChartData } = data;
|
|
956
|
+
// For focus events, we use the provided point index directly
|
|
957
|
+
const pointToHighlight = lineChartData[linenumber].data[pointIndex];
|
|
958
|
+
if (!pointToHighlight) {
|
|
959
|
+
return;
|
|
960
|
+
}
|
|
961
|
+
const { xAxisCalloutData } = pointToHighlight;
|
|
962
|
+
const formattedDate = pointToHighlight.x instanceof Date ? formatDateToLocaleString(pointToHighlight.x, props.culture, props.useUTC) : pointToHighlight.x;
|
|
963
|
+
_updateLargeDatasetHighlightAndCallout(linenumber, lineHeight, pointToHighlight, xAxisCalloutData, formattedDate, yScale);
|
|
964
|
+
};
|
|
954
965
|
const _onMouseOverLargeDataset = (linenumber, lineHeight, mouseEvent, yScale)=>{
|
|
955
966
|
mouseEvent.persist();
|
|
956
967
|
const { data } = props;
|
|
@@ -995,29 +1006,8 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
995
1006
|
}
|
|
996
1007
|
const { xAxisCalloutData } = lineChartData[linenumber].data[index];
|
|
997
1008
|
const formattedDate = xPointToHighlight instanceof Date ? formatDateToLocaleString(xPointToHighlight, props.culture, props.useUTC) : xPointToHighlight;
|
|
998
|
-
const found = findCalloutPoints(calloutPointsRef.current, xPointToHighlight);
|
|
999
1009
|
const pointToHighlight = lineChartData[linenumber].data[index];
|
|
1000
|
-
|
|
1001
|
-
// if no points need to be called out then don't show vertical line and callout card
|
|
1002
|
-
if (found && pointToHighlightUpdated) {
|
|
1003
|
-
_uniqueCallOutID = `#${_staticHighlightCircle}_${linenumber}`;
|
|
1004
|
-
d3Select(`#${_staticHighlightCircle}_${linenumber}`).attr('cx', `${_xAxisScale(pointToHighlight.x)}`).attr('cy', `${yScale(pointToHighlight.y)}`).attr('visibility', 'visibility');
|
|
1005
|
-
d3Select(`#${_verticalLine}`).attr('transform', ()=>`translate(${_xAxisScale(pointToHighlight.x)}, ${yScale(pointToHighlight.y)})`).attr('visibility', 'visibility').attr('y2', `${lineHeight - 5 - yScale(pointToHighlight.y)}`);
|
|
1006
|
-
const targetElement = document.getElementById(`${_staticHighlightCircle}_${linenumber}`);
|
|
1007
|
-
const rect = targetElement.getBoundingClientRect();
|
|
1008
|
-
setNearestCircleToHighlight(pointToHighlight);
|
|
1009
|
-
updatePosition(rect.x, rect.y);
|
|
1010
|
-
setStackCalloutProps(found);
|
|
1011
|
-
setYValueHover(found.values);
|
|
1012
|
-
setDataPointCalloutProps(found);
|
|
1013
|
-
xAxisCalloutData ? setHoverXValue(xAxisCalloutData) : setHoverXValue(formattedDate);
|
|
1014
|
-
setActivePoint('');
|
|
1015
|
-
}
|
|
1016
|
-
if (!found) {
|
|
1017
|
-
setPopoverOpen(false);
|
|
1018
|
-
setNearestCircleToHighlight(pointToHighlight);
|
|
1019
|
-
setActivePoint('');
|
|
1020
|
-
}
|
|
1010
|
+
_updateLargeDatasetHighlightAndCallout(linenumber, lineHeight, pointToHighlight, xAxisCalloutData, formattedDate, yScale);
|
|
1021
1011
|
};
|
|
1022
1012
|
function _handleFocus(event, lineId, x, xAxisCalloutData, circleId, targetElement, xAxisCalloutAccessibilityData) {
|
|
1023
1013
|
_uniqueCallOutID = circleId;
|
|
@@ -1194,6 +1184,10 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
1194
1184
|
const yValue = point.yAxisCalloutData || point.y;
|
|
1195
1185
|
return ((_point_callOutAccessibilityData = point.callOutAccessibilityData) === null || _point_callOutAccessibilityData === void 0 ? void 0 : _point_callOutAccessibilityData.ariaLabel) || `${xValue}. ${legend}, ${yValue}.`;
|
|
1196
1186
|
}
|
|
1187
|
+
function _getChartTitle() {
|
|
1188
|
+
const { chartTitle, lineChartData } = props.data;
|
|
1189
|
+
return (chartTitle ? `${chartTitle}. ` : '') + `Line chart with ${(lineChartData === null || lineChartData === void 0 ? void 0 : lineChartData.length) || 0} lines. `;
|
|
1190
|
+
}
|
|
1197
1191
|
function _isChartEmpty() {
|
|
1198
1192
|
return !(props.data && props.data.lineChartData && props.data.lineChartData.length > 0 && props.data.lineChartData.filter((item)=>item.data.length).length > 0);
|
|
1199
1193
|
}
|
|
@@ -1220,7 +1214,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
1220
1214
|
color: lineColor,
|
|
1221
1215
|
XValue: hoverXValue,
|
|
1222
1216
|
descriptionMessage: props.getCalloutDescriptionMessage && stackCalloutProps ? props.getCalloutDescriptionMessage(stackCalloutProps) : undefined,
|
|
1223
|
-
|
|
1217
|
+
tabIndex: 0,
|
|
1224
1218
|
xAxisCalloutAccessibilityData: xAxisCalloutAccessibilityData,
|
|
1225
1219
|
...props.calloutProps,
|
|
1226
1220
|
isPopoverOpen: isPopoverOpen,
|
|
@@ -1242,7 +1236,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
1242
1236
|
};
|
|
1243
1237
|
return !_isChartEmpty() ? /*#__PURE__*/ React.createElement(CartesianChart, {
|
|
1244
1238
|
...props,
|
|
1245
|
-
chartTitle:
|
|
1239
|
+
chartTitle: _getChartTitle(),
|
|
1246
1240
|
points: points,
|
|
1247
1241
|
chartType: ChartTypes.LineChart,
|
|
1248
1242
|
calloutProps: calloutProps,
|
|
@@ -1262,7 +1256,6 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
1262
1256
|
onChartMouseLeave: _handleChartMouseLeave,
|
|
1263
1257
|
enableFirstRenderOptimization: props.enablePerfOptimization && _firstRenderOptimization,
|
|
1264
1258
|
componentRef: cartesianChartRef,
|
|
1265
|
-
/* eslint-disable react/jsx-no-bind */ // eslint-disable-next-line react/no-children-prop
|
|
1266
1259
|
children: (props)=>{
|
|
1267
1260
|
_xAxisScale = props.xScale;
|
|
1268
1261
|
_yScalePrimary = props.yScalePrimary;
|