@fluentui/react-charts 0.0.0-nightly-20251212-0406.1 → 0.0.0-nightly-20251216-0407.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -13
- package/dist/index.d.ts +18 -0
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js +20 -18
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
- package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +7 -1
- package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -1
- package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +7 -1
- package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.js +8 -1
- package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +165 -19
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +15 -0
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib/components/LineChart/LineChart.js +5 -1
- package/lib/components/LineChart/LineChart.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.js +11 -1
- package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.js +12 -5
- package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +13 -4
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib/types/DataPoint.js.map +1 -1
- package/lib/utilities/utilities.js +2 -2
- package/lib/utilities/utilities.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js +20 -18
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +7 -1
- package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +7 -1
- package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +8 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +165 -18
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +15 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.js +5 -1
- package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.js +11 -1
- 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/VerticalBarChart/VerticalBarChart.js +12 -5
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +13 -4
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib-commonjs/types/DataPoint.js.map +1 -1
- package/lib-commonjs/utilities/utilities.js +2 -2
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +12 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/CommonComponents/CartesianChart.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport { ModifiedCartesianChartProps } from '../../index';\nimport { useCartesianChartStyles } from './useCartesianChartStyles.styles';\nimport { select as d3Select } from 'd3-selection';\nimport {\n createNumericXAxis,\n createStringXAxis,\n IAxisData,\n createDateXAxis,\n IMargins,\n XAxisTypes,\n YAxisType,\n createWrapOfXLabels,\n rotateXAxisLabels,\n calculateLongestLabelWidth,\n createYAxisLabels,\n ChartTypes,\n wrapContent,\n useRtl,\n truncateString,\n tooltipOfAxislabels,\n getSecureProps,\n DEFAULT_WRAP_WIDTH,\n} from '../../utilities/index';\nimport { useId } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport { SVGTooltipText, SVGTooltipTextProps } from '../../utilities/SVGTooltipText';\nimport { ChartAnnotationLayer } from './Annotations/ChartAnnotationLayer';\nimport { ChartAnnotationContext } from './Annotations/ChartAnnotationLayer.types';\nimport { ChartPopover } from './ChartPopover';\nimport { useFocusableGroup, useArrowNavigationGroup } from '@fluentui/react-tabster';\n\nconst HORIZONTAL_MARGIN_FOR_YAXIS_TITLE = 24;\nconst VERTICAL_MARGIN_FOR_XAXIS_TITLE = 20;\nconst AXIS_TITLE_PADDING = 8;\nconst DEFAULT_MARGIN_WITH_TICKS = 40;\nconst DEFAULT_MARGIN_NO_TICKS = 20;\n\n/**\n * Cartesian Chart component\n * {@docCategory CartesianChart}\n */\nexport const CartesianChart: React.FunctionComponent<ModifiedCartesianChartProps> = React.forwardRef<\n HTMLDivElement,\n ModifiedCartesianChartProps\n>(({ hideTickOverlap = true, ...props }, forwardedRef) => {\n const chartContainer = React.useRef<HTMLDivElement | null>(null);\n let legendContainer: HTMLDivElement;\n const minLegendContainerHeight: number = 40;\n const xAxisElement = React.useRef<SVGSVGElement | null>(null);\n const yAxisElement = React.useRef<SVGSVGElement | null>(null);\n const yAxisElementSecondary = React.useRef<SVGSVGElement | null>(null);\n let margins: IMargins;\n const idForGraph: string = 'chart_';\n let _reqID: number | undefined;\n const _useRtl: boolean = useRtl();\n let _tickValues: (string | number)[];\n const _isFirstRender = React.useRef<boolean>(true);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let _xScale: any;\n const isIntegralDataset = React.useMemo(() => {\n return !props.points.some((point: { y: number }) => point.y % 1 !== 0);\n }, [props.points]);\n let _tooltipId: string = useId('tooltip_');\n /* Used for when WrapXAxisLabels props appeared.\n * To display the total word (space separated words), Need to have more space than usual.\n * This height will get total height need to disaply total word.\n * These value need to be removed from actual svg height/graph height.\n * Defalut value is 0. And this values calculted when 'wrapXAxisLables' or 'showXAxisLablesTooltip' is true.\n */\n let _removalValueForTextTuncate: number = 0;\n const _yAxisTickText = React.useRef<string[]>([]);\n\n const [containerWidth, setContainerWidth] = React.useState<number>(0);\n const [containerHeight, setContainerHeight] = React.useState<number>(0);\n const [startFromX, setStartFromX] = React.useState<number>(0);\n const prevWidthRef = React.useRef<number | undefined>(undefined);\n const prevHeightRef = React.useRef<number | undefined>(undefined);\n\n const classes = useCartesianChartStyles(props);\n const focusAttributes = useFocusableGroup();\n const arrowAttributes = useArrowNavigationGroup({ axis: 'horizontal' });\n // ComponentdidMount and Componentwillunmount logic\n React.useEffect(() => {\n _fitParentContainer();\n if (props.showYAxisLables) {\n const maxYAxisLabelLength = calculateMaxYAxisLabelLength(classes.yAxis!);\n if (startFromX !== maxYAxisLabelLength) {\n setStartFromX(maxYAxisLabelLength);\n }\n } else if (startFromX !== 0) {\n setStartFromX(0);\n }\n return () => {\n if (_reqID !== undefined) {\n cancelAnimationFrame(_reqID);\n }\n };\n }, [props]);\n\n // ComponentDidUpdate logic\n React.useEffect(() => {\n // Check if height or width changed\n if (\n prevWidthRef.current !== undefined &&\n prevHeightRef.current !== undefined &&\n (prevWidthRef.current !== props.width || prevHeightRef.current !== props.height)\n ) {\n _fitParentContainer();\n }\n // Update refs with current values\n prevWidthRef.current = props.width;\n prevHeightRef.current = props.height;\n\n if (props.showYAxisLables) {\n const maxYAxisLabelLength = calculateMaxYAxisLabelLength(classes.yAxis!);\n if (startFromX !== maxYAxisLabelLength) {\n setStartFromX(maxYAxisLabelLength);\n }\n } else if (startFromX !== 0) {\n setStartFromX(0);\n }\n }, [props.width, props.height, props.chartType, props.showYAxisLables, props.yAxisType]);\n\n React.useImperativeHandle(\n props.componentRef,\n () => ({\n chartContainer: chartContainer.current ?? null,\n }),\n [],\n );\n\n /**\n * Dedicated function to return the Callout JSX Element , which can further be used to only call this when\n * only the calloutprops and charthover props changes.\n * @param calloutProps\n * @param chartHoverProps\n * @returns\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n function _generateCallout(calloutProps: any): JSXElement {\n return <ChartPopover {...calloutProps} />;\n }\n\n function calculateMaxYAxisLabelLength(className: string): number {\n const formatTickLabel = (str: string) => {\n if (props.showYAxisLablesTooltip) {\n return truncateString(str, props.noOfCharsToTruncate || 4);\n }\n\n return str;\n };\n return calculateLongestLabelWidth(\n _yAxisTickText.current.map(label => formatTickLabel(label)),\n `.${className} text`,\n );\n }\n\n const {\n calloutProps,\n points,\n chartType,\n svgProps,\n culture,\n dateLocalizeOptions,\n timeFormatLocale,\n customDateTimeFormatter,\n } = props;\n if (props.parentRef) {\n _fitParentContainer();\n }\n\n margins = _calcMargins();\n // Callback for margins to the chart\n props.getmargins && props.getmargins(margins);\n\n let callout: JSXElement | null = null;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let yScalePrimary: any;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let yScaleSecondary: any;\n\n let children = null;\n if ((props.enableFirstRenderOptimization && chartContainer.current) || !props.enableFirstRenderOptimization) {\n _isFirstRender.current = false;\n const XAxisParams = {\n domainNRangeValues: props.getDomainNRangeValues(\n points,\n props.getDomainMargins ? props.getDomainMargins(containerWidth) : margins,\n containerWidth,\n chartType,\n _useRtl,\n props.xAxisType,\n props.barwidth!,\n props.tickValues!,\n ),\n // FIXME: In XAxisParams, containerHeight is used by HBWA to generate vertical gridlines.\n // Since the x-axis in HBWA is numeric, it typically doesn't require transformation.\n // However, if transformation props are enabled, the updated _removalValueForTextTuncate\n // will only be available in the next render, as it's set after the axis is created.\n // Solution: Delay the creation of gridlines until after the transformation has been applied,\n // or precompute the required height for transformed labels (_removalValueForTextTuncate).\n containerHeight: containerHeight - _removalValueForTextTuncate,\n margins: margins,\n xAxisElement: xAxisElement.current!,\n showRoundOffXTickValues: props.showRoundOffXTickValues ?? true,\n xAxisCount: props.xAxisTickCount,\n xAxistickSize: props.xAxistickSize,\n tickPadding: props.tickPadding || props.showXAxisLablesTooltip ? 5 : 10,\n xAxisPadding: props.xAxisPadding,\n xAxisInnerPadding: props.xAxisInnerPadding,\n xAxisOuterPadding: props.xAxisOuterPadding,\n containerWidth: containerWidth,\n hideTickOverlap: props.rotateXAxisLables ? false : hideTickOverlap,\n calcMaxLabelWidth: _calcMaxLabelWidthWithTransform,\n xMinValue: props.xMinValue,\n xMaxValue: props.xMaxValue,\n ...props.xAxis,\n };\n\n /**\n * These scales used for 2 purposes.\n * 1. To create x and y axis\n * 2. To draw the graph.\n * For area/line chart using same scales. For other charts, creating their own scales to draw the graph.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let xScale: any;\n let tickValues: (string | number)[];\n switch (props.xAxisType!) {\n case XAxisTypes.NumericAxis:\n ({ xScale, tickValues } = createNumericXAxis(\n XAxisParams,\n props.tickParams!,\n props.chartType,\n culture,\n props.xScaleType,\n _useRtl,\n ));\n break;\n case XAxisTypes.DateAxis:\n ({ xScale, tickValues } = createDateXAxis(\n XAxisParams,\n props.tickParams!,\n culture,\n dateLocalizeOptions,\n timeFormatLocale,\n customDateTimeFormatter,\n props.useUTC,\n props.chartType,\n ));\n break;\n case XAxisTypes.StringAxis:\n ({ xScale, tickValues } = createStringXAxis(\n XAxisParams,\n props.tickParams!,\n props.datasetForXAxisDomain!,\n culture,\n _useRtl,\n ));\n break;\n default:\n ({ xScale, tickValues } = createNumericXAxis(\n XAxisParams,\n props.tickParams!,\n props.chartType,\n culture,\n props.xScaleType,\n _useRtl,\n ));\n }\n _xScale = xScale;\n _tickValues = tickValues;\n\n _transformXAxisLabels();\n\n const YAxisParams = {\n margins: props.getYDomainMargins ? props.getYDomainMargins(containerHeight) : margins,\n containerWidth: containerWidth,\n containerHeight: containerHeight - _removalValueForTextTuncate,\n yAxisElement: yAxisElement.current!,\n yAxisTickFormat: props.yAxisTickFormat!,\n yAxisTickCount: props.yAxisTickCount!,\n yMinValue: props.yMinValue || 0,\n yMaxValue: props.yMaxValue || 0,\n tickPadding: 10,\n maxOfYVal: props.maxOfYVal,\n yMinMaxValues: props.getMinMaxOfYAxis(points, props.yAxisType),\n // please note these padding default values must be consistent in here\n // and the parent chart(HBWA/Vertical etc..) for more details refer example\n // http://using-d3js.com/04_07_ordinal_scales.html\n yAxisPadding: props.yAxisPadding || 0,\n tickValues: props.yAxisTickValues,\n ...props.yAxis,\n };\n /**\n * These scales used for 2 purposes.\n * 1. To create x and y axis\n * 2. To draw the graph.\n * For area/line chart using same scales. For other charts, creating their own scales to draw the graph.\n */\n const axisData: IAxisData = { yAxisDomainValues: [], yAxisTickText: [] };\n if (props.yAxisType && props.yAxisType === YAxisType.StringAxis) {\n yScalePrimary = props.createStringYAxis(\n YAxisParams,\n props.stringDatasetForYAxisDomain!,\n _useRtl,\n axisData,\n props.barwidth,\n props.chartType,\n );\n } else {\n // TODO: Since the scale domain values are now computed independently for both the primary and\n // secondary y-axes, the yMinValue and yMaxValue props are no longer necessary for accurately\n // rendering the secondary y-axis. Therefore, rather than checking the secondaryYScaleOptions\n // prop to determine whether to create a secondary y-axis, it's more appropriate to check if any\n // data points are assigned to use the secondary y-scale.\n if (props?.secondaryYScaleOptions) {\n const YAxisParamsSecondary = {\n margins: margins,\n containerWidth: containerWidth,\n containerHeight: containerHeight - _removalValueForTextTuncate!,\n yAxisElement: yAxisElementSecondary.current,\n yAxisTickFormat: props.yAxisTickFormat!,\n yAxisTickCount: props.yAxisTickCount!,\n yMinValue: props.secondaryYScaleOptions?.yMinValue || 0,\n yMaxValue: props.secondaryYScaleOptions?.yMaxValue ?? 100,\n tickPadding: 10,\n yMinMaxValues: props.getMinMaxOfYAxis(points, props.yAxisType, true),\n yAxisPadding: props.yAxisPadding,\n };\n\n yScaleSecondary = props.createYAxis(\n YAxisParamsSecondary,\n _useRtl,\n axisData,\n isIntegralDataset,\n chartType,\n true,\n props.roundedTicks!,\n props.secondaryYScaleType,\n _useRtl,\n );\n }\n yScalePrimary = props.createYAxis(\n YAxisParams,\n _useRtl,\n axisData,\n isIntegralDataset,\n chartType,\n false,\n props.roundedTicks!,\n props.yScaleType,\n _useRtl,\n );\n }\n _yAxisTickText.current = axisData.yAxisTickText;\n props.getAxisData && props.getAxisData(axisData);\n\n // Removing un wanted tooltip div from DOM, when prop not provided, for proper cleanup\n // of unwanted DOM elements, to prevent flacky behaviour in tooltips , that might occur\n // in creating tooltips when tooltips are enabled( as we try to recreate a tspan with _tooltipId)\n if (!props.showYAxisLablesTooltip) {\n try {\n document.getElementById(_tooltipId) && document.getElementById(_tooltipId)!.remove();\n //eslint-disable-next-line no-empty\n } catch (e) {}\n }\n // Used to display tooltip at y axis labels.\n if (props.showYAxisLablesTooltip) {\n // To create y axis tick values by if specified truncating the rest of the text\n // and showing elipsis or showing the whole string,\n yScalePrimary &&\n // Note: This function should be invoked within the showYAxisLablesTooltip check,\n // as its sole purpose is to truncate labels that exceed the noOfCharsToTruncate limit.\n createYAxisLabels(\n yAxisElement.current!,\n yScalePrimary,\n props.noOfCharsToTruncate || 4,\n props.showYAxisLablesTooltip || false,\n _useRtl,\n );\n const _yAxisElement = d3Select(yAxisElement.current!).call(yScalePrimary);\n try {\n document.getElementById(_tooltipId) && document.getElementById(_tooltipId)!.remove();\n //eslint-disable-next-line no-empty\n } catch (e) {}\n const ytooltipProps = {\n tooltipCls: classes.tooltip!,\n id: _tooltipId,\n axis: _yAxisElement,\n };\n _yAxisElement && tooltipOfAxislabels(ytooltipProps);\n }\n\n // Call back to the chart.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const _getData = (xScale: any, yScalePrimary: any, yScaleSecondary: any) => {\n props.getGraphData &&\n props.getGraphData(\n xScale,\n yScalePrimary,\n containerHeight - _removalValueForTextTuncate!,\n containerWidth,\n xAxisElement.current,\n yAxisElement.current,\n yScaleSecondary,\n );\n };\n\n // Callback function for chart, returns axis\n _getData(xScale, yScalePrimary, yScaleSecondary);\n\n children = props.children({\n xScale,\n yScalePrimary,\n yScaleSecondary,\n containerHeight,\n containerWidth,\n });\n\n if (!props.hideTooltip && calloutProps!.isPopoverOpen) {\n callout = _generateCallout(calloutProps);\n }\n }\n const svgDimensions = {\n width: containerWidth,\n height: containerHeight,\n };\n\n const plotWidth = Math.max(0, svgDimensions.width - margins.left! - margins.right!);\n const plotHeight = Math.max(0, svgDimensions.height - margins.top! - margins.bottom! - _removalValueForTextTuncate);\n\n const plotRect = {\n x: margins.left!,\n y: margins.top!,\n width: plotWidth,\n height: plotHeight,\n };\n\n const annotations = props.annotations ?? [];\n const hasAnnotations = annotations.length > 0;\n const annotationContext: ChartAnnotationContext | undefined = hasAnnotations\n ? {\n plotRect,\n svgRect: svgDimensions,\n isRtl: _useRtl,\n xScale: _xScale,\n yScalePrimary,\n yScaleSecondary,\n }\n : undefined;\n\n const xAxisTitleMaxWidth = svgDimensions.width - margins.left! - margins.right! - AXIS_TITLE_PADDING * 2;\n const yAxisTitleMaxHeight =\n svgDimensions.height - margins.bottom! - margins.top! - _removalValueForTextTuncate! - AXIS_TITLE_PADDING * 2;\n const yAxisTitleCenterY = margins.top! + AXIS_TITLE_PADDING + yAxisTitleMaxHeight / 2;\n const yAxisTitleCenterX = _useRtl\n ? svgDimensions.width - AXIS_TITLE_PADDING\n : HORIZONTAL_MARGIN_FOR_YAXIS_TITLE - AXIS_TITLE_PADDING;\n const secondaryYAxisTitleCenterX = _useRtl\n ? HORIZONTAL_MARGIN_FOR_YAXIS_TITLE - AXIS_TITLE_PADDING\n : svgDimensions.width - AXIS_TITLE_PADDING;\n\n const commonSvgToolTipProps: SVGTooltipTextProps = {\n wrapContent,\n showBackground: true,\n className: classes.svgTooltip,\n content: '',\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 && getComputedStyle(legendContainer);\n legendContainerHeight =\n ((legendContainer && legendContainer.getBoundingClientRect().height) || minLegendContainerHeight) +\n parseFloat((legendContainerComputedStyles && legendContainerComputedStyles.marginTop) || '0') +\n parseFloat((legendContainerComputedStyles && legendContainerComputedStyles.marginBottom) || '0');\n }\n if (props.parentRef || chartContainer.current) {\n const container = props.parentRef ? props.parentRef : chartContainer.current!;\n const currentContainerWidth =\n props.reflowProps?.mode === 'min-width' && !_isFirstRender.current\n ? Math.max(container.getBoundingClientRect().width, _calculateChartMinWidth())\n : container.getBoundingClientRect().width;\n const currentContainerHeight =\n container.getBoundingClientRect().height > legendContainerHeight\n ? container.getBoundingClientRect().height\n : 350;\n const shouldResize =\n containerWidth !== currentContainerWidth || containerHeight !== currentContainerHeight - legendContainerHeight;\n if (shouldResize) {\n setContainerWidth(currentContainerWidth);\n setContainerHeight(currentContainerHeight - legendContainerHeight);\n }\n }\n //});\n }\n\n function _onChartLeave(): void {\n props.onChartMouseLeave && props.onChartMouseLeave();\n }\n\n function _calculateChartMinWidth(): number {\n // Adding 10px for padding on both sides\n const labelWidth = _calcMaxLabelWidthWithTransform(_tickValues) + 10;\n\n let minChartWidth = margins.left! + margins.right! + labelWidth * (_tickValues.length - 1);\n\n if (\n [ChartTypes.GroupedVerticalBarChart, ChartTypes.VerticalBarChart, ChartTypes.VerticalStackedBarChart].includes(\n props.chartType,\n )\n ) {\n const minDomainMargin = 8;\n minChartWidth += minDomainMargin * 2;\n }\n\n return minChartWidth;\n }\n\n function _calcMaxLabelWidthWithTransform(x: (string | number)[]) {\n // Case: rotated labels\n if (!props.wrapXAxisLables && props.rotateXAxisLables && props.xAxisType! === XAxisTypes.StringAxis) {\n const longestLabelWidth = calculateLongestLabelWidth(x, `.${classes.xAxis} text`);\n return Math.ceil(longestLabelWidth * Math.cos(Math.PI / 4));\n }\n\n // Case: truncated labels\n if (props.showXAxisLablesTooltip) {\n const tickValues = x.map(val => {\n const numChars = props.noOfCharsToTruncate || 4;\n return val.toString().length > numChars ? `${val.toString().slice(0, numChars)}...` : val;\n });\n\n const longestLabelWidth = calculateLongestLabelWidth(tickValues, `.${classes.xAxis} text`);\n return Math.ceil(longestLabelWidth);\n }\n\n // Case: wrapped labels\n if (props.wrapXAxisLables) {\n // FIXME: Calculate the max width of lines instead of words. This requires applying\n // the wrapping transformation earlier to obtain the actual rendered lines.\n const words: string[] = [];\n x.forEach((val: string) => {\n words.push(...val.toString().split(/\\s+/));\n });\n\n // This approach works well in most cases, since overflow typically occurs only when\n // a single word exceeds the specified width — otherwise, the text will wrap as expected.\n const longestLabelWidth = calculateLongestLabelWidth(words, `.${classes.xAxis} text`);\n return Math.max(Math.ceil(longestLabelWidth), DEFAULT_WRAP_WIDTH);\n }\n\n // Default case\n const longestLabelWidth = calculateLongestLabelWidth(x, `.${classes.xAxis} text`);\n return Math.ceil(longestLabelWidth);\n }\n\n function _transformXAxisLabels() {\n _removalValueForTextTuncate = 0;\n\n /*\n * To enable wrapping of x axis tick values or to display complete x axis tick values,\n * we need to calculate how much space it needed to render the text.\n * No need to re-calculate every time the chart renders and same time need to get an update. So using setState.\n * Required space will be calculated first time chart rendering and if any width/height of chart updated.\n * */\n if (props.wrapXAxisLables || props.showXAxisLablesTooltip) {\n let maxXAxisLabelWidth: number | undefined;\n if (props.xAxisType === XAxisTypes.StringAxis) {\n if ((props.datasetForXAxisDomain?.length || 0) > 1) {\n maxXAxisLabelWidth = _xScale.step();\n } else {\n maxXAxisLabelWidth = containerWidth;\n }\n }\n\n const wrapLabelProps = {\n node: xAxisElement.current!,\n xAxis: _xScale,\n showXAxisLablesTooltip: props.showXAxisLablesTooltip || false,\n noOfCharsToTruncate: props.noOfCharsToTruncate || 4,\n width: maxXAxisLabelWidth,\n };\n _removalValueForTextTuncate = createWrapOfXLabels(wrapLabelProps) ?? 0;\n }\n\n if (!props.wrapXAxisLables && props.rotateXAxisLables && props.xAxisType! === XAxisTypes.StringAxis) {\n const rotateLabelProps = {\n node: xAxisElement.current!,\n xAxis: _xScale,\n };\n const rotatedHeight = rotateXAxisLabels(rotateLabelProps) ?? 0;\n // margins.bottom is used as padding here\n _removalValueForTextTuncate = rotatedHeight + margins.bottom!;\n }\n }\n\n function _calcMargins(): IMargins {\n let _margins = _getDefaultMargins();\n\n _margins = _applyTitleMargins(_margins);\n _margins = _applyAnnotationMargins(_margins);\n\n if (_useRtl) {\n _margins = _swapRtlMargins(_margins);\n }\n\n return {\n ..._margins,\n ...props.margins,\n };\n }\n\n function _getDefaultMargins(): IMargins {\n return {\n top: DEFAULT_MARGIN_NO_TICKS,\n // Smaller than the default because it is based on the line height rather than\n // the length of the tick labels.\n bottom: DEFAULT_MARGIN_WITH_TICKS - 5,\n // For the actual margin, add the tick size, tick padding, and some extra space to\n // the width of the longest yaxis tick label (startFromX).\n left: Math.max(DEFAULT_MARGIN_WITH_TICKS, startFromX + 20),\n right: props.secondaryYScaleOptions ? DEFAULT_MARGIN_WITH_TICKS : DEFAULT_MARGIN_NO_TICKS,\n };\n }\n\n function _applyTitleMargins(_margins: IMargins): IMargins {\n const updated = { ..._margins };\n if (props.xAxisTitle !== undefined && props.xAxisTitle !== '') {\n updated.bottom! += VERTICAL_MARGIN_FOR_XAXIS_TITLE;\n }\n if (props.yAxisTitle !== undefined && props.yAxisTitle !== '') {\n updated.left! += HORIZONTAL_MARGIN_FOR_YAXIS_TITLE;\n }\n if (props.secondaryYAxistitle !== undefined && props.secondaryYAxistitle !== '') {\n updated.right! += HORIZONTAL_MARGIN_FOR_YAXIS_TITLE;\n }\n return updated;\n }\n\n function _applyAnnotationMargins(_margins: IMargins): IMargins {\n const updated = { ..._margins };\n if (props.xAxisAnnotation !== undefined && props.xAxisAnnotation !== '') {\n updated.top! += VERTICAL_MARGIN_FOR_XAXIS_TITLE;\n }\n if (\n props.yAxisAnnotation !== undefined &&\n props.yAxisAnnotation !== '' &&\n (props.secondaryYAxistitle === undefined || props.secondaryYAxistitle === '')\n ) {\n updated.right! += HORIZONTAL_MARGIN_FOR_YAXIS_TITLE;\n }\n return updated;\n }\n\n function _swapRtlMargins(_margins: IMargins): IMargins {\n return {\n ..._margins,\n left: _margins.right,\n right: _margins.left,\n };\n }\n\n /**\n * We have use the {@link defaultTabbableElement } to fix\n * the Focus not landing on chart while tabbing, instead goes to legend.\n * This issue is observed in Area, line chart after performance optimization done in the PR {@link https://github.com/microsoft/fluentui/pull/27721 }\n * This issue is observed in Bar charts after the changes done by FocusZone team in the PR: {@link https://github.com/microsoft/fluentui/pull/24175 }\n * The issue in Bar Charts(VB and VSB) is due to a {@link FocusZone } update where previously an event listener was\n * attached on keydown to the window, so that whenever the tab key is pressed all outer FocusZone's\n * tab-indexes are updated (an outer FocusZone is a FocusZone that is not within another one).\n * But now after the above PR : they are attaching the\n * listeners to the FocusZone elements instead of the window. So in the first render cycle in Bar charts\n * bars are not created as in the first render cycle the size of the chart container is not known( or is 0)\n * which creates bars of height 0 so instead we do not create any bars and instead return empty fragments.\n *\n * We have tried 2 Approaches to fix the issue:\n * 1. Using the {@link elementRef} property of FocusZone where we dispatch event for tab keydown\n * after the second render cycle which triggers an update of the tab index in FocusZone.\n * But this is a hacky solution and not a proper fix and also elementRef is deprecated.\n * 2. Using the default tabbable element to fix the issue.\n */\n\n return (\n <div\n id={idForGraph}\n className={classes.root}\n role={'presentation'}\n ref={(rootElem: HTMLDivElement) => {\n chartContainer.current = rootElem;\n }}\n onMouseLeave={_onChartLeave}\n >\n <div className={classes.chartWrapper} {...focusAttributes} {...arrowAttributes}>\n {_isFirstRender.current}\n <svg\n width={svgDimensions.width}\n height={svgDimensions.height}\n aria-label={props.chartTitle}\n style={{ display: 'block' }}\n className={classes.chart}\n {...getSecureProps(svgProps)}\n >\n <g\n ref={(e: SVGSVGElement | null) => {\n xAxisElement.current = e!;\n }}\n id={`xAxisGElement${idForGraph}`}\n // To add wrap of x axis lables feature, need to remove word height from svg height.\n transform={`translate(0, ${svgDimensions.height - margins.bottom! - _removalValueForTextTuncate!})`}\n className={classes.xAxis}\n />\n {props.xAxisTitle !== undefined && props.xAxisTitle !== '' && (\n <SVGTooltipText\n {...commonSvgToolTipProps}\n content={props.xAxisTitle}\n textProps={{\n x: margins.left! + AXIS_TITLE_PADDING + xAxisTitleMaxWidth / 2,\n y: svgDimensions.height - AXIS_TITLE_PADDING,\n className: classes.axisTitle!,\n textAnchor: 'middle',\n }}\n maxWidth={xAxisTitleMaxWidth}\n />\n )}\n {props.xAxisAnnotation !== undefined && props.xAxisAnnotation !== '' && (\n <SVGTooltipText\n {...commonSvgToolTipProps}\n content={props.xAxisAnnotation}\n textProps={{\n x: margins.left! + AXIS_TITLE_PADDING + xAxisTitleMaxWidth / 2,\n y: VERTICAL_MARGIN_FOR_XAXIS_TITLE - AXIS_TITLE_PADDING,\n className: classes.axisAnnotation!,\n textAnchor: 'middle',\n 'aria-hidden': true,\n }}\n maxWidth={xAxisTitleMaxWidth}\n />\n )}\n <g\n ref={(e: SVGSVGElement | null) => {\n yAxisElement.current = e!;\n }}\n id={`yAxisGElement${idForGraph}`}\n transform={`translate(${_useRtl ? svgDimensions.width - margins.right! : margins.left!}, 0)`}\n className={classes.yAxis}\n />\n {props.secondaryYScaleOptions && (\n <g>\n <g\n ref={(e: SVGSVGElement | null) => {\n yAxisElementSecondary.current = e!;\n }}\n id={`yAxisGElementSecondary${idForGraph}`}\n transform={`translate(${_useRtl ? margins.left! : svgDimensions.width - margins.right!}, 0)`}\n className={classes.yAxis}\n />\n {props.secondaryYAxistitle !== undefined && props.secondaryYAxistitle !== '' && (\n <SVGTooltipText\n {...commonSvgToolTipProps}\n content={props.secondaryYAxistitle}\n textProps={{\n x: secondaryYAxisTitleCenterX,\n y: yAxisTitleCenterY,\n textAnchor: 'middle',\n transform: `rotate(-90, ${secondaryYAxisTitleCenterX}, ${yAxisTitleCenterY})`,\n className: classes.axisTitle!,\n }}\n maxWidth={yAxisTitleMaxHeight}\n />\n )}\n </g>\n )}\n {children}\n {props.yAxisTitle !== undefined && props.yAxisTitle !== '' && (\n <SVGTooltipText\n {...commonSvgToolTipProps}\n content={props.yAxisTitle}\n textProps={{\n x: yAxisTitleCenterX,\n y: yAxisTitleCenterY,\n textAnchor: 'middle',\n transform: `rotate(-90, ${yAxisTitleCenterX}, ${yAxisTitleCenterY})`,\n className: classes.axisTitle!,\n }}\n maxWidth={yAxisTitleMaxHeight}\n />\n )}\n {props.yAxisAnnotation !== undefined &&\n props.yAxisAnnotation !== '' &&\n (props.secondaryYAxistitle === undefined || props.secondaryYAxistitle === '') && (\n <SVGTooltipText\n {...commonSvgToolTipProps}\n content={props.yAxisAnnotation}\n textProps={{\n x: secondaryYAxisTitleCenterX,\n y: yAxisTitleCenterY,\n textAnchor: 'middle',\n transform: `rotate(-90, ${secondaryYAxisTitleCenterX}, ${yAxisTitleCenterY})`,\n className: classes.axisAnnotation!,\n 'aria-hidden': true,\n }}\n maxWidth={yAxisTitleMaxHeight}\n />\n )}\n </svg>\n {hasAnnotations && annotationContext && (\n <ChartAnnotationLayer\n annotations={annotations}\n context={annotationContext}\n className={classes.annotationLayer}\n />\n )}\n </div>\n\n {!props.hideLegend && (\n <div\n ref={(e: HTMLDivElement) => {\n legendContainer = e;\n }}\n className={classes.legendContainer}\n >\n {props.legendBars}\n </div>\n )}\n {/** The callout is used for narration, so keep it mounted on the DOM */}\n {callout && <React.Suspense fallback={<div>Loading...</div>}>{callout}</React.Suspense>}\n </div>\n );\n});\nCartesianChart.displayName = 'CartesianChart';\n"],"names":["React","useCartesianChartStyles","select","d3Select","createNumericXAxis","createStringXAxis","createDateXAxis","XAxisTypes","YAxisType","createWrapOfXLabels","rotateXAxisLabels","calculateLongestLabelWidth","createYAxisLabels","ChartTypes","wrapContent","useRtl","truncateString","tooltipOfAxislabels","getSecureProps","DEFAULT_WRAP_WIDTH","useId","SVGTooltipText","ChartAnnotationLayer","ChartPopover","useFocusableGroup","useArrowNavigationGroup","HORIZONTAL_MARGIN_FOR_YAXIS_TITLE","VERTICAL_MARGIN_FOR_XAXIS_TITLE","AXIS_TITLE_PADDING","DEFAULT_MARGIN_WITH_TICKS","DEFAULT_MARGIN_NO_TICKS","CartesianChart","forwardRef","hideTickOverlap","props","forwardedRef","chartContainer","useRef","legendContainer","minLegendContainerHeight","xAxisElement","yAxisElement","yAxisElementSecondary","margins","idForGraph","_reqID","_useRtl","_tickValues","_isFirstRender","_xScale","isIntegralDataset","useMemo","points","some","point","y","_tooltipId","_removalValueForTextTuncate","_yAxisTickText","containerWidth","setContainerWidth","useState","containerHeight","setContainerHeight","startFromX","setStartFromX","prevWidthRef","undefined","prevHeightRef","classes","focusAttributes","arrowAttributes","axis","useEffect","_fitParentContainer","showYAxisLables","maxYAxisLabelLength","calculateMaxYAxisLabelLength","yAxis","cancelAnimationFrame","current","width","height","chartType","yAxisType","useImperativeHandle","componentRef","_generateCallout","calloutProps","className","formatTickLabel","str","showYAxisLablesTooltip","noOfCharsToTruncate","map","label","svgProps","culture","dateLocalizeOptions","timeFormatLocale","customDateTimeFormatter","parentRef","_calcMargins","getmargins","callout","yScalePrimary","yScaleSecondary","children","enableFirstRenderOptimization","XAxisParams","domainNRangeValues","getDomainNRangeValues","getDomainMargins","xAxisType","barwidth","tickValues","showRoundOffXTickValues","xAxisCount","xAxisTickCount","xAxistickSize","tickPadding","showXAxisLablesTooltip","xAxisPadding","xAxisInnerPadding","xAxisOuterPadding","rotateXAxisLables","calcMaxLabelWidth","_calcMaxLabelWidthWithTransform","xMinValue","xMaxValue","xAxis","xScale","NumericAxis","tickParams","xScaleType","DateAxis","useUTC","StringAxis","datasetForXAxisDomain","_transformXAxisLabels","YAxisParams","getYDomainMargins","yAxisTickFormat","yAxisTickCount","yMinValue","yMaxValue","maxOfYVal","yMinMaxValues","getMinMaxOfYAxis","yAxisPadding","yAxisTickValues","axisData","yAxisDomainValues","yAxisTickText","createStringYAxis","stringDatasetForYAxisDomain","secondaryYScaleOptions","YAxisParamsSecondary","createYAxis","roundedTicks","secondaryYScaleType","yScaleType","getAxisData","document","getElementById","remove","e","_yAxisElement","call","ytooltipProps","tooltipCls","tooltip","id","_getData","getGraphData","hideTooltip","isPopoverOpen","svgDimensions","plotWidth","Math","max","left","right","plotHeight","top","bottom","plotRect","x","annotations","hasAnnotations","length","annotationContext","svgRect","isRtl","xAxisTitleMaxWidth","yAxisTitleMaxHeight","yAxisTitleCenterY","yAxisTitleCenterX","secondaryYAxisTitleCenterX","commonSvgToolTipProps","showBackground","svgTooltip","content","legendContainerHeight","hideLegend","legendContainerComputedStyles","getComputedStyle","getBoundingClientRect","parseFloat","marginTop","marginBottom","container","currentContainerWidth","reflowProps","mode","_calculateChartMinWidth","currentContainerHeight","shouldResize","_onChartLeave","onChartMouseLeave","labelWidth","minChartWidth","GroupedVerticalBarChart","VerticalBarChart","VerticalStackedBarChart","includes","minDomainMargin","wrapXAxisLables","longestLabelWidth","ceil","cos","PI","val","numChars","toString","slice","words","forEach","push","split","maxXAxisLabelWidth","step","wrapLabelProps","node","rotateLabelProps","rotatedHeight","_margins","_getDefaultMargins","_applyTitleMargins","_applyAnnotationMargins","_swapRtlMargins","updated","xAxisTitle","yAxisTitle","secondaryYAxistitle","xAxisAnnotation","yAxisAnnotation","div","root","role","ref","rootElem","onMouseLeave","chartWrapper","svg","aria-label","chartTitle","style","display","chart","g","transform","textProps","axisTitle","textAnchor","maxWidth","axisAnnotation","context","annotationLayer","legendBars","Suspense","fallback","displayName"],"mappings":"AAAA;;;;;+BA6Ca+B;;;;;;;iEA3CU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A,aAAA,CAACzO,8BAAAA,EAAAA;QACE,GAAGkL,qBAAqB;QACzBG,SAASxK,MAAM8N,eAAe;QAC9BgB,WAAW;YACTrF,GAAGW;YACH/I,GAAG6I;YACH8E,YAAY;YACZH,WAAW,CAAC,YAAY,EAAEzE,2BAA2B,EAAE,EAAEF,kBAAkB,CAAC,CAAC;YAC7E3G,WAAWpB,QAAQ+M,cAAc;YACjC,eAAe;QACjB;QACAD,UAAUhF;SAIjBN,kBAAkBE,qBAAAA,WAAAA,GACjB,OAAA,aAAA,CAACzK,0CAAAA,EAAAA;QACCsK,aAAaA;QACbyF,SAAStF;QACTtG,WAAWpB,QAAQiN,eAAe;SAKvC,CAACpP,MAAM0K,UAAU,IAAA,WAAA,GAChB,OAAA,aAAA,CAACqD,OAAAA;QACCG,KAAK,CAAC9F;YACJhI,kBAAkBgI;QACpB;QACA7E,WAAWpB,QAAQ/B,eAAe;OAEjCJ,MAAMqP,UAAU,GAIpB/K,WAAAA,WAAAA,GAAW,OAAA,aAAA,CAACxG,OAAMwR,QAAQ,EAAA;QAACC,UAAAA,WAAAA,GAAU,OAAA,aAAA,CAACxB,OAAAA,MAAI;OAAmBzJ;AAGpE,GAAG;AACHzE,eAAe2P,WAAW,GAAG"}
|
|
1
|
+
{"version":3,"sources":["../src/components/CommonComponents/CartesianChart.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport { ModifiedCartesianChartProps } from '../../index';\nimport { useCartesianChartStyles } from './useCartesianChartStyles.styles';\nimport { select as d3Select } from 'd3-selection';\nimport {\n createNumericXAxis,\n createStringXAxis,\n IAxisData,\n createDateXAxis,\n IMargins,\n XAxisTypes,\n YAxisType,\n createWrapOfXLabels,\n rotateXAxisLabels,\n calculateLongestLabelWidth,\n createYAxisLabels,\n ChartTypes,\n wrapContent,\n useRtl,\n truncateString,\n tooltipOfAxislabels,\n getSecureProps,\n DEFAULT_WRAP_WIDTH,\n} from '../../utilities/index';\nimport { useId } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport { SVGTooltipText, SVGTooltipTextProps } from '../../utilities/SVGTooltipText';\nimport { ChartAnnotationLayer } from './Annotations/ChartAnnotationLayer';\nimport { ChartAnnotationContext } from './Annotations/ChartAnnotationLayer.types';\nimport { ChartPopover } from './ChartPopover';\nimport { useFocusableGroup, useArrowNavigationGroup } from '@fluentui/react-tabster';\n\nconst HORIZONTAL_MARGIN_FOR_YAXIS_TITLE = 24;\nconst VERTICAL_MARGIN_FOR_XAXIS_TITLE = 20;\nconst AXIS_TITLE_PADDING = 8;\nconst DEFAULT_MARGIN_WITH_TICKS = 40;\nconst DEFAULT_MARGIN_NO_TICKS = 20;\n\n/**\n * Cartesian Chart component\n * {@docCategory CartesianChart}\n */\nexport const CartesianChart: React.FunctionComponent<ModifiedCartesianChartProps> = React.forwardRef<\n HTMLDivElement,\n ModifiedCartesianChartProps\n>(({ hideTickOverlap = true, ...props }, forwardedRef) => {\n const chartContainer = React.useRef<HTMLDivElement | null>(null);\n let legendContainer: HTMLDivElement;\n const minLegendContainerHeight: number = 40;\n const xAxisElement = React.useRef<SVGSVGElement | null>(null);\n const yAxisElement = React.useRef<SVGSVGElement | null>(null);\n const yAxisElementSecondary = React.useRef<SVGSVGElement | null>(null);\n let margins: IMargins;\n const idForGraph: string = 'chart_';\n let _reqID: number | undefined;\n const _useRtl: boolean = useRtl();\n let _tickValues: (string | number)[];\n const _isFirstRender = React.useRef<boolean>(true);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let _xScale: any;\n const isIntegralDataset = React.useMemo(() => {\n return !props.points.some((point: { y: number }) => point.y % 1 !== 0);\n }, [props.points]);\n let _tooltipId: string = useId('tooltip_');\n /* Used for when WrapXAxisLabels props appeared.\n * To display the total word (space separated words), Need to have more space than usual.\n * This height will get total height need to disaply total word.\n * These value need to be removed from actual svg height/graph height.\n * Defalut value is 0. And this values calculted when 'wrapXAxisLables' or 'showXAxisLablesTooltip' is true.\n */\n let _removalValueForTextTuncate: number = 0;\n const _yAxisTickText = React.useRef<string[]>([]);\n\n const [containerWidth, setContainerWidth] = React.useState<number>(0);\n const [containerHeight, setContainerHeight] = React.useState<number>(0);\n const [startFromX, setStartFromX] = React.useState<number>(0);\n const prevWidthRef = React.useRef<number | undefined>(undefined);\n const prevHeightRef = React.useRef<number | undefined>(undefined);\n\n const classes = useCartesianChartStyles(props);\n const focusAttributes = useFocusableGroup();\n const arrowAttributes = useArrowNavigationGroup({ axis: 'horizontal' });\n // ComponentdidMount and Componentwillunmount logic\n React.useEffect(() => {\n _fitParentContainer();\n if (props.showYAxisLables) {\n const maxYAxisLabelLength = calculateMaxYAxisLabelLength(classes.yAxis!);\n if (startFromX !== maxYAxisLabelLength) {\n setStartFromX(maxYAxisLabelLength);\n }\n } else if (startFromX !== 0) {\n setStartFromX(0);\n }\n return () => {\n if (_reqID !== undefined) {\n cancelAnimationFrame(_reqID);\n }\n };\n }, [props]);\n\n // ComponentDidUpdate logic\n React.useEffect(() => {\n // Check if height or width changed\n if (\n prevWidthRef.current !== undefined &&\n prevHeightRef.current !== undefined &&\n (prevWidthRef.current !== props.width || prevHeightRef.current !== props.height)\n ) {\n _fitParentContainer();\n }\n // Update refs with current values\n prevWidthRef.current = props.width;\n prevHeightRef.current = props.height;\n\n if (props.showYAxisLables) {\n const maxYAxisLabelLength = calculateMaxYAxisLabelLength(classes.yAxis!);\n if (startFromX !== maxYAxisLabelLength) {\n setStartFromX(maxYAxisLabelLength);\n }\n } else if (startFromX !== 0) {\n setStartFromX(0);\n }\n }, [props.width, props.height, props.chartType, props.showYAxisLables, props.yAxisType]);\n\n React.useImperativeHandle(\n props.componentRef,\n () => ({\n chartContainer: chartContainer.current ?? null,\n }),\n [],\n );\n\n /**\n * Dedicated function to return the Callout JSX Element , which can further be used to only call this when\n * only the calloutprops and charthover props changes.\n * @param calloutProps\n * @param chartHoverProps\n * @returns\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n function _generateCallout(calloutProps: any): JSXElement {\n return <ChartPopover {...calloutProps} />;\n }\n\n function calculateMaxYAxisLabelLength(className: string): number {\n const formatTickLabel = (str: string) => {\n if (props.showYAxisLablesTooltip) {\n return truncateString(str, props.noOfCharsToTruncate || 4);\n }\n\n return str;\n };\n return calculateLongestLabelWidth(\n _yAxisTickText.current.map(label => formatTickLabel(label)),\n `.${className} text`,\n );\n }\n\n const {\n calloutProps,\n points,\n chartType,\n svgProps,\n culture,\n dateLocalizeOptions,\n timeFormatLocale,\n customDateTimeFormatter,\n } = props;\n if (props.parentRef) {\n _fitParentContainer();\n }\n\n margins = _calcMargins();\n // Callback for margins to the chart\n props.getmargins && props.getmargins(margins);\n\n let callout: JSXElement | null = null;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let yScalePrimary: any;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let yScaleSecondary: any;\n\n let children = null;\n if ((props.enableFirstRenderOptimization && chartContainer.current) || !props.enableFirstRenderOptimization) {\n _isFirstRender.current = false;\n const XAxisParams = {\n domainNRangeValues: props.getDomainNRangeValues(\n points,\n props.getDomainMargins ? props.getDomainMargins(containerWidth) : margins,\n containerWidth,\n chartType,\n _useRtl,\n props.xAxisType,\n props.barwidth!,\n props.tickValues!,\n ),\n // FIXME: In XAxisParams, containerHeight is used by HBWA to generate vertical gridlines.\n // Since the x-axis in HBWA is numeric, it typically doesn't require transformation.\n // However, if transformation props are enabled, the updated _removalValueForTextTuncate\n // will only be available in the next render, as it's set after the axis is created.\n // Solution: Delay the creation of gridlines until after the transformation has been applied,\n // or precompute the required height for transformed labels (_removalValueForTextTuncate).\n containerHeight: containerHeight - _removalValueForTextTuncate,\n margins: margins,\n xAxisElement: xAxisElement.current!,\n showRoundOffXTickValues: props.showRoundOffXTickValues ?? true,\n xAxisCount: props.xAxisTickCount,\n xAxistickSize: props.xAxistickSize,\n tickPadding: props.tickPadding || props.showXAxisLablesTooltip ? 5 : 10,\n xAxisPadding: props.xAxisPadding,\n xAxisInnerPadding: props.xAxisInnerPadding,\n xAxisOuterPadding: props.xAxisOuterPadding,\n containerWidth: containerWidth,\n hideTickOverlap: props.rotateXAxisLables ? false : hideTickOverlap,\n calcMaxLabelWidth: _calcMaxLabelWidthWithTransform,\n xMinValue: props.xMinValue,\n xMaxValue: props.xMaxValue,\n ...props.xAxis,\n };\n\n /**\n * These scales used for 2 purposes.\n * 1. To create x and y axis\n * 2. To draw the graph.\n * For area/line chart using same scales. For other charts, creating their own scales to draw the graph.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let xScale: any;\n let tickValues: (string | number)[];\n switch (props.xAxisType!) {\n case XAxisTypes.NumericAxis:\n ({ xScale, tickValues } = createNumericXAxis(\n XAxisParams,\n props.tickParams!,\n props.chartType,\n culture,\n props.xScaleType,\n _useRtl,\n ));\n break;\n case XAxisTypes.DateAxis:\n ({ xScale, tickValues } = createDateXAxis(\n XAxisParams,\n props.tickParams!,\n culture,\n dateLocalizeOptions,\n timeFormatLocale,\n customDateTimeFormatter,\n props.useUTC,\n props.chartType,\n ));\n break;\n case XAxisTypes.StringAxis:\n ({ xScale, tickValues } = createStringXAxis(\n XAxisParams,\n props.tickParams!,\n props.datasetForXAxisDomain!,\n culture,\n _useRtl,\n ));\n break;\n default:\n ({ xScale, tickValues } = createNumericXAxis(\n XAxisParams,\n props.tickParams!,\n props.chartType,\n culture,\n props.xScaleType,\n _useRtl,\n ));\n }\n _xScale = xScale;\n _tickValues = tickValues;\n\n _transformXAxisLabels();\n\n const YAxisParams = {\n margins: props.getYDomainMargins ? props.getYDomainMargins(containerHeight) : margins,\n containerWidth: containerWidth,\n containerHeight: containerHeight - _removalValueForTextTuncate,\n yAxisElement: yAxisElement.current!,\n yAxisTickFormat: props.yAxisTickFormat!,\n yAxisTickCount: props.yAxisTickCount!,\n yMinValue: props.yMinValue || 0,\n yMaxValue: props.yMaxValue || 0,\n tickPadding: 10,\n maxOfYVal: props.maxOfYVal,\n yMinMaxValues: props.getMinMaxOfYAxis(points, props.yAxisType),\n // please note these padding default values must be consistent in here\n // and the parent chart(HBWA/Vertical etc..) for more details refer example\n // http://using-d3js.com/04_07_ordinal_scales.html\n yAxisPadding: props.yAxisPadding || 0,\n tickValues: props.yAxisTickValues,\n ...props.yAxis,\n };\n /**\n * These scales used for 2 purposes.\n * 1. To create x and y axis\n * 2. To draw the graph.\n * For area/line chart using same scales. For other charts, creating their own scales to draw the graph.\n */\n const axisData: IAxisData = { yAxisDomainValues: [], yAxisTickText: [] };\n if (props.yAxisType && props.yAxisType === YAxisType.StringAxis) {\n yScalePrimary = props.createStringYAxis(\n YAxisParams,\n props.stringDatasetForYAxisDomain!,\n _useRtl,\n axisData,\n props.barwidth,\n props.chartType,\n );\n } else {\n // TODO: Since the scale domain values are now computed independently for both the primary and\n // secondary y-axes, the yMinValue and yMaxValue props are no longer necessary for accurately\n // rendering the secondary y-axis. Therefore, rather than checking the secondaryYScaleOptions\n // prop to determine whether to create a secondary y-axis, it's more appropriate to check if any\n // data points are assigned to use the secondary y-scale.\n if (props?.secondaryYScaleOptions) {\n const YAxisParamsSecondary = {\n margins: margins,\n containerWidth: containerWidth,\n containerHeight: containerHeight - _removalValueForTextTuncate!,\n yAxisElement: yAxisElementSecondary.current,\n yAxisTickFormat: props.yAxisTickFormat!,\n yAxisTickCount: props.yAxisTickCount!,\n yMinValue: props.secondaryYScaleOptions?.yMinValue || 0,\n yMaxValue: props.secondaryYScaleOptions?.yMaxValue ?? 100,\n tickPadding: 10,\n yMinMaxValues: props.getMinMaxOfYAxis(points, props.yAxisType, true),\n yAxisPadding: props.yAxisPadding,\n };\n\n yScaleSecondary = props.createYAxis(\n YAxisParamsSecondary,\n _useRtl,\n axisData,\n isIntegralDataset,\n chartType,\n true,\n props.roundedTicks!,\n props.secondaryYScaleType,\n _useRtl,\n );\n }\n yScalePrimary = props.createYAxis(\n YAxisParams,\n _useRtl,\n axisData,\n isIntegralDataset,\n chartType,\n false,\n props.roundedTicks!,\n props.yScaleType,\n _useRtl,\n );\n }\n _yAxisTickText.current = axisData.yAxisTickText;\n props.getAxisData && props.getAxisData(axisData);\n\n // Removing un wanted tooltip div from DOM, when prop not provided, for proper cleanup\n // of unwanted DOM elements, to prevent flacky behaviour in tooltips , that might occur\n // in creating tooltips when tooltips are enabled( as we try to recreate a tspan with _tooltipId)\n if (!props.showYAxisLablesTooltip) {\n try {\n document.getElementById(_tooltipId) && document.getElementById(_tooltipId)!.remove();\n //eslint-disable-next-line no-empty\n } catch (e) {}\n }\n // Used to display tooltip at y axis labels.\n if (props.showYAxisLablesTooltip) {\n // To create y axis tick values by if specified truncating the rest of the text\n // and showing elipsis or showing the whole string,\n yScalePrimary &&\n // Note: This function should be invoked within the showYAxisLablesTooltip check,\n // as its sole purpose is to truncate labels that exceed the noOfCharsToTruncate limit.\n createYAxisLabels(\n yAxisElement.current!,\n yScalePrimary,\n props.noOfCharsToTruncate || 4,\n props.showYAxisLablesTooltip || false,\n _useRtl,\n );\n const _yAxisElement = d3Select(yAxisElement.current!).call(yScalePrimary);\n try {\n document.getElementById(_tooltipId) && document.getElementById(_tooltipId)!.remove();\n //eslint-disable-next-line no-empty\n } catch (e) {}\n const ytooltipProps = {\n tooltipCls: classes.tooltip!,\n id: _tooltipId,\n axis: _yAxisElement,\n };\n _yAxisElement && tooltipOfAxislabels(ytooltipProps);\n }\n\n // Call back to the chart.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const _getData = (xScale: any, yScalePrimary: any, yScaleSecondary: any) => {\n props.getGraphData &&\n props.getGraphData(\n xScale,\n yScalePrimary,\n containerHeight - _removalValueForTextTuncate!,\n containerWidth,\n xAxisElement.current,\n yAxisElement.current,\n yScaleSecondary,\n );\n };\n\n // Callback function for chart, returns axis\n _getData(xScale, yScalePrimary, yScaleSecondary);\n\n children = props.children({\n xScale,\n yScalePrimary,\n yScaleSecondary,\n containerHeight,\n containerWidth,\n });\n\n if (!props.hideTooltip && calloutProps!.isPopoverOpen) {\n callout = _generateCallout(calloutProps);\n }\n }\n const svgDimensions = {\n width: containerWidth,\n height: containerHeight,\n };\n\n const plotWidth = Math.max(0, svgDimensions.width - margins.left! - margins.right!);\n const plotHeight = Math.max(0, svgDimensions.height - margins.top! - margins.bottom! - _removalValueForTextTuncate);\n\n const plotRect = {\n x: margins.left!,\n y: margins.top!,\n width: plotWidth,\n height: plotHeight,\n };\n\n const annotations = props.annotations ?? [];\n const hasAnnotations = annotations.length > 0;\n const annotationContext: ChartAnnotationContext | undefined = hasAnnotations\n ? {\n plotRect,\n svgRect: svgDimensions,\n isRtl: _useRtl,\n xScale: _xScale,\n yScalePrimary,\n yScaleSecondary,\n }\n : undefined;\n\n const xAxisTitleMaxWidth = svgDimensions.width - margins.left! - margins.right! - AXIS_TITLE_PADDING * 2;\n const yAxisTitleMaxHeight =\n svgDimensions.height - margins.bottom! - margins.top! - _removalValueForTextTuncate! - AXIS_TITLE_PADDING * 2;\n const yAxisTitleCenterY = margins.top! + AXIS_TITLE_PADDING + yAxisTitleMaxHeight / 2;\n const yAxisTitleCenterX = _useRtl\n ? svgDimensions.width - AXIS_TITLE_PADDING\n : HORIZONTAL_MARGIN_FOR_YAXIS_TITLE - AXIS_TITLE_PADDING;\n const secondaryYAxisTitleCenterX = _useRtl\n ? HORIZONTAL_MARGIN_FOR_YAXIS_TITLE - AXIS_TITLE_PADDING\n : svgDimensions.width - AXIS_TITLE_PADDING;\n\n const commonSvgToolTipProps: SVGTooltipTextProps = {\n wrapContent,\n showBackground: true,\n className: classes.svgTooltip,\n content: '',\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 && getComputedStyle(legendContainer);\n legendContainerHeight =\n ((legendContainer && legendContainer.getBoundingClientRect().height) || minLegendContainerHeight) +\n parseFloat((legendContainerComputedStyles && legendContainerComputedStyles.marginTop) || '0') +\n parseFloat((legendContainerComputedStyles && legendContainerComputedStyles.marginBottom) || '0');\n }\n if (props.parentRef || chartContainer.current) {\n const container = props.parentRef ? props.parentRef : chartContainer.current!;\n const currentContainerWidth =\n props.reflowProps?.mode === 'min-width' && !_isFirstRender.current\n ? Math.max(container.getBoundingClientRect().width, _calculateChartMinWidth())\n : container.getBoundingClientRect().width;\n const currentContainerHeight =\n container.getBoundingClientRect().height > legendContainerHeight\n ? container.getBoundingClientRect().height\n : 350;\n const shouldResize =\n containerWidth !== currentContainerWidth || containerHeight !== currentContainerHeight - legendContainerHeight;\n if (shouldResize) {\n setContainerWidth(currentContainerWidth);\n setContainerHeight(currentContainerHeight - legendContainerHeight);\n }\n }\n //});\n }\n\n function _onChartLeave(): void {\n props.onChartMouseLeave && props.onChartMouseLeave();\n }\n\n function _calculateChartMinWidth(): number {\n // Adding 10px for padding on both sides\n const labelWidth = _calcMaxLabelWidthWithTransform(_tickValues) + 10;\n\n let minChartWidth = margins.left! + margins.right! + labelWidth * (_tickValues.length - 1);\n\n if (\n [ChartTypes.GroupedVerticalBarChart, ChartTypes.VerticalBarChart, ChartTypes.VerticalStackedBarChart].includes(\n props.chartType,\n )\n ) {\n const minDomainMargin = 8;\n minChartWidth += minDomainMargin * 2;\n }\n\n return minChartWidth;\n }\n\n function _getChartDescription(): string {\n return (\n (props.chartTitle || 'Chart. ') +\n _getAxisTitle('X', props.xAxisTitle, props.xAxisType) +\n _getAxisTitle('Y', props.yAxisTitle, props.yAxisType || YAxisType.NumericAxis) +\n (props.secondaryYScaleOptions\n ? _getAxisTitle('secondary Y', props.secondaryYAxistitle, YAxisType.NumericAxis)\n : '')\n );\n }\n\n function _getAxisTitle(axisLabel: string, axisTitle: string | undefined, axisType: XAxisTypes | YAxisType): string {\n return (\n `The ${axisLabel} axis displays ` +\n (axisTitle ||\n (axisType === XAxisTypes.StringAxis || axisType === YAxisType.StringAxis\n ? 'categories'\n : axisType === XAxisTypes.DateAxis || axisType === YAxisType.DateAxis\n ? 'time'\n : 'values')) +\n '. '\n );\n }\n\n function _calcMaxLabelWidthWithTransform(x: (string | number)[]) {\n // Case: rotated labels\n if (!props.wrapXAxisLables && props.rotateXAxisLables && props.xAxisType! === XAxisTypes.StringAxis) {\n const longestLabelWidth = calculateLongestLabelWidth(x, `.${classes.xAxis} text`);\n return Math.ceil(longestLabelWidth * Math.cos(Math.PI / 4));\n }\n\n // Case: truncated labels\n if (props.showXAxisLablesTooltip) {\n const tickValues = x.map(val => {\n const numChars = props.noOfCharsToTruncate || 4;\n return val.toString().length > numChars ? `${val.toString().slice(0, numChars)}...` : val;\n });\n\n const longestLabelWidth = calculateLongestLabelWidth(tickValues, `.${classes.xAxis} text`);\n return Math.ceil(longestLabelWidth);\n }\n\n // Case: wrapped labels\n if (props.wrapXAxisLables) {\n // FIXME: Calculate the max width of lines instead of words. This requires applying\n // the wrapping transformation earlier to obtain the actual rendered lines.\n const words: string[] = [];\n x.forEach((val: string) => {\n words.push(...val.toString().split(/\\s+/));\n });\n\n // This approach works well in most cases, since overflow typically occurs only when\n // a single word exceeds the specified width — otherwise, the text will wrap as expected.\n const longestLabelWidth = calculateLongestLabelWidth(words, `.${classes.xAxis} text`);\n return Math.max(Math.ceil(longestLabelWidth), DEFAULT_WRAP_WIDTH);\n }\n\n // Default case\n const longestLabelWidth = calculateLongestLabelWidth(x, `.${classes.xAxis} text`);\n return Math.ceil(longestLabelWidth);\n }\n\n function _transformXAxisLabels() {\n _removalValueForTextTuncate = 0;\n\n /*\n * To enable wrapping of x axis tick values or to display complete x axis tick values,\n * we need to calculate how much space it needed to render the text.\n * No need to re-calculate every time the chart renders and same time need to get an update. So using setState.\n * Required space will be calculated first time chart rendering and if any width/height of chart updated.\n * */\n if (props.wrapXAxisLables || props.showXAxisLablesTooltip) {\n let maxXAxisLabelWidth: number | undefined;\n if (props.xAxisType === XAxisTypes.StringAxis) {\n if ((props.datasetForXAxisDomain?.length || 0) > 1) {\n maxXAxisLabelWidth = _xScale.step();\n } else {\n maxXAxisLabelWidth = containerWidth;\n }\n }\n\n const wrapLabelProps = {\n node: xAxisElement.current!,\n xAxis: _xScale,\n showXAxisLablesTooltip: props.showXAxisLablesTooltip || false,\n noOfCharsToTruncate: props.noOfCharsToTruncate || 4,\n width: maxXAxisLabelWidth,\n };\n _removalValueForTextTuncate = createWrapOfXLabels(wrapLabelProps) ?? 0;\n }\n\n if (!props.wrapXAxisLables && props.rotateXAxisLables && props.xAxisType! === XAxisTypes.StringAxis) {\n const rotateLabelProps = {\n node: xAxisElement.current!,\n xAxis: _xScale,\n };\n const rotatedHeight = rotateXAxisLabels(rotateLabelProps) ?? 0;\n // margins.bottom is used as padding here\n _removalValueForTextTuncate = rotatedHeight + margins.bottom!;\n }\n }\n\n function _calcMargins(): IMargins {\n let _margins = _getDefaultMargins();\n\n _margins = _applyTitleMargins(_margins);\n _margins = _applyAnnotationMargins(_margins);\n\n if (_useRtl) {\n _margins = _swapRtlMargins(_margins);\n }\n\n return {\n ..._margins,\n ...props.margins,\n };\n }\n\n function _getDefaultMargins(): IMargins {\n return {\n top: DEFAULT_MARGIN_NO_TICKS,\n // Smaller than the default because it is based on the line height rather than\n // the length of the tick labels.\n bottom: DEFAULT_MARGIN_WITH_TICKS - 5,\n // For the actual margin, add the tick size, tick padding, and some extra space to\n // the width of the longest yaxis tick label (startFromX).\n left: Math.max(DEFAULT_MARGIN_WITH_TICKS, startFromX + 20),\n right: props.secondaryYScaleOptions ? DEFAULT_MARGIN_WITH_TICKS : DEFAULT_MARGIN_NO_TICKS,\n };\n }\n\n function _applyTitleMargins(_margins: IMargins): IMargins {\n const updated = { ..._margins };\n if (props.xAxisTitle !== undefined && props.xAxisTitle !== '') {\n updated.bottom! += VERTICAL_MARGIN_FOR_XAXIS_TITLE;\n }\n if (props.yAxisTitle !== undefined && props.yAxisTitle !== '') {\n updated.left! += HORIZONTAL_MARGIN_FOR_YAXIS_TITLE;\n }\n if (props.secondaryYAxistitle !== undefined && props.secondaryYAxistitle !== '') {\n updated.right! += HORIZONTAL_MARGIN_FOR_YAXIS_TITLE;\n }\n return updated;\n }\n\n function _applyAnnotationMargins(_margins: IMargins): IMargins {\n const updated = { ..._margins };\n if (props.xAxisAnnotation !== undefined && props.xAxisAnnotation !== '') {\n updated.top! += VERTICAL_MARGIN_FOR_XAXIS_TITLE;\n }\n if (\n props.yAxisAnnotation !== undefined &&\n props.yAxisAnnotation !== '' &&\n (props.secondaryYAxistitle === undefined || props.secondaryYAxistitle === '')\n ) {\n updated.right! += HORIZONTAL_MARGIN_FOR_YAXIS_TITLE;\n }\n return updated;\n }\n\n function _swapRtlMargins(_margins: IMargins): IMargins {\n return {\n ..._margins,\n left: _margins.right,\n right: _margins.left,\n };\n }\n\n /**\n * We have use the {@link defaultTabbableElement } to fix\n * the Focus not landing on chart while tabbing, instead goes to legend.\n * This issue is observed in Area, line chart after performance optimization done in the PR {@link https://github.com/microsoft/fluentui/pull/27721 }\n * This issue is observed in Bar charts after the changes done by FocusZone team in the PR: {@link https://github.com/microsoft/fluentui/pull/24175 }\n * The issue in Bar Charts(VB and VSB) is due to a {@link FocusZone } update where previously an event listener was\n * attached on keydown to the window, so that whenever the tab key is pressed all outer FocusZone's\n * tab-indexes are updated (an outer FocusZone is a FocusZone that is not within another one).\n * But now after the above PR : they are attaching the\n * listeners to the FocusZone elements instead of the window. So in the first render cycle in Bar charts\n * bars are not created as in the first render cycle the size of the chart container is not known( or is 0)\n * which creates bars of height 0 so instead we do not create any bars and instead return empty fragments.\n *\n * We have tried 2 Approaches to fix the issue:\n * 1. Using the {@link elementRef} property of FocusZone where we dispatch event for tab keydown\n * after the second render cycle which triggers an update of the tab index in FocusZone.\n * But this is a hacky solution and not a proper fix and also elementRef is deprecated.\n * 2. Using the default tabbable element to fix the issue.\n */\n\n return (\n <div\n id={idForGraph}\n className={classes.root}\n role={'presentation'}\n ref={(rootElem: HTMLDivElement) => {\n chartContainer.current = rootElem;\n }}\n onMouseLeave={_onChartLeave}\n >\n <div className={classes.chartWrapper} {...focusAttributes} {...arrowAttributes}>\n {_isFirstRender.current}\n <svg\n width={svgDimensions.width}\n height={svgDimensions.height}\n role=\"region\"\n aria-label={_getChartDescription()}\n style={{ display: 'block' }}\n className={classes.chart}\n {...getSecureProps(svgProps)}\n >\n <g\n ref={(e: SVGSVGElement | null) => {\n xAxisElement.current = e!;\n }}\n id={`xAxisGElement${idForGraph}`}\n // To add wrap of x axis lables feature, need to remove word height from svg height.\n transform={`translate(0, ${svgDimensions.height - margins.bottom! - _removalValueForTextTuncate!})`}\n className={classes.xAxis}\n />\n {props.xAxisTitle !== undefined && props.xAxisTitle !== '' && (\n <SVGTooltipText\n {...commonSvgToolTipProps}\n content={props.xAxisTitle}\n textProps={{\n x: margins.left! + AXIS_TITLE_PADDING + xAxisTitleMaxWidth / 2,\n y: svgDimensions.height - AXIS_TITLE_PADDING,\n className: classes.axisTitle!,\n textAnchor: 'middle',\n }}\n maxWidth={xAxisTitleMaxWidth}\n />\n )}\n {props.xAxisAnnotation !== undefined && props.xAxisAnnotation !== '' && (\n <SVGTooltipText\n {...commonSvgToolTipProps}\n content={props.xAxisAnnotation}\n textProps={{\n x: margins.left! + AXIS_TITLE_PADDING + xAxisTitleMaxWidth / 2,\n y: VERTICAL_MARGIN_FOR_XAXIS_TITLE - AXIS_TITLE_PADDING,\n className: classes.axisAnnotation!,\n textAnchor: 'middle',\n 'aria-hidden': true,\n }}\n maxWidth={xAxisTitleMaxWidth}\n />\n )}\n <g\n ref={(e: SVGSVGElement | null) => {\n yAxisElement.current = e!;\n }}\n id={`yAxisGElement${idForGraph}`}\n transform={`translate(${_useRtl ? svgDimensions.width - margins.right! : margins.left!}, 0)`}\n className={classes.yAxis}\n />\n {props.secondaryYScaleOptions && (\n <g>\n <g\n ref={(e: SVGSVGElement | null) => {\n yAxisElementSecondary.current = e!;\n }}\n id={`yAxisGElementSecondary${idForGraph}`}\n transform={`translate(${_useRtl ? margins.left! : svgDimensions.width - margins.right!}, 0)`}\n className={classes.yAxis}\n />\n {props.secondaryYAxistitle !== undefined && props.secondaryYAxistitle !== '' && (\n <SVGTooltipText\n {...commonSvgToolTipProps}\n content={props.secondaryYAxistitle}\n textProps={{\n x: secondaryYAxisTitleCenterX,\n y: yAxisTitleCenterY,\n textAnchor: 'middle',\n transform: `rotate(-90, ${secondaryYAxisTitleCenterX}, ${yAxisTitleCenterY})`,\n className: classes.axisTitle!,\n }}\n maxWidth={yAxisTitleMaxHeight}\n />\n )}\n </g>\n )}\n {children}\n {props.yAxisTitle !== undefined && props.yAxisTitle !== '' && (\n <SVGTooltipText\n {...commonSvgToolTipProps}\n content={props.yAxisTitle}\n textProps={{\n x: yAxisTitleCenterX,\n y: yAxisTitleCenterY,\n textAnchor: 'middle',\n transform: `rotate(-90, ${yAxisTitleCenterX}, ${yAxisTitleCenterY})`,\n className: classes.axisTitle!,\n }}\n maxWidth={yAxisTitleMaxHeight}\n />\n )}\n {props.yAxisAnnotation !== undefined &&\n props.yAxisAnnotation !== '' &&\n (props.secondaryYAxistitle === undefined || props.secondaryYAxistitle === '') && (\n <SVGTooltipText\n {...commonSvgToolTipProps}\n content={props.yAxisAnnotation}\n textProps={{\n x: secondaryYAxisTitleCenterX,\n y: yAxisTitleCenterY,\n textAnchor: 'middle',\n transform: `rotate(-90, ${secondaryYAxisTitleCenterX}, ${yAxisTitleCenterY})`,\n className: classes.axisAnnotation!,\n 'aria-hidden': true,\n }}\n maxWidth={yAxisTitleMaxHeight}\n />\n )}\n </svg>\n {hasAnnotations && annotationContext && (\n <ChartAnnotationLayer\n annotations={annotations}\n context={annotationContext}\n className={classes.annotationLayer}\n />\n )}\n </div>\n\n {!props.hideLegend && (\n <div\n ref={(e: HTMLDivElement) => {\n legendContainer = e;\n }}\n className={classes.legendContainer}\n >\n {props.legendBars}\n </div>\n )}\n {/** The callout is used for narration, so keep it mounted on the DOM */}\n {callout && <React.Suspense fallback={<div>Loading...</div>}>{callout}</React.Suspense>}\n </div>\n );\n});\nCartesianChart.displayName = 'CartesianChart';\n"],"names":["React","useCartesianChartStyles","select","d3Select","createNumericXAxis","createStringXAxis","createDateXAxis","XAxisTypes","YAxisType","createWrapOfXLabels","rotateXAxisLabels","calculateLongestLabelWidth","createYAxisLabels","ChartTypes","wrapContent","useRtl","truncateString","tooltipOfAxislabels","getSecureProps","DEFAULT_WRAP_WIDTH","useId","SVGTooltipText","ChartAnnotationLayer","ChartPopover","useFocusableGroup","useArrowNavigationGroup","HORIZONTAL_MARGIN_FOR_YAXIS_TITLE","VERTICAL_MARGIN_FOR_XAXIS_TITLE","AXIS_TITLE_PADDING","DEFAULT_MARGIN_WITH_TICKS","DEFAULT_MARGIN_NO_TICKS","CartesianChart","forwardRef","hideTickOverlap","props","forwardedRef","chartContainer","useRef","legendContainer","minLegendContainerHeight","xAxisElement","yAxisElement","yAxisElementSecondary","margins","idForGraph","_reqID","_useRtl","_tickValues","_isFirstRender","_xScale","isIntegralDataset","useMemo","points","some","point","y","_tooltipId","_removalValueForTextTuncate","_yAxisTickText","containerWidth","setContainerWidth","useState","containerHeight","setContainerHeight","startFromX","setStartFromX","prevWidthRef","undefined","prevHeightRef","classes","focusAttributes","arrowAttributes","axis","useEffect","_fitParentContainer","showYAxisLables","maxYAxisLabelLength","calculateMaxYAxisLabelLength","yAxis","cancelAnimationFrame","current","width","height","chartType","yAxisType","useImperativeHandle","componentRef","_generateCallout","calloutProps","className","formatTickLabel","str","showYAxisLablesTooltip","noOfCharsToTruncate","map","label","svgProps","culture","dateLocalizeOptions","timeFormatLocale","customDateTimeFormatter","parentRef","_calcMargins","getmargins","callout","yScalePrimary","yScaleSecondary","children","enableFirstRenderOptimization","XAxisParams","domainNRangeValues","getDomainNRangeValues","getDomainMargins","xAxisType","barwidth","tickValues","showRoundOffXTickValues","xAxisCount","xAxisTickCount","xAxistickSize","tickPadding","showXAxisLablesTooltip","xAxisPadding","xAxisInnerPadding","xAxisOuterPadding","rotateXAxisLables","calcMaxLabelWidth","_calcMaxLabelWidthWithTransform","xMinValue","xMaxValue","xAxis","xScale","NumericAxis","tickParams","xScaleType","DateAxis","useUTC","StringAxis","datasetForXAxisDomain","_transformXAxisLabels","YAxisParams","getYDomainMargins","yAxisTickFormat","yAxisTickCount","yMinValue","yMaxValue","maxOfYVal","yMinMaxValues","getMinMaxOfYAxis","yAxisPadding","yAxisTickValues","axisData","yAxisDomainValues","yAxisTickText","createStringYAxis","stringDatasetForYAxisDomain","secondaryYScaleOptions","YAxisParamsSecondary","createYAxis","roundedTicks","secondaryYScaleType","yScaleType","getAxisData","document","getElementById","remove","e","_yAxisElement","call","ytooltipProps","tooltipCls","tooltip","id","_getData","getGraphData","hideTooltip","isPopoverOpen","svgDimensions","plotWidth","Math","max","left","right","plotHeight","top","bottom","plotRect","x","annotations","hasAnnotations","length","annotationContext","svgRect","isRtl","xAxisTitleMaxWidth","yAxisTitleMaxHeight","yAxisTitleCenterY","yAxisTitleCenterX","secondaryYAxisTitleCenterX","commonSvgToolTipProps","showBackground","svgTooltip","content","legendContainerHeight","hideLegend","legendContainerComputedStyles","getComputedStyle","getBoundingClientRect","parseFloat","marginTop","marginBottom","container","currentContainerWidth","reflowProps","mode","_calculateChartMinWidth","currentContainerHeight","shouldResize","_onChartLeave","onChartMouseLeave","labelWidth","minChartWidth","GroupedVerticalBarChart","VerticalBarChart","VerticalStackedBarChart","includes","minDomainMargin","_getChartDescription","chartTitle","_getAxisTitle","xAxisTitle","yAxisTitle","secondaryYAxistitle","axisLabel","axisTitle","axisType","wrapXAxisLables","longestLabelWidth","ceil","cos","PI","val","numChars","toString","slice","words","forEach","push","split","maxXAxisLabelWidth","step","wrapLabelProps","node","rotateLabelProps","rotatedHeight","_margins","_getDefaultMargins","_applyTitleMargins","_applyAnnotationMargins","_swapRtlMargins","updated","xAxisAnnotation","yAxisAnnotation","div","root","role","ref","rootElem","onMouseLeave","chartWrapper","svg","aria-label","style","display","chart","g","transform","textProps","textAnchor","maxWidth","axisAnnotation","context","annotationLayer","legendBars","Suspense","fallback","displayName"],"mappings":"AAAA;;;;;+BA6Ca+B;;;;;;;iEA3CU,QAAQ;+CAGS,mCAAmC;6BACxC,eAAe;uBAoB3C,wBAAwB;gCACT,4BAA4B;gCAEE,iCAAiC;sCAChD,qCAAqC;8BAE7C,iBAAiB;8BACa,0BAA0B;AAErF,MAAML,oCAAoC;AAC1C,MAAMC,kCAAkC;AACxC,MAAMC,qBAAqB;AAC3B,MAAMC,4BAA4B;AAClC,MAAMC,0BAA0B;AAMzB,uBAAMC,WAAAA,GAAuE/B,OAAMgC,UAAU,CAGlG,CAAC,EAAEC,kBAAkB,IAAI,EAAE,GAAGC,OAAO,EAAEC;IACvC,MAAMC,iBAAiBpC,OAAMqC,MAAM,CAAwB;IAC3D,IAAIC;IACJ,MAAMC,2BAAmC;IACzC,MAAMC,eAAexC,OAAMqC,MAAM,CAAuB;IACxD,MAAMI,eAAezC,OAAMqC,MAAM,CAAuB;IACxD,MAAMK,wBAAwB1C,OAAMqC,MAAM,CAAuB;IACjE,IAAIM;IACJ,MAAMC,aAAqB;IAC3B,IAAIC;IACJ,MAAMC,cAAmB/B,aAAAA;IACzB,IAAIgC;IACJ,MAAMC,iBAAiBhD,OAAMqC,MAAM,CAAU;IAC7C,8DAA8D;IAC9D,IAAIY;IACJ,MAAMC,oBAAoBlD,OAAMmD,OAAO,CAAC;QACtC,OAAO,CAACjB,MAAMkB,MAAM,CAACC,IAAI,CAAC,CAACC,QAAyBA,MAAMC,CAAC,GAAG,MAAM;IACtE,GAAG;QAACrB,MAAMkB,MAAM;KAAC;IACjB,IAAII,iBAAqBpC,qBAAAA,EAAM;IAC/B;;;;;GAKC,GACD,IAAIqC,8BAAsC;IAC1C,MAAMC,iBAAiB1D,OAAMqC,MAAM,CAAW,EAAE;IAEhD,MAAM,CAACsB,gBAAgBC,kBAAkB,GAAG5D,OAAM6D,QAAQ,CAAS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U,IAAA,WAAA,GAChB,OAAA,aAAA,CAAC2D,OAAAA;QACCG,KAAK,CAACpG;YACJhI,kBAAkBgI;QACpB;QACA7E,WAAWpB,QAAQ/B,eAAe;OAEjCJ,MAAMyP,UAAU,GAIpBnL,WAAAA,WAAAA,GAAW,OAAA,aAAA,CAACxG,OAAM4R,QAAQ,EAAA;QAACC,UAAAA,WAAAA,GAAU,OAAA,aAAA,CAACtB,OAAAA,MAAI;OAAmB/J;AAGpE,GAAG;AACHzE,eAAe+P,WAAW,GAAG"}
|
|
@@ -313,6 +313,62 @@ const resolveXAxisPoint = (x, isXYearCategory, isXString, isXDate, isXNumber)=>{
|
|
|
313
313
|
}
|
|
314
314
|
return x;
|
|
315
315
|
};
|
|
316
|
+
/**
|
|
317
|
+
* Formats text values according to the texttemplate specification
|
|
318
|
+
* Supports D3 format specifiers within %{text:format} patterns
|
|
319
|
+
* @param textValue The raw text value to format
|
|
320
|
+
* @param textTemplate The template string (e.g., "%{text:.1f}%", "%{text:.2%}", "%{text:,.0f}")
|
|
321
|
+
* @param index Optional index for array-based templates
|
|
322
|
+
* @returns Formatted text string
|
|
323
|
+
*
|
|
324
|
+
* Examples:
|
|
325
|
+
* - "%{text:.1f}%" → Formats number with 1 decimal place and adds % suffix
|
|
326
|
+
* - "%{text:.2%}" → Formats as percentage with 2 decimal places
|
|
327
|
+
* - "%{text:,.0f}" → Formats with thousands separator and no decimals
|
|
328
|
+
* - "%{text:$,.2f}" → Formats as currency with thousands separator and 2 decimals
|
|
329
|
+
*/ const formatTextWithTemplate = (textValue, textTemplate, index)=>{
|
|
330
|
+
if (!textTemplate) {
|
|
331
|
+
return String(textValue);
|
|
332
|
+
}
|
|
333
|
+
const numVal = typeof textValue === 'number' ? textValue : parseFloat(String(textValue));
|
|
334
|
+
if (isNaN(numVal)) {
|
|
335
|
+
return String(textValue);
|
|
336
|
+
}
|
|
337
|
+
const template = typeof textTemplate === 'string' ? textTemplate : textTemplate[index || 0] || '';
|
|
338
|
+
// Match Plotly's texttemplate pattern: %{text:format} or %{text}
|
|
339
|
+
// Can be followed by any literal text like %, $, etc.
|
|
340
|
+
const plotlyPattern = /%\{text(?::([^}]+))?\}(.*)$/;
|
|
341
|
+
const match = template.match(plotlyPattern);
|
|
342
|
+
if (match) {
|
|
343
|
+
const formatSpec = match[1]; // The format specifier (e.g., ".1f", ".2%", ",.0f") or undefined
|
|
344
|
+
const suffix = match[2]; // Any text after the closing brace (e.g., "%", " units")
|
|
345
|
+
// If no format specifier is provided (e.g., %{text}%), try to infer from suffix
|
|
346
|
+
if (!formatSpec) {
|
|
347
|
+
// Check if suffix starts with % - assume simple percentage with 1 decimal
|
|
348
|
+
if (suffix.startsWith('%')) {
|
|
349
|
+
return `${numVal.toFixed(1)}${suffix}`;
|
|
350
|
+
}
|
|
351
|
+
// No format specifier, just return the number with the suffix
|
|
352
|
+
return `${numVal}${suffix}`;
|
|
353
|
+
}
|
|
354
|
+
try {
|
|
355
|
+
// Use D3 format function to apply the format specifier
|
|
356
|
+
const formatter = (0, _d3format.format)(formatSpec);
|
|
357
|
+
const formattedValue = formatter(numVal);
|
|
358
|
+
return `${formattedValue}${suffix}`;
|
|
359
|
+
} catch (error) {
|
|
360
|
+
// Try to extract precision for basic fallback
|
|
361
|
+
const precisionMatch = formatSpec.match(/\.(\d+)[f%]/);
|
|
362
|
+
const precision = precisionMatch ? parseInt(precisionMatch[1], 10) : 2;
|
|
363
|
+
// Check if it's a percentage format
|
|
364
|
+
if (formatSpec.includes('%')) {
|
|
365
|
+
return `${(numVal * 100).toFixed(precision)}%${suffix}`;
|
|
366
|
+
}
|
|
367
|
+
return `${numVal.toFixed(precision)}${suffix}`;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
return String(textValue);
|
|
371
|
+
};
|
|
316
372
|
/**
|
|
317
373
|
* Extracts unique X-axis categories from Plotly data traces
|
|
318
374
|
* @param data Array of Plotly data traces
|
|
@@ -964,7 +1020,8 @@ const transformPlotlyJsonToDonutProps = (input, isMultiPlot, colorMap, colorwayT
|
|
|
964
1020
|
const hideLabels = firstData.textinfo ? ![
|
|
965
1021
|
'value',
|
|
966
1022
|
'percent',
|
|
967
|
-
'label+percent'
|
|
1023
|
+
'label+percent',
|
|
1024
|
+
'percent+label'
|
|
968
1025
|
].includes(firstData.textinfo) : false;
|
|
969
1026
|
const donutMarginHorizontal = hideLabels ? 0 : 80;
|
|
970
1027
|
const donutMarginVertical = 40 + (hideLabels ? 0 : 40);
|
|
@@ -997,7 +1054,8 @@ const transformPlotlyJsonToDonutProps = (input, isMultiPlot, colorMap, colorwayT
|
|
|
997
1054
|
hideLabels,
|
|
998
1055
|
showLabelsInPercent: firstData.textinfo ? [
|
|
999
1056
|
'percent',
|
|
1000
|
-
'label+percent'
|
|
1057
|
+
'label+percent',
|
|
1058
|
+
'percent+label'
|
|
1001
1059
|
].includes(firstData.textinfo) : true,
|
|
1002
1060
|
roundCorners: true,
|
|
1003
1061
|
order: 'sorted'
|
|
@@ -1024,6 +1082,7 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
1024
1082
|
validXYRanges.forEach(([rangeStart, rangeEnd], rangeIdx)=>{
|
|
1025
1083
|
const rangeXValues = series.x.slice(rangeStart, rangeEnd);
|
|
1026
1084
|
const rangeYValues = series.y.slice(rangeStart, rangeEnd);
|
|
1085
|
+
const textValues = Array.isArray(series.text) ? series.text.slice(rangeStart, rangeEnd) : typeof series.text === 'string' ? series.text : undefined;
|
|
1027
1086
|
rangeXValues.forEach((x, index2)=>{
|
|
1028
1087
|
var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout;
|
|
1029
1088
|
if (!mapXToDataPoints[x]) {
|
|
@@ -1039,6 +1098,11 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
1039
1098
|
const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, index2);
|
|
1040
1099
|
const yVal = rangeYValues[index2];
|
|
1041
1100
|
const yAxisCalloutData = getFormattedCalloutYData(yVal, yAxisTickFormat);
|
|
1101
|
+
let barLabel = Array.isArray(textValues) ? textValues[index2] : textValues;
|
|
1102
|
+
// Apply texttemplate formatting if specified
|
|
1103
|
+
if (barLabel && series.texttemplate) {
|
|
1104
|
+
barLabel = formatTextWithTemplate(barLabel, series.texttemplate, index2);
|
|
1105
|
+
}
|
|
1042
1106
|
if (series.type === 'bar') {
|
|
1043
1107
|
var _rgb_copy_formatHex8;
|
|
1044
1108
|
mapXToDataPoints[x].chartData.push({
|
|
@@ -1047,7 +1111,10 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
1047
1111
|
color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(color).copy({
|
|
1048
1112
|
opacity
|
|
1049
1113
|
}).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
|
|
1050
|
-
yAxisCalloutData
|
|
1114
|
+
yAxisCalloutData,
|
|
1115
|
+
...barLabel ? {
|
|
1116
|
+
barLabel: String(barLabel)
|
|
1117
|
+
} : {}
|
|
1051
1118
|
});
|
|
1052
1119
|
if (typeof yVal === 'number') {
|
|
1053
1120
|
yMaxValue = Math.max(yMaxValue, yVal);
|
|
@@ -1234,6 +1301,12 @@ const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
1234
1301
|
const color = colorScale ? colorScale((0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[xIndex % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : (0, _PlotlyColorAdapter.resolveColor)(extractedBarColors, xIndex, legend, colorMap, (_processedInput_layout = processedInput.layout) === null || _processedInput_layout === void 0 ? void 0 : (_processedInput_layout_template = _processedInput_layout.template) === null || _processedInput_layout_template === void 0 ? void 0 : (_processedInput_layout_template_layout = _processedInput_layout_template.layout) === null || _processedInput_layout_template_layout === void 0 ? void 0 : _processedInput_layout_template_layout.colorway, isDarkTheme);
|
|
1235
1302
|
const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, xIndex);
|
|
1236
1303
|
const yVal = series.y[xIndex];
|
|
1304
|
+
// Extract text value for barLabel
|
|
1305
|
+
let barLabel = Array.isArray(series.text) ? series.text[xIndex] : series.text;
|
|
1306
|
+
// Apply texttemplate formatting if specified
|
|
1307
|
+
if (barLabel && series.texttemplate) {
|
|
1308
|
+
barLabel = formatTextWithTemplate(barLabel, series.texttemplate, xIndex);
|
|
1309
|
+
}
|
|
1237
1310
|
var _rgb_copy_formatHex8;
|
|
1238
1311
|
return {
|
|
1239
1312
|
x: x.toString(),
|
|
@@ -1241,7 +1314,10 @@ const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
1241
1314
|
yAxisCalloutData: getFormattedCalloutYData(yVal, yAxisTickFormat),
|
|
1242
1315
|
color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(color).copy({
|
|
1243
1316
|
opacity
|
|
1244
|
-
}).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color
|
|
1317
|
+
}).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
|
|
1318
|
+
...barLabel ? {
|
|
1319
|
+
barLabel: String(barLabel)
|
|
1320
|
+
} : {}
|
|
1245
1321
|
};
|
|
1246
1322
|
}).filter((item)=>typeof item !== 'undefined'),
|
|
1247
1323
|
useSecondaryYScale: usesSecondaryYScale(series, processedInput.layout)
|
|
@@ -1358,6 +1434,11 @@ const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colorwayTyp
|
|
|
1358
1434
|
const color = colorScale ? colorScale((0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[index % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : (0, _PlotlyColorAdapter.resolveColor)(extractedColors, index, legend, colorMap, (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, isDarkTheme);
|
|
1359
1435
|
const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, index);
|
|
1360
1436
|
const yVal = calculateHistNorm(series.histnorm, y[index], total, isXString ? bin.length : getBinSize(bin));
|
|
1437
|
+
// Handle text values and texttemplate formatting for histogram bins
|
|
1438
|
+
let barLabel = Array.isArray(series.text) ? series.text[index] : series.text;
|
|
1439
|
+
if (barLabel && series.texttemplate) {
|
|
1440
|
+
barLabel = formatTextWithTemplate(barLabel, series.texttemplate, index);
|
|
1441
|
+
}
|
|
1361
1442
|
var _rgb_copy_formatHex8;
|
|
1362
1443
|
vbcData.push({
|
|
1363
1444
|
x: isXString ? bin.join(', ') : getBinCenter(bin),
|
|
@@ -1368,7 +1449,10 @@ const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colorwayTyp
|
|
|
1368
1449
|
}).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
|
|
1369
1450
|
...isXString ? {} : {
|
|
1370
1451
|
xAxisCalloutData: `[${bin.x0} - ${bin.x1})`
|
|
1371
|
-
}
|
|
1452
|
+
},
|
|
1453
|
+
...barLabel ? {
|
|
1454
|
+
barLabel: String(barLabel)
|
|
1455
|
+
} : {}
|
|
1372
1456
|
});
|
|
1373
1457
|
});
|
|
1374
1458
|
});
|
|
@@ -1785,11 +1869,53 @@ const transformPlotlyJsonToGanttChartProps = (input, isMultiPlot, colorMap, colo
|
|
|
1785
1869
|
};
|
|
1786
1870
|
};
|
|
1787
1871
|
const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
1788
|
-
var _input_layout, _input_layout_coloraxis,
|
|
1872
|
+
var _input_layout, _input_layout1, _input_layout_coloraxis, _input_layout2, _input_layout_template_layout, _input_layout_template, _input_layout3, _input_layout_template_data_histogram2d_, _input_layout_template_data_histogram2d, _input_layout_template_data, _input_layout_template1, _input_layout4, _input_layout_template_data_heatmap_, _input_layout_template_data_heatmap, _input_layout_template_data1, _input_layout_template2, _input_layout5, _input_layout6, _input_layout7;
|
|
1789
1873
|
const firstData = input.data[0];
|
|
1790
1874
|
const heatmapDataPoints = [];
|
|
1791
1875
|
let zMin = Number.POSITIVE_INFINITY;
|
|
1792
1876
|
let zMax = Number.NEGATIVE_INFINITY;
|
|
1877
|
+
// Build a 2D array of annotations based on their grid position
|
|
1878
|
+
const annotationGrid = [];
|
|
1879
|
+
const rawAnnotations = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.annotations;
|
|
1880
|
+
if (rawAnnotations) {
|
|
1881
|
+
const annotationsArray = Array.isArray(rawAnnotations) ? rawAnnotations : [
|
|
1882
|
+
rawAnnotations
|
|
1883
|
+
];
|
|
1884
|
+
// Collect all unique x and y values from valid annotations
|
|
1885
|
+
const xSet = new Set();
|
|
1886
|
+
const ySet = new Set();
|
|
1887
|
+
const validAnnotations = [];
|
|
1888
|
+
annotationsArray.forEach((a)=>{
|
|
1889
|
+
if (a && typeof a.x === 'number' && typeof a.y === 'number' && typeof a.text === 'string' && (a.xref === 'x' || a.xref === undefined) && (a.yref === 'y' || a.yref === undefined)) {
|
|
1890
|
+
xSet.add(a.x);
|
|
1891
|
+
ySet.add(a.y);
|
|
1892
|
+
validAnnotations.push({
|
|
1893
|
+
x: a.x,
|
|
1894
|
+
y: a.y,
|
|
1895
|
+
text: cleanText(a.text)
|
|
1896
|
+
});
|
|
1897
|
+
}
|
|
1898
|
+
});
|
|
1899
|
+
if (validAnnotations.length > 0) {
|
|
1900
|
+
// Get sorted unique x and y values
|
|
1901
|
+
const xValues = Array.from(xSet).sort((a, b)=>a - b);
|
|
1902
|
+
const yValues = Array.from(ySet).sort((a, b)=>a - b);
|
|
1903
|
+
// Initialize 2D grid and populate
|
|
1904
|
+
validAnnotations.forEach((annotation)=>{
|
|
1905
|
+
const xIdx = xValues.indexOf(annotation.x);
|
|
1906
|
+
const yIdx = yValues.indexOf(annotation.y);
|
|
1907
|
+
if (!annotationGrid[yIdx]) {
|
|
1908
|
+
annotationGrid[yIdx] = [];
|
|
1909
|
+
}
|
|
1910
|
+
annotationGrid[yIdx][xIdx] = annotation.text;
|
|
1911
|
+
});
|
|
1912
|
+
}
|
|
1913
|
+
}
|
|
1914
|
+
// Helper function to get annotation from 2D grid by index
|
|
1915
|
+
const getAnnotationByIndex = (xIdx, yIdx)=>{
|
|
1916
|
+
var _annotationGrid_yIdx;
|
|
1917
|
+
return (_annotationGrid_yIdx = annotationGrid[yIdx]) === null || _annotationGrid_yIdx === void 0 ? void 0 : _annotationGrid_yIdx[xIdx];
|
|
1918
|
+
};
|
|
1793
1919
|
if (firstData.type === 'histogram2d') {
|
|
1794
1920
|
var _firstData_x, _firstData_xbins, _firstData_xbins1, _firstData_xbins2, _firstData_ybins, _firstData_ybins1, _firstData_ybins2;
|
|
1795
1921
|
const xValues = [];
|
|
@@ -1829,11 +1955,12 @@ const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwa
|
|
|
1829
1955
|
xBins.forEach((xBin, xIdx)=>{
|
|
1830
1956
|
yBins.forEach((yBin, yIdx)=>{
|
|
1831
1957
|
const zVal = calculateHistNorm(firstData.histnorm, z[yIdx][xIdx], total, isXString ? xBin.length : getBinSize(xBin), isYString ? yBin.length : getBinSize(yBin));
|
|
1958
|
+
const annotationText = getAnnotationByIndex(xIdx, yIdx);
|
|
1832
1959
|
heatmapDataPoints.push({
|
|
1833
1960
|
x: isXString ? xBin.join(', ') : getBinCenter(xBin),
|
|
1834
1961
|
y: isYString ? yBin.join(', ') : getBinCenter(yBin),
|
|
1835
1962
|
value: zVal,
|
|
1836
|
-
rectText: zVal
|
|
1963
|
+
rectText: annotationText || zVal
|
|
1837
1964
|
});
|
|
1838
1965
|
if (typeof zVal === 'number') {
|
|
1839
1966
|
zMin = Math.min(zMin, zVal);
|
|
@@ -1842,17 +1969,34 @@ const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwa
|
|
|
1842
1969
|
});
|
|
1843
1970
|
});
|
|
1844
1971
|
} else {
|
|
1845
|
-
var
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1972
|
+
var _zArray_;
|
|
1973
|
+
// If x and y are not provided, generate indices based on z dimensions
|
|
1974
|
+
const zArray = firstData.z;
|
|
1975
|
+
const xValues = firstData.x;
|
|
1976
|
+
const yValues = firstData.y;
|
|
1977
|
+
var _zArray_length;
|
|
1978
|
+
// Determine the dimensions from z array
|
|
1979
|
+
const yLength = (_zArray_length = zArray === null || zArray === void 0 ? void 0 : zArray.length) !== null && _zArray_length !== void 0 ? _zArray_length : 0;
|
|
1980
|
+
var _zArray__length;
|
|
1981
|
+
const xLength = (_zArray__length = zArray === null || zArray === void 0 ? void 0 : (_zArray_ = zArray[0]) === null || _zArray_ === void 0 ? void 0 : _zArray_.length) !== null && _zArray__length !== void 0 ? _zArray__length : 0;
|
|
1982
|
+
// Use provided x/y values or generate indices
|
|
1983
|
+
const xData = xValues !== null && xValues !== void 0 ? xValues : Array.from({
|
|
1984
|
+
length: xLength
|
|
1985
|
+
}, (_, i)=>i);
|
|
1986
|
+
const yData = yValues !== null && yValues !== void 0 ? yValues : Array.from({
|
|
1987
|
+
length: yLength
|
|
1988
|
+
}, (_, i)=>yLength - 1 - i);
|
|
1989
|
+
xData.forEach((xVal, xIdx)=>{
|
|
1990
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1991
|
+
yData.forEach((yVal, yIdx)=>{
|
|
1992
|
+
var _zArray_yIdx, _input_layout_xaxis, _input_layout, _input_layout_yaxis, _input_layout1;
|
|
1993
|
+
const zVal = zArray === null || zArray === void 0 ? void 0 : (_zArray_yIdx = zArray[yIdx]) === null || _zArray_yIdx === void 0 ? void 0 : _zArray_yIdx[xIdx];
|
|
1994
|
+
const annotationText = getAnnotationByIndex(xIdx, yIdx);
|
|
1851
1995
|
heatmapDataPoints.push({
|
|
1852
1996
|
x: ((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_xaxis = _input_layout.xaxis) === null || _input_layout_xaxis === void 0 ? void 0 : _input_layout_xaxis.type) === 'date' ? xVal : xVal !== null && xVal !== void 0 ? xVal : 0,
|
|
1853
1997
|
y: ((_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_yaxis = _input_layout1.yaxis) === null || _input_layout_yaxis === void 0 ? void 0 : _input_layout_yaxis.type) === 'date' ? yVal : yVal,
|
|
1854
1998
|
value: zVal,
|
|
1855
|
-
rectText: zVal
|
|
1999
|
+
rectText: annotationText || zVal
|
|
1856
2000
|
});
|
|
1857
2001
|
if (typeof zVal === 'number') {
|
|
1858
2002
|
zMin = Math.min(zMin, zVal);
|
|
@@ -1879,7 +2023,7 @@ const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwa
|
|
|
1879
2023
|
(0, _colors.getColorFromToken)(_colors.DataVizPalette.color3)
|
|
1880
2024
|
];
|
|
1881
2025
|
var _firstData_colorscale, _ref, _ref1, _ref2, _ref3;
|
|
1882
|
-
let colorscale = (_ref3 = (_ref2 = (_ref1 = (_ref = (_firstData_colorscale = firstData === null || firstData === void 0 ? void 0 : firstData.colorscale) !== null && _firstData_colorscale !== void 0 ? _firstData_colorscale : (
|
|
2026
|
+
let colorscale = (_ref3 = (_ref2 = (_ref1 = (_ref = (_firstData_colorscale = firstData === null || firstData === void 0 ? void 0 : firstData.colorscale) !== null && _firstData_colorscale !== void 0 ? _firstData_colorscale : (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.colorscale) !== null && _ref !== void 0 ? _ref : (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : (_input_layout_coloraxis = _input_layout2.coloraxis) === null || _input_layout_coloraxis === void 0 ? void 0 : _input_layout_coloraxis.colorscale) !== null && _ref1 !== void 0 ? _ref1 : (_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : (_input_layout_template = _input_layout3.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorscale) !== null && _ref2 !== void 0 ? _ref2 : firstData.type === 'histogram2d' && ((_input_layout4 = input.layout) === null || _input_layout4 === void 0 ? void 0 : (_input_layout_template1 = _input_layout4.template) === null || _input_layout_template1 === void 0 ? void 0 : (_input_layout_template_data = _input_layout_template1.data) === null || _input_layout_template_data === void 0 ? void 0 : (_input_layout_template_data_histogram2d = _input_layout_template_data.histogram2d) === null || _input_layout_template_data_histogram2d === void 0 ? void 0 : (_input_layout_template_data_histogram2d_ = _input_layout_template_data_histogram2d[0]) === null || _input_layout_template_data_histogram2d_ === void 0 ? void 0 : _input_layout_template_data_histogram2d_.colorscale)) !== null && _ref3 !== void 0 ? _ref3 : (_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : (_input_layout_template2 = _input_layout5.template) === null || _input_layout_template2 === void 0 ? void 0 : (_input_layout_template_data1 = _input_layout_template2.data) === null || _input_layout_template_data1 === void 0 ? void 0 : (_input_layout_template_data_heatmap = _input_layout_template_data1.heatmap) === null || _input_layout_template_data_heatmap === void 0 ? void 0 : (_input_layout_template_data_heatmap_ = _input_layout_template_data_heatmap[0]) === null || _input_layout_template_data_heatmap_ === void 0 ? void 0 : _input_layout_template_data_heatmap_.colorscale;
|
|
1883
2027
|
// determine if the types diverging, sequential or sequentialminus are present in colorscale
|
|
1884
2028
|
if (colorscale && typeof colorscale === 'object' && ('diverging' in colorscale || 'sequential' in colorscale || 'sequentialminus' in colorscale)) {
|
|
1885
2029
|
const isDivergent = zMin < 0 && zMax > 0; // Data spans both positive and negative values
|
|
@@ -1905,8 +2049,8 @@ const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwa
|
|
|
1905
2049
|
hideLegend: true,
|
|
1906
2050
|
showYAxisLables: true,
|
|
1907
2051
|
sortOrder: 'none',
|
|
1908
|
-
width: (
|
|
1909
|
-
height: (_input_layout_height = (
|
|
2052
|
+
width: (_input_layout6 = input.layout) === null || _input_layout6 === void 0 ? void 0 : _input_layout6.width,
|
|
2053
|
+
height: (_input_layout_height = (_input_layout7 = input.layout) === null || _input_layout7 === void 0 ? void 0 : _input_layout7.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
|
|
1910
2054
|
hideTickOverlap: true,
|
|
1911
2055
|
noOfCharsToTruncate: 20,
|
|
1912
2056
|
showYAxisLablesTooltip: true,
|
|
@@ -2755,7 +2899,10 @@ const isNonPlotType = (chartType)=>{
|
|
|
2755
2899
|
'donut',
|
|
2756
2900
|
'sankey',
|
|
2757
2901
|
'pie',
|
|
2758
|
-
'annotation'
|
|
2902
|
+
'annotation',
|
|
2903
|
+
'table',
|
|
2904
|
+
'gauge',
|
|
2905
|
+
'funnel'
|
|
2759
2906
|
].includes(chartType);
|
|
2760
2907
|
};
|
|
2761
2908
|
const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
|