@fluentui/react-charts 9.2.1 → 9.2.3
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 +57 -2
- package/dist/index.d.ts +168 -15
- package/lib/ChartTable.js +1 -0
- package/lib/ChartTable.js.map +1 -0
- package/lib/components/AreaChart/AreaChart.js +4 -1
- package/lib/components/AreaChart/AreaChart.js.map +1 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.js +2 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js +2 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
- package/lib/components/ChartTable/ChartTable.js +58 -0
- package/lib/components/ChartTable/ChartTable.js.map +1 -0
- package/lib/components/ChartTable/ChartTable.types.js +1 -0
- package/lib/components/ChartTable/ChartTable.types.js.map +1 -0
- package/lib/components/ChartTable/index.js +3 -0
- package/lib/components/ChartTable/index.js.map +1 -0
- package/lib/components/ChartTable/useChartTableStyles.styles.js +93 -0
- package/lib/components/ChartTable/useChartTableStyles.styles.js.map +1 -0
- package/lib/components/ChartTable/useChartTableStyles.styles.raw.js +55 -0
- package/lib/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -0
- package/lib/components/CommonComponents/CartesianChart.js +170 -100
- package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/CommonComponents/ChartPopover.types.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +13 -0
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +12 -0
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +180 -102
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +100 -0
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -0
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +890 -211
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.js +2 -2
- package/lib/components/DonutChart/DonutChart.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib/components/DonutChart/Pie/Pie.js.map +1 -1
- package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
- package/lib/components/GanttChart/GanttChart.js.map +1 -1
- package/lib/components/GanttChart/useGanttChartStyles.styles.js +2 -1
- package/lib/components/GanttChart/useGanttChartStyles.styles.js.map +1 -1
- package/lib/components/GanttChart/useGanttChartStyles.styles.raw.js +2 -1
- package/lib/components/GanttChart/useGanttChartStyles.styles.raw.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +185 -144
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +2 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +2 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib/components/HeatMapChart/HeatMapChart.js +175 -114
- package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js +2 -1
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -1
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js +2 -1
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js.map +1 -1
- package/lib/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
- package/lib/components/HorizontalBarChart/HorizontalBarChart.types.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +26 -6
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +2 -1
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +2 -1
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -1
- package/lib/components/Legends/Legends.js.map +1 -1
- package/lib/components/Legends/OverflowMenu.js.map +1 -1
- package/lib/components/LineChart/LineChart.js +251 -78
- package/lib/components/LineChart/LineChart.js.map +1 -1
- package/lib/components/LineChart/LineChart.types.js.map +1 -1
- package/lib/components/LineChart/useLineChartStyles.styles.js +10 -3
- package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -1
- package/lib/components/LineChart/useLineChartStyles.styles.raw.js +14 -2
- package/lib/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.js +56 -37
- package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js +21 -4
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js +16 -3
- package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.js +38 -14
- package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +2 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +2 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +214 -96
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +2 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +2 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/types/DataPoint.js.map +1 -1
- package/lib/utilities/FocusableTooltipText.js.map +1 -1
- package/lib/utilities/utilities.js +41 -42
- package/lib/utilities/utilities.js.map +1 -1
- package/lib/utilities/vbc-utils.js +24 -0
- package/lib/utilities/vbc-utils.js.map +1 -1
- package/lib-commonjs/ChartTable.js +6 -0
- package/lib-commonjs/ChartTable.js.map +1 -0
- package/lib-commonjs/components/AreaChart/AreaChart.js +4 -1
- package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +2 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/ChartTable/ChartTable.js +69 -0
- package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -0
- package/lib-commonjs/components/ChartTable/ChartTable.types.js +6 -0
- package/lib-commonjs/components/ChartTable/ChartTable.types.js.map +1 -0
- package/lib-commonjs/components/ChartTable/index.js +8 -0
- package/lib-commonjs/components/ChartTable/index.js.map +1 -0
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js +196 -0
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js.map +1 -0
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js +69 -0
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +169 -98
- package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/ChartPopover.types.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +13 -0
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +12 -0
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +176 -100
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +128 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +909 -209
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.js +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
- package/lib-commonjs/components/GanttChart/GanttChart.js.map +1 -1
- package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.js +2 -1
- package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +183 -142
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +2 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +174 -113
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js +2 -1
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.types.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +25 -5
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +2 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/Legends/Legends.js.map +1 -1
- package/lib-commonjs/components/Legends/OverflowMenu.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.js +250 -78
- package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.types.js.map +1 -1
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +12 -3
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js +14 -2
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.js +56 -37
- package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +30 -3
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js +15 -2
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +37 -13
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +2 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +213 -95
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +2 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.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.map +1 -1
- package/lib-commonjs/utilities/FocusableTooltipText.js.map +1 -1
- package/lib-commonjs/utilities/utilities.js +44 -41
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/lib-commonjs/utilities/vbc-utils.js +27 -0
- package/lib-commonjs/utilities/vbc-utils.js.map +1 -1
- package/package.json +10 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/DonutChart/DonutChart.tsx"],"sourcesContent":["/* 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 { getColorFromToken, getNextColor, useRtl } from '../../utilities/index';\nimport { Legend, Legends, LegendContainer } from '../../index';\nimport { useId } from '@fluentui/react-utilities';\nimport { useFocusableGroup } from '@fluentui/react-tabster';\nimport { ChartPopover } from '../CommonComponents/ChartPopover';\nimport { ImageExportOptions } from '../../types/index';\nimport { toImage } from '../../utilities/image-export-utils';\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 (props, forwardedRef) => {\n const _rootElem = React.useRef<HTMLDivElement | null>(null);\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>('');\n const [color, setColor] = React.useState<string | undefined>('');\n const [xCalloutValue, setXCalloutValue] = React.useState<string>('');\n const [yCalloutValue, setYCalloutValue] = React.useState<string>('');\n const [selectedLegend, setSelectedLegend] = React.useState<string>('');\n const [focusedArcId, setFocusedArcId] = React.useState<string>('');\n const [dataPointCalloutProps, setDataPointCalloutProps] = React.useState<ChartDataPoint | undefined>();\n const [clickPosition, setClickPosition] = React.useState({ x: 0, y: 0 });\n const [isPopoverOpen, setPopoverOpen] = React.useState(false);\n const _legendsRef = React.useRef<LegendContainer>(null);\n const _isRTL: boolean = useRtl();\n\n React.useEffect(() => {\n _fitParentContainer();\n }, []);\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 React.useImperativeHandle(\n props.componentRef,\n () => ({\n chartContainer: _rootElem.current,\n toImage: (opts?: ImageExportOptions): Promise<string> => {\n return toImage(_rootElem.current, _legendsRef.current?.toSVG, _isRTL, opts);\n },\n }),\n [],\n );\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[]): JSX.Element {\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 action: () => {\n if (selectedLegend === point.legend) {\n setSelectedLegend('');\n } else {\n setSelectedLegend(point.legend!);\n }\n },\n hoverAction: () => {\n _handleChartMouseLeave();\n setActiveLegend(point.legend!);\n },\n onMouseOutAction: () => {\n setActiveLegend('');\n },\n };\n return legend;\n });\n const legends = (\n <Legends\n legends={legendDataItems}\n centerLegends\n overflowText={props.legendsOverflowText}\n {...props.legendProps}\n legendRef={_legendsRef}\n />\n );\n return legends;\n }\n\n function _focusCallback(data: ChartDataPoint, id: string, e: React.FocusEvent<SVGPathElement>): void {\n let cx = 0;\n let cy = 0;\n\n const targetRect = (e.target as SVGPathElement).getBoundingClientRect();\n cx = targetRect.left + targetRect.width / 2;\n cy = targetRect.top + targetRect.height / 2;\n updatePosition(cx, cy);\n setPopoverOpen(selectedLegend === '' || selectedLegend === 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 }\n\n function _hoverCallback(data: ChartDataPoint, e: React.MouseEvent<SVGPathElement>): void {\n if (_calloutAnchorPoint !== data) {\n _calloutAnchorPoint = data;\n setPopoverOpen(selectedLegend === '' || selectedLegend === 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 updatePosition(e.clientX, e.clientY);\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 highlightedLegend = _getHighlightedLegend();\n if (valueInsideDonut !== undefined && (highlightedLegend !== '' || isPopoverOpen)) {\n let legendValue = valueInsideDonut;\n data!.map((point: ChartDataPoint, index: number) => {\n if (point.legend === highlightedLegend || (isPopoverOpen && point.legend === legend)) {\n legendValue = point.yAxisCalloutData ? point.yAxisCalloutData : point.data!;\n }\n return;\n });\n return legendValue;\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 * Note: This won't work in case of multiple legends selection.\n */\n function _getHighlightedLegend() {\n return selectedLegend || activeLegend;\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 function updatePosition(newX: number, newY: number) {\n const threshold = 1; // Set a threshold for movement\n const { x, y } = clickPosition;\n // Calculate the distance moved\n const distance = Math.sqrt(Math.pow(newX - x, 2) + Math.pow(newY - y, 2));\n // Update the position only if the distance moved is greater than the threshold\n if (distance > threshold) {\n setClickPosition({ x: newX, y: newY });\n setPopoverOpen(true);\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);\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.filter((d: ChartDataPoint) => d.data! >= 0));\n const valueInsideDonut = props.innerRadius !== 0 ? _valueInsideDonut(props.valueInsideDonut!, chartData!) : '';\n const focusAttributes = useFocusableGroup();\n return !_isChartEmpty() ? (\n <div\n className={classes.root}\n ref={(rootElem: HTMLDivElement | null) => (_rootElem.current = rootElem)}\n onMouseLeave={_handleChartMouseLeave}\n >\n <div className={classes.chartWrapper} {...focusAttributes}>\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 ?? 'en-us'}\n clickPosition={clickPosition}\n isPopoverOpen={!props.hideTooltip && isPopoverOpen}\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 ref={(e: HTMLDivElement) => (legendContainer.current = e)} className={classes.legendContainer}>\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';\nDonutChart.defaultProps = {\n innerRadius: 0,\n hideLabels: true,\n};\n"],"names":["React","Pie","useDonutChartStyles","formatToLocaleString","getColorFromToken","getNextColor","useRtl","Legends","useId","useFocusableGroup","ChartPopover","toImage","MIN_LEGEND_CONTAINER_HEIGHT","DonutChart","forwardRef","props","forwardedRef","_rootElem","useRef","_uniqText","_calloutAnchorPoint","_emptyChartId","legendContainer","prevSize","value","setValue","useState","legend","setLegend","_width","setWidth","width","_height","setHeight","height","activeLegend","setActiveLegend","color","setColor","xCalloutValue","setXCalloutValue","yCalloutValue","setYCalloutValue","selectedLegend","setSelectedLegend","focusedArcId","setFocusedArcId","dataPointCalloutProps","setDataPointCalloutProps","clickPosition","setClickPosition","x","y","isPopoverOpen","setPopoverOpen","_legendsRef","_isRTL","useEffect","_fitParentContainer","current","useImperativeHandle","componentRef","chartContainer","opts","toSVG","_elevateToMinimums","data","sumOfData","minPercent","elevatedData","forEach","item","push","yAxisCalloutData","undefined","toLocaleString","_createLegends","chartData","legendDataItems","map","point","index","title","action","hoverAction","_handleChartMouseLeave","onMouseOutAction","legends","centerLegends","overflowText","legendsOverflowText","legendProps","legendRef","_focusCallback","id","e","cx","cy","targetRect","target","getBoundingClientRect","left","top","updatePosition","toString","xAxisCalloutData","_hoverCallback","clientX","clientY","_onBlur","_hoverLeave","_valueInsideDonut","valueInsideDonut","highlightedLegend","_getHighlightedLegend","legendValue","_toLocaleString","localeString","culture","_isChartEmpty","filter","d","length","_addDefaultColors","donutChartDataPoint","defaultColor","newX","newY","threshold","distance","Math","sqrt","pow","legendContainerHeight","hideLegend","legendContainerComputedStyles","getComputedStyle","parseFloat","marginTop","marginBottom","parentRef","container","currentContainerWidth","currentContainerHeight","shouldResize","points","classes","legendBars","donutMarginHorizontal","hideLabels","donutMarginVertical","outerRadius","min","innerRadius","focusAttributes","div","className","root","ref","rootElem","onMouseLeave","chartWrapper","svg","chart","aria-label","chartTitle","onFocusCallback","hoverOnCallback","hoverLeaveCallback","uniqText","onBlurCallback","activeArc","href","showLabelsInPercent","hideTooltip","YValue","isCalloutForStack","customCallout","customizedCallout","onRenderCalloutPerDataPoint","customCalloutProps","calloutPropsPerDataPoint","isCartesian","role","style","opacity","displayName","defaultProps"],"mappings":"AAAA,oCAAoC,GACpC,YAAYA;;;;+BAqBCa;;;;;;;iEArBU,QAAQ;uBACX,cAAc;2CAEE,+BAA+B;gCAE9B,4BAA4B;wBACT,w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B,CAACpI,yBAClC2B;YACJ0G,oBAAoBrK,MAAMsK,wBAAwB,GAC9CtK,MAAMsK,wBAAwB,CAACtI,yBAC/B2B;QACN;QACA4G,aAAa;QAEd,CAAChD,cAAAA,WAAAA,GACA,OAAA,aAAA,CAACqB,OAAAA;QAAIG,KAAK,CAAC/D,IAAuBzE,gBAAgBqC,OAAO,GAAGoC;QAAI6D,WAAWV,QAAQ5H,eAAe;OAC/F6H,eAAAA,WAAAA,GAKP,OAAA,aAAA,CAACQ,OAAAA;QAAI7D,IAAIzE;QAAgBkK,MAAM;QAASC,OAAO;YAAEC,SAAS;QAAI;QAAGrB,cAAY;;AAEjF,GACA;AAEFvJ,WAAW6K,WAAW,GAAG;AACzB7K,WAAW8K,YAAY,GAAG;IACxBlC,aAAa;IACbJ,YAAY;AACd"}
|
|
1
|
+
{"version":3,"sources":["../src/components/DonutChart/DonutChart.tsx"],"sourcesContent":["/* 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 { getColorFromToken, getNextColor, MIN_DONUT_RADIUS, useRtl } from '../../utilities/index';\nimport { Legend, Legends, LegendContainer } from '../../index';\nimport { useId } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport { useFocusableGroup } from '@fluentui/react-tabster';\nimport { ChartPopover } from '../CommonComponents/ChartPopover';\nimport { ImageExportOptions } from '../../types/index';\nimport { toImage } from '../../utilities/image-export-utils';\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 (props, forwardedRef) => {\n const _rootElem = React.useRef<HTMLDivElement | null>(null);\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>('');\n const [color, setColor] = React.useState<string | undefined>('');\n const [xCalloutValue, setXCalloutValue] = React.useState<string>('');\n const [yCalloutValue, setYCalloutValue] = React.useState<string>('');\n const [selectedLegend, setSelectedLegend] = React.useState<string>('');\n const [focusedArcId, setFocusedArcId] = React.useState<string>('');\n const [dataPointCalloutProps, setDataPointCalloutProps] = React.useState<ChartDataPoint | undefined>();\n const [clickPosition, setClickPosition] = React.useState({ x: 0, y: 0 });\n const [isPopoverOpen, setPopoverOpen] = React.useState(false);\n const _legendsRef = React.useRef<LegendContainer>(null);\n const _isRTL: boolean = useRtl();\n\n React.useEffect(() => {\n _fitParentContainer();\n }, []);\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 React.useImperativeHandle(\n props.componentRef,\n () => ({\n chartContainer: _rootElem.current,\n toImage: (opts?: ImageExportOptions): Promise<string> => {\n return toImage(_rootElem.current, _legendsRef.current?.toSVG, _isRTL, opts);\n },\n }),\n [],\n );\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 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 action: () => {\n if (selectedLegend === point.legend) {\n setSelectedLegend('');\n } else {\n setSelectedLegend(point.legend!);\n }\n },\n hoverAction: () => {\n _handleChartMouseLeave();\n setActiveLegend(point.legend!);\n },\n onMouseOutAction: () => {\n setActiveLegend('');\n },\n };\n return legend;\n });\n const legends = (\n <Legends\n legends={legendDataItems}\n centerLegends\n overflowText={props.legendsOverflowText}\n {...props.legendProps}\n legendRef={_legendsRef}\n />\n );\n return legends;\n }\n\n function _focusCallback(data: ChartDataPoint, id: string, e: React.FocusEvent<SVGPathElement>): void {\n let cx = 0;\n let cy = 0;\n\n const targetRect = (e.target as SVGPathElement).getBoundingClientRect();\n cx = targetRect.left + targetRect.width / 2;\n cy = targetRect.top + targetRect.height / 2;\n updatePosition(cx, cy);\n setPopoverOpen(selectedLegend === '' || selectedLegend === 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 }\n\n function _hoverCallback(data: ChartDataPoint, e: React.MouseEvent<SVGPathElement>): void {\n if (_calloutAnchorPoint !== data) {\n _calloutAnchorPoint = data;\n setPopoverOpen(selectedLegend === '' || selectedLegend === 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 updatePosition(e.clientX, e.clientY);\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 highlightedLegend = _getHighlightedLegend();\n if (valueInsideDonut !== undefined && (highlightedLegend !== '' || isPopoverOpen)) {\n let legendValue = valueInsideDonut;\n data!.map((point: ChartDataPoint, index: number) => {\n if (point.legend === highlightedLegend || (isPopoverOpen && point.legend === legend)) {\n legendValue = point.yAxisCalloutData ? point.yAxisCalloutData : point.data!;\n }\n return;\n });\n return legendValue;\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 * Note: This won't work in case of multiple legends selection.\n */\n function _getHighlightedLegend() {\n return selectedLegend || activeLegend;\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 function updatePosition(newX: number, newY: number) {\n const threshold = 1; // Set a threshold for movement\n const { x, y } = clickPosition;\n // Calculate the distance moved\n const distance = Math.sqrt(Math.pow(newX - x, 2) + Math.pow(newY - y, 2));\n // Update the position only if the distance moved is greater than the threshold\n if (distance > threshold) {\n setClickPosition({ x: newX, y: newY });\n setPopoverOpen(true);\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);\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.filter((d: ChartDataPoint) => d.data! >= 0));\n const valueInsideDonut =\n props.innerRadius! > MIN_DONUT_RADIUS ? _valueInsideDonut(props.valueInsideDonut!, chartData!) : '';\n const focusAttributes = useFocusableGroup();\n return !_isChartEmpty() ? (\n <div\n className={classes.root}\n ref={(rootElem: HTMLDivElement | null) => (_rootElem.current = rootElem)}\n onMouseLeave={_handleChartMouseLeave}\n >\n <div className={classes.chartWrapper} {...focusAttributes}>\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 ?? 'en-us'}\n clickPosition={clickPosition}\n isPopoverOpen={!props.hideTooltip && isPopoverOpen}\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 ref={(e: HTMLDivElement) => (legendContainer.current = e)} className={classes.legendContainer}>\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';\nDonutChart.defaultProps = {\n innerRadius: 0,\n hideLabels: true,\n};\n"],"names":["React","Pie","useDonutChartStyles","formatToLocaleString","getColorFromToken","getNextColor","MIN_DONUT_RADIUS","useRtl","Legends","useId","useFocusableGroup","ChartPopover","toImage","MIN_LEGEND_CONTAINER_HEIGHT","DonutChart","forwardRef","props","forwardedRef","_rootElem","useRef","_uniqText","_calloutAnchorPoint","_emptyChartId","legendContainer","prevSize","value","setValue","useState","legend","setLegend","_width","setWidth","width","_height","setHeight","height","activeLegend","setActiveLegend","color","setColor","xCalloutValue","setXCalloutValue","yCalloutValue","setYCalloutValue","selectedLegend","setSelectedLegend","focusedArcId","setFocusedArcId","dataPointCalloutProps","setDataPointCalloutProps","clickPosition","setClickPosition","x","y","isPopoverOpen","setPopoverOpen","_legendsRef","_isRTL","useEffect","_fitParentContainer","current","useImperativeHandle","componentRef","chartContainer","opts","toSVG","_elevateToMinimums","data","sumOfData","minPercent","elevatedData","forEach","item","push","yAxisCalloutData","undefined","toLocaleString","_createLegends","chartData","legendDataItems","map","point","index","title","action","hoverAction","_handleChartMouseLeave","onMouseOutAction","legends","centerLegends","overflowText","legendsOverflowText","legendProps","legendRef","_focusCallback","id","e","cx","cy","targetRect","target","getBoundingClientRect","left","top","updatePosition","toString","xAxisCalloutData","_hoverCallback","clientX","clientY","_onBlur","_hoverLeave","_valueInsideDonut","valueInsideDonut","highlightedLegend","_getHighlightedLegend","legendValue","_toLocaleString","localeString","culture","_isChartEmpty","filter","d","length","_addDefaultColors","donutChartDataPoint","defaultColor","newX","newY","threshold","distance","Math","sqrt","pow","legendContainerHeight","hideLegend","legendContainerComputedStyles","getComputedStyle","parseFloat","marginTop","marginBottom","parentRef","container","currentContainerWidth","currentContainerHeight","shouldResize","points","classes","legendBars","donutMarginHorizontal","hideLabels","donutMarginVertical","outerRadius","min","innerRadius","focusAttributes","div","className","root","ref","rootElem","onMouseLeave","chartWrapper","svg","chart","aria-label","chartTitle","onFocusCallback","hoverOnCallback","hoverLeaveCallback","uniqText","onBlurCallback","activeArc","href","showLabelsInPercent","hideTooltip","YValue","isCalloutForStack","customCallout","customizedCallout","onRenderCalloutPerDataPoint","customCalloutProps","calloutPropsPerDataPoint","isCartesian","role","style","opacity","displayName","defaultProps"],"mappings":"AAAA,oCAAoC,GACpC,YAAYA;;;;+BAsBCc;;;;;;;iEAtBU,QAAQ;uBACX,cAAc;2CAEE,+BAA+B;gCAE9B,4BAA4B;wBACS,wBAAwB;wBACjD,cAAc;gCACzC,4BAA4B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G,oBAAoBrK,MAAMsK,wBAAwB,GAC9CtK,MAAMsK,wBAAwB,CAACtI,yBAC/B2B;QACN;QACA4G,aAAa;QAEd,CAAChD,cAAAA,WAAAA,GACA,OAAA,aAAA,CAACqB,OAAAA;QAAIG,KAAK,CAAC/D,IAAuBzE,gBAAgBqC,OAAO,GAAGoC;QAAI6D,WAAWV,QAAQ5H,eAAe;OAC/F6H,eAAAA,WAAAA,GAKP,OAAA,aAAA,CAACQ,OAAAA;QAAI7D,IAAIzE;QAAgBkK,MAAM;QAASC,OAAO;YAAEC,SAAS;QAAI;QAAGrB,cAAY;;AAEjF,GACA;AAEFvJ,WAAW6K,WAAW,GAAG;AACzB7K,WAAW8K,YAAY,GAAG;IACxBlC,aAAa;IACbJ,YAAY;AACd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/DonutChart/DonutChart.types.ts"],"sourcesContent":["import * as React from 'react';\nimport { 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 {\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) =>
|
|
1
|
+
{"version":3,"sources":["../src/components/DonutChart/DonutChart.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport { 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 {\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.RefObject<Chart>;\n\n /**\n * Prop to enable the round corners in the chart\n * @default false\n */\n roundCorners?: boolean;\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 the chart wrapper div\n */\n chartWrapper?: string;\n}\n"],"names":["React"],"mappings":";;;;;iEAAuB,QAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/DonutChart/Pie/Pie.tsx"],"sourcesContent":["/* eslint-disable react-hooks/exhaustive-deps */\n/* eslint-disable react/jsx-no-bind */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport * as React from 'react';\nimport { pie as d3Pie } from 'd3-shape';\nimport { PieProps } from './index';\nimport { Arc } from '../Arc/index';\nimport { ChartDataPoint } from '../index';\nimport { usePieStyles } from './usePieStyles.styles';\nimport { wrapTextInsideDonut } from '../../../utilities/index';\nconst TEXT_PADDING: number = 5;\n\n// Create a Pie within Donut Chart variant which uses these default styles and this styled subcomponent.\n/**\n * Pie component within Donut Chart.\n * {@docCategory PieDonutChart}\n */\nexport const Pie: React.FunctionComponent<PieProps> = React.forwardRef<HTMLDivElement, PieProps>(\n (props, forwardedRef) => {\n React.useEffect(() => {\n wrapTextInsideDonut(classes.insideDonutString, props.innerRadius! * 2 - TEXT_PADDING);\n }, []);\n\n let _totalValue: number;\n const classes = usePieStyles(props);\n const pieForFocusRing = d3Pie()\n .sort(null)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n .value((d: any) => d.data)\n .padAngle(0);\n\n function _focusCallback(data: ChartDataPoint, id: string, e: React.FocusEvent<SVGPathElement>): void {\n props.onFocusCallback!(data, id, e);\n }\n\n function _hoverCallback(data: ChartDataPoint, e: React.MouseEvent<SVGPathElement>): void {\n props.hoverOnCallback!(data, e);\n }\n\n function _computeTotalValue() {\n let totalValue = 0;\n props.data.forEach((arc: ChartDataPoint) => {\n totalValue += arc.data!;\n });\n return totalValue;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n function arcGenerator(\n d: any,\n i: number,\n focusData: any,\n href?: string,\n ): // eslint-disable-next-line @typescript-eslint/no-deprecated\n
|
|
1
|
+
{"version":3,"sources":["../src/components/DonutChart/Pie/Pie.tsx"],"sourcesContent":["/* eslint-disable react-hooks/exhaustive-deps */\n/* eslint-disable react/jsx-no-bind */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport * as React from 'react';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport { pie as d3Pie } from 'd3-shape';\nimport { PieProps } from './index';\nimport { Arc } from '../Arc/index';\nimport { ChartDataPoint } from '../index';\nimport { usePieStyles } from './usePieStyles.styles';\nimport { wrapTextInsideDonut } from '../../../utilities/index';\nconst TEXT_PADDING: number = 5;\n\n// Create a Pie within Donut Chart variant which uses these default styles and this styled subcomponent.\n/**\n * Pie component within Donut Chart.\n * {@docCategory PieDonutChart}\n */\nexport const Pie: React.FunctionComponent<PieProps> = React.forwardRef<HTMLDivElement, PieProps>(\n (props, forwardedRef) => {\n React.useEffect(() => {\n wrapTextInsideDonut(classes.insideDonutString, props.innerRadius! * 2 - TEXT_PADDING);\n }, []);\n\n let _totalValue: number;\n const classes = usePieStyles(props);\n const pieForFocusRing = d3Pie()\n .sort(null)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n .value((d: any) => d.data)\n .padAngle(0);\n\n function _focusCallback(data: ChartDataPoint, id: string, e: React.FocusEvent<SVGPathElement>): void {\n props.onFocusCallback!(data, id, e);\n }\n\n function _hoverCallback(data: ChartDataPoint, e: React.MouseEvent<SVGPathElement>): void {\n props.hoverOnCallback!(data, e);\n }\n\n function _computeTotalValue() {\n let totalValue = 0;\n props.data.forEach((arc: ChartDataPoint) => {\n totalValue += arc.data!;\n });\n return totalValue;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n function arcGenerator(\n d: any,\n i: number,\n focusData: any,\n href?: string,\n ): // eslint-disable-next-line @typescript-eslint/no-deprecated\n JSXElement {\n const color = d && d.data && d.data.color;\n return (\n <Arc\n key={i}\n data={d}\n focusData={focusData}\n innerRadius={props.innerRadius}\n outerRadius={props.outerRadius}\n color={color!}\n onFocusCallback={_focusCallback}\n hoverOnCallback={_hoverCallback}\n onBlurCallback={props.onBlurCallback}\n hoverLeaveCallback={props.hoverLeaveCallback}\n uniqText={props.uniqText}\n activeArc={props.activeArc}\n href={href}\n calloutId={props.calloutId}\n valueInsideDonut={props.valueInsideDonut}\n focusedArcId={props.focusedArcId}\n showLabelsInPercent={props.showLabelsInPercent}\n totalValue={_totalValue}\n hideLabels={props.hideLabels}\n />\n );\n }\n\n const { data } = props;\n const focusData = pieForFocusRing(data.map(d => d.data!));\n\n const piechart = d3Pie<ChartDataPoint>()\n .sort(null)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n .value((d: any) => d.data)\n .padAngle(0.02)(data);\n const translate = `translate(${props.width / 2}, ${props.height / 2})`;\n\n _totalValue = _computeTotalValue();\n\n return (\n <g transform={translate}>\n {piechart.map((d: any, i: number) => arcGenerator(d, i, focusData[i], props.href))}\n {props.valueInsideDonut && (\n <text y={5} textAnchor=\"middle\" dominantBaseline=\"middle\" className={classes.insideDonutString}>\n {props.valueInsideDonut}\n </text>\n )}\n </g>\n );\n },\n);\nPie.displayName = 'Pie';\n"],"names":["React","pie","d3Pie","Arc","usePieStyles","wrapTextInsideDonut","TEXT_PADDING","Pie","forwardRef","props","forwardedRef","useEffect","classes","insideDonutString","innerRadius","_totalValue","pieForFocusRing","sort","value","d","data","padAngle","_focusCallback","id","e","onFocusCallback","_hoverCallback","hoverOnCallback","_computeTotalValue","totalValue","forEach","arc","arcGenerator","i","focusData","href","color","key","outerRadius","onBlurCallback","hoverLeaveCallback","uniqText","activeArc","calloutId","valueInsideDonut","focusedArcId","showLabelsInPercent","hideLabels","map","piechart","translate","width","height","g","transform","text","y","textAnchor","dominantBaseline","className","displayName"],"mappings":"AAAA,8CAA8C,GAC9C,oCAAoC,GACpC,qDAAqD,GACrD,YAAYA;;;;;;;;;;;iEAAW,QAAQ;yBAEF,WAAW;uBAEpB,eAAe;oCAEN,wBAAwB;wBACjB,2BAA2B;AAC/D,MAAMM,eAAuB;AAOtB,MAAMC,MAAAA,WAAAA,GAAyCP,OAAMQ,UAAU,CACpE,CAACC,OAAOC;IACNV,OAAMW,SAAS,CAAC;QACdN,+BAAAA,EAAoBO,QAAQC,iBAAiB,EAAEJ,MAAMK,WAAW,GAAI,IAAIR;IAC1E,GAAG,EAAE;IAEL,IAAIS;IACJ,MAAMH,cAAUR,gCAAAA,EAAaK;IAC7B,MAAMO,sBAAkBd,YAAAA,IACrBe,IAAI,CAAC,MACN,8DAA8D;KAC7DC,KAAK,CAAC,CAACC,IAAWA,EAAEC,IAAI,EACxBC,QAAQ,CAAC;IAEZ,SAASC,eAAeF,IAAoB,EAAEG,EAAU,EAAEC,CAAmC;QAC3Ff,MAAMgB,eAAe,CAAEL,MAAMG,IAAIC;IACnC;IAEA,SAASE,eAAeN,IAAoB,EAAEI,CAAmC;QAC/Ef,MAAMkB,eAAe,CAAEP,MAAMI;IAC/B;IAEA,SAASI;QACP,IAAIC,aAAa;QACjBpB,MAAMW,IAAI,CAACU,OAAO,CAAC,CAACC;YAClBF,cAAcE,IAAIX,IAAI;QACxB;QACA,OAAOS;IACT;IAEA,8DAA8D;IAC9D,SAASG,aACPb,CAAM,EACNc,CAAS,EACTC,SAAc,EACdC,IAAa;QAGb,MAAMC,QAAQjB,KAAKA,EAAEC,IAAI,IAAID,EAAEC,IAAI,CAACgB,KAAK;QACzC,OAAA,WAAA,GACE,OAAA,aAAA,CAACjC,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KjC,GACA;AACFrC,IAAIqD,WAAW,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/FunnelChart/FunnelChart.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useId } from '@fluentui/react-utilities';\nimport { useRtl } from '../../utilities/index';\nimport { FunnelChartDataPoint, FunnelChartProps } from './FunnelChart.types';\nimport { Legend, Legends, LegendContainer } from '../Legends/index';\nimport { useFocusableGroup } 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, ImageExportOptions } from '../../index';\nimport { toImage } from '../../utilities/image-export-utils';\n\nexport const FunnelChart: React.FunctionComponent<FunnelChartProps> = React.forwardRef<\n HTMLDivElement,\n FunnelChartProps\n>((props, forwardedRef) => {\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 [clickPosition, setClickPosition] = React.useState({ x: 0, y: 0 });\n const [isPopoverOpen, setPopoverOpen] = React.useState(false);\n const chartContainerRef = React.useRef<HTMLDivElement | null>(null);\n const isStacked = isStackedFunnelData(props.data);\n const _legendsRef = React.useRef<LegendContainer>(null);\n\n React.useEffect(() => {\n if (props.legendProps?.selectedLegends) {\n setSelectedLegends(props.legendProps.selectedLegends);\n }\n }, [props.legendProps?.selectedLegends]);\n\n React.useImperativeHandle(\n props.componentRef,\n () => ({\n toImage: (opts?: ImageExportOptions): Promise<string> => {\n return toImage(chartContainerRef.current, _legendsRef.current?.toSVG, isRTL, opts);\n },\n }),\n [],\n );\n\n function _handleHover(data: FunnelChartDataPoint, mouseEvent: React.MouseEvent<SVGElement>) {\n mouseEvent?.persist();\n updatePosition(mouseEvent.clientX, mouseEvent.clientY);\n setCalloutData(data);\n setPopoverOpen(true);\n }\n\n function _handleFocus(data: FunnelChartDataPoint, focusEvent: React.FocusEvent<SVGPathElement>) {\n focusEvent?.persist();\n let x = 0;\n let y = 0;\n const targetRect = (focusEvent.target as SVGPathElement).getBoundingClientRect();\n x = targetRect.left + targetRect.width / 2;\n y = targetRect.top + targetRect.height / 2;\n\n updatePosition(x, y);\n setCalloutData(data);\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 ) {\n mouseEvent?.persist();\n updatePosition(mouseEvent.clientX, mouseEvent.clientY);\n setCalloutData({\n stage,\n value: subValue.value,\n color: subValue.color,\n category: subValue.category,\n } as FunnelChartDataPoint);\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 ) {\n focusEvent?.persist();\n let x = 0;\n let y = 0;\n const targetRect = (focusEvent.target as SVGPathElement).getBoundingClientRect();\n x = targetRect.left + targetRect.width / 2;\n y = targetRect.top + targetRect.height / 2;\n\n updatePosition(x, y);\n setCalloutData({\n stage,\n value: subValue.value,\n color: subValue.color,\n category: subValue.category,\n } as FunnelChartDataPoint);\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 ) {\n if ('subValue' in data) {\n return {\n culture: props.culture,\n onMouseOver:\n opacity == 1\n ? (event: React.MouseEvent<SVGElement>) => _handleStackedHover(data.stage, data.subValue, event)\n : undefined,\n onMouseMove:\n opacity == 1\n ? (event: React.MouseEvent<SVGElement>) => _handleStackedHover(data.stage, data.subValue, event)\n : undefined,\n onFocus: (event: React.FocusEvent<SVGPathElement>) => _handleStackedFocus(data.stage, data.subValue, event),\n onBlur: () => _handleMouseOut(),\n onMouseOut: () => _handleMouseOut(),\n };\n } else {\n return {\n culture: props.culture,\n onMouseOver: opacity == 1 ? (event: React.MouseEvent<SVGElement>) => _handleHover(data, event) : undefined,\n onMouseMove: opacity == 1 ? (event: React.MouseEvent<SVGElement>) => _handleHover(data, event) : undefined,\n onFocus: (event: React.FocusEvent<SVGPathElement>) => _handleFocus(data, event),\n onBlur: () => _handleMouseOut(),\n onMouseOut: () => _handleMouseOut(),\n };\n }\n }\n\n function _renderSegmentText({\n show,\n x,\n y,\n value,\n textColor,\n }: {\n show: boolean;\n x: number;\n y: number;\n value: number;\n textColor: string;\n }) {\n if (!show) {\n return null;\n }\n\n const textElement = (\n <text x={isRTL ? funnelWidth - x : x} y={y} textAnchor=\"middle\" alignmentBaseline=\"middle\" fill={textColor}>\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 eventHandlers = _getEventHandlerProps(data, opacity);\n const textColor = getContrastTextColor(fill);\n\n return (\n <g key={key}>\n <path d={pathD} fill={fill} opacity={opacity} {...eventHandlers} tabIndex={tabIndex} />\n {textProps && <g {...eventHandlers}>{_renderSegmentText({ ...textProps, textColor })}</g>}\n </g>\n );\n }\n\n function _createFunnel(\n containerHeight: number,\n containerWidth: number,\n ): // eslint-disable-next-line @typescript-eslint/no-deprecated\n JSX.Element[] {\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 ): // eslint-disable-next-line @typescript-eslint/no-deprecated\n JSX.Element {\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(\n containerHeight: number,\n containerWidth: number,\n ): // eslint-disable-next-line @typescript-eslint/no-deprecated\n JSX.Element[] {\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 // eslint-disable-next-line @typescript-eslint/no-deprecated\n const paths: JSX.Element[] = [];\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(): // eslint-disable-next-line @typescript-eslint/no-deprecated\n JSX.Element {\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 function updatePosition(newX: number, newY: number) {\n const threshold = 1; // Set a threshold for movement\n const { x, y } = clickPosition;\n // Calculate the distance moved\n const distance = Math.sqrt(Math.pow(newX - x, 2) + Math.pow(newY - y, 2));\n // Update the position only if the distance moved is greater than the threshold\n if (distance > threshold) {\n setClickPosition({ x: newX, y: newY });\n setPopoverOpen(true);\n }\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 focusAttributes = useFocusableGroup();\n\n return !_isChartEmpty() ? (\n <div ref={chartContainerRef} className={classes.root} {...focusAttributes}>\n <svg width={width} height={height} className={classes.chart} role={'img'} 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 ?? 'en-us'}\n clickPosition={clickPosition}\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// eslint-disable-next-line @typescript-eslint/no-deprecated\nFunnelChart.defaultProps = {\n orientation: 'vertical',\n};\n"],"names":["React","useId","useRtl","Legends","useFocusableGroup","ChartPopover","formatToLocaleString","getContrastTextColor","useFunnelChartStyles","getHorizontalFunnelSegmentGeometry","getVerticalFunnelSegmentGeometry","getSegmentTextProps","getStackedHorizontalFunnelSegmentGeometry","getStackedVerticalFunnelSegmentGeometry","toImage","FunnelChart","forwardRef","props","forwardedRef","_emptyChartId","isRTL","hoveredStage","setHoveredStage","useState","calloutData","setCalloutData","selectedLegends","setSelectedLegends","clickPosition","setClickPosition","x","y","isPopoverOpen","setPopoverOpen","chartContainerRef","useRef","isStacked","isStackedFunnelData","data","_legendsRef","useEffect","legendProps","useImperativeHandle","componentRef","opts","current","toSVG","_handleHover","mouseEvent","persist","updatePosition","clientX","clientY","_handleFocus","focusEvent","targetRect","target","getBoundingClientRect","left","width","top","height","_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","culture","onMouseOver","undefined","onMouseMove","onFocus","onBlur","onMouseOut","_renderSegmentText","show","textColor","textElement","text","funnelWidth","textAnchor","alignmentBaseline","fill","toString","g","transform","_renderFunnelSegment","key","pathD","textProps","tabIndex","eventHandlers","path","d","_createFunnel","containerHeight","containerWidth","funnelHeight","map","i","geometryProps","orientation","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","hideLegend","legends","categoryMap","forEach","sub","Object","entries","title","hoverAction","onMouseOutAction","div","style","display","justifyContent","centerLegends","legendRef","_isChartEmpty","newX","newY","threshold","distance","sqrt","pow","classes","calloutProps","hoverXValue","YValue","funnelMarginTop","funnelOffsetX","focusAttributes","ref","className","root","svg","chart","role","aria-label","chartTitle","XValue","yCalloutValue","isCartesian","id","displayName","defaultProps"],"mappings":";;;;+BAoBae;;;;;;;iEApBU,QAAQ;gCACT,4BAA4B;uBAC3B,wBAAwB;wBAEE,mBAAmB;8BAClC,0BAA0B;8BAC/B,mCAAmC;gCAC3B,4BAA4B;wBAC5B,yBAAyB;4CACzB,gCAAgC;gCAO9D,mBAAmB;kCAEF,qCAAqC;AAEtD,oBAAMA,WAAAA,GAAyDf,OAAMgB,UAAU,CAGpF,CAACC,OAAOC;QAiBJ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U;qBACpG,OAAA,aAAA,CAACrF,KAAAA;QACCC,WACErF,QACI,CAAC,UAAU,EAAEgK,gBAAgBjF,YAAY,EAAE,EAAEgF,gBAAgB,aAAa,CAAC,GAC3E,CAAC,UAAU,EAAEC,cAAc,EAAE,EAAED,gBAAgB,CAAC,CAAC;OAGtD/I,YACGwG,qBAAqB/E,SAASsH,iBAAiBhF,eAC/Ce,cAAcrD,SAASsH,iBAAiBhF,gBAG/CnE,iBAAAA,WAAAA,GACC,OAAA,aAAA,CAAC3B,0BAAAA,EAAAA;QACE,GAAGY,MAAM+J,YAAY;QACtBc,MAAM,EAAEd,iBAAAA,QAAAA,iBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,aAAcC,WAAW;QACjCc,aAAa,EAAEf,iBAAAA,QAAAA,iBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,aAAcE,MAAM;QACnC3F,SAAStE,kBAAAA,MAAMsE,OAAAA,AAAO,MAAA,QAAbtE,mBAAAA,KAAAA,IAAAA,iBAAiB;QAC1BW,eAAeA;QACfI,eAAeA;QACfkC,KAAK,EAAE8G,iBAAAA,QAAAA,iBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,aAAc9G,KAAK;QAC1B8H,aAAa;QAGhBzC,oBAAAA,WAAAA,GAGH,OAAA,aAAA,CAACW,OAAAA;QAAI+B,IAAI9K;QAAewK,MAAM;QAASxB,OAAO;YAAE7E,SAAS;QAAI;QAAGsG,cAAY;;AAEhF,GAAG;AACH7K,YAAYmL,WAAW,GAAG;AAC1B,4DAA4D;AAC5DnL,YAAYoL,YAAY,GAAG;IACzB1E,aAAa;AACf"}
|
|
1
|
+
{"version":3,"sources":["../src/components/FunnelChart/FunnelChart.tsx"],"sourcesContent":["import * 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, LegendContainer } from '../Legends/index';\nimport { useFocusableGroup } 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, ImageExportOptions } from '../../index';\nimport { toImage } from '../../utilities/image-export-utils';\n\nexport const FunnelChart: React.FunctionComponent<FunnelChartProps> = React.forwardRef<\n HTMLDivElement,\n FunnelChartProps\n>((props, forwardedRef) => {\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 [clickPosition, setClickPosition] = React.useState({ x: 0, y: 0 });\n const [isPopoverOpen, setPopoverOpen] = React.useState(false);\n const chartContainerRef = React.useRef<HTMLDivElement | null>(null);\n const isStacked = isStackedFunnelData(props.data);\n const _legendsRef = React.useRef<LegendContainer>(null);\n\n React.useEffect(() => {\n if (props.legendProps?.selectedLegends) {\n setSelectedLegends(props.legendProps.selectedLegends);\n }\n }, [props.legendProps?.selectedLegends]);\n\n React.useImperativeHandle(\n props.componentRef,\n () => ({\n toImage: (opts?: ImageExportOptions): Promise<string> => {\n return toImage(chartContainerRef.current, _legendsRef.current?.toSVG, isRTL, opts);\n },\n }),\n [],\n );\n\n function _handleHover(data: FunnelChartDataPoint, mouseEvent: React.MouseEvent<SVGElement>) {\n mouseEvent?.persist();\n updatePosition(mouseEvent.clientX, mouseEvent.clientY);\n setCalloutData(data);\n setPopoverOpen(true);\n }\n\n function _handleFocus(data: FunnelChartDataPoint, focusEvent: React.FocusEvent<SVGPathElement>) {\n focusEvent?.persist();\n let x = 0;\n let y = 0;\n const targetRect = (focusEvent.target as SVGPathElement).getBoundingClientRect();\n x = targetRect.left + targetRect.width / 2;\n y = targetRect.top + targetRect.height / 2;\n\n updatePosition(x, y);\n setCalloutData(data);\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 ) {\n mouseEvent?.persist();\n updatePosition(mouseEvent.clientX, mouseEvent.clientY);\n setCalloutData({\n stage,\n value: subValue.value,\n color: subValue.color,\n category: subValue.category,\n } as FunnelChartDataPoint);\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 ) {\n focusEvent?.persist();\n let x = 0;\n let y = 0;\n const targetRect = (focusEvent.target as SVGPathElement).getBoundingClientRect();\n x = targetRect.left + targetRect.width / 2;\n y = targetRect.top + targetRect.height / 2;\n\n updatePosition(x, y);\n setCalloutData({\n stage,\n value: subValue.value,\n color: subValue.color,\n category: subValue.category,\n } as FunnelChartDataPoint);\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 ) {\n if ('subValue' in data) {\n return {\n culture: props.culture,\n onMouseOver:\n opacity == 1\n ? (event: React.MouseEvent<SVGElement>) => _handleStackedHover(data.stage, data.subValue, event)\n : undefined,\n onMouseMove:\n opacity == 1\n ? (event: React.MouseEvent<SVGElement>) => _handleStackedHover(data.stage, data.subValue, event)\n : undefined,\n onFocus: (event: React.FocusEvent<SVGPathElement>) => _handleStackedFocus(data.stage, data.subValue, event),\n onBlur: () => _handleMouseOut(),\n onMouseOut: () => _handleMouseOut(),\n };\n } else {\n return {\n culture: props.culture,\n onMouseOver: opacity == 1 ? (event: React.MouseEvent<SVGElement>) => _handleHover(data, event) : undefined,\n onMouseMove: opacity == 1 ? (event: React.MouseEvent<SVGElement>) => _handleHover(data, event) : undefined,\n onFocus: (event: React.FocusEvent<SVGPathElement>) => _handleFocus(data, event),\n onBlur: () => _handleMouseOut(),\n onMouseOut: () => _handleMouseOut(),\n };\n }\n }\n\n function _renderSegmentText({\n show,\n x,\n y,\n value,\n textColor,\n }: {\n show: boolean;\n x: number;\n y: number;\n value: number;\n textColor: string;\n }) {\n if (!show) {\n return null;\n }\n\n const textElement = (\n <text x={isRTL ? funnelWidth - x : x} y={y} textAnchor=\"middle\" alignmentBaseline=\"middle\" fill={textColor}>\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 eventHandlers = _getEventHandlerProps(data, opacity);\n const textColor = getContrastTextColor(fill);\n\n return (\n <g key={key}>\n <path d={pathD} fill={fill} opacity={opacity} {...eventHandlers} tabIndex={tabIndex} />\n {textProps && <g {...eventHandlers}>{_renderSegmentText({ ...textProps, textColor })}</g>}\n </g>\n );\n }\n\n function _createFunnel(\n containerHeight: number,\n containerWidth: number,\n ): // eslint-disable-next-line @typescript-eslint/no-deprecated\n 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 ): // eslint-disable-next-line @typescript-eslint/no-deprecated\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(\n containerHeight: number,\n containerWidth: number,\n ): // eslint-disable-next-line @typescript-eslint/no-deprecated\n 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 // eslint-disable-next-line @typescript-eslint/no-deprecated\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(): // eslint-disable-next-line @typescript-eslint/no-deprecated\n 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 function updatePosition(newX: number, newY: number) {\n const threshold = 1; // Set a threshold for movement\n const { x, y } = clickPosition;\n // Calculate the distance moved\n const distance = Math.sqrt(Math.pow(newX - x, 2) + Math.pow(newY - y, 2));\n // Update the position only if the distance moved is greater than the threshold\n if (distance > threshold) {\n setClickPosition({ x: newX, y: newY });\n setPopoverOpen(true);\n }\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 focusAttributes = useFocusableGroup();\n\n return !_isChartEmpty() ? (\n <div ref={chartContainerRef} className={classes.root} {...focusAttributes}>\n <svg width={width} height={height} className={classes.chart} role={'img'} 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 ?? 'en-us'}\n clickPosition={clickPosition}\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// eslint-disable-next-line @typescript-eslint/no-deprecated\nFunnelChart.defaultProps = {\n orientation: 'vertical',\n};\n"],"names":["React","useId","useRtl","Legends","useFocusableGroup","ChartPopover","formatToLocaleString","getContrastTextColor","useFunnelChartStyles","getHorizontalFunnelSegmentGeometry","getVerticalFunnelSegmentGeometry","getSegmentTextProps","getStackedHorizontalFunnelSegmentGeometry","getStackedVerticalFunnelSegmentGeometry","toImage","FunnelChart","forwardRef","props","forwardedRef","_emptyChartId","isRTL","hoveredStage","setHoveredStage","useState","calloutData","setCalloutData","selectedLegends","setSelectedLegends","clickPosition","setClickPosition","x","y","isPopoverOpen","setPopoverOpen","chartContainerRef","useRef","isStacked","isStackedFunnelData","data","_legendsRef","useEffect","legendProps","useImperativeHandle","componentRef","opts","current","toSVG","_handleHover","mouseEvent","persist","updatePosition","clientX","clientY","_handleFocus","focusEvent","targetRect","target","getBoundingClientRect","left","width","top","height","_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","culture","onMouseOver","undefined","onMouseMove","onFocus","onBlur","onMouseOut","_renderSegmentText","show","textColor","textElement","text","funnelWidth","textAnchor","alignmentBaseline","fill","toString","g","transform","_renderFunnelSegment","key","pathD","textProps","tabIndex","eventHandlers","path","d","_createFunnel","containerHeight","containerWidth","funnelHeight","map","i","geometryProps","orientation","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","hideLegend","legends","categoryMap","forEach","sub","Object","entries","title","hoverAction","onMouseOutAction","div","style","display","justifyContent","centerLegends","legendRef","_isChartEmpty","newX","newY","threshold","distance","sqrt","pow","classes","calloutProps","hoverXValue","YValue","funnelMarginTop","funnelOffsetX","focusAttributes","ref","className","root","svg","chart","role","aria-label","chartTitle","XValue","yCalloutValue","isCartesian","id","displayName","defaultProps"],"mappings":";;;;+BAqBae;;;;;;;iEArBU,QAAQ;gCACT,4BAA4B;uBAE3B,wBAAwB;wBAEE,mBAAmB;8BAClC,0BAA0B;8BAC/B,mCAAmC;gCAC3B,4BAA4B;wBAC5B,yBAAyB;4CACzB,gCAAgC;gCAO9D,mBAAmB;kCAEF,qCAAqC;AAEtD,oBAAMA,WAAAA,GAAyDf,OAAMgB,UAAU,CAGpF,CAACC,OAAOC;QAiBJD;IAhBJ,MAAME,oBAAwBlB,qBAAAA,EAAM;IACpC,MAAMmB,QAAQlB,iBAAAA;IAEd,MAAM,CAACmB,cAAcC,gBAAgB,GAAGtB,OAAMuB,QAAQ,CAAgB;IACtE,MAAM,CAACC,aAAaC,eAAe,GAAGzB,OAAMuB,QAAQ,CAA8B;IAClF,MAAM,CAACG,iBAAiBC,mBAAmB,GAAG3B,OAAMuB,QAAQ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,iBAAiBhF,gBAG/CnE,iBAAAA,WAAAA,GACC,OAAA,aAAA,CAAC3B,0BAAAA,EAAAA;QACE,GAAGY,MAAM+J,YAAY;QACtBc,MAAM,EAAEd,iBAAAA,QAAAA,iBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,aAAcC,WAAW;QACjCc,aAAa,EAAEf,iBAAAA,QAAAA,iBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,aAAcE,MAAM;QACnC3F,SAAStE,kBAAAA,MAAMsE,OAAAA,AAAO,MAAA,QAAbtE,mBAAAA,KAAAA,IAAAA,iBAAiB;QAC1BW,eAAeA;QACfI,eAAeA;QACfkC,KAAK,EAAE8G,iBAAAA,QAAAA,iBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,aAAc9G,KAAK;QAC1B8H,aAAa;QAGhBzC,oBAAAA,WAAAA,GAGH,OAAA,aAAA,CAACW,OAAAA;QAAI+B,IAAI9K;QAAewK,MAAM;QAASxB,OAAO;YAAE7E,SAAS;QAAI;QAAGsG,cAAY;;AAEhF,GAAG;AACH7K,YAAYmL,WAAW,GAAG;AAC1B,4DAA4D;AAC5DnL,YAAYoL,YAAY,GAAG;IACzB1E,aAAa;AACf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/GanttChart/GanttChart.tsx"],"sourcesContent":["import * as React from 'react';\nimport { max as d3Max, min as d3Min } from 'd3-array';\nimport { ScaleLinear, ScaleBand, ScaleTime } from 'd3-scale';\nimport { useId } from '@fluentui/react-utilities';\nimport { Legend, Legends, LegendContainer } from '../Legends/index';\nimport { Margins, GanttChartDataPoint } from '../../types/DataPoint';\nimport { CartesianChart, ModifiedCartesianChartProps } from '../CommonComponents/index';\nimport { GanttChartProps } from './GanttChart.types';\nimport { ChartPopover } from '../CommonComponents/ChartPopover';\nimport { ChartPopoverProps, ImageExportOptions, Chart } from '../../index';\nimport {\n ChartTypes,\n YAxisType,\n XAxisTypes,\n getTypeOfAxis,\n getNextColor,\n findHBCWANumericMinMaxOfY,\n createYAxisForHorizontalBarChartWithAxis,\n IDomainNRange,\n createStringYAxisForHorizontalBarChartWithAxis,\n areArraysEqual,\n MIN_DOMAIN_MARGIN,\n sortAxisCategories,\n calculateAppropriateBarWidth,\n getColorFromToken,\n getScalePadding,\n getDateFormatLevel,\n useRtl,\n} from '../../utilities/index';\nimport { formatDateToLocaleString, getMultiLevelDateTimeFormatOptions } from '@fluentui/chart-utilities';\nimport { toImage } from '../../utilities/image-export-utils';\n\ntype NumberScale = ScaleLinear<number, number>;\ntype StringScale = ScaleBand<string>;\ntype DateScale = ScaleTime<Date, number>;\n\nconst DEFAULT_BAR_HEIGHT = 24;\nconst MIN_BAR_HEIGHT = 1;\n\nexport const GanttChart: React.FunctionComponent<GanttChartProps> = React.forwardRef<HTMLDivElement, GanttChartProps>(\n ({ useUTC = true, yAxisCategoryOrder = 'default', maxBarHeight = 24, ...props }, forwardedRef) => {\n const _barHeight = React.useRef<number>(DEFAULT_BAR_HEIGHT);\n const _margins = React.useRef<Margins>({});\n const _calloutAnchorPoint = React.useRef<GanttChartDataPoint | null>(null);\n const _emptyChartId = useId('Gantt_empty');\n const _legendId = useId('gantt_legend');\n const _legendMap = React.useRef<Record<string, { id: string; startColor: string; endColor: string }>>({});\n const _prevProps = React.useRef<Partial<GanttChartProps>>({});\n\n const [calloutColor, setCalloutColor] = React.useState<string>('');\n const [hoveredLegend, setHoveredLegend] = React.useState<string>('');\n const [calloutLegend, setCalloutLegend] = React.useState<string>('');\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 [calloutDataPoint, setCalloutDataPoint] = React.useState<GanttChartDataPoint>();\n const [clickPosition, setClickPosition] = React.useState({ x: 0, y: 0 });\n const [isPopoverOpen, setPopoverOpen] = React.useState(false);\n const cartesianChartRef = React.useRef<Chart>(null);\n const _legendsRef = React.useRef<LegendContainer>(null);\n const _isRTL = useRtl();\n\n React.useEffect(() => {\n if (!areArraysEqual(_prevProps.current.legendProps?.selectedLegends, props.legendProps?.selectedLegends)) {\n setSelectedLegends(props.legendProps?.selectedLegends || []);\n }\n _prevProps.current = props;\n }, [props]);\n\n React.useImperativeHandle(\n props.componentRef,\n () => ({\n chartContainer: cartesianChartRef.current?.chartContainer ?? null,\n toImage: (opts?: ImageExportOptions): Promise<string> => {\n return toImage(cartesianChartRef.current?.chartContainer, _legendsRef.current?.toSVG, _isRTL, opts);\n },\n }),\n [],\n );\n\n const _points = React.useMemo(() => {\n _legendMap.current = {};\n let colorIndex = 0;\n\n return (\n props.data?.map(point => {\n const legend = `${point.legend}`;\n if (!_legendMap.current[legend]) {\n let startColor = point.color ? getColorFromToken(point.color) : getNextColor(colorIndex, 0);\n let endColor = startColor;\n\n if (props.enableGradient) {\n startColor = point.gradient?.[0]!;\n endColor = point.gradient?.[1]!;\n }\n\n _legendMap.current[legend] = { id: `${_legendId}_${colorIndex}`, startColor, endColor };\n colorIndex += 1;\n }\n\n const { startColor, endColor } = _legendMap.current[legend];\n return {\n ...point,\n color: startColor,\n ...(props.enableGradient ? { gradient: [startColor, endColor] as [string, string] } : {}),\n };\n }) ?? []\n );\n }, [props.data, props.enableGradient]);\n\n const _xAxisType = React.useMemo(() => {\n if (_points.length > 0) {\n return getTypeOfAxis(_points[0].x.start, true) as XAxisTypes;\n }\n return XAxisTypes.DateAxis;\n }, [_points]);\n\n const _yAxisType = React.useMemo(() => {\n if (_points.length > 0) {\n return getTypeOfAxis(_points[0].y, false) as YAxisType;\n }\n return YAxisType.StringAxis;\n }, [_points]);\n\n const _yAxisPadding = React.useMemo(() => {\n return getScalePadding(props.yAxisPadding, undefined, 1 / 2);\n }, [props.yAxisPadding]);\n\n const _dateFormatOptions = React.useMemo(() => {\n if (_xAxisType !== XAxisTypes.DateAxis) {\n return undefined;\n }\n\n let lowestFormatLevel = 100;\n let highestFormatLevel = -1;\n _points.forEach(p => {\n const startFormatLevel = getDateFormatLevel(p.x.start as Date, useUTC as boolean);\n const endFormatLevel = getDateFormatLevel(p.x.end as Date, useUTC as boolean);\n lowestFormatLevel = Math.min(lowestFormatLevel, startFormatLevel, endFormatLevel);\n highestFormatLevel = Math.max(highestFormatLevel, startFormatLevel, endFormatLevel);\n });\n\n return getMultiLevelDateTimeFormatOptions(lowestFormatLevel, highestFormatLevel);\n }, [useUTC, _points, _xAxisType]);\n\n const _mapYValueToXValues = React.useCallback(() => {\n const yValueToXValues: Record<string, number[]> = {};\n _points.forEach(point => {\n if (!yValueToXValues[point.y]) {\n yValueToXValues[point.y] = [];\n }\n yValueToXValues[point.y].push(+point.x.end - +point.x.start);\n });\n return yValueToXValues;\n }, [_points]);\n\n const _getOrderedYAxisLabels = React.useCallback(() => {\n const yValueToXValues = _mapYValueToXValues();\n\n if (_yAxisType !== YAxisType.StringAxis) {\n return Object.keys(yValueToXValues).sort((a, b) => +a - +b);\n }\n\n if (yAxisCategoryOrder === 'default') {\n return Object.keys(yValueToXValues).reverse();\n }\n return sortAxisCategories(yValueToXValues, yAxisCategoryOrder);\n }, [_mapYValueToXValues, _yAxisType, yAxisCategoryOrder]);\n\n const _yAxisLabels = React.useMemo(() => _getOrderedYAxisLabels(), [_getOrderedYAxisLabels]);\n\n const _getDomainNRangeValues = React.useCallback(\n (\n points: GanttChartDataPoint[],\n margins: Margins,\n containerWidth: number,\n chartType: ChartTypes,\n isRTL: boolean,\n xAxisType: XAxisTypes,\n barWidth: number,\n tickValues: Date[] | number[] | undefined,\n shiftX: number,\n ): IDomainNRange => {\n const xValues: (Date | number)[] = [];\n points.forEach(point => {\n xValues.push(point.x.start, point.x.end);\n });\n\n const xMin = d3Min(xValues) || 0;\n const xMax = d3Max(xValues) || 0;\n\n return {\n dStartValue: isRTL ? xMax : xMin,\n dEndValue: isRTL ? xMin : xMax,\n rStartValue: margins.left! + (isRTL ? 0 : shiftX),\n rEndValue: containerWidth - margins.right! - (isRTL ? shiftX : 0),\n };\n },\n [],\n );\n\n const _getMargins = React.useCallback((margins: Margins) => {\n _margins.current = margins;\n }, []);\n\n const _getFormattedXValue = React.useCallback(\n (point: GanttChartDataPoint): string => {\n let formattedStartX: string;\n let formattedEndX: string;\n\n if (_xAxisType === XAxisTypes.DateAxis) {\n formattedStartX = formatDateToLocaleString(\n point.x.start as Date,\n props.culture,\n useUTC as boolean,\n false,\n _dateFormatOptions,\n );\n formattedEndX = formatDateToLocaleString(\n point.x.end as Date,\n props.culture,\n useUTC as boolean,\n false,\n _dateFormatOptions,\n );\n } else {\n formattedStartX = point.x.start.toString();\n formattedEndX = point.x.end.toString();\n }\n\n return `${formattedStartX} - ${formattedEndX}`;\n },\n [props.culture, useUTC, _dateFormatOptions, _xAxisType],\n );\n\n const _getCustomizedCallout = React.useCallback(() => {\n const defaultRender = (point?: GanttChartDataPoint): React.JSX.Element | null => {\n return point ? (\n <ChartPopover\n isPopoverOpen={isPopoverOpen}\n clickPosition={clickPosition}\n XValue={point.yAxisCalloutData || point.y.toString()}\n legend={point.legend}\n YValue={point.xAxisCalloutData || _getFormattedXValue(point)}\n color={point.color}\n culture={props.culture}\n />\n ) : null;\n };\n\n return props.onRenderCalloutPerDataPoint\n ? props.onRenderCalloutPerDataPoint(calloutDataPoint, defaultRender)\n : null;\n //eslint-disable-next-line react-hooks/exhaustive-deps\n }, [_getFormattedXValue, calloutDataPoint, props.culture, props.onRenderCalloutPerDataPoint]);\n\n const _getAriaLabel = React.useCallback(\n (point: GanttChartDataPoint): string => {\n const xValue = point.xAxisCalloutData || _getFormattedXValue(point);\n const yValue = point.yAxisCalloutData || point.y;\n return (\n point.callOutAccessibilityData?.ariaLabel ||\n `${yValue}. ` + (point.legend ? `${point.legend}, ` : '') + `${xValue}.`\n );\n },\n [_getFormattedXValue],\n );\n\n const _getHighlightedLegend = React.useCallback(() => {\n return selectedLegends.length > 0 ? selectedLegends : hoveredLegend ? [hoveredLegend] : [];\n }, [hoveredLegend, selectedLegends]);\n\n /**\n * This function checks if the given legend is highlighted or not.\n * A legend can be highlighted in 2 ways:\n * 1. selection: if the user clicks on it\n * 2. hovering: if there is no selected legend and the user hovers over it\n */\n const _legendHighlighted = React.useCallback(\n (legend: string | undefined) => {\n return _getHighlightedLegend().includes(`${legend}`);\n },\n [_getHighlightedLegend],\n );\n\n /**\n * This function checks if none of the legends is selected or hovered.\n */\n const _noLegendHighlighted = React.useCallback(() => {\n return _getHighlightedLegend().length === 0;\n }, [_getHighlightedLegend]);\n\n const _showCallout = React.useCallback(\n (target: React.MouseEvent<SVGElement> | React.FocusEvent<SVGElement>, point: GanttChartDataPoint) => {\n if (!(_noLegendHighlighted() || _legendHighlighted(point.legend)) || _calloutAnchorPoint.current === point) {\n return;\n }\n if ('clientX' in target && 'clientY' in target) {\n updatePosition(target.clientX, target.clientY);\n } else {\n const rect = (target.target as SVGElement).getBoundingClientRect();\n updatePosition(rect.left, rect.top);\n }\n _calloutAnchorPoint.current = point;\n setPopoverOpen(true);\n setCalloutLegend(point.legend!);\n setCalloutColor(point.color!);\n setXCalloutValue(point.yAxisCalloutData || point.y.toString());\n setYCalloutValue(point.xAxisCalloutData! || _getFormattedXValue(point));\n setCalloutDataPoint(point);\n },\n [_getFormattedXValue, _legendHighlighted, _noLegendHighlighted],\n );\n\n const _onBarFocus = React.useCallback(\n (point: GanttChartDataPoint, focusEvent: React.FocusEvent<SVGElement>): void => {\n _showCallout(focusEvent, point);\n },\n [_showCallout],\n );\n\n const _onBarHover = React.useCallback(\n (point: GanttChartDataPoint, mouseEvent: React.MouseEvent<SVGElement>): void => {\n _showCallout(mouseEvent, point);\n },\n [_showCallout],\n );\n\n const _onBarLeave = React.useCallback((): void => {\n // do nothing\n }, []);\n\n const _handleChartMouseLeave = React.useCallback((): void => {\n _calloutAnchorPoint.current = null;\n setPopoverOpen(false);\n setCalloutLegend('');\n setCalloutColor('');\n setXCalloutValue('');\n setYCalloutValue('');\n setCalloutDataPoint(undefined);\n }, []);\n\n const _getBarHeight = React.useCallback(\n (adjustedValue: number): number => {\n let barHeight: number;\n if (typeof props.barHeight === 'number') {\n barHeight = props.barHeight;\n } else {\n barHeight = adjustedValue;\n }\n if (typeof maxBarHeight === 'number') {\n barHeight = Math.min(barHeight, maxBarHeight);\n }\n barHeight = Math.max(barHeight, MIN_BAR_HEIGHT);\n return barHeight;\n },\n [maxBarHeight, props.barHeight],\n );\n\n const _getOrderedDataPoints = React.useCallback(() => {\n const result: GanttChartDataPoint[] = [];\n\n const yValueToPoints: Record<string, GanttChartDataPoint[]> = {};\n _points.forEach(point => {\n if (!yValueToPoints[point.y]) {\n yValueToPoints[point.y] = [];\n }\n yValueToPoints[point.y].push(point);\n });\n\n for (let i = _yAxisLabels.length - 1; i >= 0; i--) {\n const yValue = _yAxisLabels[i];\n if (yValueToPoints[yValue]) {\n result.push(...yValueToPoints[yValue].sort((a, b) => +a.x.start - +b.x.start));\n }\n }\n\n return result;\n }, [_points, _yAxisLabels]);\n\n const _createBars = React.useCallback(\n ({\n xScale,\n yScalePrimary: yScale,\n }: {\n xScale: DateScale | NumberScale;\n yScalePrimary: NumberScale | StringScale;\n }): React.JSX.Element => {\n const getGradientId = (legend: string | undefined) => {\n const legendId = _legendMap.current[`${legend}`].id;\n return `${legendId}_gradient`;\n };\n\n const gradientDefs: React.JSX.Element[] = [];\n if (props.enableGradient) {\n Object.keys(_legendMap.current).forEach((legend: string, index: number) => {\n const { startColor, endColor } = _legendMap.current[legend];\n gradientDefs.push(\n <linearGradient key={index} id={getGradientId(legend)}>\n <stop offset=\"0\" stopColor={startColor} />\n <stop offset=\"100%\" stopColor={endColor} />\n </linearGradient>,\n );\n });\n }\n\n let scaleBandwidth = 0;\n if (_yAxisType === YAxisType.StringAxis) {\n scaleBandwidth = (yScale as StringScale).bandwidth();\n _barHeight.current = _getBarHeight(scaleBandwidth);\n }\n\n const points = _getOrderedDataPoints();\n const bars = points.map((point: GanttChartDataPoint, index: number) => {\n const rectStartX = xScale(point.x.start);\n const rectEndX = xScale(point.x.end);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const rectY = yScale(point.y as any)! + (scaleBandwidth - _barHeight.current) / 2;\n\n const shouldHighlight = _noLegendHighlighted() || _legendHighlighted(point.legend);\n\n return (\n <rect\n key={index}\n x={Math.min(rectStartX, rectEndX)}\n y={rectY}\n width={Math.abs(rectEndX - rectStartX)}\n height={_barHeight.current}\n rx={props.roundCorners ? 3 : 0}\n fill={props.enableGradient ? `url(#${getGradientId(point.legend)})` : point.color}\n opacity={shouldHighlight ? 1 : 0.1}\n onClick={point.onClick}\n onMouseOver={(event: React.MouseEvent<SVGElement>) => _onBarHover(point, event)}\n onMouseLeave={_onBarLeave}\n onFocus={(event: React.FocusEvent<SVGElement>) => _onBarFocus(point, event)}\n onBlur={_onBarLeave}\n tabIndex={shouldHighlight ? 0 : -1}\n role=\"img\"\n aria-label={_getAriaLabel(point)}\n />\n );\n });\n return (\n <g>\n {gradientDefs.length > 0 ? <defs>{gradientDefs}</defs> : null}\n {bars}\n </g>\n );\n },\n [\n _getAriaLabel,\n _getBarHeight,\n _getOrderedDataPoints,\n _legendHighlighted,\n _noLegendHighlighted,\n _onBarFocus,\n _onBarHover,\n _onBarLeave,\n _yAxisType,\n props.enableGradient,\n props.roundCorners,\n ],\n );\n\n const _onLegendHover = React.useCallback((legend: string): void => {\n setHoveredLegend(legend);\n }, []);\n\n const _onLegendLeave = React.useCallback((): void => {\n setHoveredLegend('');\n }, []);\n\n const _onLegendSelectionChange = React.useCallback(\n (_selectedLegends: string[], event: React.MouseEvent<HTMLButtonElement>, currentLegend?: Legend): void => {\n if (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 [props.legendProps],\n );\n\n const _getLegendData = React.useCallback((): React.JSX.Element => {\n const actions: Legend[] = [];\n\n Object.keys(_legendMap.current).forEach((legendTitle: string) => {\n const legend: Legend = {\n title: legendTitle,\n color: _legendMap.current[legendTitle].startColor,\n hoverAction: () => {\n _handleChartMouseLeave();\n _onLegendHover(legendTitle);\n },\n onMouseOutAction: () => {\n _onLegendLeave();\n },\n };\n\n actions.push(legend);\n });\n\n const legends = (\n <Legends\n legends={actions}\n enabledWrapLines={props.enabledLegendsWrapLines}\n overflowText={props.legendsOverflowText}\n onChange={_onLegendSelectionChange}\n {...props.legendProps}\n legendRef={_legendsRef}\n />\n );\n return legends;\n }, [\n _handleChartMouseLeave,\n _onLegendHover,\n _onLegendLeave,\n _onLegendSelectionChange,\n props.enabledLegendsWrapLines,\n props.legendProps,\n props.legendsOverflowText,\n ]);\n\n const _getChartTitle = React.useCallback((): string => {\n return (props.chartTitle ? `${props.chartTitle}. ` : '') + `Gantt chart with ${_points.length} data points. `;\n }, [_points.length, props.chartTitle]);\n\n const _isChartEmpty = React.useCallback((): boolean => {\n return _points.length === 0;\n }, [_points.length]);\n\n const _getYDomainMargins = React.useCallback(\n (containerHeight: number): Margins => {\n let domainMargin = MIN_DOMAIN_MARGIN;\n\n const ySet = new Set<string | number>();\n _points.forEach((point: GanttChartDataPoint) => {\n ySet.add(point.y);\n });\n const uniqueY = Array.from(ySet);\n\n /** Total height available to render the bars */\n const totalHeight =\n containerHeight -\n (_margins.current.top! + MIN_DOMAIN_MARGIN) -\n (_margins.current.bottom! + MIN_DOMAIN_MARGIN);\n\n if (_yAxisType !== YAxisType.StringAxis) {\n _barHeight.current = _getBarHeight(\n calculateAppropriateBarWidth(uniqueY as number[] | Date[], totalHeight, _yAxisPadding),\n );\n domainMargin += _barHeight.current / 2;\n }\n\n return {\n ..._margins.current,\n top: _margins.current.top! + domainMargin,\n bottom: _margins.current.bottom! + domainMargin,\n };\n },\n [_getBarHeight, _points, _yAxisPadding, _yAxisType],\n );\n\n function updatePosition(newX: number, newY: number) {\n const threshold = 1; // Set a threshold for movement\n const { x, y } = clickPosition;\n // Calculate the distance moved\n const distance = Math.sqrt(Math.pow(newX - x, 2) + Math.pow(newY - y, 2));\n // Update the position only if the distance moved is greater than the threshold\n if (distance > threshold) {\n setClickPosition({ x: newX, y: newY });\n setPopoverOpen(true);\n }\n }\n\n if (!_isChartEmpty()) {\n _barHeight.current = _getBarHeight(DEFAULT_BAR_HEIGHT);\n\n const calloutProps: ChartPopoverProps = {\n isPopoverOpen,\n clickPosition,\n color: calloutColor,\n legend: calloutLegend,\n XValue: xCalloutValue,\n YValue: yCalloutValue,\n ...props.calloutProps,\n };\n const tickParams: ModifiedCartesianChartProps['tickParams'] = {\n tickValues: props.tickValues,\n tickFormat: props.tickFormat,\n };\n\n return (\n <CartesianChart\n {...props}\n yAxisPadding={_yAxisPadding}\n chartTitle={_getChartTitle()}\n points={_points}\n chartType={ChartTypes.GanttChart}\n xAxisType={_xAxisType}\n yAxisType={_yAxisType}\n componentRef={cartesianChartRef}\n stringDatasetForYAxisDomain={_yAxisLabels}\n calloutProps={calloutProps}\n tickParams={tickParams}\n legendBars={_getLegendData()}\n createYAxis={createYAxisForHorizontalBarChartWithAxis}\n getDomainNRangeValues={_getDomainNRangeValues}\n createStringYAxis={createStringYAxisForHorizontalBarChartWithAxis}\n getMinMaxOfYAxis={findHBCWANumericMinMaxOfY}\n customizedCallout={_getCustomizedCallout()}\n getmargins={_getMargins}\n getYDomainMargins={_getYDomainMargins}\n onChartMouseLeave={_handleChartMouseLeave}\n useUTC={useUTC}\n children={_createBars}\n />\n );\n } else {\n return (\n <div id={_emptyChartId} role={'alert'} style={{ opacity: '0' }} aria-label={'Graph has no data to display'} />\n );\n }\n },\n);\n\nGanttChart.displayName = 'GanttChart';\n"],"names":["React","max","d3Max","min","d3Min","useId","Legends","CartesianChart","ChartPopover","ChartTypes","YAxisType","XAxisTypes","getTypeOfAxis","getNextColor","findHBCWANumericMinMaxOfY","createYAxisForHorizontalBarChartWithAxis","createStringYAxisForHorizontalBarChartWithAxis","areArraysEqual","MIN_DOMAIN_MARGIN","sortAxisCategories","calculateAppropriateBarWidth","getColorFromToken","getScalePadding","getDateFormatLevel","useRtl","formatDateToLocaleString","getMultiLevelDateTimeFormatOptions","toImage","DEFAULT_BAR_HEIGHT","MIN_BAR_HEIGHT","GanttChart","forwardRef","useUTC","yAxisCategoryOrder","maxBarHeight","props","forwardedRef","_barHeight","useRef","_margins","_calloutAnchorPoint","_emptyChartId","_legendId","_legendMap","_prevProps","calloutColor","setCalloutColor","useState","hoveredLegend","setHoveredLegend","calloutLegend","setCalloutLegend","xCalloutValue","setXCalloutValue","yCalloutValue","setYCalloutValue","selectedLegends","setSelectedLegends","legendProps","calloutDataPoint","setCalloutDataPoint","clickPosition","setClickPosition","x","y","isPopoverOpen","setPopoverOpen","cartesianChartRef","_legendsRef","_isRTL","useEffect","current","useImperativeHandle","componentRef","chartContainer","opts","toSVG","_points","useMemo","colorIndex","data","map","point","legend","startColor","color","endColor","enableGradient","gradient","id","_xAxisType","length","start","DateAxis","_yAxisType","StringAxis","_yAxisPadding","yAxisPadding","undefined","_dateFormatOptions","lowestFormatLevel","highestFormatLevel","forEach","p","startFormatLevel","endFormatLevel","end","Math","_mapYValueToXValues","useCallback","yValueToXValues","push","_getOrderedYAxisLabels","Object","keys","sort","a","b","reverse","_yAxisLabels","_getDomainNRangeValues","points","margins","containerWidth","chartType","isRTL","xAxisType","barWidth","tickValues","shiftX","xValues","xMin","xMax","dStartValue","dEndValue","rStartValue","left","rEndValue","right","_getMargins","_getFormattedXValue","formattedStartX","formattedEndX","culture","toString","_getCustomizedCallout","defaultRender","XValue","yAxisCalloutData","YValue","xAxisCalloutData","onRenderCalloutPerDataPoint","_getAriaLabel","xValue","yValue","callOutAccessibilityData","ariaLabel","_getHighlightedLegend","_legendHighlighted","includes","_noLegendHighlighted","_showCallout","target","updatePosition","clientX","clientY","rect","getBoundingClientRect","top","_onBarFocus","focusEvent","_onBarHover","mouseEvent","_onBarLeave","_handleChartMouseLeave","_getBarHeight","adjustedValue","barHeight","_getOrderedDataPoints","result","yValueToPoints","i","_createBars","xScale","yScalePrimary","yScale","getGradientId","legendId","gradientDefs","index","linearGradient","key","stop","offset","stopColor","scaleBandwidth","bandwidth","bars","rectStartX","rectEndX","rectY","shouldHighlight","width","abs","height","rx","roundCorners","fill","opacity","onClick","onMouseOver","event","onMouseLeave","onFocus","onBlur","tabIndex","role","aria-label","g","defs","_onLegendHover","_onLegendLeave","_onLegendSelectionChange","_selectedLegends","currentLegend","canSelectMultipleLegends","slice","onChange","_getLegendData","actions","legendTitle","title","hoverAction","onMouseOutAction","legends","enabledWrapLines","enabledLegendsWrapLines","overflowText","legendsOverflowText","legendRef","_getChartTitle","chartTitle","_isChartEmpty","_getYDomainMargins","containerHeight","domainMargin","ySet","Set","add","uniqueY","Array","from","totalHeight","bottom","newX","newY","threshold","distance","sqrt","pow","calloutProps","tickParams","tickFormat","yAxisType","stringDatasetForYAxisDomain","legendBars","createYAxis","getDomainNRangeValues","createStringYAxis","getMinMaxOfYAxis","customizedCallout","getmargins","getYDomainMargins","onChartMouseLeave","children","div","style","displayName"],"mappings":";;;;+BAuCa8B;;;;;;;iEAvCU,QAAQ;yBACY,WAAW;gCAEhC,4BAA4B;uBACD,mBAAmB;wBAER,4BAA4B;8BAE3D,mCAAmC;wBAoBzD,wBAAwB;gCAC8C,4BAA4B;kCACjF,qCAAqC;AAM7D,MAAMF,qBAAqB;AAC3B,MAAMC,iBAAiB;AAEhB,mBAAMC,WAAAA,GAAuD9B,OAAM+B,UAAU,CAClF,CAAC,EAAEC,SAAS,IAAI,EAAEC,qBAAqB,SAAS,EAAEC,eAAe,EAAE,EAAE,GAAGC,OAAO,EAAEC;QAcRD;IAbvE,MAAME,aAAarC,OAAMsC,MAAM,CAASV;IACxC,MAAMW,WAAWvC,OAAMsC,MAAM,CAAU,CAAC;IACxC,MAAME,sBAAsBxC,OAAMsC,MAAM,CAA6B;IACrE,MAAMG,oBAAgBpC,qBAAAA,EAAM;IAC5B,MAAMqC,g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A,EAAAA;YACE,GAAG4B,KAAK;YACT8D,cAAcD;YACdiJ,YAAYD;YACZvH,QAAQ5C;YACR+C,WAAWnH,kBAAAA,CAAWqB,UAAU;YAChCgG,WAAWpC;YACX6K,WAAWzK;YACXrB,cAAcN;YACdqM,6BAA6BjJ;YAC7B6I,cAAcA;YACdC,YAAYA;YACZI,YAAYrC;YACZsC,aAAa3P,gDAAAA;YACb4P,uBAAuBnJ;YACvBoJ,mBAAmB5P,sDAAAA;YACnB6P,kBAAkB/P,iCAAAA;YAClBgQ,mBAAmB7H;YACnB8H,YAAYpI;YACZqI,mBAAmB7B;YACnB8B,mBAAmBnG;YACnB9I,QAAQA;YACRkP,UAAU5F;;IAGhB,OAAO;QACL,OAAA,WAAA,GACE,OAAA,aAAA,CAAC6F,OAAAA;YAAI1L,IAAIhD;YAAe+K,MAAM;YAAS4D,OAAO;gBAAEpE,SAAS;YAAI;YAAGS,cAAY;;IAEhF;AACF,GACA;AAEF3L,WAAWuP,WAAW,GAAG"}
|
|
1
|
+
{"version":3,"sources":["../src/components/GanttChart/GanttChart.tsx"],"sourcesContent":["import * as React from 'react';\nimport { max as d3Max, min as d3Min } from 'd3-array';\nimport { ScaleLinear, ScaleBand, ScaleTime } from 'd3-scale';\nimport { useId } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport { Legend, Legends, LegendContainer } from '../Legends/index';\nimport { Margins, GanttChartDataPoint } from '../../types/DataPoint';\nimport { CartesianChart, ModifiedCartesianChartProps } from '../CommonComponents/index';\nimport { GanttChartProps } from './GanttChart.types';\nimport { ChartPopover } from '../CommonComponents/ChartPopover';\nimport { ChartPopoverProps, ImageExportOptions, Chart } from '../../index';\nimport {\n ChartTypes,\n YAxisType,\n XAxisTypes,\n getTypeOfAxis,\n getNextColor,\n findHBCWANumericMinMaxOfY,\n createYAxisForHorizontalBarChartWithAxis,\n IDomainNRange,\n createStringYAxisForHorizontalBarChartWithAxis,\n areArraysEqual,\n MIN_DOMAIN_MARGIN,\n sortAxisCategories,\n calculateAppropriateBarWidth,\n getColorFromToken,\n getScalePadding,\n getDateFormatLevel,\n useRtl,\n} from '../../utilities/index';\nimport { formatDateToLocaleString, getMultiLevelDateTimeFormatOptions } from '@fluentui/chart-utilities';\nimport { toImage } from '../../utilities/image-export-utils';\n\ntype NumberScale = ScaleLinear<number, number>;\ntype StringScale = ScaleBand<string>;\ntype DateScale = ScaleTime<Date, number>;\n\nconst DEFAULT_BAR_HEIGHT = 24;\nconst MIN_BAR_HEIGHT = 1;\n\nexport const GanttChart: React.FunctionComponent<GanttChartProps> = React.forwardRef<HTMLDivElement, GanttChartProps>(\n ({ useUTC = true, yAxisCategoryOrder = 'default', maxBarHeight = 24, ...props }, forwardedRef) => {\n const _barHeight = React.useRef<number>(DEFAULT_BAR_HEIGHT);\n const _margins = React.useRef<Margins>({});\n const _calloutAnchorPoint = React.useRef<GanttChartDataPoint | null>(null);\n const _emptyChartId = useId('Gantt_empty');\n const _legendId = useId('gantt_legend');\n const _legendMap = React.useRef<Record<string, { id: string; startColor: string; endColor: string }>>({});\n const _prevProps = React.useRef<Partial<GanttChartProps>>({});\n\n const [calloutColor, setCalloutColor] = React.useState<string>('');\n const [hoveredLegend, setHoveredLegend] = React.useState<string>('');\n const [calloutLegend, setCalloutLegend] = React.useState<string>('');\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 [calloutDataPoint, setCalloutDataPoint] = React.useState<GanttChartDataPoint>();\n const [clickPosition, setClickPosition] = React.useState({ x: 0, y: 0 });\n const [isPopoverOpen, setPopoverOpen] = React.useState(false);\n const cartesianChartRef = React.useRef<Chart>(null);\n const _legendsRef = React.useRef<LegendContainer>(null);\n const _isRTL = useRtl();\n\n React.useEffect(() => {\n if (!areArraysEqual(_prevProps.current.legendProps?.selectedLegends, props.legendProps?.selectedLegends)) {\n setSelectedLegends(props.legendProps?.selectedLegends || []);\n }\n _prevProps.current = props;\n }, [props]);\n\n React.useImperativeHandle(\n props.componentRef,\n () => ({\n chartContainer: cartesianChartRef.current?.chartContainer ?? null,\n toImage: (opts?: ImageExportOptions): Promise<string> => {\n return toImage(cartesianChartRef.current?.chartContainer, _legendsRef.current?.toSVG, _isRTL, opts);\n },\n }),\n [],\n );\n\n const _points = React.useMemo(() => {\n _legendMap.current = {};\n let colorIndex = 0;\n\n return (\n props.data?.map(point => {\n const legend = `${point.legend}`;\n if (!_legendMap.current[legend]) {\n let startColor = point.color ? getColorFromToken(point.color) : getNextColor(colorIndex, 0);\n let endColor = startColor;\n\n if (props.enableGradient) {\n startColor = point.gradient?.[0]!;\n endColor = point.gradient?.[1]!;\n }\n\n _legendMap.current[legend] = { id: `${_legendId}_${colorIndex}`, startColor, endColor };\n colorIndex += 1;\n }\n\n const { startColor, endColor } = _legendMap.current[legend];\n return {\n ...point,\n color: startColor,\n ...(props.enableGradient ? { gradient: [startColor, endColor] as [string, string] } : {}),\n };\n }) ?? []\n );\n }, [props.data, props.enableGradient]);\n\n const _xAxisType = React.useMemo(() => {\n if (_points.length > 0) {\n return getTypeOfAxis(_points[0].x.start, true) as XAxisTypes;\n }\n return XAxisTypes.DateAxis;\n }, [_points]);\n\n const _yAxisType = React.useMemo(() => {\n if (_points.length > 0) {\n return getTypeOfAxis(_points[0].y, false) as YAxisType;\n }\n return YAxisType.StringAxis;\n }, [_points]);\n\n const _yAxisPadding = React.useMemo(() => {\n return getScalePadding(props.yAxisPadding, undefined, 1 / 2);\n }, [props.yAxisPadding]);\n\n const _dateFormatOptions = React.useMemo(() => {\n if (_xAxisType !== XAxisTypes.DateAxis) {\n return undefined;\n }\n\n let lowestFormatLevel = 100;\n let highestFormatLevel = -1;\n _points.forEach(p => {\n const startFormatLevel = getDateFormatLevel(p.x.start as Date, useUTC as boolean);\n const endFormatLevel = getDateFormatLevel(p.x.end as Date, useUTC as boolean);\n lowestFormatLevel = Math.min(lowestFormatLevel, startFormatLevel, endFormatLevel);\n highestFormatLevel = Math.max(highestFormatLevel, startFormatLevel, endFormatLevel);\n });\n\n return getMultiLevelDateTimeFormatOptions(lowestFormatLevel, highestFormatLevel);\n }, [useUTC, _points, _xAxisType]);\n\n const _mapYValueToXValues = React.useCallback(() => {\n const yValueToXValues: Record<string, number[]> = {};\n _points.forEach(point => {\n if (!yValueToXValues[point.y]) {\n yValueToXValues[point.y] = [];\n }\n yValueToXValues[point.y].push(+point.x.end - +point.x.start);\n });\n return yValueToXValues;\n }, [_points]);\n\n const _getOrderedYAxisLabels = React.useCallback(() => {\n const yValueToXValues = _mapYValueToXValues();\n\n if (_yAxisType !== YAxisType.StringAxis) {\n return Object.keys(yValueToXValues).sort((a, b) => +a - +b);\n }\n\n if (yAxisCategoryOrder === 'default') {\n return Object.keys(yValueToXValues).reverse();\n }\n return sortAxisCategories(yValueToXValues, yAxisCategoryOrder);\n }, [_mapYValueToXValues, _yAxisType, yAxisCategoryOrder]);\n\n const _yAxisLabels = React.useMemo(() => _getOrderedYAxisLabels(), [_getOrderedYAxisLabels]);\n\n const _getDomainNRangeValues = React.useCallback(\n (\n points: GanttChartDataPoint[],\n margins: Margins,\n containerWidth: number,\n chartType: ChartTypes,\n isRTL: boolean,\n xAxisType: XAxisTypes,\n barWidth: number,\n tickValues: Date[] | number[] | undefined,\n shiftX: number,\n ): IDomainNRange => {\n const xValues: (Date | number)[] = [];\n points.forEach(point => {\n xValues.push(point.x.start, point.x.end);\n });\n\n const xMin = d3Min(xValues) || 0;\n const xMax = d3Max(xValues) || 0;\n\n return {\n dStartValue: isRTL ? xMax : xMin,\n dEndValue: isRTL ? xMin : xMax,\n rStartValue: margins.left! + (isRTL ? 0 : shiftX),\n rEndValue: containerWidth - margins.right! - (isRTL ? shiftX : 0),\n };\n },\n [],\n );\n\n const _getMargins = React.useCallback((margins: Margins) => {\n _margins.current = margins;\n }, []);\n\n const _getFormattedXValue = React.useCallback(\n (point: GanttChartDataPoint): string => {\n let formattedStartX: string;\n let formattedEndX: string;\n\n if (_xAxisType === XAxisTypes.DateAxis) {\n formattedStartX = formatDateToLocaleString(\n point.x.start as Date,\n props.culture,\n useUTC as boolean,\n false,\n _dateFormatOptions,\n );\n formattedEndX = formatDateToLocaleString(\n point.x.end as Date,\n props.culture,\n useUTC as boolean,\n false,\n _dateFormatOptions,\n );\n } else {\n formattedStartX = point.x.start.toString();\n formattedEndX = point.x.end.toString();\n }\n\n return `${formattedStartX} - ${formattedEndX}`;\n },\n [props.culture, useUTC, _dateFormatOptions, _xAxisType],\n );\n\n const _getCustomizedCallout = React.useCallback(() => {\n const defaultRender = (point?: GanttChartDataPoint): JSXElement | null => {\n return point ? (\n <ChartPopover\n isPopoverOpen={isPopoverOpen}\n clickPosition={clickPosition}\n XValue={point.yAxisCalloutData || point.y.toString()}\n legend={point.legend}\n YValue={point.xAxisCalloutData || _getFormattedXValue(point)}\n color={point.color}\n culture={props.culture}\n />\n ) : null;\n };\n\n return props.onRenderCalloutPerDataPoint\n ? props.onRenderCalloutPerDataPoint(calloutDataPoint, defaultRender)\n : null;\n //eslint-disable-next-line react-hooks/exhaustive-deps\n }, [_getFormattedXValue, calloutDataPoint, props.culture, props.onRenderCalloutPerDataPoint]);\n\n const _getAriaLabel = React.useCallback(\n (point: GanttChartDataPoint): string => {\n const xValue = point.xAxisCalloutData || _getFormattedXValue(point);\n const yValue = point.yAxisCalloutData || point.y;\n return (\n point.callOutAccessibilityData?.ariaLabel ||\n `${yValue}. ` + (point.legend ? `${point.legend}, ` : '') + `${xValue}.`\n );\n },\n [_getFormattedXValue],\n );\n\n const _getHighlightedLegend = React.useCallback(() => {\n return selectedLegends.length > 0 ? selectedLegends : hoveredLegend ? [hoveredLegend] : [];\n }, [hoveredLegend, selectedLegends]);\n\n /**\n * This function checks if the given legend is highlighted or not.\n * A legend can be highlighted in 2 ways:\n * 1. selection: if the user clicks on it\n * 2. hovering: if there is no selected legend and the user hovers over it\n */\n const _legendHighlighted = React.useCallback(\n (legend: string | undefined) => {\n return _getHighlightedLegend().includes(`${legend}`);\n },\n [_getHighlightedLegend],\n );\n\n /**\n * This function checks if none of the legends is selected or hovered.\n */\n const _noLegendHighlighted = React.useCallback(() => {\n return _getHighlightedLegend().length === 0;\n }, [_getHighlightedLegend]);\n\n const _showCallout = React.useCallback(\n (target: React.MouseEvent<SVGElement> | React.FocusEvent<SVGElement>, point: GanttChartDataPoint) => {\n if (!(_noLegendHighlighted() || _legendHighlighted(point.legend)) || _calloutAnchorPoint.current === point) {\n return;\n }\n if ('clientX' in target && 'clientY' in target) {\n updatePosition(target.clientX, target.clientY);\n } else {\n const rect = (target.target as SVGElement).getBoundingClientRect();\n updatePosition(rect.left, rect.top);\n }\n _calloutAnchorPoint.current = point;\n setPopoverOpen(true);\n setCalloutLegend(point.legend!);\n setCalloutColor(point.color!);\n setXCalloutValue(point.yAxisCalloutData || point.y.toString());\n setYCalloutValue(point.xAxisCalloutData! || _getFormattedXValue(point));\n setCalloutDataPoint(point);\n },\n [_getFormattedXValue, _legendHighlighted, _noLegendHighlighted],\n );\n\n const _onBarFocus = React.useCallback(\n (point: GanttChartDataPoint, focusEvent: React.FocusEvent<SVGElement>): void => {\n _showCallout(focusEvent, point);\n },\n [_showCallout],\n );\n\n const _onBarHover = React.useCallback(\n (point: GanttChartDataPoint, mouseEvent: React.MouseEvent<SVGElement>): void => {\n _showCallout(mouseEvent, point);\n },\n [_showCallout],\n );\n\n const _onBarLeave = React.useCallback((): void => {\n // do nothing\n }, []);\n\n const _handleChartMouseLeave = React.useCallback((): void => {\n _calloutAnchorPoint.current = null;\n setPopoverOpen(false);\n setCalloutLegend('');\n setCalloutColor('');\n setXCalloutValue('');\n setYCalloutValue('');\n setCalloutDataPoint(undefined);\n }, []);\n\n const _getBarHeight = React.useCallback(\n (adjustedValue: number): number => {\n let barHeight: number;\n if (typeof props.barHeight === 'number') {\n barHeight = props.barHeight;\n } else {\n barHeight = adjustedValue;\n }\n if (typeof maxBarHeight === 'number') {\n barHeight = Math.min(barHeight, maxBarHeight);\n }\n barHeight = Math.max(barHeight, MIN_BAR_HEIGHT);\n return barHeight;\n },\n [maxBarHeight, props.barHeight],\n );\n\n const _getOrderedDataPoints = React.useCallback(() => {\n const result: GanttChartDataPoint[] = [];\n\n const yValueToPoints: Record<string, GanttChartDataPoint[]> = {};\n _points.forEach(point => {\n if (!yValueToPoints[point.y]) {\n yValueToPoints[point.y] = [];\n }\n yValueToPoints[point.y].push(point);\n });\n\n for (let i = _yAxisLabels.length - 1; i >= 0; i--) {\n const yValue = _yAxisLabels[i];\n if (yValueToPoints[yValue]) {\n result.push(...yValueToPoints[yValue].sort((a, b) => +a.x.start - +b.x.start));\n }\n }\n\n return result;\n }, [_points, _yAxisLabels]);\n\n const _createBars = React.useCallback(\n ({\n xScale,\n yScalePrimary: yScale,\n }: {\n xScale: DateScale | NumberScale;\n yScalePrimary: NumberScale | StringScale;\n }): JSXElement => {\n const getGradientId = (legend: string | undefined) => {\n const legendId = _legendMap.current[`${legend}`].id;\n return `${legendId}_gradient`;\n };\n\n const gradientDefs: JSXElement[] = [];\n if (props.enableGradient) {\n Object.keys(_legendMap.current).forEach((legend: string, index: number) => {\n const { startColor, endColor } = _legendMap.current[legend];\n gradientDefs.push(\n <linearGradient key={index} id={getGradientId(legend)}>\n <stop offset=\"0\" stopColor={startColor} />\n <stop offset=\"100%\" stopColor={endColor} />\n </linearGradient>,\n );\n });\n }\n\n let scaleBandwidth = 0;\n if (_yAxisType === YAxisType.StringAxis) {\n scaleBandwidth = (yScale as StringScale).bandwidth();\n _barHeight.current = _getBarHeight(scaleBandwidth);\n }\n\n const points = _getOrderedDataPoints();\n const bars = points.map((point: GanttChartDataPoint, index: number) => {\n const rectStartX = xScale(point.x.start);\n const rectEndX = xScale(point.x.end);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const rectY = yScale(point.y as any)! + (scaleBandwidth - _barHeight.current) / 2;\n\n const shouldHighlight = _noLegendHighlighted() || _legendHighlighted(point.legend);\n\n return (\n <rect\n key={index}\n x={Math.min(rectStartX, rectEndX)}\n y={rectY}\n width={Math.abs(rectEndX - rectStartX)}\n height={_barHeight.current}\n rx={props.roundCorners ? 3 : 0}\n fill={props.enableGradient ? `url(#${getGradientId(point.legend)})` : point.color}\n opacity={shouldHighlight ? 1 : 0.1}\n onClick={point.onClick}\n onMouseOver={(event: React.MouseEvent<SVGElement>) => _onBarHover(point, event)}\n onMouseLeave={_onBarLeave}\n onFocus={(event: React.FocusEvent<SVGElement>) => _onBarFocus(point, event)}\n onBlur={_onBarLeave}\n tabIndex={shouldHighlight ? 0 : -1}\n role=\"img\"\n aria-label={_getAriaLabel(point)}\n />\n );\n });\n return (\n <g>\n {gradientDefs.length > 0 ? <defs>{gradientDefs}</defs> : null}\n {bars}\n </g>\n );\n },\n [\n _getAriaLabel,\n _getBarHeight,\n _getOrderedDataPoints,\n _legendHighlighted,\n _noLegendHighlighted,\n _onBarFocus,\n _onBarHover,\n _onBarLeave,\n _yAxisType,\n props.enableGradient,\n props.roundCorners,\n ],\n );\n\n const _onLegendHover = React.useCallback((legend: string): void => {\n setHoveredLegend(legend);\n }, []);\n\n const _onLegendLeave = React.useCallback((): void => {\n setHoveredLegend('');\n }, []);\n\n const _onLegendSelectionChange = React.useCallback(\n (_selectedLegends: string[], event: React.MouseEvent<HTMLButtonElement>, currentLegend?: Legend): void => {\n if (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 [props.legendProps],\n );\n\n const _getLegendData = React.useCallback((): JSXElement => {\n const actions: Legend[] = [];\n\n Object.keys(_legendMap.current).forEach((legendTitle: string) => {\n const legend: Legend = {\n title: legendTitle,\n color: _legendMap.current[legendTitle].startColor,\n hoverAction: () => {\n _handleChartMouseLeave();\n _onLegendHover(legendTitle);\n },\n onMouseOutAction: () => {\n _onLegendLeave();\n },\n };\n\n actions.push(legend);\n });\n\n const legends = (\n <Legends\n legends={actions}\n enabledWrapLines={props.enabledLegendsWrapLines}\n overflowText={props.legendsOverflowText}\n onChange={_onLegendSelectionChange}\n {...props.legendProps}\n legendRef={_legendsRef}\n />\n );\n return legends;\n }, [\n _handleChartMouseLeave,\n _onLegendHover,\n _onLegendLeave,\n _onLegendSelectionChange,\n props.enabledLegendsWrapLines,\n props.legendProps,\n props.legendsOverflowText,\n ]);\n\n const _getChartTitle = React.useCallback((): string => {\n return (props.chartTitle ? `${props.chartTitle}. ` : '') + `Gantt chart with ${_points.length} data points. `;\n }, [_points.length, props.chartTitle]);\n\n const _isChartEmpty = React.useCallback((): boolean => {\n return _points.length === 0;\n }, [_points.length]);\n\n const _getYDomainMargins = React.useCallback(\n (containerHeight: number): Margins => {\n let domainMargin = MIN_DOMAIN_MARGIN;\n\n const ySet = new Set<string | number>();\n _points.forEach((point: GanttChartDataPoint) => {\n ySet.add(point.y);\n });\n const uniqueY = Array.from(ySet);\n\n /** Total height available to render the bars */\n const totalHeight =\n containerHeight -\n (_margins.current.top! + MIN_DOMAIN_MARGIN) -\n (_margins.current.bottom! + MIN_DOMAIN_MARGIN);\n\n if (_yAxisType !== YAxisType.StringAxis) {\n _barHeight.current = _getBarHeight(\n calculateAppropriateBarWidth(uniqueY as number[] | Date[], totalHeight, _yAxisPadding),\n );\n domainMargin += _barHeight.current / 2;\n }\n\n return {\n ..._margins.current,\n top: _margins.current.top! + domainMargin,\n bottom: _margins.current.bottom! + domainMargin,\n };\n },\n [_getBarHeight, _points, _yAxisPadding, _yAxisType],\n );\n\n function updatePosition(newX: number, newY: number) {\n const threshold = 1; // Set a threshold for movement\n const { x, y } = clickPosition;\n // Calculate the distance moved\n const distance = Math.sqrt(Math.pow(newX - x, 2) + Math.pow(newY - y, 2));\n // Update the position only if the distance moved is greater than the threshold\n if (distance > threshold) {\n setClickPosition({ x: newX, y: newY });\n setPopoverOpen(true);\n }\n }\n\n if (!_isChartEmpty()) {\n _barHeight.current = _getBarHeight(DEFAULT_BAR_HEIGHT);\n\n const calloutProps: ChartPopoverProps = {\n isPopoverOpen,\n clickPosition,\n color: calloutColor,\n legend: calloutLegend,\n XValue: xCalloutValue,\n YValue: yCalloutValue,\n ...props.calloutProps,\n };\n const tickParams: ModifiedCartesianChartProps['tickParams'] = {\n tickValues: props.tickValues,\n tickFormat: props.tickFormat,\n };\n\n return (\n <CartesianChart\n {...props}\n yAxisPadding={_yAxisPadding}\n chartTitle={_getChartTitle()}\n points={_points}\n chartType={ChartTypes.GanttChart}\n xAxisType={_xAxisType}\n yAxisType={_yAxisType}\n componentRef={cartesianChartRef}\n stringDatasetForYAxisDomain={_yAxisLabels}\n calloutProps={calloutProps}\n tickParams={tickParams}\n legendBars={_getLegendData()}\n createYAxis={createYAxisForHorizontalBarChartWithAxis}\n getDomainNRangeValues={_getDomainNRangeValues}\n createStringYAxis={createStringYAxisForHorizontalBarChartWithAxis}\n getMinMaxOfYAxis={findHBCWANumericMinMaxOfY}\n customizedCallout={_getCustomizedCallout()}\n getmargins={_getMargins}\n getYDomainMargins={_getYDomainMargins}\n onChartMouseLeave={_handleChartMouseLeave}\n useUTC={useUTC}\n children={_createBars}\n />\n );\n } else {\n return (\n <div id={_emptyChartId} role={'alert'} style={{ opacity: '0' }} aria-label={'Graph has no data to display'} />\n );\n }\n },\n);\n\nGanttChart.displayName = 'GanttChart';\n"],"names":["React","max","d3Max","min","d3Min","useId","Legends","CartesianChart","ChartPopover","ChartTypes","YAxisType","XAxisTypes","getTypeOfAxis","getNextColor","findHBCWANumericMinMaxOfY","createYAxisForHorizontalBarChartWithAxis","createStringYAxisForHorizontalBarChartWithAxis","areArraysEqual","MIN_DOMAIN_MARGIN","sortAxisCategories","calculateAppropriateBarWidth","getColorFromToken","getScalePadding","getDateFormatLevel","useRtl","formatDateToLocaleString","getMultiLevelDateTimeFormatOptions","toImage","DEFAULT_BAR_HEIGHT","MIN_BAR_HEIGHT","GanttChart","forwardRef","useUTC","yAxisCategoryOrder","maxBarHeight","props","forwardedRef","_barHeight","useRef","_margins","_calloutAnchorPoint","_emptyChartId","_legendId","_legendMap","_prevProps","calloutColor","setCalloutColor","useState","hoveredLegend","setHoveredLegend","calloutLegend","setCalloutLegend","xCalloutValue","setXCalloutValue","yCalloutValue","setYCalloutValue","selectedLegends","setSelectedLegends","legendProps","calloutDataPoint","setCalloutDataPoint","clickPosition","setClickPosition","x","y","isPopoverOpen","setPopoverOpen","cartesianChartRef","_legendsRef","_isRTL","useEffect","current","useImperativeHandle","componentRef","chartContainer","opts","toSVG","_points","useMemo","colorIndex","data","map","point","legend","startColor","color","endColor","enableGradient","gradient","id","_xAxisType","length","start","DateAxis","_yAxisType","StringAxis","_yAxisPadding","yAxisPadding","undefined","_dateFormatOptions","lowestFormatLevel","highestFormatLevel","forEach","p","startFormatLevel","endFormatLevel","end","Math","_mapYValueToXValues","useCallback","yValueToXValues","push","_getOrderedYAxisLabels","Object","keys","sort","a","b","reverse","_yAxisLabels","_getDomainNRangeValues","points","margins","containerWidth","chartType","isRTL","xAxisType","barWidth","tickValues","shiftX","xValues","xMin","xMax","dStartValue","dEndValue","rStartValue","left","rEndValue","right","_getMargins","_getFormattedXValue","formattedStartX","formattedEndX","culture","toString","_getCustomizedCallout","defaultRender","XValue","yAxisCalloutData","YValue","xAxisCalloutData","onRenderCalloutPerDataPoint","_getAriaLabel","xValue","yValue","callOutAccessibilityData","ariaLabel","_getHighlightedLegend","_legendHighlighted","includes","_noLegendHighlighted","_showCallout","target","updatePosition","clientX","clientY","rect","getBoundingClientRect","top","_onBarFocus","focusEvent","_onBarHover","mouseEvent","_onBarLeave","_handleChartMouseLeave","_getBarHeight","adjustedValue","barHeight","_getOrderedDataPoints","result","yValueToPoints","i","_createBars","xScale","yScalePrimary","yScale","getGradientId","legendId","gradientDefs","index","linearGradient","key","stop","offset","stopColor","scaleBandwidth","bandwidth","bars","rectStartX","rectEndX","rectY","shouldHighlight","width","abs","height","rx","roundCorners","fill","opacity","onClick","onMouseOver","event","onMouseLeave","onFocus","onBlur","tabIndex","role","aria-label","g","defs","_onLegendHover","_onLegendLeave","_onLegendSelectionChange","_selectedLegends","currentLegend","canSelectMultipleLegends","slice","onChange","_getLegendData","actions","legendTitle","title","hoverAction","onMouseOutAction","legends","enabledWrapLines","enabledLegendsWrapLines","overflowText","legendsOverflowText","legendRef","_getChartTitle","chartTitle","_isChartEmpty","_getYDomainMargins","containerHeight","domainMargin","ySet","Set","add","uniqueY","Array","from","totalHeight","bottom","newX","newY","threshold","distance","sqrt","pow","calloutProps","tickParams","tickFormat","yAxisType","stringDatasetForYAxisDomain","legendBars","createYAxis","getDomainNRangeValues","createStringYAxis","getMinMaxOfYAxis","customizedCallout","getmargins","getYDomainMargins","onChartMouseLeave","children","div","style","displayName"],"mappings":";;;;+BAwCa8B;;;;;;;iEAxCU,QAAQ;yBACY,WAAW;gCAEhC,4BAA4B;uBAED,mBAAmB;wBAER,4BAA4B;8BAE3D,mCAAmC;wBAoBzD,wBAAwB;gCAC8C,4BAA4B;kCACjF,qCAAqC;AAM7D,MAAMF,qBAAqB;AAC3B,MAAMC,iBAAiB;AAEhB,mBAAMC,WAAAA,GAAuD9B,OAAM+B,UAAU,CAClF,CAAC,EAAEC,SAAS,IAAI,EAAEC,qBAAqB,SAAS,EAAEC,eAAe,EAAE,EAAE,GAAGC,OAAO,EAAEC;QAcRD;IAbvE,MAAME,aAAarC,OAAMsC,MAAM,CAASV;IACxC,MAAMW,WAAWvC,OAAMsC,MAAM,CAAU,CAAC;IACxC,MAAME,sBAAsBxC,OAAMsC,MAAM,CAA6B;IACrE,MAAMG,oBAAgBpC,qBAAAA,EAAM;IAC5B,MAAMqC,gBAAYrC,qBAAAA,EAAM;IACxB,MAAMsC,aAAa3C,OAAMsC,MAAM,CAAuE,CAAC;IACvG,MAAMM,aAAa5C,OAAMsC,MAAM,CAA2B,CAAC;IAE3D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;YACX6K,WAAWzK;YACXrB,cAAcN;YACdqM,6BAA6BjJ;YAC7B6I,cAAcA;YACdC,YAAYA;YACZI,YAAYrC;YACZsC,aAAa3P,gDAAAA;YACb4P,uBAAuBnJ;YACvBoJ,mBAAmB5P,sDAAAA;YACnB6P,kBAAkB/P,iCAAAA;YAClBgQ,mBAAmB7H;YACnB8H,YAAYpI;YACZqI,mBAAmB7B;YACnB8B,mBAAmBnG;YACnB9I,QAAQA;YACRkP,UAAU5F;;IAGhB,OAAO;QACL,OAAA,WAAA,GACE,OAAA,aAAA,CAAC6F,OAAAA;YAAI1L,IAAIhD;YAAe+K,MAAM;YAAS4D,OAAO;gBAAEpE,SAAS;YAAI;YAAGS,cAAY;;IAEhF;AACF,GACA;AAEF3L,WAAWuP,WAAW,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useGanttChartStyles.styles.js"],"sourcesContent":["/**\n * @internal\n */ export const ganttClassNames = {\n root: '',\n xAxis: '',\n yAxis: '',\n legendContainer: '',\n hover: '',\n descriptionMessage: '',\n tooltip: '',\n axisTitle: '',\n chartTitle: '',\n opacityChangeOnHover: '',\n shapeStyles: '',\n chartWrapper: '',\n svgTooltip: '',\n chart: ''\n};\n/**\n * Apply styling to the GanttChart component\n */ export const useGanttChartStyles = (props)=>{\n return {};\n};\n"],"names":["ganttClassNames","root","xAxis","yAxis","legendContainer","hover","descriptionMessage","tooltip","axisTitle","chartTitle","opacityChangeOnHover","shapeStyles","chartWrapper","svgTooltip","chart","useGanttChartStyles","props"],"mappings":"AAAA;;CAEA,EAAI;;;;;;;;;;;mBAA4B;;;
|
|
1
|
+
{"version":3,"sources":["useGanttChartStyles.styles.js"],"sourcesContent":["/**\n * @internal\n */ export const ganttClassNames = {\n root: '',\n xAxis: '',\n yAxis: '',\n legendContainer: '',\n hover: '',\n descriptionMessage: '',\n tooltip: '',\n axisTitle: '',\n chartTitle: '',\n opacityChangeOnHover: '',\n shapeStyles: '',\n chartWrapper: '',\n svgTooltip: '',\n chart: '',\n axisAnnotation: ''\n};\n/**\n * Apply styling to the GanttChart component\n */ export const useGanttChartStyles = (props)=>{\n return {};\n};\n"],"names":["ganttClassNames","root","xAxis","yAxis","legendContainer","hover","descriptionMessage","tooltip","axisTitle","chartTitle","opacityChangeOnHover","shapeStyles","chartWrapper","svgTooltip","chart","axisAnnotation","useGanttChartStyles","props"],"mappings":"AAAA;;CAEA,EAAI;;;;;;;;;;;mBAA4B;;;uBAmBI;;;;AAnBzB,MAAMA,kBAAkB;IAC/BC,IAAI,EAAE,EAAE;IACRC,KAAK,EAAE,EAAE;IACTC,KAAK,EAAE,EAAE;IACTC,eAAe,EAAE,EAAE;IACnBC,KAAK,EAAE,EAAE;IACTC,kBAAkB,EAAE,EAAE;IACtBC,OAAO,EAAE,EAAE;IACXC,SAAS,EAAE,EAAE;IACbC,UAAU,EAAE,EAAE;IACdC,oBAAoB,EAAE,EAAE;IACxBC,WAAW,EAAE,EAAE;IACfC,YAAY,EAAE,EAAE;IAChBC,UAAU,EAAE,EAAE;IACdC,KAAK,EAAE,EAAE;IACTC,cAAc,EAAE;AACpB,CAAC;AAGU,MAAMC,uBAAuBC,KAAK,IAAG;IAC5C,OAAO,CAAC,CAAC;AACb,CAAC"}
|