@fluentui/react-charts 0.0.0-nightly-20260109-0406.1 → 0.0.0-nightly-20260113-0406.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 +361 -0
- 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/ChartTable/ChartTable.js +21 -7
- 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 +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/CommonComponents/CartesianChart.js +5 -3
- package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.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 +250 -153
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.js +12 -4
- 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 +27 -5
- 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/GaugeChart/GaugeChart.js +5 -5
- 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 +8 -5
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js +2 -5
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.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/PolarChart/PolarChart.js +576 -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 +13 -3
- 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 +23 -6
- 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/VerticalStackedBarChart/VerticalStackedBarChart.js +25 -36
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/types/DataPoint.js +1 -1
- package/lib/types/DataPoint.js.map +1 -1
- package/lib/utilities/ChartTitle.js +33 -0
- package/lib/utilities/ChartTitle.js.map +1 -0
- package/lib/utilities/Common.styles.js +73 -1
- package/lib/utilities/Common.styles.js.map +1 -1
- package/lib/utilities/Common.styles.raw.js +70 -0
- package/lib/utilities/Common.styles.raw.js.map +1 -1
- package/lib/utilities/index.js +1 -0
- package/lib/utilities/index.js.map +1 -1
- package/lib/utilities/utilities.js +2 -2
- 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/ChartTable/ChartTable.js +21 -7
- 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 +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/CommonComponents/CartesianChart.js +4 -2
- 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/DeclarativeChart/DeclarativeChart.js +59 -56
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +256 -156
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.js +11 -3
- 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 +26 -4
- 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/GaugeChart/GaugeChart.js +4 -4
- 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 +10 -4
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js +2 -5
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.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/PolarChart/PolarChart.js +586 -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 +13 -3
- 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 -4
- 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/VerticalStackedBarChart/VerticalStackedBarChart.js +25 -36
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib-commonjs/index.js +1 -0
- package/lib-commonjs/index.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 +41 -0
- package/lib-commonjs/utilities/ChartTitle.js.map +1 -0
- package/lib-commonjs/utilities/Common.styles.js +69 -0
- package/lib-commonjs/utilities/Common.styles.js.map +1 -1
- package/lib-commonjs/utilities/Common.styles.raw.js +69 -0
- package/lib-commonjs/utilities/Common.styles.raw.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 +6 -0
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +10 -10
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { Pie } from './Pie/index';
|
|
4
4
|
import { useDonutChartStyles } from './useDonutChartStyles.styles';
|
|
5
5
|
import { formatToLocaleString } from '@fluentui/chart-utilities';
|
|
6
|
-
import { areArraysEqual, getColorFromToken, getNextColor, MIN_DONUT_RADIUS } from '../../utilities/index';
|
|
6
|
+
import { areArraysEqual, getColorFromToken, getNextColor, MIN_DONUT_RADIUS, ChartTitle, CHART_TITLE_PADDING } from '../../utilities/index';
|
|
7
7
|
import { Legends } from '../../index';
|
|
8
8
|
import { useId } from '@fluentui/react-utilities';
|
|
9
9
|
import { useArrowNavigationGroup } from '@fluentui/react-tabster';
|
|
@@ -15,7 +15,7 @@ const MIN_LEGEND_CONTAINER_HEIGHT = 40;
|
|
|
15
15
|
* Donutchart component.
|
|
16
16
|
* {@docCategory DonutChart}
|
|
17
17
|
*/ export const DonutChart = /*#__PURE__*/ React.forwardRef(({ innerRadius = 0, hideLabels = true, ...restProps }, forwardedRef)=>{
|
|
18
|
-
var _props_legendProps;
|
|
18
|
+
var _props_legendProps, _props_titleStyles_titleFont, _props_titleStyles;
|
|
19
19
|
const props = {
|
|
20
20
|
innerRadius,
|
|
21
21
|
hideLabels,
|
|
@@ -247,7 +247,8 @@ const MIN_LEGEND_CONTAINER_HEIGHT = 40;
|
|
|
247
247
|
const legendBars = _createLegends(points.filter((d)=>d.data >= 0));
|
|
248
248
|
const donutMarginHorizontal = props.hideLabels ? 0 : 80;
|
|
249
249
|
const donutMarginVertical = props.hideLabels ? 0 : 40;
|
|
250
|
-
const
|
|
250
|
+
const titleHeight = (data === null || data === void 0 ? void 0 : data.chartTitle) ? Math.max((typeof ((_props_titleStyles = props.titleStyles) === null || _props_titleStyles === void 0 ? void 0 : (_props_titleStyles_titleFont = _props_titleStyles.titleFont) === null || _props_titleStyles_titleFont === void 0 ? void 0 : _props_titleStyles_titleFont.size) === 'number' ? props.titleStyles.titleFont.size : 13) + CHART_TITLE_PADDING, 36) : 0;
|
|
251
|
+
const outerRadius = Math.min(_width - donutMarginHorizontal, _height - donutMarginVertical - titleHeight) / 2;
|
|
251
252
|
const chartData = _elevateToMinimums(points);
|
|
252
253
|
const valueInsideDonut = props.innerRadius > MIN_DONUT_RADIUS ? _valueInsideDonut(props.valueInsideDonut, chartData) : '';
|
|
253
254
|
const arrowAttributes = useArrowNavigationGroup({
|
|
@@ -273,7 +274,14 @@ const MIN_LEGEND_CONTAINER_HEIGHT = 40;
|
|
|
273
274
|
"aria-label": data === null || data === void 0 ? void 0 : data.chartTitle,
|
|
274
275
|
width: _width,
|
|
275
276
|
height: _height
|
|
276
|
-
}, /*#__PURE__*/ React.createElement(
|
|
277
|
+
}, !hideLegend && (data === null || data === void 0 ? void 0 : data.chartTitle) && /*#__PURE__*/ React.createElement(ChartTitle, {
|
|
278
|
+
title: data.chartTitle,
|
|
279
|
+
x: _width / 2,
|
|
280
|
+
maxWidth: _width - 20,
|
|
281
|
+
className: classes.chartTitle,
|
|
282
|
+
titleStyles: props.titleStyles,
|
|
283
|
+
tooltipClassName: classes.svgTooltip
|
|
284
|
+
}), /*#__PURE__*/ React.createElement(Pie, {
|
|
277
285
|
width: _width,
|
|
278
286
|
height: _height,
|
|
279
287
|
outerRadius: outerRadius,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/DonutChart/DonutChart.tsx"],"sourcesContent":["'use client';\n\n/* eslint-disable react/jsx-no-bind */\nimport * as React from 'react';\nimport { Pie } from './Pie/index';\nimport { DonutChartProps } from './DonutChart.types';\nimport { useDonutChartStyles } from './useDonutChartStyles.styles';\nimport { ChartDataPoint } from '../../DonutChart';\nimport { formatToLocaleString } from '@fluentui/chart-utilities';\nimport { areArraysEqual, getColorFromToken, getNextColor, MIN_DONUT_RADIUS } from '../../utilities/index';\nimport { Legend, Legends } from '../../index';\nimport { useId } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport { useArrowNavigationGroup } from '@fluentui/react-tabster';\nimport { ChartPopover } from '../CommonComponents/ChartPopover';\nimport { useImageExport } from '../../utilities/hooks';\n\nconst MIN_LEGEND_CONTAINER_HEIGHT = 40;\n\n// Create a DonutChart variant which uses these default styles and this styled subcomponent.\n/**\n * Donutchart component.\n * {@docCategory DonutChart}\n */\nexport const DonutChart: React.FunctionComponent<DonutChartProps> = React.forwardRef<HTMLDivElement, DonutChartProps>(\n ({ innerRadius = 0, hideLabels = true, ...restProps }, forwardedRef) => {\n const props = { innerRadius, hideLabels, ...restProps };\n const { chartContainerRef: _rootElem, legendsRef: _legendsRef } = useImageExport(\n props.componentRef,\n props.hideLegend,\n false,\n );\n const _uniqText: string = useId('_Pie_');\n /* eslint-disable @typescript-eslint/no-explicit-any */\n let _calloutAnchorPoint: ChartDataPoint | null;\n let _emptyChartId: string | null;\n const legendContainer = React.useRef<HTMLDivElement | null>(null);\n const prevSize = React.useRef<{ width?: number; height?: number }>({});\n\n const [value, setValue] = React.useState<string | undefined>('');\n const [legend, setLegend] = React.useState<string | undefined>('');\n const [_width, setWidth] = React.useState<number | undefined>(props.width || 200);\n const [_height, setHeight] = React.useState<number | undefined>(props.height || 200);\n const [activeLegend, setActiveLegend] = React.useState<string | undefined>(undefined);\n const [color, setColor] = React.useState<string | undefined>('');\n const [xCalloutValue, setXCalloutValue] = React.useState<string>('');\n const [yCalloutValue, setYCalloutValue] = React.useState<string>('');\n const [selectedLegends, setSelectedLegends] = React.useState<string[]>(props.legendProps?.selectedLegends || []);\n const [focusedArcId, setFocusedArcId] = React.useState<string>('');\n const [dataPointCalloutProps, setDataPointCalloutProps] = React.useState<ChartDataPoint | undefined>();\n const [refSelected, setRefSelected] = React.useState<HTMLElement | null>(null);\n const [isPopoverOpen, setPopoverOpen] = React.useState(false);\n const prevPropsRef = React.useRef<DonutChartProps | null>(null);\n\n React.useEffect(() => {\n _fitParentContainer();\n }, []);\n\n React.useEffect(() => {\n if (prevPropsRef.current) {\n const prevProps = prevPropsRef.current;\n if (!areArraysEqual(prevProps.legendProps?.selectedLegends, props.legendProps?.selectedLegends)) {\n setSelectedLegends(props.legendProps?.selectedLegends || []);\n }\n }\n prevPropsRef.current = props;\n }, [props]);\n\n React.useEffect(() => {\n if (prevSize.current.height !== props.height || prevSize.current.width !== props.width) {\n _fitParentContainer();\n }\n prevSize.current.height = props.height;\n prevSize.current.width = props.width;\n }, [props.width, props.height]);\n\n function _elevateToMinimums(data: ChartDataPoint[]) {\n let sumOfData = 0;\n const minPercent = 0.01;\n const elevatedData: ChartDataPoint[] = [];\n data.forEach(item => {\n sumOfData += item.data!;\n });\n data.forEach(item => {\n elevatedData.push(\n minPercent * sumOfData > item.data! && item.data! > 0\n ? {\n ...item,\n data: minPercent * sumOfData,\n yAxisCalloutData:\n item.yAxisCalloutData === undefined ? item.data!.toLocaleString() : item.yAxisCalloutData,\n }\n : item,\n );\n });\n return elevatedData;\n }\n function _createLegends(chartData: ChartDataPoint[]): JSXElement {\n if (props.order === 'sorted') {\n chartData.sort((a: ChartDataPoint, b: ChartDataPoint) => {\n return b.data! - a.data!;\n });\n }\n const legendDataItems = chartData.map((point: ChartDataPoint, index: number) => {\n const color: string = point.color!;\n // mapping data to the format Legends component needs\n const legend: Legend = {\n title: point.legend!,\n color,\n hoverAction: () => {\n _handleChartMouseLeave();\n setActiveLegend(point.legend!);\n },\n onMouseOutAction: () => {\n setActiveLegend(undefined);\n },\n };\n return legend;\n });\n const legends = (\n <Legends\n legends={legendDataItems}\n centerLegends\n overflowText={props.legendsOverflowText}\n {...props.legendProps}\n // eslint-disable-next-line react/jsx-no-bind\n onChange={_onLegendSelectionChange}\n legendRef={_legendsRef}\n />\n );\n return legends;\n }\n function _onLegendSelectionChange(\n selectedLegends: string[],\n event: React.MouseEvent<HTMLButtonElement>,\n currentLegend?: Legend,\n ): void {\n if (props.legendProps && props.legendProps?.canSelectMultipleLegends) {\n setSelectedLegends(selectedLegends);\n } else {\n setSelectedLegends(selectedLegends.slice(-1));\n }\n if (props.legendProps?.onChange) {\n props.legendProps.onChange(selectedLegends, event, currentLegend);\n }\n }\n\n function _focusCallback(\n data: ChartDataPoint,\n id: string,\n e: React.FocusEvent<SVGPathElement>,\n targetElement?: HTMLElement | null,\n ): void {\n setPopoverOpen(_noLegendsHighlighted() || _isLegendHighlighted(data.legend));\n setValue(data.data!.toString());\n setLegend(data.legend);\n setColor(data.color!);\n setXCalloutValue(data.xAxisCalloutData!);\n setYCalloutValue(data.yAxisCalloutData!);\n setFocusedArcId(id);\n setDataPointCalloutProps(data);\n setRefSelected(targetElement!);\n }\n\n function _hoverCallback(\n data: ChartDataPoint,\n e: React.MouseEvent<SVGPathElement>,\n targetElement?: HTMLElement | null,\n ): void {\n if (_calloutAnchorPoint !== data) {\n _calloutAnchorPoint = data;\n setPopoverOpen(_noLegendsHighlighted() || _isLegendHighlighted(data.legend));\n setValue(data.data!.toString());\n setLegend(data.legend);\n setColor(data.color!);\n setXCalloutValue(data.xAxisCalloutData!);\n setYCalloutValue(data.yAxisCalloutData!);\n setDataPointCalloutProps(data);\n setRefSelected(targetElement!);\n }\n }\n function _onBlur(): void {\n setFocusedArcId('');\n }\n\n function _hoverLeave(): void {\n /**/\n }\n\n function _handleChartMouseLeave() {\n _calloutAnchorPoint = null;\n setPopoverOpen(false);\n }\n\n function _valueInsideDonut(valueInsideDonut: string | number | undefined, data: ChartDataPoint[]) {\n const highlightedLegends = _getHighlightedLegend();\n if (valueInsideDonut !== undefined && (highlightedLegends.length === 1 || isPopoverOpen)) {\n const pointValue = data.find(point => _isLegendHighlighted(point.legend));\n return pointValue\n ? pointValue.yAxisCalloutData\n ? pointValue.yAxisCalloutData\n : pointValue.data!\n : valueInsideDonut;\n } else if (highlightedLegends.length > 0) {\n let totalValue = 0;\n data.forEach(point => {\n if (highlightedLegends.includes(point.legend!)) {\n totalValue += point.data!;\n }\n });\n return totalValue;\n } else {\n return valueInsideDonut;\n }\n }\n\n function _toLocaleString(data: string | number | undefined) {\n const localeString = formatToLocaleString(data, props.culture);\n if (!localeString) {\n return data;\n }\n return localeString?.toString();\n }\n\n /**\n * This function returns\n * the selected legend if there is one\n * or the hovered legend if none of the legends is selected.\n */\n function _getHighlightedLegend() {\n return selectedLegends.length > 0 ? selectedLegends : activeLegend ? [activeLegend] : [];\n }\n\n function _isLegendHighlighted(legend: string | undefined): boolean {\n return _getHighlightedLegend().includes(legend!);\n }\n\n function _noLegendsHighlighted(): boolean {\n return _getHighlightedLegend().length === 0;\n }\n\n function _isChartEmpty(): boolean {\n return !(\n props.data &&\n props.data.chartData &&\n props.data.chartData!.filter((d: ChartDataPoint) => d.data! > 0).length > 0\n );\n }\n\n function _addDefaultColors(donutChartDataPoint?: ChartDataPoint[]): ChartDataPoint[] {\n return donutChartDataPoint\n ? donutChartDataPoint.map((item, index) => {\n let defaultColor: string;\n if (typeof item.color === 'undefined') {\n defaultColor = getNextColor(index, 0);\n } else {\n defaultColor = getColorFromToken(item.color);\n }\n return { ...item, defaultColor };\n })\n : [];\n }\n\n /**\n * When screen resizes, along with screen, chart also auto adjusted.\n * This method used to adjust height and width of the charts.\n */\n function _fitParentContainer(): void {\n //_reqID = requestAnimationFrame(() => {\n let legendContainerHeight;\n if (props.hideLegend) {\n // If there is no legend, need not to allocate some space from total chart space.\n legendContainerHeight = 0;\n } else {\n const legendContainerComputedStyles = legendContainer.current && getComputedStyle(legendContainer.current);\n legendContainerHeight =\n ((legendContainer.current && legendContainer.current.getBoundingClientRect().height) ||\n MIN_LEGEND_CONTAINER_HEIGHT) +\n parseFloat((legendContainerComputedStyles && legendContainerComputedStyles.marginTop) || '0') +\n parseFloat((legendContainerComputedStyles && legendContainerComputedStyles.marginBottom) || '0');\n }\n if (props.parentRef || _rootElem.current) {\n const container = props.parentRef ? props.parentRef : _rootElem.current!;\n const currentContainerWidth = container.getBoundingClientRect().width;\n const currentContainerHeight =\n container.getBoundingClientRect().height > legendContainerHeight\n ? container.getBoundingClientRect().height\n : 200;\n const shouldResize =\n _width !== currentContainerWidth || _height !== currentContainerHeight - legendContainerHeight;\n if (shouldResize) {\n setWidth(currentContainerWidth);\n setHeight(currentContainerHeight - legendContainerHeight);\n }\n }\n //});\n }\n\n const { data, hideLegend = false } = props;\n const points = _addDefaultColors(data?.chartData);\n\n const classes = useDonutChartStyles(props);\n\n const legendBars = _createLegends(points.filter(d => d.data! >= 0));\n const donutMarginHorizontal = props.hideLabels ? 0 : 80;\n const donutMarginVertical = props.hideLabels ? 0 : 40;\n const outerRadius = Math.min(_width! - donutMarginHorizontal, _height! - donutMarginVertical) / 2;\n const chartData = _elevateToMinimums(points);\n const valueInsideDonut =\n props.innerRadius! > MIN_DONUT_RADIUS ? _valueInsideDonut(props.valueInsideDonut!, chartData!) : '';\n const arrowAttributes = useArrowNavigationGroup({ circular: true, axis: 'horizontal' });\n return !_isChartEmpty() ? (\n <div\n className={classes.root}\n ref={(rootElem: HTMLDivElement | null) => {\n _rootElem.current = rootElem;\n }}\n onMouseLeave={_handleChartMouseLeave}\n >\n {props.xAxisAnnotation && (\n <text className={classes.axisAnnotation} x={_width! / 2} y={_height! - 10} textAnchor=\"middle\">\n {props.xAxisAnnotation}\n </text>\n )}\n <div className={classes.chartWrapper} {...arrowAttributes}>\n <svg className={classes.chart} aria-label={data?.chartTitle} width={_width} height={_height}>\n <Pie\n width={_width!}\n height={_height!}\n outerRadius={outerRadius}\n innerRadius={props.innerRadius!}\n data={chartData!}\n onFocusCallback={_focusCallback}\n hoverOnCallback={_hoverCallback}\n hoverLeaveCallback={_hoverLeave}\n uniqText={_uniqText}\n onBlurCallback={_onBlur}\n activeArc={_getHighlightedLegend()}\n focusedArcId={focusedArcId || ''}\n href={props.href!}\n valueInsideDonut={_toLocaleString(valueInsideDonut)}\n showLabelsInPercent={props.showLabelsInPercent}\n hideLabels={props.hideLabels}\n />\n </svg>\n </div>\n <ChartPopover\n xCalloutValue={xCalloutValue}\n yCalloutValue={yCalloutValue}\n culture={props.culture}\n positioning={{\n target: refSelected,\n }}\n isPopoverOpen={\n !props.hideTooltip && isPopoverOpen && (_noLegendsHighlighted() || _isLegendHighlighted(legend))\n }\n legend={legend!}\n YValue={value!}\n color={color}\n isCalloutForStack={false}\n customCallout={{\n customizedCallout: props.onRenderCalloutPerDataPoint\n ? props.onRenderCalloutPerDataPoint(dataPointCalloutProps!)\n : undefined,\n customCalloutProps: props.calloutPropsPerDataPoint\n ? props.calloutPropsPerDataPoint(dataPointCalloutProps!)\n : undefined,\n }}\n isCartesian={false}\n />\n {!hideLegend && (\n <div\n ref={(e: HTMLDivElement) => {\n legendContainer.current = e;\n }}\n className={classes.legendContainer}\n >\n {legendBars}\n </div>\n )}\n </div>\n ) : (\n <div id={_emptyChartId!} role={'alert'} style={{ opacity: '0' }} aria-label={'Graph has no data to display'} />\n );\n },\n);\n\nDonutChart.displayName = 'DonutChart';\n"],"names":["React","Pie","useDonutChartStyles","formatToLocaleString","areArraysEqual","getColorFromToken","getNextColor","MIN_DONUT_RADIUS","Legends","useId","useArrowNavigationGroup","ChartPopover","useImageExport","MIN_LEGEND_CONTAINER_HEIGHT","DonutChart","forwardRef","innerRadius","hideLabels","restProps","forwardedRef","props","chartContainerRef","_rootElem","legendsRef","_legendsRef","componentRef","hideLegend","_uniqText","_calloutAnchorPoint","_emptyChartId","legendContainer","useRef","prevSize","value","setValue","useState","legend","setLegend","_width","setWidth","width","_height","setHeight","height","activeLegend","setActiveLegend","undefined","color","setColor","xCalloutValue","setXCalloutValue","yCalloutValue","setYCalloutValue","selectedLegends","setSelectedLegends","legendProps","focusedArcId","setFocusedArcId","dataPointCalloutProps","setDataPointCalloutProps","refSelected","setRefSelected","isPopoverOpen","setPopoverOpen","prevPropsRef","useEffect","_fitParentContainer","current","prevProps","_elevateToMinimums","data","sumOfData","minPercent","elevatedData","forEach","item","push","yAxisCalloutData","toLocaleString","_createLegends","chartData","order","sort","a","b","legendDataItems","map","point","index","title","hoverAction","_handleChartMouseLeave","onMouseOutAction","legends","centerLegends","overflowText","legendsOverflowText","onChange","_onLegendSelectionChange","legendRef","event","currentLegend","canSelectMultipleLegends","slice","_focusCallback","id","e","targetElement","_noLegendsHighlighted","_isLegendHighlighted","toString","xAxisCalloutData","_hoverCallback","_onBlur","_hoverLeave","_valueInsideDonut","valueInsideDonut","highlightedLegends","_getHighlightedLegend","length","pointValue","find","totalValue","includes","_toLocaleString","localeString","culture","_isChartEmpty","filter","d","_addDefaultColors","donutChartDataPoint","defaultColor","legendContainerHeight","legendContainerComputedStyles","getComputedStyle","getBoundingClientRect","parseFloat","marginTop","marginBottom","parentRef","container","currentContainerWidth","currentContainerHeight","shouldResize","points","classes","legendBars","donutMarginHorizontal","donutMarginVertical","outerRadius","Math","min","arrowAttributes","circular","axis","div","className","root","ref","rootElem","onMouseLeave","xAxisAnnotation","text","axisAnnotation","x","y","textAnchor","chartWrapper","svg","chart","aria-label","chartTitle","onFocusCallback","hoverOnCallback","hoverLeaveCallback","uniqText","onBlurCallback","activeArc","href","showLabelsInPercent","positioning","target","hideTooltip","YValue","isCalloutForStack","customCallout","customizedCallout","onRenderCalloutPerDataPoint","customCalloutProps","calloutPropsPerDataPoint","isCartesian","role","style","opacity","displayName"],"mappings":"AAAA;AAEA,oCAAoC,GACpC,YAAYA,WAAW,QAAQ;AAC/B,SAASC,GAAG,QAAQ,cAAc;AAElC,SAASC,mBAAmB,QAAQ,+BAA+B;AAEnE,SAASC,oBAAoB,QAAQ,4BAA4B;AACjE,SAASC,cAAc,EAAEC,iBAAiB,EAAEC,YAAY,EAAEC,gBAAgB,QAAQ,wBAAwB;AAC1G,SAAiBC,OAAO,QAAQ,cAAc;AAC9C,SAASC,KAAK,QAAQ,4BAA4B;AAElD,SAASC,uBAAuB,QAAQ,0BAA0B;AAClE,SAASC,YAAY,QAAQ,mCAAmC;AAChE,SAASC,cAAc,QAAQ,wBAAwB;AAEvD,MAAMC,8BAA8B;AAEpC,4FAA4F;AAC5F;;;CAGC,GACD,OAAO,MAAMC,2BAAuDd,MAAMe,UAAU,CAClF,CAAC,EAAEC,cAAc,CAAC,EA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W,IAAIzH,iBAAkB8C,CAAAA,2BAA2BC,qBAAqBzE,OAAM;QAEhGA,QAAQA;QACRoJ,QAAQvJ;QACRc,OAAOA;QACP0I,mBAAmB;QACnBC,eAAe;YACbC,mBAAmBvK,MAAMwK,2BAA2B,GAChDxK,MAAMwK,2BAA2B,CAAClI,yBAClCZ;YACJ+I,oBAAoBzK,MAAM0K,wBAAwB,GAC9C1K,MAAM0K,wBAAwB,CAACpI,yBAC/BZ;QACN;QACAiJ,aAAa;QAEd,CAACrK,4BACA,oBAACkI;QACCG,KAAK,CAACrD;YACJ5E,gBAAgBqC,OAAO,GAAGuC;QAC5B;QACAmD,WAAWX,QAAQpH,eAAe;OAEjCqH,6BAKP,oBAACS;QAAInD,IAAI5E;QAAgBmK,MAAM;QAASC,OAAO;YAAEC,SAAS;QAAI;QAAGvB,cAAY;;AAEjF,GACA;AAEF7J,WAAWqL,WAAW,GAAG"}
|
|
1
|
+
{"version":3,"sources":["../src/components/DonutChart/DonutChart.tsx"],"sourcesContent":["'use client';\n\n/* eslint-disable react/jsx-no-bind */\nimport * as React from 'react';\nimport { Pie } from './Pie/index';\nimport { DonutChartProps } from './DonutChart.types';\nimport { useDonutChartStyles } from './useDonutChartStyles.styles';\nimport { ChartDataPoint } from '../../DonutChart';\nimport { formatToLocaleString } from '@fluentui/chart-utilities';\nimport {\n areArraysEqual,\n getColorFromToken,\n getNextColor,\n MIN_DONUT_RADIUS,\n ChartTitle,\n CHART_TITLE_PADDING,\n} from '../../utilities/index';\nimport { Legend, Legends } from '../../index';\nimport { useId } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport { useArrowNavigationGroup } from '@fluentui/react-tabster';\nimport { ChartPopover } from '../CommonComponents/ChartPopover';\nimport { useImageExport } from '../../utilities/hooks';\n\nconst MIN_LEGEND_CONTAINER_HEIGHT = 40;\n\n// Create a DonutChart variant which uses these default styles and this styled subcomponent.\n/**\n * Donutchart component.\n * {@docCategory DonutChart}\n */\nexport const DonutChart: React.FunctionComponent<DonutChartProps> = React.forwardRef<HTMLDivElement, DonutChartProps>(\n ({ innerRadius = 0, hideLabels = true, ...restProps }, forwardedRef) => {\n const props = { innerRadius, hideLabels, ...restProps };\n const { chartContainerRef: _rootElem, legendsRef: _legendsRef } = useImageExport(\n props.componentRef,\n props.hideLegend,\n false,\n );\n const _uniqText: string = useId('_Pie_');\n /* eslint-disable @typescript-eslint/no-explicit-any */\n let _calloutAnchorPoint: ChartDataPoint | null;\n let _emptyChartId: string | null;\n const legendContainer = React.useRef<HTMLDivElement | null>(null);\n const prevSize = React.useRef<{ width?: number; height?: number }>({});\n\n const [value, setValue] = React.useState<string | undefined>('');\n const [legend, setLegend] = React.useState<string | undefined>('');\n const [_width, setWidth] = React.useState<number | undefined>(props.width || 200);\n const [_height, setHeight] = React.useState<number | undefined>(props.height || 200);\n const [activeLegend, setActiveLegend] = React.useState<string | undefined>(undefined);\n const [color, setColor] = React.useState<string | undefined>('');\n const [xCalloutValue, setXCalloutValue] = React.useState<string>('');\n const [yCalloutValue, setYCalloutValue] = React.useState<string>('');\n const [selectedLegends, setSelectedLegends] = React.useState<string[]>(props.legendProps?.selectedLegends || []);\n const [focusedArcId, setFocusedArcId] = React.useState<string>('');\n const [dataPointCalloutProps, setDataPointCalloutProps] = React.useState<ChartDataPoint | undefined>();\n const [refSelected, setRefSelected] = React.useState<HTMLElement | null>(null);\n const [isPopoverOpen, setPopoverOpen] = React.useState(false);\n const prevPropsRef = React.useRef<DonutChartProps | null>(null);\n\n React.useEffect(() => {\n _fitParentContainer();\n }, []);\n\n React.useEffect(() => {\n if (prevPropsRef.current) {\n const prevProps = prevPropsRef.current;\n if (!areArraysEqual(prevProps.legendProps?.selectedLegends, props.legendProps?.selectedLegends)) {\n setSelectedLegends(props.legendProps?.selectedLegends || []);\n }\n }\n prevPropsRef.current = props;\n }, [props]);\n\n React.useEffect(() => {\n if (prevSize.current.height !== props.height || prevSize.current.width !== props.width) {\n _fitParentContainer();\n }\n prevSize.current.height = props.height;\n prevSize.current.width = props.width;\n }, [props.width, props.height]);\n\n function _elevateToMinimums(data: ChartDataPoint[]) {\n let sumOfData = 0;\n const minPercent = 0.01;\n const elevatedData: ChartDataPoint[] = [];\n data.forEach(item => {\n sumOfData += item.data!;\n });\n data.forEach(item => {\n elevatedData.push(\n minPercent * sumOfData > item.data! && item.data! > 0\n ? {\n ...item,\n data: minPercent * sumOfData,\n yAxisCalloutData:\n item.yAxisCalloutData === undefined ? item.data!.toLocaleString() : item.yAxisCalloutData,\n }\n : item,\n );\n });\n return elevatedData;\n }\n function _createLegends(chartData: ChartDataPoint[]): JSXElement {\n if (props.order === 'sorted') {\n chartData.sort((a: ChartDataPoint, b: ChartDataPoint) => {\n return b.data! - a.data!;\n });\n }\n const legendDataItems = chartData.map((point: ChartDataPoint, index: number) => {\n const color: string = point.color!;\n // mapping data to the format Legends component needs\n const legend: Legend = {\n title: point.legend!,\n color,\n hoverAction: () => {\n _handleChartMouseLeave();\n setActiveLegend(point.legend!);\n },\n onMouseOutAction: () => {\n setActiveLegend(undefined);\n },\n };\n return legend;\n });\n const legends = (\n <Legends\n legends={legendDataItems}\n centerLegends\n overflowText={props.legendsOverflowText}\n {...props.legendProps}\n // eslint-disable-next-line react/jsx-no-bind\n onChange={_onLegendSelectionChange}\n legendRef={_legendsRef}\n />\n );\n return legends;\n }\n function _onLegendSelectionChange(\n selectedLegends: string[],\n event: React.MouseEvent<HTMLButtonElement>,\n currentLegend?: Legend,\n ): void {\n if (props.legendProps && props.legendProps?.canSelectMultipleLegends) {\n setSelectedLegends(selectedLegends);\n } else {\n setSelectedLegends(selectedLegends.slice(-1));\n }\n if (props.legendProps?.onChange) {\n props.legendProps.onChange(selectedLegends, event, currentLegend);\n }\n }\n\n function _focusCallback(\n data: ChartDataPoint,\n id: string,\n e: React.FocusEvent<SVGPathElement>,\n targetElement?: HTMLElement | null,\n ): void {\n setPopoverOpen(_noLegendsHighlighted() || _isLegendHighlighted(data.legend));\n setValue(data.data!.toString());\n setLegend(data.legend);\n setColor(data.color!);\n setXCalloutValue(data.xAxisCalloutData!);\n setYCalloutValue(data.yAxisCalloutData!);\n setFocusedArcId(id);\n setDataPointCalloutProps(data);\n setRefSelected(targetElement!);\n }\n\n function _hoverCallback(\n data: ChartDataPoint,\n e: React.MouseEvent<SVGPathElement>,\n targetElement?: HTMLElement | null,\n ): void {\n if (_calloutAnchorPoint !== data) {\n _calloutAnchorPoint = data;\n setPopoverOpen(_noLegendsHighlighted() || _isLegendHighlighted(data.legend));\n setValue(data.data!.toString());\n setLegend(data.legend);\n setColor(data.color!);\n setXCalloutValue(data.xAxisCalloutData!);\n setYCalloutValue(data.yAxisCalloutData!);\n setDataPointCalloutProps(data);\n setRefSelected(targetElement!);\n }\n }\n function _onBlur(): void {\n setFocusedArcId('');\n }\n\n function _hoverLeave(): void {\n /**/\n }\n\n function _handleChartMouseLeave() {\n _calloutAnchorPoint = null;\n setPopoverOpen(false);\n }\n\n function _valueInsideDonut(valueInsideDonut: string | number | undefined, data: ChartDataPoint[]) {\n const highlightedLegends = _getHighlightedLegend();\n if (valueInsideDonut !== undefined && (highlightedLegends.length === 1 || isPopoverOpen)) {\n const pointValue = data.find(point => _isLegendHighlighted(point.legend));\n return pointValue\n ? pointValue.yAxisCalloutData\n ? pointValue.yAxisCalloutData\n : pointValue.data!\n : valueInsideDonut;\n } else if (highlightedLegends.length > 0) {\n let totalValue = 0;\n data.forEach(point => {\n if (highlightedLegends.includes(point.legend!)) {\n totalValue += point.data!;\n }\n });\n return totalValue;\n } else {\n return valueInsideDonut;\n }\n }\n\n function _toLocaleString(data: string | number | undefined) {\n const localeString = formatToLocaleString(data, props.culture);\n if (!localeString) {\n return data;\n }\n return localeString?.toString();\n }\n\n /**\n * This function returns\n * the selected legend if there is one\n * or the hovered legend if none of the legends is selected.\n */\n function _getHighlightedLegend() {\n return selectedLegends.length > 0 ? selectedLegends : activeLegend ? [activeLegend] : [];\n }\n\n function _isLegendHighlighted(legend: string | undefined): boolean {\n return _getHighlightedLegend().includes(legend!);\n }\n\n function _noLegendsHighlighted(): boolean {\n return _getHighlightedLegend().length === 0;\n }\n\n function _isChartEmpty(): boolean {\n return !(\n props.data &&\n props.data.chartData &&\n props.data.chartData!.filter((d: ChartDataPoint) => d.data! > 0).length > 0\n );\n }\n\n function _addDefaultColors(donutChartDataPoint?: ChartDataPoint[]): ChartDataPoint[] {\n return donutChartDataPoint\n ? donutChartDataPoint.map((item, index) => {\n let defaultColor: string;\n if (typeof item.color === 'undefined') {\n defaultColor = getNextColor(index, 0);\n } else {\n defaultColor = getColorFromToken(item.color);\n }\n return { ...item, defaultColor };\n })\n : [];\n }\n\n /**\n * When screen resizes, along with screen, chart also auto adjusted.\n * This method used to adjust height and width of the charts.\n */\n function _fitParentContainer(): void {\n //_reqID = requestAnimationFrame(() => {\n let legendContainerHeight;\n if (props.hideLegend) {\n // If there is no legend, need not to allocate some space from total chart space.\n legendContainerHeight = 0;\n } else {\n const legendContainerComputedStyles = legendContainer.current && getComputedStyle(legendContainer.current);\n legendContainerHeight =\n ((legendContainer.current && legendContainer.current.getBoundingClientRect().height) ||\n MIN_LEGEND_CONTAINER_HEIGHT) +\n parseFloat((legendContainerComputedStyles && legendContainerComputedStyles.marginTop) || '0') +\n parseFloat((legendContainerComputedStyles && legendContainerComputedStyles.marginBottom) || '0');\n }\n if (props.parentRef || _rootElem.current) {\n const container = props.parentRef ? props.parentRef : _rootElem.current!;\n const currentContainerWidth = container.getBoundingClientRect().width;\n const currentContainerHeight =\n container.getBoundingClientRect().height > legendContainerHeight\n ? container.getBoundingClientRect().height\n : 200;\n const shouldResize =\n _width !== currentContainerWidth || _height !== currentContainerHeight - legendContainerHeight;\n if (shouldResize) {\n setWidth(currentContainerWidth);\n setHeight(currentContainerHeight - legendContainerHeight);\n }\n }\n //});\n }\n\n const { data, hideLegend = false } = props;\n const points = _addDefaultColors(data?.chartData);\n\n const classes = useDonutChartStyles(props);\n\n const legendBars = _createLegends(points.filter(d => d.data! >= 0));\n const donutMarginHorizontal = props.hideLabels ? 0 : 80;\n const donutMarginVertical = props.hideLabels ? 0 : 40;\n const titleHeight = data?.chartTitle\n ? Math.max(\n (typeof props.titleStyles?.titleFont?.size === 'number' ? props.titleStyles.titleFont.size : 13) +\n CHART_TITLE_PADDING,\n 36,\n )\n : 0;\n const outerRadius = Math.min(_width! - donutMarginHorizontal, _height! - donutMarginVertical - titleHeight) / 2;\n const chartData = _elevateToMinimums(points);\n const valueInsideDonut =\n props.innerRadius! > MIN_DONUT_RADIUS ? _valueInsideDonut(props.valueInsideDonut!, chartData!) : '';\n const arrowAttributes = useArrowNavigationGroup({ circular: true, axis: 'horizontal' });\n return !_isChartEmpty() ? (\n <div\n className={classes.root}\n ref={(rootElem: HTMLDivElement | null) => {\n _rootElem.current = rootElem;\n }}\n onMouseLeave={_handleChartMouseLeave}\n >\n {props.xAxisAnnotation && (\n <text className={classes.axisAnnotation} x={_width! / 2} y={_height! - 10} textAnchor=\"middle\">\n {props.xAxisAnnotation}\n </text>\n )}\n <div className={classes.chartWrapper} {...arrowAttributes}>\n <svg className={classes.chart} aria-label={data?.chartTitle} width={_width} height={_height}>\n {!hideLegend && data?.chartTitle && (\n <ChartTitle\n title={data.chartTitle}\n x={_width! / 2}\n maxWidth={_width! - 20}\n className={classes.chartTitle}\n titleStyles={props.titleStyles}\n tooltipClassName={classes.svgTooltip}\n />\n )}\n <Pie\n width={_width!}\n height={_height!}\n outerRadius={outerRadius}\n innerRadius={props.innerRadius!}\n data={chartData!}\n onFocusCallback={_focusCallback}\n hoverOnCallback={_hoverCallback}\n hoverLeaveCallback={_hoverLeave}\n uniqText={_uniqText}\n onBlurCallback={_onBlur}\n activeArc={_getHighlightedLegend()}\n focusedArcId={focusedArcId || ''}\n href={props.href!}\n valueInsideDonut={_toLocaleString(valueInsideDonut)}\n showLabelsInPercent={props.showLabelsInPercent}\n hideLabels={props.hideLabels}\n />\n </svg>\n </div>\n <ChartPopover\n xCalloutValue={xCalloutValue}\n yCalloutValue={yCalloutValue}\n culture={props.culture}\n positioning={{\n target: refSelected,\n }}\n isPopoverOpen={\n !props.hideTooltip && isPopoverOpen && (_noLegendsHighlighted() || _isLegendHighlighted(legend))\n }\n legend={legend!}\n YValue={value!}\n color={color}\n isCalloutForStack={false}\n customCallout={{\n customizedCallout: props.onRenderCalloutPerDataPoint\n ? props.onRenderCalloutPerDataPoint(dataPointCalloutProps!)\n : undefined,\n customCalloutProps: props.calloutPropsPerDataPoint\n ? props.calloutPropsPerDataPoint(dataPointCalloutProps!)\n : undefined,\n }}\n isCartesian={false}\n />\n {!hideLegend && (\n <div\n ref={(e: HTMLDivElement) => {\n legendContainer.current = e;\n }}\n className={classes.legendContainer}\n >\n {legendBars}\n </div>\n )}\n </div>\n ) : (\n <div id={_emptyChartId!} role={'alert'} style={{ opacity: '0' }} aria-label={'Graph has no data to display'} />\n );\n },\n);\n\nDonutChart.displayName = 'DonutChart';\n"],"names":["React","Pie","useDonutChartStyles","formatToLocaleString","areArraysEqual","getColorFromToken","getNextColor","MIN_DONUT_RADIUS","ChartTitle","CHART_TITLE_PADDING","Legends","useId","useArrowNavigationGroup","ChartPopover","useImageExport","MIN_LEGEND_CONTAINER_HEIGHT","DonutChart","forwardRef","innerRadius","hideLabels","restProps","forwardedRef","props","chartContainerRef","_rootElem","legendsRef","_legendsRef","componentRef","hideLegend","_uniqText","_calloutAnchorPoint","_emptyChartId","legendContainer","useRef","prevSize","value","setValue","useState","legend","setLegend","_width","setWidth","width","_height","setHeight","height","activeLegend","setActiveLegend","undefined","color","setColor","xCalloutValue","setXCalloutValue","yCalloutValue","setYCalloutValue","selectedLegends","setSelectedLegends","legendProps","focusedArcId","setFocusedArcId","dataPointCalloutProps","setDataPointCalloutProps","refSelected","setRefSelected","isPopoverOpen","setPopoverOpen","prevPropsRef","useEffect","_fitParentContainer","current","prevProps","_elevateToMinimums","data","sumOfData","minPercent","elevatedData","forEach","item","push","yAxisCalloutData","toLocaleString","_createLegends","chartData","order","sort","a","b","legendDataItems","map","point","index","title","hoverAction","_handleChartMouseLeave","onMouseOutAction","legends","centerLegends","overflowText","legendsOverflowText","onChange","_onLegendSelectionChange","legendRef","event","currentLegend","canSelectMultipleLegends","slice","_focusCallback","id","e","targetElement","_noLegendsHighlighted","_isLegendHighlighted","toString","xAxisCalloutData","_hoverCallback","_onBlur","_hoverLeave","_valueInsideDonut","valueInsideDonut","highlightedLegends","_getHighlightedLegend","length","pointValue","find","totalValue","includes","_toLocaleString","localeString","culture","_isChartEmpty","filter","d","_addDefaultColors","donutChartDataPoint","defaultColor","legendContainerHeight","legendContainerComputedStyles","getComputedStyle","getBoundingClientRect","parseFloat","marginTop","marginBottom","parentRef","container","currentContainerWidth","currentContainerHeight","shouldResize","points","classes","legendBars","donutMarginHorizontal","donutMarginVertical","titleHeight","chartTitle","Math","max","titleStyles","titleFont","size","outerRadius","min","arrowAttributes","circular","axis","div","className","root","ref","rootElem","onMouseLeave","xAxisAnnotation","text","axisAnnotation","x","y","textAnchor","chartWrapper","svg","chart","aria-label","maxWidth","tooltipClassName","svgTooltip","onFocusCallback","hoverOnCallback","hoverLeaveCallback","uniqText","onBlurCallback","activeArc","href","showLabelsInPercent","positioning","target","hideTooltip","YValue","isCalloutForStack","customCallout","customizedCallout","onRenderCalloutPerDataPoint","customCalloutProps","calloutPropsPerDataPoint","isCartesian","role","style","opacity","displayName"],"mappings":"AAAA;AAEA,oCAAoC,GACpC,YAAYA,WAAW,QAAQ;AAC/B,SAASC,GAAG,QAAQ,cAAc;AAElC,SAASC,mBAAmB,QAAQ,+BAA+B;AAEnE,SAASC,oBAAoB,QAAQ,4BAA4B;AACjE,SACEC,cAAc,EACdC,iBAAiB,EACjBC,YAAY,EACZC,gBAAgB,EAChBC,UAAU,EACVC,mBAAmB,QACd,wBAAwB;AAC/B,SAAiBC,OAAO,QAAQ,cAAc;AAC9C,SAASC,KAAK,QAAQ,4BAA4B;AAElD,SAASC,uBAAuB,QAAQ,0BAA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zD,IAAI5E;QAAgB2K,MAAM;QAASC,OAAO;YAAEC,SAAS;QAAI;QAAGzB,cAAY;;AAEjF,GACA;AAEFnK,WAAW6L,WAAW,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/DonutChart/DonutChart.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport { CartesianChartProps, CartesianChartStyleProps } from '../CommonComponents/index';\nimport { ChartProps, ChartDataPoint, Chart } from './index';\nimport { ChartPopoverProps } from '../CommonComponents/ChartPopover.types';\nimport { LegendsProps } from '../Legends/index';\n\n/**\n * Donut Chart properties.\n * {@docCategory DonutChart}\n */\nexport interface DonutChartProps extends CartesianChartProps {\n /**\n * Data to render in the chart.\n */\n data?: ChartProps;\n\n /**\n * inner radius for donut size\n */\n innerRadius?: number;\n\n /**\n * Call to provide customized styling that will layer on top of the variant rules.\n */\n styles?: DonutChartStyles;\n\n /**\n * props for inside donut value\n */\n valueInsideDonut?: string | number;\n\n /**\n * Define a custom callout renderer for a data point\n */\n onRenderCalloutPerDataPoint?: (dataPointCalloutProps: ChartDataPoint) => JSXElement | undefined;\n\n /**\n * Define a custom callout props override\n */\n calloutPropsPerDataPoint?: (dataPointCalloutProps: ChartDataPoint) => ChartPopoverProps;\n\n /**\n * props for the callout in the chart\n */\n calloutProps?: ChartPopoverProps;\n\n /**\n * The prop used to define the culture to localized the numbers\n */\n culture?: string;\n\n /**\n * Prop to show the arc labels in percentage format\n * @default false\n */\n showLabelsInPercent?: boolean;\n\n /**\n * Prop to hide the arc labels\n * @default true\n */\n hideLabels?: boolean;\n\n /**\n * Below height used for resizing of the chart\n * Wrap chart in your container and send the updated height and width to these props.\n * These values decide wheather chart re render or not. Please check examples for reference\n */\n height?: number;\n\n /**\n * Below width used for resizing of the chart\n * Wrap chart in your container and send the updated height and width to these props.\n * These values decide wheather chart re render or not. Please check examples for reference\n */\n width?: number;\n\n /**\n * this prop takes its parent as a HTML element to define the width and height of the chart\n */\n parentRef?: HTMLElement | null;\n\n /**\n * Additional CSS class(es) to apply to the Chart.\n */\n className?: string;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n legendsOverflowText?: any;\n\n /*\n * props for the legends in the chart\n */\n legendProps?: Partial<LegendsProps>;\n\n /** decides wether to show/hide legends\n * @defaultvalue false\n */\n hideLegend?: boolean;\n\n /**\n * Url that the data-viz needs to redirect to upon clicking on it\n */\n href?: string;\n\n /**\n * Do not show tooltips in chart\n * @default false\n */\n hideTooltip?: boolean;\n\n /**\n * Optional callback to access the Chart interface. Use this instead of ref for accessing\n * the public methods and properties of the component.\n */\n componentRef?: React.Ref<Chart>;\n\n /**\n * Prop to enable the round corners in the chart\n * @default false\n */\n roundCorners?: boolean;\n\n /**\n * Rendering order of the legend\n * @default 'default'\n * 'default' - as per data provided\n * 'sorted' - in descending order of value\n */\n order?: 'default' | 'sorted';\n}\n\n/**\n * Donut Chart style properties\n * {@docCategory DonutChart}\n */\nexport interface DonutChartStyleProps extends CartesianChartStyleProps {}\n\n/**\n * Donut Chart styles\n * {@docCategory DonutChart}\n */\nexport interface DonutChartStyles {\n /**\n * Style for the root element.\n */\n root?: string;\n\n /**\n * Style for the chart.\n */\n chart?: string;\n /**\n * Style for the legend container.\n */\n legendContainer: string;\n\n /**\n * styles for axis annotation\n */\n axisAnnotation?: string;\n\n /**\n * Styles for the chart wrapper div\n */\n chartWrapper?: string;\n}\n"],"names":["React"],"mappings":"AAAA,YAAYA,WAAW,QAAQ"}
|
|
1
|
+
{"version":3,"sources":["../src/components/DonutChart/DonutChart.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport { CartesianChartProps, CartesianChartStyleProps } from '../CommonComponents/index';\nimport { ChartProps, ChartDataPoint, Chart } from './index';\nimport { ChartPopoverProps } from '../CommonComponents/ChartPopover.types';\nimport { LegendsProps } from '../Legends/index';\nimport type { TitleStyles } from '../../utilities/Common.styles';\n\n/**\n * Donut Chart properties.\n * {@docCategory DonutChart}\n */\nexport interface DonutChartProps extends CartesianChartProps {\n /**\n * Title styles configuration for the chart title\n */\n titleStyles?: TitleStyles;\n\n /**\n * Data to render in the chart.\n */\n data?: ChartProps;\n\n /**\n * inner radius for donut size\n */\n innerRadius?: number;\n\n /**\n * Call to provide customized styling that will layer on top of the variant rules.\n */\n styles?: DonutChartStyles;\n\n /**\n * props for inside donut value\n */\n valueInsideDonut?: string | number;\n\n /**\n * Define a custom callout renderer for a data point\n */\n onRenderCalloutPerDataPoint?: (dataPointCalloutProps: ChartDataPoint) => JSXElement | undefined;\n\n /**\n * Define a custom callout props override\n */\n calloutPropsPerDataPoint?: (dataPointCalloutProps: ChartDataPoint) => ChartPopoverProps;\n\n /**\n * props for the callout in the chart\n */\n calloutProps?: ChartPopoverProps;\n\n /**\n * The prop used to define the culture to localized the numbers\n */\n culture?: string;\n\n /**\n * Prop to show the arc labels in percentage format\n * @default false\n */\n showLabelsInPercent?: boolean;\n\n /**\n * Prop to hide the arc labels\n * @default true\n */\n hideLabels?: boolean;\n\n /**\n * Below height used for resizing of the chart\n * Wrap chart in your container and send the updated height and width to these props.\n * These values decide wheather chart re render or not. Please check examples for reference\n */\n height?: number;\n\n /**\n * Below width used for resizing of the chart\n * Wrap chart in your container and send the updated height and width to these props.\n * These values decide wheather chart re render or not. Please check examples for reference\n */\n width?: number;\n\n /**\n * this prop takes its parent as a HTML element to define the width and height of the chart\n */\n parentRef?: HTMLElement | null;\n\n /**\n * Additional CSS class(es) to apply to the Chart.\n */\n className?: string;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n legendsOverflowText?: any;\n\n /*\n * props for the legends in the chart\n */\n legendProps?: Partial<LegendsProps>;\n\n /** decides wether to show/hide legends\n * @defaultvalue false\n */\n hideLegend?: boolean;\n\n /**\n * Url that the data-viz needs to redirect to upon clicking on it\n */\n href?: string;\n\n /**\n * Do not show tooltips in chart\n * @default false\n */\n hideTooltip?: boolean;\n\n /**\n * Optional callback to access the Chart interface. Use this instead of ref for accessing\n * the public methods and properties of the component.\n */\n componentRef?: React.Ref<Chart>;\n\n /**\n * Prop to enable the round corners in the chart\n * @default false\n */\n roundCorners?: boolean;\n\n /**\n * Rendering order of the legend\n * @default 'default'\n * 'default' - as per data provided\n * 'sorted' - in descending order of value\n */\n order?: 'default' | 'sorted';\n}\n\n/**\n * Donut Chart style properties\n * {@docCategory DonutChart}\n */\nexport interface DonutChartStyleProps extends CartesianChartStyleProps {}\n\n/**\n * Donut Chart styles\n * {@docCategory DonutChart}\n */\nexport interface DonutChartStyles {\n /**\n * Style for the root element.\n */\n root?: string;\n\n /**\n * Style for the chart.\n */\n chart?: string;\n /**\n * Style for the legend container.\n */\n legendContainer: string;\n\n /**\n * Style for the chart title.\n */\n chartTitle?: string;\n\n /**\n * styles for axis annotation\n */\n axisAnnotation?: string;\n\n /**\n * Styles for the chart wrapper div\n */\n chartWrapper?: string;\n\n /**\n * Style for SVG tooltip text\n */\n svgTooltip?: string;\n}\n"],"names":["React"],"mappings":"AAAA,YAAYA,WAAW,QAAQ"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { __styles, mergeClasses } from '@griffel/react';
|
|
4
4
|
import { tokens, typographyStyles } from '@fluentui/react-theme';
|
|
5
|
-
import { getAxisTitleStyle } from '../../utilities/index';
|
|
5
|
+
import { getAxisTitleStyle, getChartTitleStyles, HighContrastSelector } from '../../utilities/index';
|
|
6
6
|
/**
|
|
7
7
|
* @internal
|
|
8
8
|
*/
|
|
@@ -11,7 +11,9 @@ export const donutClassNames = {
|
|
|
11
11
|
chart: 'fui-donut__chart',
|
|
12
12
|
legendContainer: 'fui-donut__legendContainer',
|
|
13
13
|
chartWrapper: 'fui-donut__chartWrapper',
|
|
14
|
-
axisAnnotation: 'fui-donut__axisAnnotation'
|
|
14
|
+
axisAnnotation: 'fui-donut__axisAnnotation',
|
|
15
|
+
chartTitle: 'fui-donut__chartTitle',
|
|
16
|
+
svgTooltip: 'fui-donut__svgTooltip'
|
|
15
17
|
};
|
|
16
18
|
/**
|
|
17
19
|
* Base Styles
|
|
@@ -50,20 +52,36 @@ const useStyles = /*#__PURE__*/__styles({
|
|
|
50
52
|
sj55zd: "fkfq4zb",
|
|
51
53
|
Bkfmm31: "fhuob2q",
|
|
52
54
|
Bxms50k: "f1yn2ez9"
|
|
55
|
+
},
|
|
56
|
+
chartTitle: {
|
|
57
|
+
Bahqtrf: "fk6fouc",
|
|
58
|
+
Be2twd7: "f13mqy1h",
|
|
59
|
+
Bhrd7zp: "fl43uef",
|
|
60
|
+
Bg96gwp: "fcpl73t",
|
|
61
|
+
Bkfmm31: "fhuob2q",
|
|
62
|
+
Bvjb7m6: "fhv2zbx",
|
|
63
|
+
fsow6f: "f17mccla",
|
|
64
|
+
jrapky: "fqcjy3b"
|
|
65
|
+
},
|
|
66
|
+
svgTooltip: {
|
|
67
|
+
Bkfmm31: "f5q6cfr",
|
|
68
|
+
Bxms50k: "f1bgda6t"
|
|
53
69
|
}
|
|
54
70
|
}, {
|
|
55
71
|
d: [".fk6fouc{font-family:var(--fontFamilyBase);}", ".fkhj508{font-size:var(--fontSizeBase300);}", ".figsok6{font-weight:var(--fontWeightRegular);}", ".f1i3iumi{line-height:var(--lineHeightBase300);}", ".f22iagw{display:flex;}", ".f1vx9l62{flex-direction:column;}", ".fly5x3f{width:100%;}", ".f1l02sjl{height:100%;}", ".f1o700av{text-align:left;}", ".fes3tcz{text-align:right;}", ".f1e4lqlz{box-sizing:content-box;}", ".fzm18in{alignment-adjust:center;}", ".ftgm304{display:block;}", [".f1gl81tg{overflow:visible;}", {
|
|
56
72
|
p: -1
|
|
57
|
-
}], ".fikn0iw{padding-top:var(--spacingVerticalL);}", ".f13mqy1h{font-size:var(--fontSizeBase100);}", ".fl43uef{font-weight:var(--fontWeightSemibold);}", ".fcpl73t{line-height:var(--lineHeightBase100);}", ".fmd4ok8{font-style:normal;}", ".f17mccla{text-align:center;}", ".fkfq4zb{color:var(--colorNeutralForeground2);}", ".fhuob2q{fill:var(--colorNeutralForeground1);}"],
|
|
73
|
+
}], ".fikn0iw{padding-top:var(--spacingVerticalL);}", ".f13mqy1h{font-size:var(--fontSizeBase100);}", ".fl43uef{font-weight:var(--fontWeightSemibold);}", ".fcpl73t{line-height:var(--lineHeightBase100);}", ".fmd4ok8{font-style:normal;}", ".f17mccla{text-align:center;}", ".fkfq4zb{color:var(--colorNeutralForeground2);}", ".fhuob2q{fill:var(--colorNeutralForeground1);}", ".fhv2zbx{forced-color-adjust:auto;}", ".fqcjy3b{margin-bottom:var(--spacingVerticalS);}", ".f5q6cfr{fill:var(--colorNeutralBackground1);}"],
|
|
58
74
|
m: [["@media screen and (-ms-high-contrast: active),screen and (forced-colors: active){.f1yn2ez9{fill:CanvasText;}}", {
|
|
59
75
|
m: "screen and (-ms-high-contrast: active), screen and (forced-colors: active)"
|
|
76
|
+
}], ["@media screen and (-ms-high-contrast: active),screen and (forced-colors: active){.f1bgda6t{fill:Canvas;}}", {
|
|
77
|
+
m: "screen and (-ms-high-contrast: active), screen and (forced-colors: active)"
|
|
60
78
|
}]]
|
|
61
79
|
});
|
|
62
80
|
/**
|
|
63
81
|
* Apply styling to the DonutChart component
|
|
64
82
|
*/
|
|
65
83
|
export const useDonutChartStyles = props => {
|
|
66
|
-
var _props_styles, _props_styles1, _props_styles2, _props_styles3, _props_styles4;
|
|
84
|
+
var _props_styles, _props_styles1, _props_styles2, _props_styles3, _props_styles4, _props_styles5, _props_styles6;
|
|
67
85
|
const {
|
|
68
86
|
className
|
|
69
87
|
} = props;
|
|
@@ -73,6 +91,8 @@ export const useDonutChartStyles = props => {
|
|
|
73
91
|
chart: mergeClasses(donutClassNames.chart, baseStyles.chart, (_props_styles1 = props.styles) === null || _props_styles1 === void 0 ? void 0 : _props_styles1.chart),
|
|
74
92
|
legendContainer: mergeClasses(donutClassNames.legendContainer, baseStyles.legendContainer, (_props_styles2 = props.styles) === null || _props_styles2 === void 0 ? void 0 : _props_styles2.legendContainer),
|
|
75
93
|
chartWrapper: mergeClasses(donutClassNames.chartWrapper, (_props_styles3 = props.styles) === null || _props_styles3 === void 0 ? void 0 : _props_styles3.chartWrapper),
|
|
76
|
-
axisAnnotation: mergeClasses(donutClassNames.axisAnnotation, baseStyles.axisAnnotation, (_props_styles4 = props.styles) === null || _props_styles4 === void 0 ? void 0 : _props_styles4.axisAnnotation)
|
|
94
|
+
axisAnnotation: mergeClasses(donutClassNames.axisAnnotation, baseStyles.axisAnnotation, (_props_styles4 = props.styles) === null || _props_styles4 === void 0 ? void 0 : _props_styles4.axisAnnotation),
|
|
95
|
+
chartTitle: mergeClasses(donutClassNames.chartTitle, baseStyles.chartTitle, (_props_styles5 = props.styles) === null || _props_styles5 === void 0 ? void 0 : _props_styles5.chartTitle),
|
|
96
|
+
svgTooltip: mergeClasses(donutClassNames.svgTooltip, baseStyles.svgTooltip, (_props_styles6 = props.styles) === null || _props_styles6 === void 0 ? void 0 : _props_styles6.svgTooltip)
|
|
77
97
|
};
|
|
78
98
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__styles","mergeClasses","tokens","typographyStyles","getAxisTitleStyle","donutClassNames","root","chart","legendContainer","chartWrapper","axisAnnotation","useStyles","Bahqtrf","Be2twd7","Bhrd7zp","Bg96gwp","mc9l5x","Beiy3e4","a9b677","Bqenvij","fsow6f","B7ck84d","ek0pe7","B68tc82","Bmxbyg5","Bpg54ce","z8tnut","B80ckks","sj55zd","Bkfmm31","Bxms50k","d","p","m","useDonutChartStyles","props","_props_styles","_props_styles1","_props_styles2","_props_styles3","_props_styles4","className","baseStyles","styles"],"sources":["useDonutChartStyles.styles.js"],"sourcesContent":["'use client';\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\nimport { getAxisTitleStyle } from '../../utilities/index';\n/**\n * @internal\n */ export const donutClassNames = {\n root: 'fui-donut__root',\n chart: 'fui-donut__chart',\n legendContainer: 'fui-donut__legendContainer',\n chartWrapper: 'fui-donut__chartWrapper',\n axisAnnotation: 'fui-donut__axisAnnotation'\n};\n/**\n * Base Styles\n */ const useStyles = makeStyles({\n root: {\n // alignItems: 'center',\n ...typographyStyles.body1,\n display: 'flex',\n flexDirection: 'column',\n width: '100%',\n height: '100%',\n textAlign: 'left'\n },\n chart: {\n boxSizing: 'content-box',\n alignmentAdjust: 'center',\n display: 'block',\n overflow: 'visible'\n },\n legendContainer: {\n paddingTop: tokens.spacingVerticalL,\n width: '100%'\n },\n axisAnnotation: getAxisTitleStyle()\n});\n/**\n * Apply styling to the DonutChart component\n */ export const useDonutChartStyles = (props)=>{\n var _props_styles, _props_styles1, _props_styles2, _props_styles3, _props_styles4;\n const { className } = props;\n const baseStyles = useStyles();\n return {\n root: mergeClasses(donutClassNames.root, baseStyles.root, className, (_props_styles = props.styles) === null || _props_styles === void 0 ? void 0 : _props_styles.root),\n chart: mergeClasses(donutClassNames.chart, baseStyles.chart, (_props_styles1 = props.styles) === null || _props_styles1 === void 0 ? void 0 : _props_styles1.chart),\n legendContainer: mergeClasses(donutClassNames.legendContainer, baseStyles.legendContainer, (_props_styles2 = props.styles) === null || _props_styles2 === void 0 ? void 0 : _props_styles2.legendContainer),\n chartWrapper: mergeClasses(donutClassNames.chartWrapper, (_props_styles3 = props.styles) === null || _props_styles3 === void 0 ? void 0 : _props_styles3.chartWrapper),\n axisAnnotation: mergeClasses(donutClassNames.axisAnnotation, baseStyles.axisAnnotation, (_props_styles4 = props.styles) === null || _props_styles4 === void 0 ? void 0 : _props_styles4.axisAnnotation)\n };\n};\n"],"mappings":"AAAA,YAAY;;AACZ,SAAAA,QAAA,EAAqBC,YAAY,QAAQ,gBAAgB;AACzD,SAASC,MAAM,EAAEC,gBAAgB,QAAQ,uBAAuB;AAChE,SAASC,iBAAiB,QAAQ,uBAAuB;
|
|
1
|
+
{"version":3,"names":["__styles","mergeClasses","tokens","typographyStyles","getAxisTitleStyle","getChartTitleStyles","HighContrastSelector","donutClassNames","root","chart","legendContainer","chartWrapper","axisAnnotation","chartTitle","svgTooltip","useStyles","Bahqtrf","Be2twd7","Bhrd7zp","Bg96gwp","mc9l5x","Beiy3e4","a9b677","Bqenvij","fsow6f","B7ck84d","ek0pe7","B68tc82","Bmxbyg5","Bpg54ce","z8tnut","B80ckks","sj55zd","Bkfmm31","Bxms50k","Bvjb7m6","jrapky","d","p","m","useDonutChartStyles","props","_props_styles","_props_styles1","_props_styles2","_props_styles3","_props_styles4","_props_styles5","_props_styles6","className","baseStyles","styles"],"sources":["useDonutChartStyles.styles.js"],"sourcesContent":["'use client';\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\nimport { getAxisTitleStyle, getChartTitleStyles, HighContrastSelector } from '../../utilities/index';\n/**\n * @internal\n */ export const donutClassNames = {\n root: 'fui-donut__root',\n chart: 'fui-donut__chart',\n legendContainer: 'fui-donut__legendContainer',\n chartWrapper: 'fui-donut__chartWrapper',\n axisAnnotation: 'fui-donut__axisAnnotation',\n chartTitle: 'fui-donut__chartTitle',\n svgTooltip: 'fui-donut__svgTooltip'\n};\n/**\n * Base Styles\n */ const useStyles = makeStyles({\n root: {\n // alignItems: 'center',\n ...typographyStyles.body1,\n display: 'flex',\n flexDirection: 'column',\n width: '100%',\n height: '100%',\n textAlign: 'left'\n },\n chart: {\n boxSizing: 'content-box',\n alignmentAdjust: 'center',\n display: 'block',\n overflow: 'visible'\n },\n legendContainer: {\n paddingTop: tokens.spacingVerticalL,\n width: '100%'\n },\n axisAnnotation: getAxisTitleStyle(),\n chartTitle: getChartTitleStyles(),\n svgTooltip: {\n fill: tokens.colorNeutralBackground1,\n [HighContrastSelector]: {\n fill: 'Canvas'\n }\n }\n});\n/**\n * Apply styling to the DonutChart component\n */ export const useDonutChartStyles = (props)=>{\n var _props_styles, _props_styles1, _props_styles2, _props_styles3, _props_styles4, _props_styles5, _props_styles6;\n const { className } = props;\n const baseStyles = useStyles();\n return {\n root: mergeClasses(donutClassNames.root, baseStyles.root, className, (_props_styles = props.styles) === null || _props_styles === void 0 ? void 0 : _props_styles.root),\n chart: mergeClasses(donutClassNames.chart, baseStyles.chart, (_props_styles1 = props.styles) === null || _props_styles1 === void 0 ? void 0 : _props_styles1.chart),\n legendContainer: mergeClasses(donutClassNames.legendContainer, baseStyles.legendContainer, (_props_styles2 = props.styles) === null || _props_styles2 === void 0 ? void 0 : _props_styles2.legendContainer),\n chartWrapper: mergeClasses(donutClassNames.chartWrapper, (_props_styles3 = props.styles) === null || _props_styles3 === void 0 ? void 0 : _props_styles3.chartWrapper),\n axisAnnotation: mergeClasses(donutClassNames.axisAnnotation, baseStyles.axisAnnotation, (_props_styles4 = props.styles) === null || _props_styles4 === void 0 ? void 0 : _props_styles4.axisAnnotation),\n chartTitle: mergeClasses(donutClassNames.chartTitle, baseStyles.chartTitle, (_props_styles5 = props.styles) === null || _props_styles5 === void 0 ? void 0 : _props_styles5.chartTitle),\n svgTooltip: mergeClasses(donutClassNames.svgTooltip, baseStyles.svgTooltip, (_props_styles6 = props.styles) === null || _props_styles6 === void 0 ? void 0 : _props_styles6.svgTooltip)\n };\n};\n"],"mappings":"AAAA,YAAY;;AACZ,SAAAA,QAAA,EAAqBC,YAAY,QAAQ,gBAAgB;AACzD,SAASC,MAAM,EAAEC,gBAAgB,QAAQ,uBAAuB;AAChE,SAASC,iBAAiB,EAAEC,mBAAmB,EAAEC,oBAAoB,QAAQ,uBAAuB;AACpG;AACA;AACA;AAAI,OAAO,MAAMC,eAAe,GAAG;EAC/BC,IAAI,EAAE,iBAAiB;EACvBC,KAAK,EAAE,kBAAkB;EACzBC,eAAe,EAAE,4BAA4B;EAC7CC,YAAY,EAAE,yBAAyB;EACvCC,cAAc,EAAE,2BAA2B;EAC3CC,UAAU,EAAE,uBAAuB;EACnCC,UAAU,EAAE;AAChB,CAAC;AACD;AACA;AACA;AAAI,MAAMC,SAAS,gBAAGf,QAAA;E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AClC,UAAU;EAC1L,CAAC;AACL,CAAC","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { makeStyles, mergeClasses } from '@griffel/react';
|
|
3
3
|
import { tokens, typographyStyles } from '@fluentui/react-theme';
|
|
4
|
-
import { getAxisTitleStyle } from '../../utilities/index';
|
|
4
|
+
import { getAxisTitleStyle, getChartTitleStyles, HighContrastSelector } from '../../utilities/index';
|
|
5
5
|
/**
|
|
6
6
|
* @internal
|
|
7
7
|
*/ export const donutClassNames = {
|
|
@@ -9,7 +9,9 @@ import { getAxisTitleStyle } from '../../utilities/index';
|
|
|
9
9
|
chart: 'fui-donut__chart',
|
|
10
10
|
legendContainer: 'fui-donut__legendContainer',
|
|
11
11
|
chartWrapper: 'fui-donut__chartWrapper',
|
|
12
|
-
axisAnnotation: 'fui-donut__axisAnnotation'
|
|
12
|
+
axisAnnotation: 'fui-donut__axisAnnotation',
|
|
13
|
+
chartTitle: 'fui-donut__chartTitle',
|
|
14
|
+
svgTooltip: 'fui-donut__svgTooltip'
|
|
13
15
|
};
|
|
14
16
|
/**
|
|
15
17
|
* Base Styles
|
|
@@ -33,12 +35,19 @@ import { getAxisTitleStyle } from '../../utilities/index';
|
|
|
33
35
|
paddingTop: tokens.spacingVerticalL,
|
|
34
36
|
width: '100%'
|
|
35
37
|
},
|
|
36
|
-
axisAnnotation: getAxisTitleStyle()
|
|
38
|
+
axisAnnotation: getAxisTitleStyle(),
|
|
39
|
+
chartTitle: getChartTitleStyles(),
|
|
40
|
+
svgTooltip: {
|
|
41
|
+
fill: tokens.colorNeutralBackground1,
|
|
42
|
+
[HighContrastSelector]: {
|
|
43
|
+
fill: 'Canvas'
|
|
44
|
+
}
|
|
45
|
+
}
|
|
37
46
|
});
|
|
38
47
|
/**
|
|
39
48
|
* Apply styling to the DonutChart component
|
|
40
49
|
*/ export const useDonutChartStyles = (props)=>{
|
|
41
|
-
var _props_styles, _props_styles1, _props_styles2, _props_styles3, _props_styles4;
|
|
50
|
+
var _props_styles, _props_styles1, _props_styles2, _props_styles3, _props_styles4, _props_styles5, _props_styles6;
|
|
42
51
|
const { className } = props;
|
|
43
52
|
const baseStyles = useStyles();
|
|
44
53
|
return {
|
|
@@ -46,6 +55,8 @@ import { getAxisTitleStyle } from '../../utilities/index';
|
|
|
46
55
|
chart: mergeClasses(donutClassNames.chart, baseStyles.chart, (_props_styles1 = props.styles) === null || _props_styles1 === void 0 ? void 0 : _props_styles1.chart),
|
|
47
56
|
legendContainer: mergeClasses(donutClassNames.legendContainer, baseStyles.legendContainer, (_props_styles2 = props.styles) === null || _props_styles2 === void 0 ? void 0 : _props_styles2.legendContainer),
|
|
48
57
|
chartWrapper: mergeClasses(donutClassNames.chartWrapper, (_props_styles3 = props.styles) === null || _props_styles3 === void 0 ? void 0 : _props_styles3.chartWrapper),
|
|
49
|
-
axisAnnotation: mergeClasses(donutClassNames.axisAnnotation, baseStyles.axisAnnotation, (_props_styles4 = props.styles) === null || _props_styles4 === void 0 ? void 0 : _props_styles4.axisAnnotation)
|
|
58
|
+
axisAnnotation: mergeClasses(donutClassNames.axisAnnotation, baseStyles.axisAnnotation, (_props_styles4 = props.styles) === null || _props_styles4 === void 0 ? void 0 : _props_styles4.axisAnnotation),
|
|
59
|
+
chartTitle: mergeClasses(donutClassNames.chartTitle, baseStyles.chartTitle, (_props_styles5 = props.styles) === null || _props_styles5 === void 0 ? void 0 : _props_styles5.chartTitle),
|
|
60
|
+
svgTooltip: mergeClasses(donutClassNames.svgTooltip, baseStyles.svgTooltip, (_props_styles6 = props.styles) === null || _props_styles6 === void 0 ? void 0 : _props_styles6.svgTooltip)
|
|
50
61
|
};
|
|
51
62
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/DonutChart/useDonutChartStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { GriffelStyle, makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\nimport { DonutChartProps, DonutChartStyles } from './index';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { getAxisTitleStyle } from '../../utilities/index';\n\n/**\n * @internal\n */\nexport const donutClassNames: SlotClassNames<DonutChartStyles> = {\n root: 'fui-donut__root',\n chart: 'fui-donut__chart',\n legendContainer: 'fui-donut__legendContainer',\n chartWrapper: 'fui-donut__chartWrapper',\n axisAnnotation: 'fui-donut__axisAnnotation',\n};\n\n/**\n * Base Styles\n */\nconst useStyles = makeStyles({\n root: {\n // alignItems: 'center',\n ...typographyStyles.body1,\n display: 'flex',\n flexDirection: 'column',\n width: '100%',\n height: '100%',\n textAlign: 'left',\n },\n chart: {\n boxSizing: 'content-box',\n alignmentAdjust: 'center',\n display: 'block',\n overflow: 'visible',\n },\n legendContainer: {\n paddingTop: tokens.spacingVerticalL,\n width: '100%',\n },\n axisAnnotation: getAxisTitleStyle() as GriffelStyle,\n});\n\n/**\n * Apply styling to the DonutChart component\n */\nexport const useDonutChartStyles = (props: DonutChartProps): DonutChartStyles => {\n const { className } = props;\n const baseStyles = useStyles();\n\n return {\n root: mergeClasses(donutClassNames.root, baseStyles.root, className, props.styles?.root),\n chart: mergeClasses(donutClassNames.chart, baseStyles.chart, props.styles?.chart),\n legendContainer: mergeClasses(\n donutClassNames.legendContainer,\n baseStyles.legendContainer,\n props.styles?.legendContainer,\n ),\n chartWrapper: mergeClasses(donutClassNames.chartWrapper, props.styles?.chartWrapper),\n axisAnnotation: mergeClasses(\n donutClassNames.axisAnnotation,\n baseStyles.axisAnnotation,\n props.styles?.axisAnnotation,\n ),\n };\n};\n"],"names":["makeStyles","mergeClasses","tokens","typographyStyles","getAxisTitleStyle","donutClassNames","root","chart","legendContainer","chartWrapper","axisAnnotation","useStyles","body1","display","flexDirection","width","height","textAlign","boxSizing","alignmentAdjust","overflow","paddingTop","spacingVerticalL","useDonutChartStyles","props","className","baseStyles","styles"],"mappings":"AAAA;AAEA,SAAuBA,UAAU,EAAEC,YAAY,QAAQ,iBAAiB;AACxE,SAASC,MAAM,EAAEC,gBAAgB,QAAQ,wBAAwB;AAGjE,SAASC,iBAAiB,QAAQ,wBAAwB;
|
|
1
|
+
{"version":3,"sources":["../src/components/DonutChart/useDonutChartStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { GriffelStyle, makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\nimport { DonutChartProps, DonutChartStyles } from './index';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { getAxisTitleStyle, getChartTitleStyles, HighContrastSelector } from '../../utilities/index';\n\n/**\n * @internal\n */\nexport const donutClassNames: SlotClassNames<DonutChartStyles> = {\n root: 'fui-donut__root',\n chart: 'fui-donut__chart',\n legendContainer: 'fui-donut__legendContainer',\n chartWrapper: 'fui-donut__chartWrapper',\n axisAnnotation: 'fui-donut__axisAnnotation',\n chartTitle: 'fui-donut__chartTitle',\n svgTooltip: 'fui-donut__svgTooltip',\n};\n\n/**\n * Base Styles\n */\nconst useStyles = makeStyles({\n root: {\n // alignItems: 'center',\n ...typographyStyles.body1,\n display: 'flex',\n flexDirection: 'column',\n width: '100%',\n height: '100%',\n textAlign: 'left',\n },\n chart: {\n boxSizing: 'content-box',\n alignmentAdjust: 'center',\n display: 'block',\n overflow: 'visible',\n },\n legendContainer: {\n paddingTop: tokens.spacingVerticalL,\n width: '100%',\n },\n axisAnnotation: getAxisTitleStyle() as GriffelStyle,\n chartTitle: getChartTitleStyles() as GriffelStyle,\n svgTooltip: {\n fill: tokens.colorNeutralBackground1,\n [HighContrastSelector]: {\n fill: 'Canvas',\n },\n },\n});\n\n/**\n * Apply styling to the DonutChart component\n */\nexport const useDonutChartStyles = (props: DonutChartProps): DonutChartStyles => {\n const { className } = props;\n const baseStyles = useStyles();\n\n return {\n root: mergeClasses(donutClassNames.root, baseStyles.root, className, props.styles?.root),\n chart: mergeClasses(donutClassNames.chart, baseStyles.chart, props.styles?.chart),\n legendContainer: mergeClasses(\n donutClassNames.legendContainer,\n baseStyles.legendContainer,\n props.styles?.legendContainer,\n ),\n chartWrapper: mergeClasses(donutClassNames.chartWrapper, props.styles?.chartWrapper),\n axisAnnotation: mergeClasses(\n donutClassNames.axisAnnotation,\n baseStyles.axisAnnotation,\n props.styles?.axisAnnotation,\n ),\n chartTitle: mergeClasses(donutClassNames.chartTitle, baseStyles.chartTitle, props.styles?.chartTitle),\n svgTooltip: mergeClasses(donutClassNames.svgTooltip, baseStyles.svgTooltip, props.styles?.svgTooltip),\n };\n};\n"],"names":["makeStyles","mergeClasses","tokens","typographyStyles","getAxisTitleStyle","getChartTitleStyles","HighContrastSelector","donutClassNames","root","chart","legendContainer","chartWrapper","axisAnnotation","chartTitle","svgTooltip","useStyles","body1","display","flexDirection","width","height","textAlign","boxSizing","alignmentAdjust","overflow","paddingTop","spacingVerticalL","fill","colorNeutralBackground1","useDonutChartStyles","props","className","baseStyles","styles"],"mappings":"AAAA;AAEA,SAAuBA,UAAU,EAAEC,YAAY,QAAQ,iBAAiB;AACxE,SAASC,MAAM,EAAEC,gBAAgB,QAAQ,wBAAwB;AAGjE,SAASC,iBAAiB,EAAEC,mBAAmB,EAAEC,oBAAoB,QAAQ,wBAAwB;AAErG;;CAEC,GACD,OAAO,MAAMC,kBAAoD;IAC/DC,MAAM;IACNC,OAAO;IACPC,iBAAiB;IACjBC,cAAc;IACdC,gBAAgB;IAChBC,YAAY;IACZC,YAAY;AACd,EAAE;AAEF;;CAEC,GACD,MAAMC,YAAYf,WAAW;IAC3BQ,MAAM;QACJ,wBAAwB;QACxB,GAAGL,iBAAiBa,KAAK;QACzBC,SAAS;QACTC,eAAe;QACfC,OAAO;QACPC,QAAQ;QACRC,WAAW;IACb;IACAZ,OAAO;QACLa,WAAW;QACXC,iBAAiB;QACjBN,SAAS;QACTO,UAAU;IACZ;IACAd,iBAAiB;QACfe,YAAYvB,OAAOwB,gBAAgB;QACnCP,OAAO;IACT;IACAP,gBAAgBR;IAChBS,YA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ilities';
|
|
4
|
-
import { useRtl } from '../../utilities/index';
|
|
4
|
+
import { useRtl, ChartTitle, CHART_TITLE_PADDING } from '../../utilities/index';
|
|
5
5
|
import { Legends } from '../Legends/index';
|
|
6
6
|
import { useArrowNavigationGroup } from '@fluentui/react-tabster';
|
|
7
7
|
import { ChartPopover } from '../CommonComponents/ChartPopover';
|
|
@@ -11,7 +11,7 @@ import { useFunnelChartStyles } from './useFunnelChartStyles.styles';
|
|
|
11
11
|
import { getHorizontalFunnelSegmentGeometry, getVerticalFunnelSegmentGeometry, getSegmentTextProps, getStackedHorizontalFunnelSegmentGeometry, getStackedVerticalFunnelSegmentGeometry } from './funnelGeometry';
|
|
12
12
|
import { useImageExport } from '../../utilities/hooks';
|
|
13
13
|
export const FunnelChart = /*#__PURE__*/ React.forwardRef(({ orientation = 'vertical', ...restProps }, forwardedRef)=>{
|
|
14
|
-
var _props_legendProps;
|
|
14
|
+
var _props_legendProps, _props_titleStyles_titleFont, _props_titleStyles;
|
|
15
15
|
const props = {
|
|
16
16
|
orientation,
|
|
17
17
|
...restProps
|
|
@@ -97,6 +97,18 @@ export const FunnelChart = /*#__PURE__*/ React.forwardRef(({ orientation = 'vert
|
|
|
97
97
|
function noLegendHighlighted() {
|
|
98
98
|
return getHighlightedLegend().length === 0;
|
|
99
99
|
}
|
|
100
|
+
function _getAriaLabel(data) {
|
|
101
|
+
if ('subValue' in data) {
|
|
102
|
+
// Stacked funnel segment
|
|
103
|
+
const formattedValue = formatToLocaleString(data.subValue.value.toString(), props.culture);
|
|
104
|
+
return `${data.stage}, ${data.subValue.category}, ${formattedValue}.`;
|
|
105
|
+
} else {
|
|
106
|
+
var _data_value;
|
|
107
|
+
// Non-stacked funnel segment
|
|
108
|
+
const formattedValue = formatToLocaleString(((_data_value = data.value) !== null && _data_value !== void 0 ? _data_value : 0).toString(), props.culture);
|
|
109
|
+
return `${data.stage}, ${formattedValue}.`;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
100
112
|
function _getEventHandlerProps(data, opacity, segmentId) {
|
|
101
113
|
const targetElement = document.getElementById(segmentId);
|
|
102
114
|
if ('subValue' in data) {
|
|
@@ -150,7 +162,9 @@ export const FunnelChart = /*#__PURE__*/ React.forwardRef(({ orientation = 'vert
|
|
|
150
162
|
fill: fill,
|
|
151
163
|
opacity: opacity,
|
|
152
164
|
...eventHandlers,
|
|
153
|
-
tabIndex: tabIndex
|
|
165
|
+
tabIndex: tabIndex,
|
|
166
|
+
role: "img",
|
|
167
|
+
"aria-label": _getAriaLabel(data)
|
|
154
168
|
}), textProps && /*#__PURE__*/ React.createElement("g", eventHandlers, _renderSegmentText({
|
|
155
169
|
...textProps,
|
|
156
170
|
textColor,
|
|
@@ -333,7 +347,8 @@ export const FunnelChart = /*#__PURE__*/ React.forwardRef(({ orientation = 'vert
|
|
|
333
347
|
};
|
|
334
348
|
const width = props.width || 350;
|
|
335
349
|
const height = props.height || 500;
|
|
336
|
-
const
|
|
350
|
+
const titleHeight = props.chartTitle ? Math.max((typeof ((_props_titleStyles = props.titleStyles) === null || _props_titleStyles === void 0 ? void 0 : (_props_titleStyles_titleFont = _props_titleStyles.titleFont) === null || _props_titleStyles_titleFont === void 0 ? void 0 : _props_titleStyles_titleFont.size) === 'number' ? props.titleStyles.titleFont.size : 13) + CHART_TITLE_PADDING, 40) : 40;
|
|
351
|
+
const funnelMarginTop = titleHeight;
|
|
337
352
|
const funnelWidth = width * 0.8;
|
|
338
353
|
const funnelOffsetX = (width - funnelWidth) / 2;
|
|
339
354
|
const arrowAttributes = useArrowNavigationGroup({
|
|
@@ -354,7 +369,14 @@ export const FunnelChart = /*#__PURE__*/ React.forwardRef(({ orientation = 'vert
|
|
|
354
369
|
...arrowAttributes,
|
|
355
370
|
role: 'img',
|
|
356
371
|
"aria-label": props.chartTitle
|
|
357
|
-
}, /*#__PURE__*/ React.createElement(
|
|
372
|
+
}, !props.hideLegend && props.chartTitle && /*#__PURE__*/ React.createElement(ChartTitle, {
|
|
373
|
+
title: props.chartTitle,
|
|
374
|
+
x: width / 2,
|
|
375
|
+
maxWidth: width - 20,
|
|
376
|
+
className: classes.chartTitle,
|
|
377
|
+
titleStyles: props.titleStyles,
|
|
378
|
+
tooltipClassName: classes.svgTooltip
|
|
379
|
+
}), /*#__PURE__*/ React.createElement("g", {
|
|
358
380
|
transform: isRTL ? `translate(${funnelOffsetX + funnelWidth}, ${funnelMarginTop}) scale(-1,1)` : `translate(${funnelOffsetX}, ${funnelMarginTop})`
|
|
359
381
|
}, isStacked ? _createStackedFunnel(height - funnelMarginTop, funnelWidth) : _createFunnel(height - funnelMarginTop, funnelWidth))), isPopoverOpen && /*#__PURE__*/ React.createElement(ChartPopover, {
|
|
360
382
|
...props.calloutProps,
|