@fluentui/react-charts 0.0.0-nightly-20260108-0406.1 → 0.0.0-nightly-20260112-0407.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -13
- package/dist/index.d.ts +5 -0
- package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js +2 -1
- package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -1
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js +7 -5
- 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 +47 -3
- package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -1
- package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +24 -17
- package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -1
- package/lib/components/FunnelChart/FunnelChart.js +15 -2
- package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +2 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib/components/LineChart/LineChart.js +4 -1
- package/lib/components/LineChart/LineChart.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +25 -36
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js +2 -1
- package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js +7 -5
- 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 +58 -4
- package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +24 -17
- package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/FunnelChart.js +15 -2
- package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +2 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.js +4 -1
- package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +25 -36
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/package.json +10 -10
package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js
CHANGED
|
@@ -75,6 +75,7 @@ const getDefaultConnectorStrokeColor = ()=>_reacttheme.tokens.colorNeutralForegr
|
|
|
75
75
|
const chartAnnotationLayerClassNames = {
|
|
76
76
|
root: 'fui-chartAnnotationLayer__root',
|
|
77
77
|
annotation: 'fui-chartAnnotationLayer__annotation',
|
|
78
|
+
annotationNoDefaults: 'fui-chartAnnotationLayer__annotationNoDefaults',
|
|
78
79
|
connectorLayer: 'fui-chartAnnotationLayer__connectorLayer',
|
|
79
80
|
measurement: 'fui-chartAnnotationLayer__measurement',
|
|
80
81
|
annotationContent: 'fui-chartAnnotationLayer__annotationContent',
|
|
@@ -85,7 +86,24 @@ const chartAnnotationLayerClassNames = {
|
|
|
85
86
|
};
|
|
86
87
|
/**
|
|
87
88
|
* Base Styles
|
|
88
|
-
*/ const
|
|
89
|
+
*/ const annotationBaseStyles = {
|
|
90
|
+
..._reacttheme.typographyStyles.caption1,
|
|
91
|
+
position: 'absolute',
|
|
92
|
+
pointerEvents: 'none',
|
|
93
|
+
display: 'flex',
|
|
94
|
+
alignItems: 'center',
|
|
95
|
+
justifyContent: 'center',
|
|
96
|
+
textAlign: 'center',
|
|
97
|
+
color: _reacttheme.tokens.colorNeutralForeground1,
|
|
98
|
+
paddingTop: '4px',
|
|
99
|
+
paddingBottom: '4px',
|
|
100
|
+
paddingLeft: '8px',
|
|
101
|
+
paddingRight: '8px',
|
|
102
|
+
borderRadius: _reacttheme.tokens.borderRadiusMedium,
|
|
103
|
+
whiteSpace: 'pre-wrap',
|
|
104
|
+
zIndex: 2
|
|
105
|
+
};
|
|
106
|
+
const useStyles = (0, _react.makeStyles)({
|
|
89
107
|
root: {
|
|
90
108
|
position: 'absolute',
|
|
91
109
|
top: '0',
|
|
@@ -99,23 +117,12 @@ const chartAnnotationLayerClassNames = {
|
|
|
99
117
|
zIndex: 1
|
|
100
118
|
},
|
|
101
119
|
annotation: {
|
|
102
|
-
...
|
|
103
|
-
position: 'absolute',
|
|
104
|
-
pointerEvents: 'none',
|
|
105
|
-
display: 'flex',
|
|
106
|
-
alignItems: 'center',
|
|
107
|
-
justifyContent: 'center',
|
|
108
|
-
textAlign: 'center',
|
|
109
|
-
color: _reacttheme.tokens.colorNeutralForeground1,
|
|
110
|
-
paddingTop: '4px',
|
|
111
|
-
paddingBottom: '4px',
|
|
112
|
-
paddingLeft: '8px',
|
|
113
|
-
paddingRight: '8px',
|
|
114
|
-
borderRadius: _reacttheme.tokens.borderRadiusMedium,
|
|
120
|
+
...annotationBaseStyles,
|
|
115
121
|
boxShadow: _reacttheme.tokens.shadow16,
|
|
116
|
-
border: `1px solid ${_reacttheme.tokens.colorNeutralStroke1}
|
|
117
|
-
|
|
118
|
-
|
|
122
|
+
border: `1px solid ${_reacttheme.tokens.colorNeutralStroke1}`
|
|
123
|
+
},
|
|
124
|
+
annotationNoDefaults: {
|
|
125
|
+
...annotationBaseStyles
|
|
119
126
|
},
|
|
120
127
|
connectorLayer: {
|
|
121
128
|
position: 'absolute',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.ts"],"sourcesContent":["'use client';\n\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport { SlotClassNames } from '@fluentui/react-utilities';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\nimport { color as d3Color } from 'd3-color';\nimport { ChartAnnotationArrowHead } from '../../../types/ChartAnnotation';\n\nexport interface ChartAnnotationLayerStyles {\n root?: string;\n annotation?: string;\n connectorLayer?: string;\n measurement?: string;\n annotationContent?: string;\n annotationForeignObject?: string;\n annotationContentInteractive?: string;\n annotationForeignObjectInteractive?: string;\n connectorGroup?: string;\n}\n\nexport interface ChartAnnotationLayerStyleProps {\n className?: string;\n styles?: Partial<ChartAnnotationLayerStyles>;\n}\n\nexport const DEFAULT_ANNOTATION_BACKGROUND_OPACITY = 0.8;\nexport const DEFAULT_ANNOTATION_PADDING = '4px 8px';\nexport const DEFAULT_CONNECTOR_START_PADDING = 12;\nexport const DEFAULT_CONNECTOR_END_PADDING = 0;\nexport const DEFAULT_CONNECTOR_STROKE_WIDTH = 2;\nexport const DEFAULT_CONNECTOR_ARROW: ChartAnnotationArrowHead = 'end';\n\nexport const applyOpacityToColor = (\n color: string | undefined,\n opacity: number,\n options?: {\n preserveOriginalOpacity?: boolean;\n },\n): string | undefined => {\n if (!color) {\n return undefined;\n }\n\n const parsed = d3Color(color);\n if (!parsed) {\n return color;\n }\n\n const originalOpacity = typeof parsed.opacity === 'number' ? parsed.opacity : 1;\n const preserveOriginalOpacity = options?.preserveOriginalOpacity ?? true;\n\n if (preserveOriginalOpacity && originalOpacity < 1) {\n return parsed.toString();\n }\n\n parsed.opacity = Math.max(0, Math.min(1, opacity));\n return parsed.toString();\n};\n\n/**\n * Get default annotation background color with opacity applied\n * Updated for v9 - uses tokens instead of theme\n */\nexport const getDefaultAnnotationBackgroundColor = (): string | undefined =>\n applyOpacityToColor(tokens.colorNeutralBackground1, DEFAULT_ANNOTATION_BACKGROUND_OPACITY);\n\n/**\n * Get default connector stroke color\n * Updated for v9 - uses tokens instead of theme\n */\nexport const getDefaultConnectorStrokeColor = (): string => tokens.colorNeutralForeground1;\n\n/**\n * @internal\n */\nexport const chartAnnotationLayerClassNames: SlotClassNames<ChartAnnotationLayerStyles> = {\n root: 'fui-chartAnnotationLayer__root',\n annotation: 'fui-chartAnnotationLayer__annotation',\n connectorLayer: 'fui-chartAnnotationLayer__connectorLayer',\n measurement: 'fui-chartAnnotationLayer__measurement',\n annotationContent: 'fui-chartAnnotationLayer__annotationContent',\n annotationForeignObject: 'fui-chartAnnotationLayer__annotationForeignObject',\n annotationContentInteractive: 'fui-chartAnnotationLayer__annotationContentInteractive',\n annotationForeignObjectInteractive: 'fui-chartAnnotationLayer__annotationForeignObjectInteractive',\n connectorGroup: 'fui-chartAnnotationLayer__connectorGroup',\n};\n\n/**\n * Base Styles\n */\nconst useStyles = makeStyles({\n root: {\n position: 'absolute',\n top: '0',\n left: '0',\n right: '0',\n bottom: '0',\n width: '100%',\n height: '100%',\n pointerEvents: 'none',\n overflow: 'visible',\n zIndex: 1,\n },\n annotation: {\n ...typographyStyles.caption1,\n position: 'absolute',\n pointerEvents: 'none',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n textAlign: 'center',\n color: tokens.colorNeutralForeground1,\n paddingTop: '4px',\n paddingBottom: '4px',\n paddingLeft: '8px',\n paddingRight: '8px',\n borderRadius: tokens.borderRadiusMedium,\n boxShadow: tokens.shadow16,\n border: `1px solid ${tokens.colorNeutralStroke1}`,\n whiteSpace: 'pre-wrap',\n zIndex: 2,\n },\n connectorLayer: {\n position: 'absolute',\n top: '0',\n left: '0',\n width: '100%',\n height: '100%',\n pointerEvents: 'none',\n overflow: 'visible',\n },\n measurement: {\n position: 'absolute',\n visibility: 'hidden',\n pointerEvents: 'none',\n },\n annotationContent: {\n width: '100%',\n height: '100%',\n pointerEvents: 'none',\n },\n annotationForeignObject: {\n overflow: 'visible',\n pointerEvents: 'none',\n },\n annotationContentInteractive: {\n pointerEvents: 'auto',\n },\n annotationForeignObjectInteractive: {\n pointerEvents: 'auto',\n },\n connectorGroup: {\n pointerEvents: 'none',\n },\n});\n\n/**\n * Apply styling to the ChartAnnotationLayer slots based on the state\n */\nexport const useChartAnnotationLayerStyles = (props: ChartAnnotationLayerStyleProps): ChartAnnotationLayerStyles => {\n const baseStyles = useStyles();\n\n return {\n root: mergeClasses(chartAnnotationLayerClassNames.root, baseStyles.root, props.className, props.styles?.root),\n annotation: mergeClasses(\n chartAnnotationLayerClassNames.annotation,\n baseStyles.annotation,\n props.styles?.annotation,\n ),\n connectorLayer: mergeClasses(\n chartAnnotationLayerClassNames.connectorLayer,\n baseStyles.connectorLayer,\n props.styles?.connectorLayer,\n ),\n measurement: mergeClasses(\n chartAnnotationLayerClassNames.measurement,\n baseStyles.measurement,\n props.styles?.measurement,\n ),\n annotationContent: mergeClasses(\n chartAnnotationLayerClassNames.annotationContent,\n baseStyles.annotationContent,\n props.styles?.annotationContent,\n ),\n annotationForeignObject: mergeClasses(\n chartAnnotationLayerClassNames.annotationForeignObject,\n baseStyles.annotationForeignObject,\n props.styles?.annotationForeignObject,\n ),\n annotationContentInteractive: mergeClasses(\n chartAnnotationLayerClassNames.annotationContentInteractive,\n baseStyles.annotationContentInteractive,\n props.styles?.annotationContentInteractive,\n ),\n annotationForeignObjectInteractive: mergeClasses(\n chartAnnotationLayerClassNames.annotationForeignObjectInteractive,\n baseStyles.annotationForeignObjectInteractive,\n props.styles?.annotationForeignObjectInteractive,\n ),\n connectorGroup: mergeClasses(\n chartAnnotationLayerClassNames.connectorGroup,\n baseStyles.connectorGroup,\n props.styles?.connectorGroup,\n ),\n };\n};\n"],"names":["makeStyles","mergeClasses","tokens","typographyStyles","color","d3Color","DEFAULT_ANNOTATION_BACKGROUND_OPACITY","DEFAULT_ANNOTATION_PADDING","DEFAULT_CONNECTOR_START_PADDING","DEFAULT_CONNECTOR_END_PADDING","DEFAULT_CONNECTOR_STROKE_WIDTH","DEFAULT_CONNECTOR_ARROW","applyOpacityToColor","opacity","options","undefined","parsed","originalOpacity","preserveOriginalOpacity","toString","Math","max","min","getDefaultAnnotationBackgroundColor","colorNeutralBackground1","getDefaultConnectorStrokeColor","colorNeutralForeground1","chartAnnotationLayerClassNames","root","annotation","connectorLayer","measurement","annotationContent","annotationForeignObject","annotationContentInteractive","annotationForeignObjectInteractive","connectorGroup","useStyles","position","top","left","right","bottom","width","height","pointerEvents","overflow","zIndex","caption1","display","alignItems","justifyContent","textAlign","paddingTop","paddingBottom","paddingLeft","paddingRight","borderRadius","borderRadiusMedium","boxShadow","shadow16","border","colorNeutralStroke1","whiteSpace","visibility","useChartAnnotationLayerStyles","props","baseStyles","className","styles"],"mappings":"AAAA;;;;;;;;;;;;IAyBaM,qCAAAA;;;8BACAC;;;2BAIAI;eAAAA;;iCAFAF;;;mCADAD;eAAAA;;kCAEAE;;;uBAGAE;eAAAA;;IA2CAe,8BAAAA;;;uCAZAJ;eAAAA;;IAOAE,8BAAAA;;;iCAyFAwC;eAAAA;;;uBA7J4B,iBAAiB;4BAEjB,wBAAwB;yBAChC,WAAW;AAoBrC,8CAA8C,IAAI;AAClD,MAAM1D,6BAA6B,UAAU;AAC7C,wCAAwC,GAAG;AAC3C,MAAME,gCAAgC,EAAE;AACxC,MAAMC,iCAAiC,EAAE;AACzC,gCAA0D,MAAM;AAEhE,4BAA4B,CACjCN,OACAS,SACAC;IAIA,IAAI,CAACV,OAAO;QACV,OAAOW;IACT;IAEA,MAAMC,aAASX,cAAAA,EAAQD;IACvB,IAAI,CAACY,QAAQ;QACX,OAAOZ;IACT;IAEA,MAAMa,kBAAkB,OAAOD,OAAOH,OAAO,KAAK,WAAWG,OAAOH,OAAO,GAAG;QAC9CC;IAAhC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AcnC,WAAW;QAE3BC,uBAAmB/B,mBAAAA,EACjB0B,+BAA+BK,iBAAiB,EAChDmC,WAAWnC,iBAAiB,EAAA,CAC5BkC,iBAAAA,MAAMG,MAAAA,AAAM,MAAA,QAAZH,mBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,eAAclC,iBAAiB;QAEjCC,6BAAyBhC,mBAAAA,EACvB0B,+BAA+BM,uBAAuB,EACtDkC,WAAWlC,uBAAuB,EAAA,CAClCiC,iBAAAA,MAAMG,MAAAA,AAAM,MAAA,QAAZH,mBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,eAAcjC,uBAAuB;QAEvCC,kCAA8BjC,mBAAAA,EAC5B0B,+BAA+BO,4BAA4B,EAC3DiC,WAAWjC,4BAA4B,EAAA,CACvCgC,iBAAAA,MAAMG,MAAAA,AAAM,MAAA,QAAZH,mBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,eAAchC,4BAA4B;QAE5CC,oCAAoClC,uBAAAA,EAClC0B,+BAA+BQ,kCAAkC,EACjEgC,WAAWhC,kCAAkC,EAAA,CAC7C+B,iBAAAA,MAAMG,MAAAA,AAAM,MAAA,QAAZH,mBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,eAAc/B,kCAAkC;QAElDC,oBAAgBnC,mBAAAA,EACd0B,+BAA+BS,cAAc,EAC7C+B,WAAW/B,cAAc,EAAA,CACzB8B,iBAAAA,MAAMG,MAAAA,AAAM,MAAA,QAAZH,mBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,eAAc9B,cAAc;IAEhC;AACF,EAAE"}
|
|
1
|
+
{"version":3,"sources":["../src/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.ts"],"sourcesContent":["'use client';\n\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport { SlotClassNames } from '@fluentui/react-utilities';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\nimport { color as d3Color } from 'd3-color';\nimport { ChartAnnotationArrowHead } from '../../../types/ChartAnnotation';\n\nexport interface ChartAnnotationLayerStyles {\n root?: string;\n annotation?: string;\n annotationNoDefaults?: string;\n connectorLayer?: string;\n measurement?: string;\n annotationContent?: string;\n annotationForeignObject?: string;\n annotationContentInteractive?: string;\n annotationForeignObjectInteractive?: string;\n connectorGroup?: string;\n}\n\nexport interface ChartAnnotationLayerStyleProps {\n className?: string;\n styles?: Partial<ChartAnnotationLayerStyles>;\n}\n\nexport const DEFAULT_ANNOTATION_BACKGROUND_OPACITY = 0.8;\nexport const DEFAULT_ANNOTATION_PADDING = '4px 8px';\nexport const DEFAULT_CONNECTOR_START_PADDING = 12;\nexport const DEFAULT_CONNECTOR_END_PADDING = 0;\nexport const DEFAULT_CONNECTOR_STROKE_WIDTH = 2;\nexport const DEFAULT_CONNECTOR_ARROW: ChartAnnotationArrowHead = 'end';\n\nexport const applyOpacityToColor = (\n color: string | undefined,\n opacity: number,\n options?: {\n preserveOriginalOpacity?: boolean;\n },\n): string | undefined => {\n if (!color) {\n return undefined;\n }\n\n const parsed = d3Color(color);\n if (!parsed) {\n return color;\n }\n\n const originalOpacity = typeof parsed.opacity === 'number' ? parsed.opacity : 1;\n const preserveOriginalOpacity = options?.preserveOriginalOpacity ?? true;\n\n if (preserveOriginalOpacity && originalOpacity < 1) {\n return parsed.toString();\n }\n\n parsed.opacity = Math.max(0, Math.min(1, opacity));\n return parsed.toString();\n};\n\n/**\n * Get default annotation background color with opacity applied\n * Updated for v9 - uses tokens instead of theme\n */\nexport const getDefaultAnnotationBackgroundColor = (): string | undefined =>\n applyOpacityToColor(tokens.colorNeutralBackground1, DEFAULT_ANNOTATION_BACKGROUND_OPACITY);\n\n/**\n * Get default connector stroke color\n * Updated for v9 - uses tokens instead of theme\n */\nexport const getDefaultConnectorStrokeColor = (): string => tokens.colorNeutralForeground1;\n\n/**\n * @internal\n */\nexport const chartAnnotationLayerClassNames: SlotClassNames<ChartAnnotationLayerStyles> = {\n root: 'fui-chartAnnotationLayer__root',\n annotation: 'fui-chartAnnotationLayer__annotation',\n annotationNoDefaults: 'fui-chartAnnotationLayer__annotationNoDefaults',\n connectorLayer: 'fui-chartAnnotationLayer__connectorLayer',\n measurement: 'fui-chartAnnotationLayer__measurement',\n annotationContent: 'fui-chartAnnotationLayer__annotationContent',\n annotationForeignObject: 'fui-chartAnnotationLayer__annotationForeignObject',\n annotationContentInteractive: 'fui-chartAnnotationLayer__annotationContentInteractive',\n annotationForeignObjectInteractive: 'fui-chartAnnotationLayer__annotationForeignObjectInteractive',\n connectorGroup: 'fui-chartAnnotationLayer__connectorGroup',\n};\n\n/**\n * Base Styles\n */\nconst annotationBaseStyles = {\n ...typographyStyles.caption1,\n position: 'absolute',\n pointerEvents: 'none',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n textAlign: 'center',\n color: tokens.colorNeutralForeground1,\n paddingTop: '4px',\n paddingBottom: '4px',\n paddingLeft: '8px',\n paddingRight: '8px',\n borderRadius: tokens.borderRadiusMedium,\n whiteSpace: 'pre-wrap',\n zIndex: 2,\n} as const;\n\nconst useStyles = makeStyles({\n root: {\n position: 'absolute',\n top: '0',\n left: '0',\n right: '0',\n bottom: '0',\n width: '100%',\n height: '100%',\n pointerEvents: 'none',\n overflow: 'visible',\n zIndex: 1,\n },\n annotation: {\n ...annotationBaseStyles,\n boxShadow: tokens.shadow16,\n border: `1px solid ${tokens.colorNeutralStroke1}`,\n },\n annotationNoDefaults: {\n ...annotationBaseStyles,\n },\n connectorLayer: {\n position: 'absolute',\n top: '0',\n left: '0',\n width: '100%',\n height: '100%',\n pointerEvents: 'none',\n overflow: 'visible',\n },\n measurement: {\n position: 'absolute',\n visibility: 'hidden',\n pointerEvents: 'none',\n },\n annotationContent: {\n width: '100%',\n height: '100%',\n pointerEvents: 'none',\n },\n annotationForeignObject: {\n overflow: 'visible',\n pointerEvents: 'none',\n },\n annotationContentInteractive: {\n pointerEvents: 'auto',\n },\n annotationForeignObjectInteractive: {\n pointerEvents: 'auto',\n },\n connectorGroup: {\n pointerEvents: 'none',\n },\n});\n\n/**\n * Apply styling to the ChartAnnotationLayer slots based on the state\n */\nexport const useChartAnnotationLayerStyles = (props: ChartAnnotationLayerStyleProps): ChartAnnotationLayerStyles => {\n const baseStyles = useStyles();\n\n return {\n root: mergeClasses(chartAnnotationLayerClassNames.root, baseStyles.root, props.className, props.styles?.root),\n annotation: mergeClasses(\n chartAnnotationLayerClassNames.annotation,\n baseStyles.annotation,\n props.styles?.annotation,\n ),\n connectorLayer: mergeClasses(\n chartAnnotationLayerClassNames.connectorLayer,\n baseStyles.connectorLayer,\n props.styles?.connectorLayer,\n ),\n measurement: mergeClasses(\n chartAnnotationLayerClassNames.measurement,\n baseStyles.measurement,\n props.styles?.measurement,\n ),\n annotationContent: mergeClasses(\n chartAnnotationLayerClassNames.annotationContent,\n baseStyles.annotationContent,\n props.styles?.annotationContent,\n ),\n annotationForeignObject: mergeClasses(\n chartAnnotationLayerClassNames.annotationForeignObject,\n baseStyles.annotationForeignObject,\n props.styles?.annotationForeignObject,\n ),\n annotationContentInteractive: mergeClasses(\n chartAnnotationLayerClassNames.annotationContentInteractive,\n baseStyles.annotationContentInteractive,\n props.styles?.annotationContentInteractive,\n ),\n annotationForeignObjectInteractive: mergeClasses(\n chartAnnotationLayerClassNames.annotationForeignObjectInteractive,\n baseStyles.annotationForeignObjectInteractive,\n props.styles?.annotationForeignObjectInteractive,\n ),\n connectorGroup: mergeClasses(\n chartAnnotationLayerClassNames.connectorGroup,\n baseStyles.connectorGroup,\n props.styles?.connectorGroup,\n ),\n };\n};\n"],"names":["makeStyles","mergeClasses","tokens","typographyStyles","color","d3Color","DEFAULT_ANNOTATION_BACKGROUND_OPACITY","DEFAULT_ANNOTATION_PADDING","DEFAULT_CONNECTOR_START_PADDING","DEFAULT_CONNECTOR_END_PADDING","DEFAULT_CONNECTOR_STROKE_WIDTH","DEFAULT_CONNECTOR_ARROW","applyOpacityToColor","opacity","options","undefined","parsed","originalOpacity","preserveOriginalOpacity","toString","Math","max","min","getDefaultAnnotationBackgroundColor","colorNeutralBackground1","getDefaultConnectorStrokeColor","colorNeutralForeground1","chartAnnotationLayerClassNames","root","annotation","annotationNoDefaults","connectorLayer","measurement","annotationContent","annotationForeignObject","annotationContentInteractive","annotationForeignObjectInteractive","connectorGroup","annotationBaseStyles","caption1","position","pointerEvents","display","alignItems","justifyContent","textAlign","paddingTop","paddingBottom","paddingLeft","paddingRight","borderRadius","borderRadiusMedium","whiteSpace","zIndex","useStyles","top","left","right","bottom","width","height","overflow","boxShadow","shadow16","border","colorNeutralStroke1","visibility","useChartAnnotationLayerStyles","props","baseStyles","className","styles"],"mappings":"AAAA;;;;;;;;;;;;IA0BaM,qCAAAA;;;8BACAC;;;2BAIAI;eAAAA;;iCAFAF;;;mCADAD;eAAAA;;kCAEAE;;;uBAGAE;eAAAA;;IA2CAe,8BAAAA;;;uCAZAJ;;;kCAOAE;eAAAA;;IAiGA0C,6BAAAA;;;;uBAtK4B,iBAAiB;4BAEjB,wBAAwB;yBAChC,WAAW;AAqBrC,8CAA8C,IAAI;AAClD,MAAM5D,6BAA6B,UAAU;AAC7C,wCAAwC,GAAG;AAC3C,MAAME,gCAAgC,EAAE;AACxC,MAAMC,iCAAiC,EAAE;AACzC,gCAA0D,MAAM;AAEhE,4BAA4B,CACjCN,OACAS,SACAC;IAIA,IAAI,CAACV,OAAO;QACV,OAAOW;IACT;IAEA,MAAMC,aAASX,cAAAA,EAAQD;IACvB,IAAI,CAACY,QAAQ;QACX,OAAOZ;IACT;IAEA,MAAMa,kBAAkB,OAAOD,OAAOH,OAAO,KAAK,WAAWG,OAAOH,OAAO,GAAG;QAC9CC;IAAhC,MAAMI,0BAA0BJ,CAAAA,mCAAAA,YAAAA,QAAAA,YAAAA,KAAAA,IAAAA,KAAAA,IAAAA,QAASI,uBAAAA,AAAuB,MAAA,QAAhCJ,qCAAAA,KAAAA,IAAAA,mCAAoC;IAEpE,IAAII,2BAA2BD,kBAAkB,GAAG;QAClD,OAAOD,OAAOG,QAAQ;IAC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EAAA,CAC5BmC,iBAAAA,MAAMG,MAAAA,AAAM,MAAA,QAAZH,mBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,eAAcnC,iBAAiB;QAEjCC,6BAAyBjC,mBAAAA,EACvB0B,+BAA+BO,uBAAuB,EACtDmC,WAAWnC,uBAAuB,EAAA,CAClCkC,iBAAAA,MAAMG,MAAAA,AAAM,MAAA,QAAZH,mBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,eAAclC,uBAAuB;QAEvCC,kCAA8BlC,mBAAAA,EAC5B0B,+BAA+BQ,4BAA4B,EAC3DkC,WAAWlC,4BAA4B,EAAA,CACvCiC,iBAAAA,MAAMG,MAAAA,AAAM,MAAA,QAAZH,mBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,eAAcjC,4BAA4B;QAE5CC,wCAAoCnC,mBAAAA,EAClC0B,+BAA+BS,kCAAkC,EACjEiC,WAAWjC,kCAAkC,EAAA,CAC7CgC,iBAAAA,MAAMG,MAAAA,AAAM,MAAA,QAAZH,mBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,eAAchC,kCAAkC;QAElDC,oBAAgBpC,mBAAAA,EACd0B,+BAA+BU,cAAc,EAC7CgC,WAAWhC,cAAc,EAAA,CACzB+B,iBAAAA,MAAMG,MAAAA,AAAM,MAAA,QAAZH,mBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,eAAc/B,cAAc;IAEhC;AACF,EAAE"}
|
|
@@ -108,6 +108,18 @@ const FunnelChart = /*#__PURE__*/ _react.forwardRef(({ orientation = 'vertical',
|
|
|
108
108
|
function noLegendHighlighted() {
|
|
109
109
|
return getHighlightedLegend().length === 0;
|
|
110
110
|
}
|
|
111
|
+
function _getAriaLabel(data) {
|
|
112
|
+
if ('subValue' in data) {
|
|
113
|
+
// Stacked funnel segment
|
|
114
|
+
const formattedValue = (0, _chartutilities.formatToLocaleString)(data.subValue.value.toString(), props.culture);
|
|
115
|
+
return `${data.stage}, ${data.subValue.category}, ${formattedValue}.`;
|
|
116
|
+
} else {
|
|
117
|
+
var _data_value;
|
|
118
|
+
// Non-stacked funnel segment
|
|
119
|
+
const formattedValue = (0, _chartutilities.formatToLocaleString)(((_data_value = data.value) !== null && _data_value !== void 0 ? _data_value : 0).toString(), props.culture);
|
|
120
|
+
return `${data.stage}, ${formattedValue}.`;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
111
123
|
function _getEventHandlerProps(data, opacity, segmentId) {
|
|
112
124
|
const targetElement = document.getElementById(segmentId);
|
|
113
125
|
if ('subValue' in data) {
|
|
@@ -161,7 +173,9 @@ const FunnelChart = /*#__PURE__*/ _react.forwardRef(({ orientation = 'vertical',
|
|
|
161
173
|
fill: fill,
|
|
162
174
|
opacity: opacity,
|
|
163
175
|
...eventHandlers,
|
|
164
|
-
tabIndex: tabIndex
|
|
176
|
+
tabIndex: tabIndex,
|
|
177
|
+
role: "img",
|
|
178
|
+
"aria-label": _getAriaLabel(data)
|
|
165
179
|
}), textProps && /*#__PURE__*/ _react.createElement("g", eventHandlers, _renderSegmentText({
|
|
166
180
|
...textProps,
|
|
167
181
|
textColor,
|
|
@@ -363,7 +377,6 @@ const FunnelChart = /*#__PURE__*/ _react.forwardRef(({ orientation = 'vertical',
|
|
|
363
377
|
height: height,
|
|
364
378
|
className: classes.chart,
|
|
365
379
|
...arrowAttributes,
|
|
366
|
-
role: 'img',
|
|
367
380
|
"aria-label": props.chartTitle
|
|
368
381
|
}, /*#__PURE__*/ _react.createElement("g", {
|
|
369
382
|
transform: isRTL ? `translate(${funnelOffsetX + funnelWidth}, ${funnelMarginTop}) scale(-1,1)` : `translate(${funnelOffsetX}, ${funnelMarginTop})`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/FunnelChart/FunnelChart.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useId } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport { useRtl } from '../../utilities/index';\nimport { FunnelChartDataPoint, FunnelChartProps } from './FunnelChart.types';\nimport { Legend, Legends } from '../Legends/index';\nimport { useArrowNavigationGroup } from '@fluentui/react-tabster';\nimport { ChartPopover } from '../CommonComponents/ChartPopover';\nimport { formatToLocaleString } from '@fluentui/chart-utilities';\nimport { getContrastTextColor } from '../../utilities/colors';\nimport { useFunnelChartStyles } from './useFunnelChartStyles.styles';\nimport {\n getHorizontalFunnelSegmentGeometry,\n getVerticalFunnelSegmentGeometry,\n getSegmentTextProps,\n getStackedHorizontalFunnelSegmentGeometry,\n getStackedVerticalFunnelSegmentGeometry,\n} from './funnelGeometry';\nimport { ChartPopoverProps } from '../../index';\nimport { useImageExport } from '../../utilities/hooks';\n\nexport const FunnelChart: React.FunctionComponent<FunnelChartProps> = React.forwardRef<\n HTMLDivElement,\n FunnelChartProps\n>(({ orientation = 'vertical', ...restProps }, forwardedRef) => {\n const props = { orientation, ...restProps };\n const _emptyChartId: string = useId('_FunnelChart_empty');\n const isRTL = useRtl();\n\n const [hoveredStage, setHoveredStage] = React.useState<string | null>(null);\n const [calloutData, setCalloutData] = React.useState<FunnelChartDataPoint | null>(null);\n const [selectedLegends, setSelectedLegends] = React.useState<string[]>([]);\n const [isPopoverOpen, setPopoverOpen] = React.useState(false);\n const [refSelected, setRefSelected] = React.useState<HTMLElement | null>(null);\n const isStacked = isStackedFunnelData(props.data);\n const { chartContainerRef, legendsRef: _legendsRef } = useImageExport(props.componentRef, props.hideLegend, false);\n\n React.useEffect(() => {\n if (props.legendProps?.selectedLegends) {\n setSelectedLegends(props.legendProps.selectedLegends);\n }\n }, [props.legendProps?.selectedLegends]);\n\n function _handleHover(\n data: FunnelChartDataPoint,\n mouseEvent: React.MouseEvent<SVGElement>,\n targetElement?: HTMLElement | null,\n ) {\n mouseEvent?.persist();\n setCalloutData(data);\n setRefSelected(targetElement!);\n setPopoverOpen(true);\n }\n\n function _handleFocus(\n data: FunnelChartDataPoint,\n focusEvent: React.FocusEvent<SVGPathElement>,\n targetElement?: HTMLElement | null,\n ) {\n focusEvent?.persist();\n setCalloutData(data);\n setRefSelected(targetElement!);\n setPopoverOpen(true);\n }\n\n function _handleStackedHover(\n stage: string,\n subValue: { category: string; value: number; color: string },\n mouseEvent: React.MouseEvent<SVGElement>,\n targetElement?: HTMLElement | null,\n ) {\n mouseEvent?.persist();\n setCalloutData({\n stage,\n value: subValue.value,\n color: subValue.color,\n category: subValue.category,\n } as FunnelChartDataPoint);\n setRefSelected(targetElement!);\n setPopoverOpen(true);\n }\n\n function _handleStackedFocus(\n stage: string,\n subValue: { category: string; value: number; color: string },\n focusEvent: React.FocusEvent<SVGPathElement>,\n targetElement?: HTMLElement | null,\n ) {\n focusEvent?.persist();\n setCalloutData({\n stage,\n value: subValue.value,\n color: subValue.color,\n category: subValue.category,\n } as FunnelChartDataPoint);\n setRefSelected(targetElement!);\n setPopoverOpen(true);\n }\n\n function _handleMouseOut() {\n setHoveredStage(null);\n setPopoverOpen(false);\n setCalloutData(null);\n }\n\n function _onLegendSelectionChange(\n legendsSelected: string[],\n event: React.MouseEvent<HTMLButtonElement>,\n currentLegend?: Legend,\n ): void {\n if (props.legendProps?.canSelectMultipleLegends) {\n setSelectedLegends(legendsSelected);\n } else {\n setSelectedLegends(legendsSelected.slice(-1));\n }\n\n if (props.legendProps?.onChange) {\n props.legendProps.onChange(legendsSelected, event, currentLegend);\n }\n }\n\n const _onLegendSelectionChangeCallback = React.useCallback(_onLegendSelectionChange, [props.legendProps]);\n\n function getHighlightedLegend(): string[] {\n return selectedLegends.length > 0 ? selectedLegends : hoveredStage ? [hoveredStage] : [];\n }\n\n function legendHighlighted(legend: string): boolean {\n return getHighlightedLegend().includes(legend);\n }\n\n function noLegendHighlighted(): boolean {\n return getHighlightedLegend().length === 0;\n }\n\n function _getEventHandlerProps(\n data: FunnelChartDataPoint | { stage: string; subValue: { category: string; value: number; color: string } },\n opacity?: number,\n segmentId?: string,\n ) {\n const targetElement = document.getElementById(segmentId!);\n if ('subValue' in data) {\n return {\n culture: props.culture,\n onMouseOver:\n opacity == 1\n ? (event: React.MouseEvent<SVGElement>) =>\n _handleStackedHover(data.stage, data.subValue, event, targetElement)\n : undefined,\n onMouseMove:\n opacity == 1\n ? (event: React.MouseEvent<SVGElement>) =>\n _handleStackedHover(data.stage, data.subValue, event, targetElement)\n : undefined,\n onFocus: (event: React.FocusEvent<SVGPathElement>) =>\n _handleStackedFocus(data.stage, data.subValue, event, targetElement),\n onBlur: () => _handleMouseOut(),\n onMouseOut: () => _handleMouseOut(),\n };\n } else {\n return {\n culture: props.culture,\n onMouseOver:\n opacity == 1 ? (event: React.MouseEvent<SVGElement>) => _handleHover(data, event, targetElement) : undefined,\n onMouseMove:\n opacity == 1 ? (event: React.MouseEvent<SVGElement>) => _handleHover(data, event, targetElement) : undefined,\n onFocus: (event: React.FocusEvent<SVGPathElement>) => _handleFocus(data, event, targetElement),\n onBlur: () => _handleMouseOut(),\n onMouseOut: () => _handleMouseOut(),\n };\n }\n }\n\n function _renderSegmentText({\n show,\n x,\n y,\n value,\n textColor,\n opacity,\n }: {\n show: boolean;\n x: number;\n y: number;\n value: number;\n textColor: string;\n opacity: number;\n }) {\n if (!show) {\n return null;\n }\n\n const textElement = (\n <text\n x={isRTL ? funnelWidth - x : x}\n y={y}\n opacity={opacity}\n textAnchor=\"middle\"\n alignmentBaseline=\"middle\"\n fill={textColor}\n >\n {formatToLocaleString(value.toString(), props.culture) as React.ReactNode}\n </text>\n );\n\n if (isRTL) {\n return <g transform={`scale(-1,1) translate(${-funnelWidth},0)`}>{textElement}</g>;\n }\n return textElement;\n }\n\n function _renderFunnelSegment({\n key,\n pathD,\n fill,\n opacity,\n textProps,\n data,\n tabIndex,\n }: {\n key: string | number;\n pathD: string;\n fill: string;\n opacity: number;\n textProps?: {\n show: boolean;\n x: number;\n y: number;\n value: number;\n };\n data: FunnelChartDataPoint | { stage: string; subValue: { category: string; value: number; color: string } };\n tabIndex?: number;\n }) {\n const segmentId = `funnel-segment-${key}`;\n const eventHandlers = _getEventHandlerProps(data, opacity, segmentId);\n const textColor = getContrastTextColor(fill);\n return (\n <g key={key}>\n <path id={segmentId} d={pathD} fill={fill} opacity={opacity} {...eventHandlers} tabIndex={tabIndex} />\n {textProps && <g {...eventHandlers}>{_renderSegmentText({ ...textProps, textColor, opacity })}</g>}\n </g>\n );\n }\n\n function _createFunnel(containerHeight: number, containerWidth: number): JSXElement[] {\n const { data } = props;\n const funnelWidth = containerWidth;\n const funnelHeight = containerHeight * 0.8;\n\n return data.map((d, i) => {\n const geometryProps =\n props.orientation === 'vertical'\n ? getVerticalFunnelSegmentGeometry({ d, i, data, funnelWidth, funnelHeight, isRTL })\n : getHorizontalFunnelSegmentGeometry({ d, i, data, funnelWidth, funnelHeight, isRTL });\n\n const { pathD, textX, textY, availableWidth } = geometryProps;\n const minTextWidth = 16;\n const eventHandlerProps = _getEventHandlerProps(d);\n const textProps = getSegmentTextProps({\n availableWidth,\n minTextWidth,\n textX,\n textY,\n value: d.value!,\n ...eventHandlerProps,\n });\n\n return _renderFunnelSegment({\n key: i,\n pathD,\n fill: d.color!,\n opacity: legendHighlighted(d.stage as string) || noLegendHighlighted() ? 1 : 0.1,\n textProps,\n data: d,\n tabIndex: legendHighlighted(d.stage as string) || noLegendHighlighted() ? 0 : undefined,\n });\n });\n }\n\n function isStackedFunnelData(data: FunnelChartDataPoint[]): boolean {\n return Array.isArray(data) && data.every(stage => Array.isArray(stage.subValues));\n }\n\n function _renderStackedSegment(\n stage: FunnelChartDataPoint,\n subValue: { value: number; color: string; category: string },\n stageIndex: number,\n subValueIndex: number,\n geometryParams: {\n stages: FunnelChartDataPoint[];\n totals: number[];\n maxTotal: number;\n funnelWidth: number;\n funnelHeight: number;\n isRTL: boolean;\n },\n ): JSXElement {\n // Ensure stages have subValues for geometry functions\n const stagesWithSubValues = geometryParams.stages.map(s => ({\n ...s,\n subValues: s.subValues || [],\n }));\n const geom =\n props.orientation === 'vertical'\n ? getStackedVerticalFunnelSegmentGeometry({\n ...geometryParams,\n stages: stagesWithSubValues,\n i: stageIndex,\n k: subValueIndex,\n })\n : getStackedHorizontalFunnelSegmentGeometry({\n ...geometryParams,\n stages: stagesWithSubValues,\n i: stageIndex,\n k: subValueIndex,\n });\n\n const minTextWidth = 16;\n const eventHandlerProps = _getEventHandlerProps({ stage: stage.stage as string, subValue });\n const textProps = getSegmentTextProps({\n availableWidth: geom.availableWidth,\n minTextWidth,\n textX: geom.textX,\n textY: geom.textY,\n value: subValue.value,\n ...eventHandlerProps,\n });\n\n return _renderFunnelSegment({\n key: `${stageIndex}-${subValueIndex}`,\n pathD: geom.pathD,\n fill: subValue.color,\n opacity:\n (isStackedFunnelData(props.data) && legendHighlighted(subValue.category)) || noLegendHighlighted() ? 1 : 0.1,\n textProps,\n data: { stage: stage.stage as string, subValue },\n tabIndex: legendHighlighted(subValue.category) || noLegendHighlighted() ? 0 : undefined,\n });\n }\n\n function _createStackedFunnel(containerHeight: number, containerWidth: number): JSXElement[] {\n const { data } = props;\n\n const stages = data;\n const totals = stages.map(s => s?.subValues?.reduce((sum, subValue) => sum + subValue.value, 0) ?? 0);\n const maxTotal = Math.max(...totals);\n\n const funnelWidth = containerWidth;\n const funnelHeight = containerHeight * 0.8;\n\n const paths: JSXElement[] = [];\n\n const geometryParams = {\n stages,\n totals,\n maxTotal,\n funnelWidth,\n funnelHeight,\n isRTL,\n };\n\n for (let i = 0; i < stages.length; i++) {\n const cur = stages[i];\n for (let k = 0; k < (cur.subValues ?? []).length; k++) {\n const v = cur.subValues?.[k];\n if (!v) {\n continue;\n }\n paths.push(_renderStackedSegment(cur, v, i, k, geometryParams));\n }\n }\n return paths;\n }\n\n function _renderLegends(): JSXElement {\n if (props.hideLegend) {\n return <></>;\n }\n let legends: Legend[];\n\n if (isStacked) {\n // Collect unique categories and their color\n const categoryMap: Record<string, string> = {};\n props.data.forEach((stage: FunnelChartDataPoint) => {\n (stage.subValues || []).forEach(sub => {\n if (!(sub.category in categoryMap)) {\n categoryMap[sub.category] = sub.color;\n }\n });\n });\n legends = Object.entries(categoryMap).map(([category, color]) => ({\n title: category,\n color,\n hoverAction: () => setHoveredStage(category),\n onMouseOutAction: () => setHoveredStage(null),\n }));\n } else {\n legends = props.data.map((d: FunnelChartDataPoint) => ({\n title: d.stage as string,\n color: d.color!,\n hoverAction: () => setHoveredStage(d.stage as string),\n onMouseOutAction: () => setHoveredStage(null),\n }));\n }\n\n return (\n <div style={{ display: 'flex', justifyContent: 'center' }}>\n <Legends\n legends={legends}\n centerLegends={true}\n onChange={_onLegendSelectionChangeCallback}\n {...props.legendProps}\n legendRef={_legendsRef}\n />\n </div>\n );\n }\n\n function _isChartEmpty(): boolean {\n return !(props.data && props.data.length > 0);\n }\n\n const classes = useFunnelChartStyles(props);\n\n const calloutProps: ChartPopoverProps = {\n ...props.calloutProps,\n color: calloutData?.color,\n hoverXValue: calloutData?.stage,\n YValue: calloutData?.value,\n };\n\n const width = props.width || 350;\n const height = props.height || 500;\n\n const funnelMarginTop = 40;\n const funnelWidth = width * 0.8;\n const funnelOffsetX = (width - funnelWidth) / 2;\n const arrowAttributes = useArrowNavigationGroup({ circular: true, axis: 'horizontal' });\n\n return !_isChartEmpty() ? (\n <div ref={chartContainerRef} className={classes.root} style={{ width, height }}>\n <svg\n width={width}\n height={height}\n className={classes.chart}\n {...arrowAttributes}\n role={'img'}\n aria-label={props.chartTitle}\n >\n <g\n transform={\n isRTL\n ? `translate(${funnelOffsetX + funnelWidth}, ${funnelMarginTop}) scale(-1,1)`\n : `translate(${funnelOffsetX}, ${funnelMarginTop})`\n }\n >\n {isStacked\n ? _createStackedFunnel(height - funnelMarginTop, funnelWidth)\n : _createFunnel(height - funnelMarginTop, funnelWidth)}\n </g>\n </svg>\n {isPopoverOpen && (\n <ChartPopover\n {...props.calloutProps}\n XValue={calloutProps?.hoverXValue as string}\n yCalloutValue={calloutProps?.YValue as string}\n culture={props.culture}\n positioning={{\n target: refSelected,\n }}\n isPopoverOpen={isPopoverOpen}\n color={calloutProps?.color}\n isCartesian={false}\n />\n )}\n {_renderLegends()}\n </div>\n ) : (\n <div id={_emptyChartId} role={'alert'} style={{ opacity: '0' }} aria-label={'Graph has no data to display'} />\n );\n});\nFunnelChart.displayName = 'FunnelChart';\n"],"names":["React","useId","useRtl","Legends","useArrowNavigationGroup","ChartPopover","formatToLocaleString","getContrastTextColor","useFunnelChartStyles","getHorizontalFunnelSegmentGeometry","getVerticalFunnelSegmentGeometry","getSegmentTextProps","getStackedHorizontalFunnelSegmentGeometry","getStackedVerticalFunnelSegmentGeometry","useImageExport","FunnelChart","forwardRef","orientation","restProps","forwardedRef","props","_emptyChartId","isRTL","hoveredStage","setHoveredStage","useState","calloutData","setCalloutData","selectedLegends","setSelectedLegends","isPopoverOpen","setPopoverOpen","refSelected","setRefSelected","isStacked","isStackedFunnelData","data","chartContainerRef","legendsRef","_legendsRef","componentRef","hideLegend","useEffect","legendProps","_handleHover","mouseEvent","targetElement","persist","_handleFocus","focusEvent","_handleStackedHover","stage","subValue","value","color","category","_handleStackedFocus","_handleMouseOut","_onLegendSelectionChange","legendsSelected","event","currentLegend","canSelectMultipleLegends","slice","onChange","_onLegendSelectionChangeCallback","useCallback","getHighlightedLegend","length","legendHighlighted","legend","includes","noLegendHighlighted","_getEventHandlerProps","opacity","segmentId","document","getElementById","culture","onMouseOver","undefined","onMouseMove","onFocus","onBlur","onMouseOut","_renderSegmentText","show","x","y","textColor","textElement","text","funnelWidth","textAnchor","alignmentBaseline","fill","toString","g","transform","_renderFunnelSegment","key","pathD","textProps","tabIndex","eventHandlers","path","id","d","_createFunnel","containerHeight","containerWidth","funnelHeight","map","i","geometryProps","textX","textY","availableWidth","minTextWidth","eventHandlerProps","Array","isArray","every","subValues","_renderStackedSegment","stageIndex","subValueIndex","geometryParams","stagesWithSubValues","stages","s","geom","k","_createStackedFunnel","totals","reduce","sum","maxTotal","Math","max","paths","cur","v","push","_renderLegends","legends","categoryMap","forEach","sub","Object","entries","title","hoverAction","onMouseOutAction","div","style","display","justifyContent","centerLegends","legendRef","_isChartEmpty","classes","calloutProps","hoverXValue","YValue","width","height","funnelMarginTop","funnelOffsetX","arrowAttributes","circular","axis","ref","className","root","svg","chart","role","aria-label","chartTitle","XValue","yCalloutValue","positioning","target","isCartesian","displayName"],"mappings":"AAAA;;;;;+BAuBae;;;;;;;iEArBU,QAAQ;gCACT,4BAA4B;uBAE3B,wBAAwB;wBAEf,mBAAmB;8BACX,0BAA0B;8BACrC,mCAAmC;gCAC3B,4BAA4B;wBAC5B,yBAAyB;4CACzB,gCAAgC;gCAO9D,mBAAmB;uBAEK,wBAAwB;AAEhD,oBAAMA,WAAAA,GAAyDf,OAAMgB,UAAU,CAGpF,CAAC,EAAEC,cAAc,UAAU,EAAE,GAAGC,WAAW,EAAEC;QAiBzCC;IAhBJ,MAAMA,QAAQ;QAAEH;QAAa,GAAGC,SAAS;IAAC;IAC1C,MAAMG,oBAAwBpB,qBAAAA,EAAM;IACpC,MAAMqB,YAAQpB,aAAAA;IAEd,MAAM,CAACqB,cAAcC,gBAAgB,GAAGxB,OAAMyB,QAAQ,CAAgB;IACtE,MAAM,CAACC,aAAaC,eAAe,GAAG3B,OAAMyB,QAAQ,CAA8B;IAClF,MAAM,CAACG,iBAAiBC,mBAAmB,GAAG7B,OAAMyB,QAAQ,CAAW,EAAE;IACzE,MAAM,CAACK,eAAeC,eAAe,GAAG/B,OAAMyB,QAAQ,CAAC;IACvD,MAAM,CAACO,aAAaC,eAAe,GAAGjC,OAAMyB,QAAQ,CAAqB;IACzE,MAAMS,YAAYC,oBAAoBf,MAAMgB,IAAI;IAChD,MAAM,EAAEC,iBAAiB,EAAEC,YAAYC,WAAW,EAAE,OAAGzB,qBAAAA,EAAeM,MAAMoB,YAAY,EAAEpB,MAAMqB,UAAU,EAAE;IAE5GzC,OAAM0C,SAAS,CAAC;YACVtB;QAAJ,IAAA,CAAIA,qBAAAA,MAAMuB,WAAAA,AAAW,MAAA,QAAjBvB,uBAAAA,KAAAA,IAAAA,KAAAA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AAM8I,YAAY;QACtBkB,MAAM,EAAElB,iBAAAA,QAAAA,iBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,aAAcC,WAAW;QACjCkB,aAAa,EAAEnB,iBAAAA,QAAAA,iBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,aAAcE,MAAM;QACnCtF,SAAS1D,MAAM0D,OAAO;QACtBwG,aAAa;YACXC,QAAQvJ;QACV;QACAF,eAAeA;QACfwB,KAAK,EAAE4G,iBAAAA,QAAAA,iBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,aAAc5G,KAAK;QAC1BkI,aAAa;QAGhBxC,oBAAAA,WAAAA,GAGH,OAAA,aAAA,CAACU,OAAAA;QAAIhD,IAAIrF;QAAe4J,MAAM;QAAStB,OAAO;YAAEjF,SAAS;QAAI;QAAGwG,cAAY;;AAEhF,GAAG;AACHnK,YAAY0K,WAAW,GAAG"}
|
|
1
|
+
{"version":3,"sources":["../src/components/FunnelChart/FunnelChart.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useId } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport { useRtl } from '../../utilities/index';\nimport { FunnelChartDataPoint, FunnelChartProps } from './FunnelChart.types';\nimport { Legend, Legends } from '../Legends/index';\nimport { useArrowNavigationGroup } from '@fluentui/react-tabster';\nimport { ChartPopover } from '../CommonComponents/ChartPopover';\nimport { formatToLocaleString } from '@fluentui/chart-utilities';\nimport { getContrastTextColor } from '../../utilities/colors';\nimport { useFunnelChartStyles } from './useFunnelChartStyles.styles';\nimport {\n getHorizontalFunnelSegmentGeometry,\n getVerticalFunnelSegmentGeometry,\n getSegmentTextProps,\n getStackedHorizontalFunnelSegmentGeometry,\n getStackedVerticalFunnelSegmentGeometry,\n} from './funnelGeometry';\nimport { ChartPopoverProps } from '../../index';\nimport { useImageExport } from '../../utilities/hooks';\n\nexport const FunnelChart: React.FunctionComponent<FunnelChartProps> = React.forwardRef<\n HTMLDivElement,\n FunnelChartProps\n>(({ orientation = 'vertical', ...restProps }, forwardedRef) => {\n const props = { orientation, ...restProps };\n const _emptyChartId: string = useId('_FunnelChart_empty');\n const isRTL = useRtl();\n\n const [hoveredStage, setHoveredStage] = React.useState<string | null>(null);\n const [calloutData, setCalloutData] = React.useState<FunnelChartDataPoint | null>(null);\n const [selectedLegends, setSelectedLegends] = React.useState<string[]>([]);\n const [isPopoverOpen, setPopoverOpen] = React.useState(false);\n const [refSelected, setRefSelected] = React.useState<HTMLElement | null>(null);\n const isStacked = isStackedFunnelData(props.data);\n const { chartContainerRef, legendsRef: _legendsRef } = useImageExport(props.componentRef, props.hideLegend, false);\n\n React.useEffect(() => {\n if (props.legendProps?.selectedLegends) {\n setSelectedLegends(props.legendProps.selectedLegends);\n }\n }, [props.legendProps?.selectedLegends]);\n\n function _handleHover(\n data: FunnelChartDataPoint,\n mouseEvent: React.MouseEvent<SVGElement>,\n targetElement?: HTMLElement | null,\n ) {\n mouseEvent?.persist();\n setCalloutData(data);\n setRefSelected(targetElement!);\n setPopoverOpen(true);\n }\n\n function _handleFocus(\n data: FunnelChartDataPoint,\n focusEvent: React.FocusEvent<SVGPathElement>,\n targetElement?: HTMLElement | null,\n ) {\n focusEvent?.persist();\n setCalloutData(data);\n setRefSelected(targetElement!);\n setPopoverOpen(true);\n }\n\n function _handleStackedHover(\n stage: string,\n subValue: { category: string; value: number; color: string },\n mouseEvent: React.MouseEvent<SVGElement>,\n targetElement?: HTMLElement | null,\n ) {\n mouseEvent?.persist();\n setCalloutData({\n stage,\n value: subValue.value,\n color: subValue.color,\n category: subValue.category,\n } as FunnelChartDataPoint);\n setRefSelected(targetElement!);\n setPopoverOpen(true);\n }\n\n function _handleStackedFocus(\n stage: string,\n subValue: { category: string; value: number; color: string },\n focusEvent: React.FocusEvent<SVGPathElement>,\n targetElement?: HTMLElement | null,\n ) {\n focusEvent?.persist();\n setCalloutData({\n stage,\n value: subValue.value,\n color: subValue.color,\n category: subValue.category,\n } as FunnelChartDataPoint);\n setRefSelected(targetElement!);\n setPopoverOpen(true);\n }\n\n function _handleMouseOut() {\n setHoveredStage(null);\n setPopoverOpen(false);\n setCalloutData(null);\n }\n\n function _onLegendSelectionChange(\n legendsSelected: string[],\n event: React.MouseEvent<HTMLButtonElement>,\n currentLegend?: Legend,\n ): void {\n if (props.legendProps?.canSelectMultipleLegends) {\n setSelectedLegends(legendsSelected);\n } else {\n setSelectedLegends(legendsSelected.slice(-1));\n }\n\n if (props.legendProps?.onChange) {\n props.legendProps.onChange(legendsSelected, event, currentLegend);\n }\n }\n\n const _onLegendSelectionChangeCallback = React.useCallback(_onLegendSelectionChange, [props.legendProps]);\n\n function getHighlightedLegend(): string[] {\n return selectedLegends.length > 0 ? selectedLegends : hoveredStage ? [hoveredStage] : [];\n }\n\n function legendHighlighted(legend: string): boolean {\n return getHighlightedLegend().includes(legend);\n }\n\n function noLegendHighlighted(): boolean {\n return getHighlightedLegend().length === 0;\n }\n\n function _getAriaLabel(\n data: FunnelChartDataPoint | { stage: string; subValue: { category: string; value: number; color: string } },\n ): string {\n if ('subValue' in data) {\n // Stacked funnel segment\n const formattedValue = formatToLocaleString(data.subValue.value.toString(), props.culture);\n return `${data.stage}, ${data.subValue.category}, ${formattedValue}.`;\n } else {\n // Non-stacked funnel segment\n const formattedValue = formatToLocaleString((data.value ?? 0).toString(), props.culture);\n return `${data.stage}, ${formattedValue}.`;\n }\n }\n\n function _getEventHandlerProps(\n data: FunnelChartDataPoint | { stage: string; subValue: { category: string; value: number; color: string } },\n opacity?: number,\n segmentId?: string,\n ) {\n const targetElement = document.getElementById(segmentId!);\n if ('subValue' in data) {\n return {\n culture: props.culture,\n onMouseOver:\n opacity == 1\n ? (event: React.MouseEvent<SVGElement>) =>\n _handleStackedHover(data.stage, data.subValue, event, targetElement)\n : undefined,\n onMouseMove:\n opacity == 1\n ? (event: React.MouseEvent<SVGElement>) =>\n _handleStackedHover(data.stage, data.subValue, event, targetElement)\n : undefined,\n onFocus: (event: React.FocusEvent<SVGPathElement>) =>\n _handleStackedFocus(data.stage, data.subValue, event, targetElement),\n onBlur: () => _handleMouseOut(),\n onMouseOut: () => _handleMouseOut(),\n };\n } else {\n return {\n culture: props.culture,\n onMouseOver:\n opacity == 1 ? (event: React.MouseEvent<SVGElement>) => _handleHover(data, event, targetElement) : undefined,\n onMouseMove:\n opacity == 1 ? (event: React.MouseEvent<SVGElement>) => _handleHover(data, event, targetElement) : undefined,\n onFocus: (event: React.FocusEvent<SVGPathElement>) => _handleFocus(data, event, targetElement),\n onBlur: () => _handleMouseOut(),\n onMouseOut: () => _handleMouseOut(),\n };\n }\n }\n\n function _renderSegmentText({\n show,\n x,\n y,\n value,\n textColor,\n opacity,\n }: {\n show: boolean;\n x: number;\n y: number;\n value: number;\n textColor: string;\n opacity: number;\n }) {\n if (!show) {\n return null;\n }\n\n const textElement = (\n <text\n x={isRTL ? funnelWidth - x : x}\n y={y}\n opacity={opacity}\n textAnchor=\"middle\"\n alignmentBaseline=\"middle\"\n fill={textColor}\n >\n {formatToLocaleString(value.toString(), props.culture) as React.ReactNode}\n </text>\n );\n\n if (isRTL) {\n return <g transform={`scale(-1,1) translate(${-funnelWidth},0)`}>{textElement}</g>;\n }\n return textElement;\n }\n\n function _renderFunnelSegment({\n key,\n pathD,\n fill,\n opacity,\n textProps,\n data,\n tabIndex,\n }: {\n key: string | number;\n pathD: string;\n fill: string;\n opacity: number;\n textProps?: {\n show: boolean;\n x: number;\n y: number;\n value: number;\n };\n data: FunnelChartDataPoint | { stage: string; subValue: { category: string; value: number; color: string } };\n tabIndex?: number;\n }) {\n const segmentId = `funnel-segment-${key}`;\n const eventHandlers = _getEventHandlerProps(data, opacity, segmentId);\n const textColor = getContrastTextColor(fill);\n return (\n <g key={key}>\n <path\n id={segmentId}\n d={pathD}\n fill={fill}\n opacity={opacity}\n {...eventHandlers}\n tabIndex={tabIndex}\n role=\"img\"\n aria-label={_getAriaLabel(data)}\n />\n {textProps && <g {...eventHandlers}>{_renderSegmentText({ ...textProps, textColor, opacity })}</g>}\n </g>\n );\n }\n\n function _createFunnel(containerHeight: number, containerWidth: number): JSXElement[] {\n const { data } = props;\n const funnelWidth = containerWidth;\n const funnelHeight = containerHeight * 0.8;\n\n return data.map((d, i) => {\n const geometryProps =\n props.orientation === 'vertical'\n ? getVerticalFunnelSegmentGeometry({ d, i, data, funnelWidth, funnelHeight, isRTL })\n : getHorizontalFunnelSegmentGeometry({ d, i, data, funnelWidth, funnelHeight, isRTL });\n\n const { pathD, textX, textY, availableWidth } = geometryProps;\n const minTextWidth = 16;\n const eventHandlerProps = _getEventHandlerProps(d);\n const textProps = getSegmentTextProps({\n availableWidth,\n minTextWidth,\n textX,\n textY,\n value: d.value!,\n ...eventHandlerProps,\n });\n\n return _renderFunnelSegment({\n key: i,\n pathD,\n fill: d.color!,\n opacity: legendHighlighted(d.stage as string) || noLegendHighlighted() ? 1 : 0.1,\n textProps,\n data: d,\n tabIndex: legendHighlighted(d.stage as string) || noLegendHighlighted() ? 0 : undefined,\n });\n });\n }\n\n function isStackedFunnelData(data: FunnelChartDataPoint[]): boolean {\n return Array.isArray(data) && data.every(stage => Array.isArray(stage.subValues));\n }\n\n function _renderStackedSegment(\n stage: FunnelChartDataPoint,\n subValue: { value: number; color: string; category: string },\n stageIndex: number,\n subValueIndex: number,\n geometryParams: {\n stages: FunnelChartDataPoint[];\n totals: number[];\n maxTotal: number;\n funnelWidth: number;\n funnelHeight: number;\n isRTL: boolean;\n },\n ): JSXElement {\n // Ensure stages have subValues for geometry functions\n const stagesWithSubValues = geometryParams.stages.map(s => ({\n ...s,\n subValues: s.subValues || [],\n }));\n const geom =\n props.orientation === 'vertical'\n ? getStackedVerticalFunnelSegmentGeometry({\n ...geometryParams,\n stages: stagesWithSubValues,\n i: stageIndex,\n k: subValueIndex,\n })\n : getStackedHorizontalFunnelSegmentGeometry({\n ...geometryParams,\n stages: stagesWithSubValues,\n i: stageIndex,\n k: subValueIndex,\n });\n\n const minTextWidth = 16;\n const eventHandlerProps = _getEventHandlerProps({ stage: stage.stage as string, subValue });\n const textProps = getSegmentTextProps({\n availableWidth: geom.availableWidth,\n minTextWidth,\n textX: geom.textX,\n textY: geom.textY,\n value: subValue.value,\n ...eventHandlerProps,\n });\n\n return _renderFunnelSegment({\n key: `${stageIndex}-${subValueIndex}`,\n pathD: geom.pathD,\n fill: subValue.color,\n opacity:\n (isStackedFunnelData(props.data) && legendHighlighted(subValue.category)) || noLegendHighlighted() ? 1 : 0.1,\n textProps,\n data: { stage: stage.stage as string, subValue },\n tabIndex: legendHighlighted(subValue.category) || noLegendHighlighted() ? 0 : undefined,\n });\n }\n\n function _createStackedFunnel(containerHeight: number, containerWidth: number): JSXElement[] {\n const { data } = props;\n\n const stages = data;\n const totals = stages.map(s => s?.subValues?.reduce((sum, subValue) => sum + subValue.value, 0) ?? 0);\n const maxTotal = Math.max(...totals);\n\n const funnelWidth = containerWidth;\n const funnelHeight = containerHeight * 0.8;\n\n const paths: JSXElement[] = [];\n\n const geometryParams = {\n stages,\n totals,\n maxTotal,\n funnelWidth,\n funnelHeight,\n isRTL,\n };\n\n for (let i = 0; i < stages.length; i++) {\n const cur = stages[i];\n for (let k = 0; k < (cur.subValues ?? []).length; k++) {\n const v = cur.subValues?.[k];\n if (!v) {\n continue;\n }\n paths.push(_renderStackedSegment(cur, v, i, k, geometryParams));\n }\n }\n return paths;\n }\n\n function _renderLegends(): JSXElement {\n if (props.hideLegend) {\n return <></>;\n }\n let legends: Legend[];\n\n if (isStacked) {\n // Collect unique categories and their color\n const categoryMap: Record<string, string> = {};\n props.data.forEach((stage: FunnelChartDataPoint) => {\n (stage.subValues || []).forEach(sub => {\n if (!(sub.category in categoryMap)) {\n categoryMap[sub.category] = sub.color;\n }\n });\n });\n legends = Object.entries(categoryMap).map(([category, color]) => ({\n title: category,\n color,\n hoverAction: () => setHoveredStage(category),\n onMouseOutAction: () => setHoveredStage(null),\n }));\n } else {\n legends = props.data.map((d: FunnelChartDataPoint) => ({\n title: d.stage as string,\n color: d.color!,\n hoverAction: () => setHoveredStage(d.stage as string),\n onMouseOutAction: () => setHoveredStage(null),\n }));\n }\n\n return (\n <div style={{ display: 'flex', justifyContent: 'center' }}>\n <Legends\n legends={legends}\n centerLegends={true}\n onChange={_onLegendSelectionChangeCallback}\n {...props.legendProps}\n legendRef={_legendsRef}\n />\n </div>\n );\n }\n\n function _isChartEmpty(): boolean {\n return !(props.data && props.data.length > 0);\n }\n\n const classes = useFunnelChartStyles(props);\n\n const calloutProps: ChartPopoverProps = {\n ...props.calloutProps,\n color: calloutData?.color,\n hoverXValue: calloutData?.stage,\n YValue: calloutData?.value,\n };\n\n const width = props.width || 350;\n const height = props.height || 500;\n\n const funnelMarginTop = 40;\n const funnelWidth = width * 0.8;\n const funnelOffsetX = (width - funnelWidth) / 2;\n const arrowAttributes = useArrowNavigationGroup({ circular: true, axis: 'horizontal' });\n\n return !_isChartEmpty() ? (\n <div ref={chartContainerRef} className={classes.root} style={{ width, height }}>\n <svg width={width} height={height} className={classes.chart} {...arrowAttributes} aria-label={props.chartTitle}>\n <g\n transform={\n isRTL\n ? `translate(${funnelOffsetX + funnelWidth}, ${funnelMarginTop}) scale(-1,1)`\n : `translate(${funnelOffsetX}, ${funnelMarginTop})`\n }\n >\n {isStacked\n ? _createStackedFunnel(height - funnelMarginTop, funnelWidth)\n : _createFunnel(height - funnelMarginTop, funnelWidth)}\n </g>\n </svg>\n {isPopoverOpen && (\n <ChartPopover\n {...props.calloutProps}\n XValue={calloutProps?.hoverXValue as string}\n yCalloutValue={calloutProps?.YValue as string}\n culture={props.culture}\n positioning={{\n target: refSelected,\n }}\n isPopoverOpen={isPopoverOpen}\n color={calloutProps?.color}\n isCartesian={false}\n />\n )}\n {_renderLegends()}\n </div>\n ) : (\n <div id={_emptyChartId} role={'alert'} style={{ opacity: '0' }} aria-label={'Graph has no data to display'} />\n );\n});\nFunnelChart.displayName = 'FunnelChart';\n"],"names":["React","useId","useRtl","Legends","useArrowNavigationGroup","ChartPopover","formatToLocaleString","getContrastTextColor","useFunnelChartStyles","getHorizontalFunnelSegmentGeometry","getVerticalFunnelSegmentGeometry","getSegmentTextProps","getStackedHorizontalFunnelSegmentGeometry","getStackedVerticalFunnelSegmentGeometry","useImageExport","FunnelChart","forwardRef","orientation","restProps","forwardedRef","props","_emptyChartId","isRTL","hoveredStage","setHoveredStage","useState","calloutData","setCalloutData","selectedLegends","setSelectedLegends","isPopoverOpen","setPopoverOpen","refSelected","setRefSelected","isStacked","isStackedFunnelData","data","chartContainerRef","legendsRef","_legendsRef","componentRef","hideLegend","useEffect","legendProps","_handleHover","mouseEvent","targetElement","persist","_handleFocus","focusEvent","_handleStackedHover","stage","subValue","value","color","category","_handleStackedFocus","_handleMouseOut","_onLegendSelectionChange","legendsSelected","event","currentLegend","canSelectMultipleLegends","slice","onChange","_onLegendSelectionChangeCallback","useCallback","getHighlightedLegend","length","legendHighlighted","legend","includes","noLegendHighlighted","_getAriaLabel","formattedValue","toString","culture","_getEventHandlerProps","opacity","segmentId","document","getElementById","onMouseOver","undefined","onMouseMove","onFocus","onBlur","onMouseOut","_renderSegmentText","show","x","y","textColor","textElement","text","funnelWidth","textAnchor","alignmentBaseline","fill","g","transform","_renderFunnelSegment","key","pathD","textProps","tabIndex","eventHandlers","path","id","d","role","aria-label","_createFunnel","containerHeight","containerWidth","funnelHeight","map","i","geometryProps","textX","textY","availableWidth","minTextWidth","eventHandlerProps","Array","isArray","every","subValues","_renderStackedSegment","stageIndex","subValueIndex","geometryParams","stagesWithSubValues","stages","s","geom","k","_createStackedFunnel","totals","reduce","sum","maxTotal","Math","max","paths","cur","v","push","_renderLegends","legends","categoryMap","forEach","sub","Object","entries","title","hoverAction","onMouseOutAction","div","style","display","justifyContent","centerLegends","legendRef","_isChartEmpty","classes","calloutProps","hoverXValue","YValue","width","height","funnelMarginTop","funnelOffsetX","arrowAttributes","circular","axis","ref","className","root","svg","chart","chartTitle","XValue","yCalloutValue","positioning","target","isCartesian","displayName"],"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AAA,CAACS,OAAAA;QAAIV,OAAOA;QAAOC,QAAQA;QAAQO,WAAWZ,QAAQe,KAAK;QAAG,GAAGP,eAAe;QAAE9D,cAAY3F,MAAMiK,UAAU;qBAC5G,OAAA,aAAA,CAAClF,KAAAA;QACCC,WACE9E,QACI,CAAC,UAAU,EAAEsJ,gBAAgB7E,YAAY,EAAE,EAAE4E,gBAAgB,aAAa,CAAC,GAC3E,CAAC,UAAU,EAAEC,cAAc,EAAE,EAAED,gBAAgB,CAAC,CAAC;OAGtDzI,YACGuG,qBAAqBiC,SAASC,iBAAiB5E,eAC/CiB,cAAc0D,SAASC,iBAAiB5E,gBAG/CjE,iBAAAA,WAAAA,GACC,OAAA,aAAA,CAACzB,0BAAAA,EAAAA;QACE,GAAGe,MAAMkJ,YAAY;QACtBgB,MAAM,EAAEhB,iBAAAA,QAAAA,iBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,aAAcC,WAAW;QACjCgB,aAAa,EAAEjB,iBAAAA,QAAAA,iBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,aAAcE,MAAM;QACnC5F,SAASxD,MAAMwD,OAAO;QACtB4G,aAAa;YACXC,QAAQzJ;QACV;QACAF,eAAeA;QACfwB,KAAK,EAAEgH,iBAAAA,QAAAA,iBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,aAAchH,KAAK;QAC1BoI,aAAa;QAGhBtC,oBAAAA,WAAAA,GAGH,OAAA,aAAA,CAACU,OAAAA;QAAIlD,IAAIvF;QAAeyF,MAAM;QAASiD,OAAO;YAAEjF,SAAS;QAAI;QAAGiC,cAAY;;AAEhF,GAAG;AACHhG,YAAY4K,WAAW,GAAG"}
|
|
@@ -583,8 +583,9 @@ const HorizontalBarChartWithAxis = /*#__PURE__*/ _react.forwardRef((props = {
|
|
|
583
583
|
function _getAriaLabel(point) {
|
|
584
584
|
var _point_callOutAccessibilityData;
|
|
585
585
|
const xValue = point.xAxisCalloutData || point.x;
|
|
586
|
+
const legend = point.legend;
|
|
586
587
|
const yValue = point.yAxisCalloutData || point.y;
|
|
587
|
-
return ((_point_callOutAccessibilityData = point.callOutAccessibilityData) === null || _point_callOutAccessibilityData === void 0 ? void 0 : _point_callOutAccessibilityData.ariaLabel) || `${
|
|
588
|
+
return ((_point_callOutAccessibilityData = point.callOutAccessibilityData) === null || _point_callOutAccessibilityData === void 0 ? void 0 : _point_callOutAccessibilityData.ariaLabel) || `${yValue}. ` + (legend ? `${legend}, ` : '') + `${xValue}.`;
|
|
588
589
|
}
|
|
589
590
|
function _renderBarLabel(xPosition, yPosition, value, isPositiveBar) {
|
|
590
591
|
if (props.hideLabels || _barHeight < 16) {
|