@fluentui/react-charts 9.3.7 → 9.3.9
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 +60 -2
- package/dist/index.d.ts +433 -7
- package/lib/PolarChart.js +1 -0
- package/lib/PolarChart.js.map +1 -0
- package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js +2 -1
- package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -1
- package/lib/components/AreaChart/AreaChart.js +1 -28
- 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 +27 -8
- package/lib/components/ChartTable/ChartTable.js.map +1 -1
- package/lib/components/ChartTable/ChartTable.types.js.map +1 -1
- package/lib/components/ChartTable/useChartTableStyles.styles.js +24 -3
- package/lib/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
- package/lib/components/ChartTable/useChartTableStyles.styles.raw.js +14 -2
- package/lib/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js +111 -69
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -1
- package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +54 -4
- package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -1
- package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +31 -18
- package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.js +81 -44
- package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +5 -5
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +4 -3
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +33 -29
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +643 -366
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.js +24 -9
- 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 +25 -5
- package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
- package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js +16 -5
- package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
- package/lib/components/FunnelChart/FunnelChart.js +33 -8
- package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
- package/lib/components/FunnelChart/FunnelChart.types.js.map +1 -1
- package/lib/components/FunnelChart/useFunnelChartStyles.styles.js +26 -4
- package/lib/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -1
- package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js +15 -3
- package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +1 -1
- package/lib/components/GanttChart/GanttChart.js +1 -1
- package/lib/components/GanttChart/GanttChart.js.map +1 -1
- package/lib/components/GaugeChart/GaugeChart.js +13 -9
- package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
- package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -1
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.js +31 -19
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js +23 -18
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +18 -18
- 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 +5 -1
- package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +60 -10
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +18 -3
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +13 -2
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.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/OverflowMenu.js +9 -2
- package/lib/components/Legends/OverflowMenu.js.map +1 -1
- package/lib/components/LineChart/LineChart.js +65 -64
- package/lib/components/LineChart/LineChart.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/PolarChart/PolarChart.js +577 -0
- package/lib/components/PolarChart/PolarChart.js.map +1 -0
- package/lib/components/PolarChart/PolarChart.types.js +1 -0
- package/lib/components/PolarChart/PolarChart.types.js.map +1 -0
- package/lib/components/PolarChart/PolarChart.utils.js +174 -0
- package/lib/components/PolarChart/PolarChart.utils.js.map +1 -0
- package/lib/components/PolarChart/index.js +2 -0
- package/lib/components/PolarChart/index.js.map +1 -0
- package/lib/components/PolarChart/usePolarChartStyles.styles.js +72 -0
- package/lib/components/PolarChart/usePolarChartStyles.styles.js.map +1 -0
- package/lib/components/PolarChart/usePolarChartStyles.styles.raw.js +61 -0
- package/lib/components/PolarChart/usePolarChartStyles.styles.raw.js.map +1 -0
- package/lib/components/SankeyChart/SankeyChart.js +15 -5
- 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 +24 -8
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js +15 -5
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.js +13 -25
- 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/VerticalBarChart/VerticalBarChart.js +13 -78
- 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 +48 -68
- 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/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/types/ChartAnnotation.js.map +1 -1
- package/lib/types/DataPoint.js +1 -1
- package/lib/types/DataPoint.js.map +1 -1
- package/lib/utilities/ChartTitle.js +45 -0
- package/lib/utilities/ChartTitle.js.map +1 -0
- package/lib/utilities/Common.styles.js +73 -2
- package/lib/utilities/Common.styles.js.map +1 -1
- package/lib/utilities/Common.styles.raw.js +70 -1
- package/lib/utilities/Common.styles.raw.js.map +1 -1
- package/lib/utilities/image-export-utils.js +4 -4
- package/lib/utilities/image-export-utils.js.map +1 -1
- package/lib/utilities/index.js +1 -0
- package/lib/utilities/index.js.map +1 -1
- package/lib/utilities/utilities.js +219 -77
- package/lib/utilities/utilities.js.map +1 -1
- package/lib-commonjs/PolarChart.js +6 -0
- package/lib-commonjs/PolarChart.js.map +1 -0
- package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js +2 -1
- package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -1
- package/lib-commonjs/components/AreaChart/AreaChart.js +0 -26
- 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 +27 -8
- 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/ChartTable/useChartTableStyles.styles.js +34 -3
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js +14 -2
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js +111 -69
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +65 -5
- package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +31 -18
- package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +80 -43
- 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/useCartesianChartStyles.styles.js +3 -4
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +3 -2
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +59 -56
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +649 -368
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.js +22 -7
- 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 +31 -4
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js +15 -4
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/FunnelChart.js +31 -6
- 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/FunnelChart/useFunnelChartStyles.styles.js +36 -4
- package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js +15 -3
- package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/GanttChart/GanttChart.js +1 -1
- package/lib-commonjs/components/GanttChart/GanttChart.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.js +11 -7
- 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/GaugeChart/useGaugeChartStyles.styles.js +39 -18
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js +23 -18
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +16 -16
- 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 +5 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +59 -9
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +26 -3
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +13 -2
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.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/OverflowMenu.js +9 -2
- package/lib-commonjs/components/Legends/OverflowMenu.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.js +64 -63
- package/lib-commonjs/components/LineChart/LineChart.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/PolarChart/PolarChart.js +587 -0
- package/lib-commonjs/components/PolarChart/PolarChart.js.map +1 -0
- package/lib-commonjs/components/PolarChart/PolarChart.types.js +6 -0
- package/lib-commonjs/components/PolarChart/PolarChart.types.js.map +1 -0
- package/lib-commonjs/components/PolarChart/PolarChart.utils.js +204 -0
- package/lib-commonjs/components/PolarChart/PolarChart.utils.js.map +1 -0
- package/lib-commonjs/components/PolarChart/index.js +7 -0
- package/lib-commonjs/components/PolarChart/index.js.map +1 -0
- package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.js +107 -0
- package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.raw.js +75 -0
- package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/SankeyChart/SankeyChart.js +15 -5
- 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 +28 -6
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js +14 -3
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.js +12 -24
- 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/VerticalBarChart/VerticalBarChart.js +12 -77
- 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 +47 -67
- 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/index.js +1 -0
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/types/ChartAnnotation.js.map +1 -1
- package/lib-commonjs/types/DataPoint.js +1 -1
- package/lib-commonjs/types/DataPoint.js.map +1 -1
- package/lib-commonjs/utilities/ChartTitle.js +53 -0
- package/lib-commonjs/utilities/ChartTitle.js.map +1 -0
- package/lib-commonjs/utilities/Common.styles.js +69 -1
- package/lib-commonjs/utilities/Common.styles.js.map +1 -1
- package/lib-commonjs/utilities/Common.styles.raw.js +69 -1
- package/lib-commonjs/utilities/Common.styles.raw.js.map +1 -1
- package/lib-commonjs/utilities/image-export-utils.js +3 -3
- package/lib-commonjs/utilities/image-export-utils.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/utilities.js +235 -78
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +11 -17
- 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
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { max as d3Max, min as d3Min } from 'd3-array';
|
|
4
|
-
import { select as d3Select } from 'd3-selection';
|
|
5
4
|
import { useVerticalStackedBarChartStyles } from './useVerticalStackedBarChartStyles.styles';
|
|
6
5
|
import { scaleLinear as d3ScaleLinear, scaleBand as d3ScaleBand, scaleUtc as d3ScaleUtc, scaleTime as d3ScaleTime } from 'd3-scale';
|
|
7
6
|
import { useId } from '@fluentui/react-utilities';
|
|
8
7
|
import { tokens } from '@fluentui/react-theme';
|
|
8
|
+
import { useArrowNavigationGroup } from '@fluentui/react-tabster';
|
|
9
9
|
import { CartesianChart, ChartPopover, Legends } from '../../index';
|
|
10
|
-
import { ChartTypes, getAccessibleDataObject, XAxisTypes, getTypeOfAxis,
|
|
10
|
+
import { ChartTypes, getAccessibleDataObject, XAxisTypes, getTypeOfAxis, formatScientificLimitWidth, getBarWidth, getScalePadding, isScalePaddingDefined, calculateAppropriateBarWidth, areArraysEqual, calculateLongestLabelWidth, useRtl, DataVizPalette, getColorFromToken, findVSBCNumericMinMaxOfY, YAxisType, createNumericYAxis, domainRangeOfDateForAreaLineScatterVerticalBarCharts, domainRangeOfVSBCNumeric, domainRangeOfXStringAxis, createStringYAxis, calcTotalWidth, calcBandwidth, calcRequiredWidth, sortAxisCategories } from '../../utilities/index';
|
|
11
11
|
import { formatDateToLocaleString, isInvalidValue } from '@fluentui/chart-utilities';
|
|
12
12
|
import { useImageExport } from '../../utilities/hooks';
|
|
13
13
|
const barGapMultiplier = 0.2;
|
|
@@ -23,8 +23,11 @@ export const VerticalStackedBarChart = /*#__PURE__*/ React.forwardRef((_props, f
|
|
|
23
23
|
};
|
|
24
24
|
const _isRtl = useRtl();
|
|
25
25
|
const _createLegendsForLine = (data)=>_getLineLegends(data);
|
|
26
|
-
const _tooltipId = useId('VSBCTooltipId_');
|
|
27
26
|
const _emptyChartId = useId('_VSBC_empty');
|
|
27
|
+
const _arrowNavigationAttributes = useArrowNavigationGroup({
|
|
28
|
+
axis: 'vertical',
|
|
29
|
+
circular: true
|
|
30
|
+
});
|
|
28
31
|
let _points = [];
|
|
29
32
|
let _dataset;
|
|
30
33
|
let _xAxisLabels = [];
|
|
@@ -154,29 +157,27 @@ export const VerticalStackedBarChart = /*#__PURE__*/ React.forwardRef((_props, f
|
|
|
154
157
|
clientX = boundingRect.left + boundingRect.width / 2;
|
|
155
158
|
clientY = boundingRect.top + boundingRect.height / 2;
|
|
156
159
|
}
|
|
157
|
-
if (
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
}
|
|
166
|
-
} else {
|
|
167
|
-
_onStackHoverFocus(lineData.xItem, event);
|
|
160
|
+
if (_noLegendHighlighted() || _isLegendHighlighted(lineData.legend)) {
|
|
161
|
+
_updatePosition(clientX, clientY);
|
|
162
|
+
setPopoverOpen(true);
|
|
163
|
+
setXCalloutValue(`${lineData.xItem.xAxisPoint}`);
|
|
164
|
+
setYCalloutValue(`${lineData.yAxisCalloutData || lineData.data || lineData.y}`);
|
|
165
|
+
setCalloutLegend(lineData.legend);
|
|
166
|
+
setActiveXAxisDataPoint(lineData.xItem.xAxisPoint);
|
|
167
|
+
setColor(lineData.color);
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
|
-
function _onStackHoverFocus(stack,
|
|
170
|
+
function _onStackHoverFocus(stack, event) {
|
|
171
171
|
var _stack_lineData;
|
|
172
172
|
let clientX = 0;
|
|
173
173
|
let clientY = 0;
|
|
174
|
-
if ('clientX' in
|
|
175
|
-
clientX =
|
|
176
|
-
clientY =
|
|
174
|
+
if ('clientX' in event) {
|
|
175
|
+
clientX = event.clientX;
|
|
176
|
+
clientY = event.clientY;
|
|
177
177
|
} else {
|
|
178
|
-
// Handle
|
|
179
|
-
const
|
|
178
|
+
// Handle React FocusEvent or SVGGElement
|
|
179
|
+
const element = 'target' in event ? event.target : event;
|
|
180
|
+
const boundingRect = element.getBoundingClientRect();
|
|
180
181
|
clientX = boundingRect.left + boundingRect.width / 2;
|
|
181
182
|
clientY = boundingRect.top + boundingRect.height / 2;
|
|
182
183
|
}
|
|
@@ -327,19 +328,9 @@ export const VerticalStackedBarChart = /*#__PURE__*/ React.forwardRef((_props, f
|
|
|
327
328
|
const _isHavingLines = props.data.some((item)=>item.lineData && item.lineData.length > 0);
|
|
328
329
|
return props.onRenderCalloutPerStack ? props.onRenderCalloutPerStack(stackCalloutProps) : props.onRenderCalloutPerDataPoint && !_isHavingLines ? props.onRenderCalloutPerDataPoint(dataPointCalloutProps, _renderCallout) : null;
|
|
329
330
|
}
|
|
330
|
-
function _toFocusWholeStack(
|
|
331
|
+
function _toFocusWholeStack() {
|
|
331
332
|
const { isCalloutForStack = false } = props;
|
|
332
|
-
|
|
333
|
-
if (_isHavingLines) {
|
|
334
|
-
if (_getHighlightedLegend().length === 1) {
|
|
335
|
-
shouldFocusStackOnly = false;
|
|
336
|
-
} else {
|
|
337
|
-
shouldFocusStackOnly = true;
|
|
338
|
-
}
|
|
339
|
-
} else {
|
|
340
|
-
shouldFocusStackOnly = isCalloutForStack;
|
|
341
|
-
}
|
|
342
|
-
return shouldFocusStackOnly;
|
|
333
|
+
return isCalloutForStack;
|
|
343
334
|
}
|
|
344
335
|
function _getDomainNRangeValues(points, margins, width, chartType, isRTL, xAxisType, barWidth, tickValues) {
|
|
345
336
|
let domainNRangeValue;
|
|
@@ -445,8 +436,8 @@ export const VerticalStackedBarChart = /*#__PURE__*/ React.forwardRef((_props, f
|
|
|
445
436
|
const circleRef = {
|
|
446
437
|
refElement: null
|
|
447
438
|
};
|
|
448
|
-
const noBarsAndLinesActive = circlePoint.xItem.chartData.filter((dataPoint)=>_noLegendHighlighted() || _isLegendHighlighted(dataPoint.legend)).length === 0;
|
|
449
439
|
const yScaleBandwidthTranslate = !circlePoint.useSecondaryYScale && _yAxisType === YAxisType.StringAxis ? yScalePrimary.bandwidth() / 2 : 0;
|
|
440
|
+
const shouldHighlight = _isLegendHighlighted(circlePoint.legend) || _noLegendHighlighted() ? true : false;
|
|
450
441
|
dots.push(/*#__PURE__*/ React.createElement("circle", {
|
|
451
442
|
key: `${index}-${subIndex}-dot`,
|
|
452
443
|
cx: xScale(circlePoint.xItem.xAxisPoint),
|
|
@@ -464,13 +455,11 @@ export const VerticalStackedBarChart = /*#__PURE__*/ React.forwardRef((_props, f
|
|
|
464
455
|
ref: (e)=>{
|
|
465
456
|
circleRef.refElement = e;
|
|
466
457
|
},
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
'aria-label': _getAriaLabel(circlePoint.xItem, circlePoint)
|
|
473
|
-
} : {}
|
|
458
|
+
tabIndex: !props.hideTooltip && shouldHighlight ? 0 : undefined,
|
|
459
|
+
onFocus: (event)=>_lineFocus(event, circlePoint, circleRef),
|
|
460
|
+
onBlur: _handleMouseOut,
|
|
461
|
+
role: "img",
|
|
462
|
+
"aria-label": _getAriaLabel(circlePoint.xItem, circlePoint, true)
|
|
474
463
|
}));
|
|
475
464
|
});
|
|
476
465
|
});
|
|
@@ -737,8 +726,7 @@ export const VerticalStackedBarChart = /*#__PURE__*/ React.forwardRef((_props, f
|
|
|
737
726
|
const classes = useVerticalStackedBarChartStyles(props);
|
|
738
727
|
function _createBar(xBarScale, yBarScale, containerHeight, xElement) {
|
|
739
728
|
const { barCornerRadius = 0, barMinimumHeight = 0 } = props;
|
|
740
|
-
const
|
|
741
|
-
const shouldFocusWholeStack = _toFocusWholeStack(_isHavingLines);
|
|
729
|
+
const shouldFocusWholeStack = _toFocusWholeStack();
|
|
742
730
|
if (_xAxisType === XAxisTypes.StringAxis) {
|
|
743
731
|
_barWidth = getBarWidth(props.barWidth, props.maxBarWidth, xBarScale.bandwidth());
|
|
744
732
|
}
|
|
@@ -863,17 +851,28 @@ export const VerticalStackedBarChart = /*#__PURE__*/ React.forwardRef((_props, f
|
|
|
863
851
|
};
|
|
864
852
|
let showLabel = false;
|
|
865
853
|
let barLabel = 0;
|
|
854
|
+
let selectedBarTotalValue = 0;
|
|
855
|
+
let customBarLabel = undefined;
|
|
866
856
|
if (!props.hideLabels && _yAxisType !== YAxisType.StringAxis) {
|
|
857
|
+
// Collect all bars with barLabel that match the legend filter
|
|
858
|
+
const barLabelsToDisplay = barsToDisplay.filter((point)=>point.barLabel && (_noLegendHighlighted() || _isLegendHighlighted(point.legend)));
|
|
859
|
+
// For stacked bars, we want to show the total of the stack, not individual bar labels
|
|
860
|
+
// Only use customBarLabel if there's exactly one bar with a label in the stack
|
|
861
|
+
if (barLabelsToDisplay.length === 1) {
|
|
862
|
+
customBarLabel = barLabelsToDisplay[0].barLabel;
|
|
863
|
+
}
|
|
867
864
|
if (_noLegendHighlighted()) {
|
|
868
865
|
showLabel = true;
|
|
869
|
-
barLabel = barTotalValue;
|
|
866
|
+
barLabel = customBarLabel !== null && customBarLabel !== void 0 ? customBarLabel : barTotalValue;
|
|
867
|
+
selectedBarTotalValue = barTotalValue;
|
|
870
868
|
} else {
|
|
871
869
|
barsToDisplay.forEach((point)=>{
|
|
872
870
|
if (_isLegendHighlighted(point.legend)) {
|
|
873
871
|
showLabel = true;
|
|
874
|
-
|
|
872
|
+
selectedBarTotalValue += point.data;
|
|
875
873
|
}
|
|
876
874
|
});
|
|
875
|
+
barLabel = customBarLabel !== null && customBarLabel !== void 0 ? customBarLabel : selectedBarTotalValue;
|
|
877
876
|
}
|
|
878
877
|
}
|
|
879
878
|
return /*#__PURE__*/ React.createElement("g", {
|
|
@@ -887,7 +886,7 @@ export const VerticalStackedBarChart = /*#__PURE__*/ React.forwardRef((_props, f
|
|
|
887
886
|
}, singleBar), !props.hideLabels && _barWidth >= 16 && showLabel && /*#__PURE__*/ React.createElement("text", {
|
|
888
887
|
x: xPoint + _barWidth / 2,
|
|
889
888
|
//if total bar value >=0, show label above top bar, otherwise below bottom bar
|
|
890
|
-
y:
|
|
889
|
+
y: selectedBarTotalValue >= Y_ORIGIN ? yPoint - 6 : yPoint + heightOfLastBar + 12,
|
|
891
890
|
textAnchor: "middle",
|
|
892
891
|
className: classes.barLabel,
|
|
893
892
|
"aria-label": `Total: ${barLabel}`,
|
|
@@ -897,27 +896,8 @@ export const VerticalStackedBarChart = /*#__PURE__*/ React.forwardRef((_props, f
|
|
|
897
896
|
direction: 'ltr',
|
|
898
897
|
unicodeBidi: 'isolate'
|
|
899
898
|
}
|
|
900
|
-
}, typeof props.yAxisTickFormat === 'function' ? props.yAxisTickFormat(barLabel) : formatScientificLimitWidth(barLabel)));
|
|
899
|
+
}, typeof barLabel === 'string' ? barLabel : typeof props.yAxisTickFormat === 'function' ? props.yAxisTickFormat(barLabel) : formatScientificLimitWidth(barLabel)));
|
|
901
900
|
});
|
|
902
|
-
if (!props.showXAxisLablesTooltip) {
|
|
903
|
-
try {
|
|
904
|
-
document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
|
|
905
|
-
// eslint-disable-next-line no-empty
|
|
906
|
-
} catch (e) {}
|
|
907
|
-
}
|
|
908
|
-
if (!props.wrapXAxisLables && props.showXAxisLablesTooltip) {
|
|
909
|
-
const xAxisElement = d3Select(xElement).call(xBarScale);
|
|
910
|
-
try {
|
|
911
|
-
document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
|
|
912
|
-
// eslint-disable-next-line no-empty
|
|
913
|
-
} catch (e) {}
|
|
914
|
-
const tooltipProps = {
|
|
915
|
-
tooltipCls: classes.tooltip,
|
|
916
|
-
id: _tooltipId,
|
|
917
|
-
axis: xAxisElement
|
|
918
|
-
};
|
|
919
|
-
xAxisElement && tooltipOfAxislabels(tooltipProps);
|
|
920
|
-
}
|
|
921
901
|
return bars.filter((bar)=>!!bar);
|
|
922
902
|
}
|
|
923
903
|
function _getMinMaxOfYAxis(dataset, yAxisType, useSecondaryYScale) {
|
|
@@ -1019,7 +999,7 @@ export const VerticalStackedBarChart = /*#__PURE__*/ React.forwardRef((_props, f
|
|
|
1019
999
|
if (!_isChartEmpty()) {
|
|
1020
1000
|
_adjustProps();
|
|
1021
1001
|
const _isHavingLines = props.data.some((item)=>item.lineData && item.lineData.length > 0);
|
|
1022
|
-
const shouldFocusWholeStack = _toFocusWholeStack(
|
|
1002
|
+
const shouldFocusWholeStack = _toFocusWholeStack();
|
|
1023
1003
|
_dataset = _createDataSetLayer();
|
|
1024
1004
|
const legendBars = _getLegendData(_points, _createLegendsForLine(props.data));
|
|
1025
1005
|
const calloutProps = {
|
|
@@ -1033,7 +1013,7 @@ export const VerticalStackedBarChart = /*#__PURE__*/ React.forwardRef((_props, f
|
|
|
1033
1013
|
...getAccessibleDataObject(callOutAccessibilityData),
|
|
1034
1014
|
clickPosition: clickPosition,
|
|
1035
1015
|
isPopoverOpen: isPopoverOpen,
|
|
1036
|
-
isCalloutForStack:
|
|
1016
|
+
isCalloutForStack: shouldFocusWholeStack,
|
|
1037
1017
|
isCartesian: true,
|
|
1038
1018
|
customCallout: {
|
|
1039
1019
|
customizedCallout: _getCustomizedCallout() !== null ? _getCustomizedCallout() : undefined,
|
|
@@ -1078,7 +1058,7 @@ export const VerticalStackedBarChart = /*#__PURE__*/ React.forwardRef((_props, f
|
|
|
1078
1058
|
],
|
|
1079
1059
|
getYDomainMargins: _getYDomainMargins,
|
|
1080
1060
|
/* eslint-disable react/jsx-no-bind */ children: (props)=>{
|
|
1081
|
-
return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("g",
|
|
1061
|
+
return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("g", _arrowNavigationAttributes, _bars), /*#__PURE__*/ React.createElement("g", null, _isHavingLines && _createLines(props.xScale, props.yScalePrimary, props.containerHeight, props.containerWidth, props.yScaleSecondary)));
|
|
1082
1062
|
}
|
|
1083
1063
|
});
|
|
1084
1064
|
}
|