@fluentui/react-charts 9.0.2 → 9.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +48 -7
- package/dist/index.d.ts +767 -0
- package/lib/AreaChart.js +1 -0
- package/lib/AreaChart.js.map +1 -0
- package/lib/HeatMapChart.js +1 -0
- package/lib/HeatMapChart.js.map +1 -0
- package/lib/HorizontalBarChartWithAxis.js +1 -0
- package/lib/HorizontalBarChartWithAxis.js.map +1 -0
- package/lib/SankeyChart.js +1 -0
- package/lib/SankeyChart.js.map +1 -0
- package/lib/VerticalStackedBarChart.js +1 -0
- package/lib/VerticalStackedBarChart.js.map +1 -0
- package/lib/components/AreaChart/AreaChart.js +775 -0
- package/lib/components/AreaChart/AreaChart.js.map +1 -0
- package/lib/components/AreaChart/AreaChart.types.js +4 -0
- package/lib/components/AreaChart/AreaChart.types.js.map +1 -0
- package/lib/components/AreaChart/index.js +3 -0
- package/lib/components/AreaChart/index.js.map +1 -0
- package/lib/components/AreaChart/useAreaChartStyles.styles.js +64 -0
- package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -0
- package/lib/components/CommonComponents/CartesianChart.js +30 -14
- package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +112 -65
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +570 -159
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/Arc/Arc.js +1 -1
- package/lib/components/DonutChart/Arc/Arc.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.js +1 -1
- package/lib/components/DonutChart/DonutChart.js.map +1 -1
- package/lib/components/GaugeChart/GaugeChart.js +3 -0
- package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
- package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +9 -0
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib/components/HeatMapChart/HeatMapChart.js +588 -0
- package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -0
- package/lib/components/HeatMapChart/HeatMapChart.types.js +4 -0
- package/lib/components/HeatMapChart/HeatMapChart.types.js.map +1 -0
- package/lib/components/HeatMapChart/index.js +3 -0
- package/lib/components/HeatMapChart/index.js.map +1 -0
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js +46 -0
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -0
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +571 -0
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -0
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js +4 -0
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -0
- package/lib/components/HorizontalBarChartWithAxis/index.js +3 -0
- package/lib/components/HorizontalBarChartWithAxis/index.js.map +1 -0
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +76 -0
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -0
- package/lib/components/Legends/Legends.js +38 -37
- package/lib/components/Legends/Legends.js.map +1 -1
- package/lib/components/LineChart/LineChart.js +43 -35
- package/lib/components/LineChart/LineChart.js.map +1 -1
- package/lib/components/SankeyChart/SankeyChart.js +1022 -0
- package/lib/components/SankeyChart/SankeyChart.js.map +1 -0
- package/lib/components/SankeyChart/SankeyChart.types.js +3 -0
- package/lib/components/SankeyChart/SankeyChart.types.js.map +1 -0
- package/lib/components/SankeyChart/index.js +3 -0
- package/lib/components/SankeyChart/index.js.map +1 -0
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +109 -0
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -0
- package/lib/components/ScatterChart/ScatterChart.js +46 -59
- package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.js +165 -88
- package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.types.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +904 -0
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -0
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js +1 -0
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -0
- package/lib/components/VerticalStackedBarChart/index.js +3 -0
- package/lib/components/VerticalStackedBarChart/index.js.map +1 -0
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +73 -0
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -0
- package/lib/index.js +5 -0
- package/lib/index.js.map +1 -1
- package/lib/types/DataPoint.js +1 -3
- package/lib/types/DataPoint.js.map +1 -1
- package/lib/utilities/SVGTooltipText.js +49 -4
- package/lib/utilities/SVGTooltipText.js.map +1 -1
- package/lib/utilities/colors.js +20 -0
- package/lib/utilities/colors.js.map +1 -1
- package/lib/utilities/string.js +32 -0
- package/lib/utilities/string.js.map +1 -0
- package/lib/utilities/test-data.js +53 -0
- package/lib/utilities/test-data.js.map +1 -1
- package/lib/utilities/utilities.js +90 -18
- package/lib/utilities/utilities.js.map +1 -1
- package/lib-commonjs/AreaChart.js +6 -0
- package/lib-commonjs/AreaChart.js.map +1 -0
- package/lib-commonjs/HeatMapChart.js +6 -0
- package/lib-commonjs/HeatMapChart.js.map +1 -0
- package/lib-commonjs/HorizontalBarChartWithAxis.js +6 -0
- package/lib-commonjs/HorizontalBarChartWithAxis.js.map +1 -0
- package/lib-commonjs/SankeyChart.js +6 -0
- package/lib-commonjs/SankeyChart.js.map +1 -0
- package/lib-commonjs/VerticalStackedBarChart.js +6 -0
- package/lib-commonjs/VerticalStackedBarChart.js.map +1 -0
- package/lib-commonjs/components/AreaChart/AreaChart.js +781 -0
- package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -0
- package/lib-commonjs/components/AreaChart/AreaChart.types.js +7 -0
- package/lib-commonjs/components/AreaChart/AreaChart.types.js.map +1 -0
- package/lib-commonjs/components/AreaChart/index.js +8 -0
- package/lib-commonjs/components/AreaChart/index.js.map +1 -0
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +104 -0
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +29 -14
- package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +120 -73
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +592 -178
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Arc/Arc.js +1 -1
- package/lib-commonjs/components/DonutChart/Arc/Arc.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.js +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.js +3 -0
- package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +9 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +599 -0
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -0
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.types.js +7 -0
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.types.js.map +1 -0
- package/lib-commonjs/components/HeatMapChart/index.js +8 -0
- package/lib-commonjs/components/HeatMapChart/index.js.map +1 -0
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js +68 -0
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +580 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js +7 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/index.js +8 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/index.js.map +1 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +116 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -0
- package/lib-commonjs/components/Legends/Legends.js +37 -37
- package/lib-commonjs/components/Legends/Legends.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.js +41 -33
- package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/SankeyChart.js +1038 -0
- package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -0
- package/lib-commonjs/components/SankeyChart/SankeyChart.types.js +6 -0
- package/lib-commonjs/components/SankeyChart/SankeyChart.types.js.map +1 -0
- package/lib-commonjs/components/SankeyChart/index.js +8 -0
- package/lib-commonjs/components/SankeyChart/index.js.map +1 -0
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +179 -0
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/ScatterChart/ScatterChart.js +45 -58
- package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +164 -87
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.types.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +915 -0
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -0
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js +6 -0
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -0
- package/lib-commonjs/components/VerticalStackedBarChart/index.js +8 -0
- package/lib-commonjs/components/VerticalStackedBarChart/index.js.map +1 -0
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +120 -0
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -0
- package/lib-commonjs/index.js +5 -0
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/types/DataPoint.js +1 -3
- package/lib-commonjs/types/DataPoint.js.map +1 -1
- package/lib-commonjs/utilities/SVGTooltipText.js +49 -4
- package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -1
- package/lib-commonjs/utilities/colors.js +23 -0
- package/lib-commonjs/utilities/colors.js.map +1 -1
- package/lib-commonjs/utilities/string.js +29 -0
- package/lib-commonjs/utilities/string.js.map +1 -0
- package/lib-commonjs/utilities/test-data.js +59 -0
- package/lib-commonjs/utilities/test-data.js.map +1 -1
- package/lib-commonjs/utilities/utilities.js +94 -17
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +11 -8
- package/lib/components/DeclarativeChart/PlotlySchema.js +0 -7
- package/lib/components/DeclarativeChart/PlotlySchema.js.map +0 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchema.js +0 -10
- package/lib-commonjs/components/DeclarativeChart/PlotlySchema.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["CartesianChart.tsx"],"sourcesContent":["import * as React from 'react';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport { ModifiedCartesianChartProps, HorizontalBarChartWithAxisDataPoint } from '../../index';\nimport { useCartesianChartStyles } from './useCartesianChartStyles.styles';\nimport {\n createNumericXAxis,\n createStringXAxis,\n IAxisData,\n getDomainNRangeValues,\n createDateXAxis,\n createYAxis,\n createStringYAxis,\n IMargins,\n getMinMaxOfYAxis,\n XAxisTypes,\n YAxisType,\n createWrapOfXLabels,\n rotateXAxisLabels,\n calculateLongestLabelWidth,\n createYAxisLabels,\n ChartTypes,\n wrapContent,\n useRtl,\n} from '../../utilities/index';\nimport { SVGTooltipText } from '../../utilities/SVGTooltipText';\nimport { ChartPopover } from './ChartPopover';\nimport { useFocusableGroup, useArrowNavigationGroup } from '@fluentui/react-tabster';\n\n/**\n * Cartesian Chart component\n * {@docCategory CartesianChart}\n */\nexport const CartesianChart: React.FunctionComponent<ModifiedCartesianChartProps> = React.forwardRef<\n HTMLDivElement,\n ModifiedCartesianChartProps\n>((props, forwardedRef) => {\n const chartContainer = React.useRef<HTMLDivElement>();\n let legendContainer: HTMLDivElement;\n const minLegendContainerHeight: number = 40;\n const xAxisElement = React.useRef<SVGSVGElement>();\n const yAxisElement = React.useRef<SVGSVGElement>();\n const yAxisElementSecondary = React.useRef<SVGSVGElement>();\n let margins: IMargins;\n const idForGraph: string = 'chart_';\n let _reqID: number;\n const _useRtl: boolean = useRtl();\n let _tickValues: (string | number)[];\n const titleMargin: number = 8;\n const _isFirstRender = React.useRef<boolean>(true);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let _xScale: any;\n let isIntegralDataset: boolean = true;\n\n const [containerWidth, setContainerWidth] = React.useState<number>(0);\n const [containerHeight, setContainerHeight] = React.useState<number>(0);\n const [isRemoveValCalculated, setIsRemoveValCalculated] = React.useState<boolean>(true);\n const [removalValueForTextTuncate, setRemovalValueForTextTuncate] = React.useState<number>(0);\n const [startFromX, setStartFromX] = React.useState<number>(0);\n const [prevProps, setPrevProps] = React.useState<ModifiedCartesianChartProps | null>(null);\n\n /**\n * In RTL mode, Only graph will be rendered left/right. We need to provide left and right margins manually.\n * So that, in RTL, left margins becomes right margins and viceversa.\n * As graph needs to be drawn perfecty, these values consider as default values.\n * Same margins using for all other cartesian charts. Can be accessible through 'getMargins' call back method.\n */\n // eslint-disable-next-line prefer-const\n margins = {\n top: props.margins?.top ?? 20,\n bottom: props.margins?.bottom ?? 35,\n right: _useRtl ? props.margins?.left ?? 40 : props.margins?.right ?? props?.secondaryYScaleOptions ? 40 : 20,\n left: _useRtl ? (props.margins?.right ?? props?.secondaryYScaleOptions ? 40 : 20) : props.margins?.left ?? 40,\n };\n if (props.xAxisTitle !== undefined && props.xAxisTitle !== '') {\n margins.bottom! = props.margins?.bottom ?? 55;\n }\n if (props.yAxisTitle !== undefined && props.yAxisTitle !== '') {\n margins.left! = _useRtl\n ? props.margins?.right ?? props?.secondaryYAxistitle\n ? 60\n : 40\n : props.margins?.left ?? 60;\n margins.right! = _useRtl ? props.margins?.left ?? 60 : props.margins?.right ?? props?.secondaryYAxistitle ? 60 : 40;\n }\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 !== null) {\n setPrevProps(props);\n }\n if (props.chartType === ChartTypes.HorizontalBarChartWithAxis && props.showYAxisLables && yAxisElement.current) {\n const maxYAxisLabelLength = calculateLongestLabelWidth(\n props.points.map((point: HorizontalBarChartWithAxisDataPoint) => point.y),\n `.${classes.yAxis} text`,\n );\n if (startFromX !== maxYAxisLabelLength) {\n setStartFromX(maxYAxisLabelLength);\n }\n } else if (startFromX !== 0) {\n setStartFromX(0);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n isIntegralDataset = !props.points.some((point: { y: number }) => point.y % 1 !== 0);\n return () => {\n cancelAnimationFrame(_reqID);\n };\n }, [props]);\n\n // ComponentDidUpdate logic\n React.useEffect(() => {\n if (prevProps) {\n if (prevProps.height !== props.height || prevProps.width !== props.width) {\n _fitParentContainer();\n }\n }\n if (props.chartType === ChartTypes.HorizontalBarChartWithAxis && props.showYAxisLables && yAxisElement.current) {\n const maxYAxisLabelLength = calculateLongestLabelWidth(\n props.points.map((point: HorizontalBarChartWithAxisDataPoint) => point.y),\n `.${classes.yAxis} text`,\n );\n if (startFromX !== maxYAxisLabelLength) {\n setStartFromX(maxYAxisLabelLength);\n }\n } else if (startFromX !== 0) {\n setStartFromX(0);\n }\n if (prevProps !== null && prevProps.points !== props.points) {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n isIntegralDataset = !props.points.some((point: { y: number }) => point.y % 1 !== 0);\n }\n }, [props, prevProps]);\n\n React.useEffect(() => {\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);\n\n if (\n isRemoveValCalculated &&\n removalValueForTextTuncate !== rotatedHeight! + margins.bottom! &&\n rotatedHeight! > 0\n ) {\n setRemovalValueForTextTuncate(rotatedHeight! + margins.bottom!);\n setIsRemoveValCalculated(false);\n }\n }\n });\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): JSX.Element {\n return <ChartPopover {...calloutProps} />;\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 const margin = { ...margins };\n if (props.chartType === ChartTypes.HorizontalBarChartWithAxis) {\n if (!_useRtl) {\n margin.left! += startFromX;\n } else {\n margin.right! += startFromX;\n }\n }\n // Callback for margins to the chart\n props.getmargins && props.getmargins(margin);\n\n let callout: JSX.Element | null = null;\n\n let children = null;\n if ((props.enableFirstRenderOptimization && chartContainer.current) || !props.enableFirstRenderOptimization) {\n _isFirstRender.current = false;\n const XAxisParams = {\n domainNRangeValues: 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 // This is only used for Horizontal Bar Chart with Axis for y as string axis\n startFromX,\n ),\n containerHeight: containerHeight - removalValueForTextTuncate!,\n margins: margins,\n xAxisElement: xAxisElement.current!,\n 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:\n props.hideTickOverlap && !props.rotateXAxisLables && !props.showXAxisLablesTooltip && !props.wrapXAxisLables,\n };\n\n const YAxisParams = {\n margins: 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: getMinMaxOfYAxis(points, chartType, 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 };\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(XAxisParams, props.tickParams!, props.chartType, culture));\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 ));\n break;\n case XAxisTypes.StringAxis:\n ({ xScale, tickValues } = createStringXAxis(\n XAxisParams,\n props.tickParams!,\n props.datasetForXAxisDomain!,\n culture,\n ));\n break;\n default:\n ({ xScale, tickValues } = createNumericXAxis(XAxisParams, props.tickParams!, props.chartType, culture));\n }\n _xScale = xScale;\n _tickValues = tickValues;\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 set\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 const wrapLabelProps = {\n node: xAxisElement.current!,\n xAxis: xScale,\n showXAxisLablesTooltip: props.showXAxisLablesTooltip || false,\n noOfCharsToTruncate: props.noOfCharsToTruncate || 4,\n };\n const temp = xScale && (createWrapOfXLabels(wrapLabelProps) as number);\n // this value need to be updated for draw graph updated. So instead of using private value, using set\n if (isRemoveValCalculated && removalValueForTextTuncate !== temp) {\n setRemovalValueForTextTuncate(temp);\n setIsRemoveValCalculated(false);\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 yScale: any;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let yScaleSecondary: any;\n const axisData: IAxisData = { yAxisDomainValues: [] };\n if (props.yAxisType && props.yAxisType === YAxisType.StringAxis) {\n yScale = createStringYAxis(\n YAxisParams,\n props.stringDatasetForYAxisDomain!,\n _useRtl,\n props.chartType,\n props.barwidth,\n culture,\n );\n } else {\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 maxOfYVal: props.secondaryYScaleOptions?.yMaxValue ?? 100,\n yMinMaxValues: getMinMaxOfYAxis(points, chartType),\n yAxisPadding: props.yAxisPadding,\n };\n\n yScaleSecondary = createYAxis(\n YAxisParamsSecondary,\n _useRtl,\n axisData,\n chartType,\n props.barwidth!,\n isIntegralDataset,\n true,\n );\n }\n yScale = createYAxis(YAxisParams, _useRtl, axisData, chartType, props.barwidth!, isIntegralDataset);\n }\n\n /*\n * To create y axis tick values by if specified\n truncating the rest of the text and showing elipsis\n or showing the whole string,\n * */\n props.chartType === ChartTypes.HorizontalBarChartWithAxis &&\n yScale &&\n createYAxisLabels(\n yAxisElement.current!,\n yScale,\n props.noOfCharsToTruncate || 4,\n props.showYAxisLablesTooltip || false,\n startFromX,\n _useRtl,\n );\n\n // Call back to the chart.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const _getData = (xScale: any, yScale: any) => {\n props.getGraphData &&\n props.getGraphData(\n xScale,\n yScale,\n containerHeight - removalValueForTextTuncate!,\n containerWidth,\n xAxisElement.current,\n yAxisElement.current,\n );\n };\n\n props.getAxisData && props.getAxisData(axisData);\n // Callback function for chart, returns axis\n _getData(xScale, yScale);\n\n children = props.children({\n xScale,\n yScale,\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 xAxisTitleMaximumAllowedWidth = svgDimensions.width - margins.left! - margins.right! - startFromX!;\n const yAxisTitleMaximumAllowedHeight =\n svgDimensions.height - margins.bottom! - margins.top! - removalValueForTextTuncate! - titleMargin;\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 let labelWidth = 10; // Total padding on the left and right sides of the label\n\n // Case: rotated labels\n if (!props.wrapXAxisLables && props.rotateXAxisLables && props.xAxisType! === XAxisTypes.StringAxis) {\n const longestLabelWidth = calculateLongestLabelWidth(_tickValues, `.${classes.xAxis} text`);\n labelWidth += Math.ceil(longestLabelWidth * Math.cos(Math.PI / 4));\n }\n // Case: truncated labels\n else if (props.showXAxisLablesTooltip) {\n const tickValues = _tickValues.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 labelWidth += Math.ceil(longestLabelWidth);\n }\n // Case: wrapped labels\n else if (props.wrapXAxisLables) {\n const words: string[] = [];\n _tickValues.forEach((val: string) => {\n words.push(...val.toString().split(/\\s+/));\n });\n\n const longestLabelWidth = calculateLongestLabelWidth(words, `.${classes.xAxis} text`);\n labelWidth += Math.max(Math.ceil(longestLabelWidth), 10);\n }\n // Default case\n else {\n const longestLabelWidth = calculateLongestLabelWidth(_tickValues, `.${classes.xAxis} text`);\n labelWidth += Math.ceil(longestLabelWidth);\n }\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 /**\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) => (chartContainer.current = rootElem)}\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 {...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 content={props.xAxisTitle}\n textProps={{\n x: margins.left! + startFromX + xAxisTitleMaximumAllowedWidth / 2,\n y: svgDimensions.height - titleMargin,\n className: classes.axisTitle!,\n textAnchor: 'middle',\n }}\n maxWidth={xAxisTitleMaximumAllowedWidth}\n wrapContent={wrapContent}\n />\n )}\n <g\n ref={(e: SVGSVGElement | null) => {\n yAxisElement.current = e!;\n }}\n id={`yAxisGElement${idForGraph}`}\n transform={`translate(${\n _useRtl ? svgDimensions.width - margins.right! - startFromX : margins.left! + startFromX\n }, 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 content={props.secondaryYAxistitle}\n textProps={{\n x: (yAxisTitleMaximumAllowedHeight - margins.bottom!) / 2 + removalValueForTextTuncate!,\n y: _useRtl ? startFromX - titleMargin : svgDimensions.width - margins.right!,\n textAnchor: 'middle',\n transform: `translate(${\n _useRtl ? margins.right! / 2 - titleMargin : margins.right! / 2 + titleMargin\n },\n ${svgDimensions.height - margins.bottom! - margins.top! - titleMargin})rotate(-90)`,\n className: classes.axisTitle!,\n }}\n maxWidth={yAxisTitleMaximumAllowedHeight}\n wrapContent={wrapContent}\n />\n )}\n </g>\n )}\n {children}\n {props.yAxisTitle !== undefined && props.yAxisTitle !== '' && (\n <SVGTooltipText\n content={props.yAxisTitle}\n textProps={{\n x: (yAxisTitleMaximumAllowedHeight - margins.bottom!) / 2 + removalValueForTextTuncate!,\n y: _useRtl\n ? svgDimensions.width - margins.right! / 2 + titleMargin\n : margins.left! / 2 + startFromX - titleMargin,\n textAnchor: 'middle',\n transform: `translate(0,\n ${svgDimensions.height - margins.bottom! - margins.top! - titleMargin})rotate(-90)`,\n className: classes.axisTitle!,\n }}\n maxWidth={yAxisTitleMaximumAllowedHeight}\n wrapContent={wrapContent}\n />\n )}\n </svg>\n </div>\n\n {!props.hideLegend && (\n <div ref={(e: HTMLDivElement) => (legendContainer = e)} className={classes.legendContainer}>\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","createNumericXAxis","createStringXAxis","getDomainNRangeValues","createDateXAxis","createYAxis","createStringYAxis","getMinMaxOfYAxis","XAxisTypes","YAxisType","createWrapOfXLabels","rotateXAxisLabels","calculateLongestLabelWidth","createYAxisLabels","ChartTypes","wrapContent","useRtl","SVGTooltipText","ChartPopover","useFocusableGroup","useArrowNavigationGroup","CartesianChart","forwardRef","props","forwardedRef","chartContainer","useRef","legendContainer","minLegendContainerHeight","xAxisElement","yAxisElement","yAxisElementSecondary","margins","idForGraph","_reqID","_useRtl","_tickValues","titleMargin","_isFirstRender","_xScale","isIntegralDataset","containerWidth","setContainerWidth","useState","containerHeight","setContainerHeight","isRemoveValCalculated","setIsRemoveValCalculated","removalValueForTextTuncate","setRemovalValueForTextTuncate","startFromX","setStartFromX","prevProps","setPrevProps","top","bottom","right","left","secondaryYScaleOptions","xAxisTitle","undefined","yAxisTitle","secondaryYAxistitle","classes","focusAttributes","arrowAttributes","axis","useEffect","_fitParentContainer","chartType","HorizontalBarChartWithAxis","showYAxisLables","current","maxYAxisLabelLength","points","map","point","y","yAxis","some","cancelAnimationFrame","height","width","wrapXAxisLables","rotateXAxisLables","xAxisType","StringAxis","rotateLabelProps","node","xAxis","rotatedHeight","useImperativeHandle","componentRef","_generateCallout","calloutProps","svgProps","culture","dateLocalizeOptions","timeFormatLocale","customDateTimeFormatter","parentRef","margin","getmargins","callout","children","enableFirstRenderOptimization","XAxisParams","domainNRangeValues","getDomainMargins","barwidth","tickValues","showRoundOffXTickValues","xAxisCount","xAxisTickCount","xAxistickSize","tickPadding","showXAxisLablesTooltip","xAxisPadding","xAxisInnerPadding","xAxisOuterPadding","hideTickOverlap","YAxisParams","yAxisTickFormat","yAxisTickCount","yMinValue","yMaxValue","maxOfYVal","yMinMaxValues","yAxisType","yAxisPadding","xScale","NumericAxis","tickParams","DateAxis","useUTC","datasetForXAxisDomain","wrapLabelProps","noOfCharsToTruncate","temp","yScale","yScaleSecondary","axisData","yAxisDomainValues","stringDatasetForYAxisDomain","YAxisParamsSecondary","showYAxisLablesTooltip","_getData","getGraphData","getAxisData","hideTooltip","isPopoverOpen","svgDimensions","xAxisTitleMaximumAllowedWidth","yAxisTitleMaximumAllowedHeight","legendContainerHeight","hideLegend","legendContainerComputedStyles","getComputedStyle","getBoundingClientRect","parseFloat","marginTop","marginBottom","container","currentContainerWidth","reflowProps","mode","Math","max","_calculateChartMinWidth","currentContainerHeight","shouldResize","_onChartLeave","onChartMouseLeave","labelWidth","longestLabelWidth","ceil","cos","PI","val","numChars","toString","length","slice","words","forEach","push","split","minChartWidth","GroupedVerticalBarChart","VerticalBarChart","VerticalStackedBarChart","includes","minDomainMargin","div","id","className","root","role","ref","rootElem","onMouseLeave","chartWrapper","svg","aria-label","chartTitle","style","display","g","e","transform","content","textProps","x","axisTitle","textAnchor","maxWidth","legendBars","Suspense","fallback","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAG/B,SAASC,uBAAuB,QAAQ,mCAAmC;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cAAckH,cAAcrE,KAAK,GAAGlD,QAAQwB,KAAK;YAC3E8J,YAAY;YACZL,WAAW,CAAC,UAAU,EACpB9K,UAAUH,QAAQwB,KAAK,GAAI,IAAInB,cAAcL,QAAQwB,KAAK,GAAI,IAAInB,YACnE;iBACJ,EAAEkH,cAActE,MAAM,GAAGjD,QAAQuB,MAAM,GAAIvB,QAAQsB,GAAG,GAAIjB,YAAY,YAAY,CAAC;YAChF8J,WAAWpI,QAAQsJ,SAAS;QAC9B;QACAE,UAAU9D;QACV1I,aAAaA;SAKpByF,UACAjF,MAAMsC,UAAU,KAAKD,aAAarC,MAAMsC,UAAU,KAAK,oBACtD,oBAAC5C;QACCiM,SAAS3L,MAAMsC,UAAU;QACzBsJ,WAAW;YACTC,GAAG,AAAC3D,CAAAA,iCAAiCzH,QAAQuB,MAAM,IAAK,IAAIP;YAC5D6B,GAAG1C,UACCoH,cAAcrE,KAAK,GAAGlD,QAAQwB,KAAK,GAAI,IAAInB,cAC3CL,QAAQyB,IAAI,GAAI,IAAIP,aAAab;YACrCiL,YAAY;YACZL,WAAW,CAAC;iBACX,EAAE1D,cAActE,MAAM,GAAGjD,QAAQuB,MAAM,GAAIvB,QAAQsB,GAAG,GAAIjB,YAAY,YAAY,CAAC;YACpF8J,WAAWpI,QAAQsJ,SAAS;QAC9B;QACAE,UAAU9D;QACV1I,aAAaA;UAMpB,CAACQ,MAAMoI,UAAU,kBAChB,oBAACsC;QAAIK,KAAK,CAACU,IAAuBrL,kBAAkBqL;QAAIb,WAAWpI,QAAQpC,eAAe;OACvFJ,MAAMiM,UAAU,GAIpBjH,yBAAW,oBAACxG,MAAM0N,QAAQ;QAACC,wBAAU,oBAACzB,aAAI;OAAmB1F;AAGpE,GAAG;AACHlF,eAAesM,WAAW,GAAG"}
|
|
1
|
+
{"version":3,"sources":["CartesianChart.tsx"],"sourcesContent":["import * as React from 'react';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport { ModifiedCartesianChartProps, HorizontalBarChartWithAxisDataPoint, HeatMapChartDataPoint } from '../../index';\nimport { useCartesianChartStyles } from './useCartesianChartStyles.styles';\nimport {\n createNumericXAxis,\n createStringXAxis,\n IAxisData,\n getDomainNRangeValues,\n createDateXAxis,\n createYAxis,\n createStringYAxis,\n IMargins,\n getMinMaxOfYAxis,\n XAxisTypes,\n YAxisType,\n createWrapOfXLabels,\n rotateXAxisLabels,\n calculateLongestLabelWidth,\n createYAxisLabels,\n ChartTypes,\n wrapContent,\n useRtl,\n} from '../../utilities/index';\nimport { SVGTooltipText } from '../../utilities/SVGTooltipText';\nimport { ChartPopover } from './ChartPopover';\nimport { useFocusableGroup, useArrowNavigationGroup } from '@fluentui/react-tabster';\n\n/**\n * Cartesian Chart component\n * {@docCategory CartesianChart}\n */\nexport const CartesianChart: React.FunctionComponent<ModifiedCartesianChartProps> = React.forwardRef<\n HTMLDivElement,\n ModifiedCartesianChartProps\n>((props, forwardedRef) => {\n const chartContainer = React.useRef<HTMLDivElement>();\n let legendContainer: HTMLDivElement;\n const minLegendContainerHeight: number = 40;\n const xAxisElement = React.useRef<SVGSVGElement>();\n const yAxisElement = React.useRef<SVGSVGElement>();\n const yAxisElementSecondary = React.useRef<SVGSVGElement>();\n let margins: IMargins;\n const idForGraph: string = 'chart_';\n let _reqID: number;\n const _useRtl: boolean = useRtl();\n let _tickValues: (string | number)[];\n const titleMargin: number = 8;\n const _isFirstRender = React.useRef<boolean>(true);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let _xScale: any;\n let isIntegralDataset: boolean = true;\n\n const [containerWidth, setContainerWidth] = React.useState<number>(0);\n const [containerHeight, setContainerHeight] = React.useState<number>(0);\n const [isRemoveValCalculated, setIsRemoveValCalculated] = React.useState<boolean>(true);\n const [removalValueForTextTuncate, setRemovalValueForTextTuncate] = React.useState<number>(0);\n const [startFromX, setStartFromX] = React.useState<number>(0);\n const [prevProps, setPrevProps] = React.useState<ModifiedCartesianChartProps | null>(null);\n\n const chartTypesToCheck = [ChartTypes.HorizontalBarChartWithAxis, ChartTypes.HeatMapChart];\n /**\n * In RTL mode, Only graph will be rendered left/right. We need to provide left and right margins manually.\n * So that, in RTL, left margins becomes right margins and viceversa.\n * As graph needs to be drawn perfecty, these values consider as default values.\n * Same margins using for all other cartesian charts. Can be accessible through 'getMargins' call back method.\n */\n // eslint-disable-next-line prefer-const\n margins = {\n top: props.margins?.top ?? 20,\n bottom: props.margins?.bottom ?? 35,\n right: _useRtl ? props.margins?.left ?? 40 : props.margins?.right ?? props?.secondaryYScaleOptions ? 40 : 20,\n left: _useRtl ? (props.margins?.right ?? props?.secondaryYScaleOptions ? 40 : 20) : props.margins?.left ?? 40,\n };\n if (props.xAxisTitle !== undefined && props.xAxisTitle !== '') {\n margins.bottom! = props.margins?.bottom ?? 55;\n }\n if (props.yAxisTitle !== undefined && props.yAxisTitle !== '') {\n margins.left! = _useRtl\n ? props.margins?.right ?? props?.secondaryYAxistitle\n ? 80\n : 40\n : props.margins?.left ?? 60;\n margins.right! = _useRtl ? props.margins?.left ?? 60 : props.margins?.right ?? props?.secondaryYAxistitle ? 80 : 40;\n }\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 !== null) {\n setPrevProps(props);\n }\n if (chartTypesToCheck.includes(props.chartType) && props.showYAxisLables && yAxisElement) {\n const maxYAxisLabelLength = calculateMaxYAxisLabelLength(props.chartType, props.points, classes.yAxis!);\n if (startFromX !== maxYAxisLabelLength) {\n setStartFromX(maxYAxisLabelLength);\n }\n } else if (startFromX !== 0) {\n setStartFromX(0);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n isIntegralDataset = !props.points.some((point: { y: number }) => point.y % 1 !== 0);\n return () => {\n cancelAnimationFrame(_reqID);\n };\n }, [props]);\n\n // ComponentDidUpdate logic\n React.useEffect(() => {\n if (prevProps) {\n if (prevProps.height !== props.height || prevProps.width !== props.width) {\n _fitParentContainer();\n }\n }\n if (chartTypesToCheck.includes(props.chartType) && props.showYAxisLables && yAxisElement) {\n const maxYAxisLabelLength = calculateMaxYAxisLabelLength(props.chartType, props.points, classes.yAxis!);\n if (startFromX !== maxYAxisLabelLength) {\n setStartFromX(maxYAxisLabelLength);\n }\n } else if (startFromX !== 0) {\n setStartFromX(0);\n }\n if (prevProps !== null && prevProps.points !== props.points) {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n isIntegralDataset = !props.points.some((point: { y: number }) => point.y % 1 !== 0);\n }\n }, [props, prevProps]);\n\n React.useEffect(() => {\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);\n\n if (\n isRemoveValCalculated &&\n removalValueForTextTuncate !== rotatedHeight! + margins.bottom! &&\n rotatedHeight! > 0\n ) {\n setRemovalValueForTextTuncate(rotatedHeight! + margins.bottom!);\n setIsRemoveValCalculated(false);\n }\n }\n });\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): JSX.Element {\n return <ChartPopover {...calloutProps} />;\n }\n\n function calculateMaxYAxisLabelLength(\n chartType: ChartTypes,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n points: any[],\n className: string,\n ): number {\n if (chartType === ChartTypes.HeatMapChart) {\n return calculateLongestLabelWidth(\n points[0]?.data?.map((point: HeatMapChartDataPoint) => point.y),\n `.${className} text`,\n );\n } else {\n return calculateLongestLabelWidth(\n points?.map((point: HorizontalBarChartWithAxisDataPoint) => point.y),\n `.${className} text`,\n );\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 const margin = { ...margins };\n if (chartTypesToCheck.includes(props.chartType)) {\n if (!_useRtl) {\n margin.left! += startFromX;\n } else {\n margin.right! += startFromX;\n }\n }\n // Callback for margins to the chart\n props.getmargins && props.getmargins(margin);\n\n let callout: JSX.Element | null = null;\n\n let children = null;\n if ((props.enableFirstRenderOptimization && chartContainer.current) || !props.enableFirstRenderOptimization) {\n _isFirstRender.current = false;\n const XAxisParams = {\n domainNRangeValues: 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 // This is only used for Horizontal Bar Chart with Axis for y as string axis\n startFromX,\n ),\n containerHeight: containerHeight - removalValueForTextTuncate!,\n margins: margins,\n xAxisElement: xAxisElement.current!,\n 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:\n props.hideTickOverlap && !props.rotateXAxisLables && !props.showXAxisLablesTooltip && !props.wrapXAxisLables,\n };\n\n const YAxisParams = {\n margins: 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: getMinMaxOfYAxis(points, chartType, 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 };\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(XAxisParams, props.tickParams!, props.chartType, culture));\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 ));\n break;\n case XAxisTypes.StringAxis:\n ({ xScale, tickValues } = createStringXAxis(\n XAxisParams,\n props.tickParams!,\n props.datasetForXAxisDomain!,\n culture,\n ));\n break;\n default:\n ({ xScale, tickValues } = createNumericXAxis(XAxisParams, props.tickParams!, props.chartType, culture));\n }\n _xScale = xScale;\n _tickValues = tickValues;\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 set\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 const wrapLabelProps = {\n node: xAxisElement.current!,\n xAxis: xScale,\n showXAxisLablesTooltip: props.showXAxisLablesTooltip || false,\n noOfCharsToTruncate: props.noOfCharsToTruncate || 4,\n };\n const temp = xScale && (createWrapOfXLabels(wrapLabelProps) as number);\n // this value need to be updated for draw graph updated. So instead of using private value, using set\n if (isRemoveValCalculated && removalValueForTextTuncate !== temp) {\n setRemovalValueForTextTuncate(temp);\n setIsRemoveValCalculated(false);\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 yScale: any;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let yScaleSecondary: any;\n const axisData: IAxisData = { yAxisDomainValues: [] };\n if (props.yAxisType && props.yAxisType === YAxisType.StringAxis) {\n yScale = createStringYAxis(\n YAxisParams,\n props.stringDatasetForYAxisDomain!,\n _useRtl,\n props.chartType,\n props.barwidth,\n culture,\n );\n } else {\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 maxOfYVal: props.secondaryYScaleOptions?.yMaxValue ?? 100,\n yMinMaxValues: getMinMaxOfYAxis(points, chartType),\n yAxisPadding: props.yAxisPadding,\n };\n\n yScaleSecondary = createYAxis(\n YAxisParamsSecondary,\n _useRtl,\n axisData,\n chartType,\n props.barwidth!,\n isIntegralDataset,\n true,\n props.roundedTicks!,\n );\n }\n yScale = createYAxis(\n YAxisParams,\n _useRtl,\n axisData,\n chartType,\n props.barwidth!,\n isIntegralDataset,\n false,\n props.roundedTicks!,\n );\n }\n\n /*\n * To create y axis tick values by if specified\n truncating the rest of the text and showing elipsis\n or showing the whole string,\n * */\n chartTypesToCheck.includes(props.chartType) &&\n yScale &&\n createYAxisLabels(\n yAxisElement.current!,\n yScale,\n props.noOfCharsToTruncate || 4,\n props.showYAxisLablesTooltip || false,\n startFromX,\n _useRtl,\n );\n\n // Call back to the chart.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const _getData = (xScale: any, yScale: any) => {\n props.getGraphData &&\n props.getGraphData(\n xScale,\n yScale,\n containerHeight - removalValueForTextTuncate!,\n containerWidth,\n xAxisElement.current,\n yAxisElement.current,\n );\n };\n\n props.getAxisData && props.getAxisData(axisData);\n // Callback function for chart, returns axis\n _getData(xScale, yScale);\n\n children = props.children({\n xScale,\n yScale,\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 xAxisTitleMaximumAllowedWidth = svgDimensions.width - margins.left! - margins.right! - startFromX!;\n const yAxisTitleMaximumAllowedHeight =\n svgDimensions.height - margins.bottom! - margins.top! - removalValueForTextTuncate! - titleMargin;\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 let labelWidth = 10; // Total padding on the left and right sides of the label\n\n // Case: rotated labels\n if (!props.wrapXAxisLables && props.rotateXAxisLables && props.xAxisType! === XAxisTypes.StringAxis) {\n const longestLabelWidth = calculateLongestLabelWidth(_tickValues, `.${classes.xAxis} text`);\n labelWidth += Math.ceil(longestLabelWidth * Math.cos(Math.PI / 4));\n }\n // Case: truncated labels\n else if (props.showXAxisLablesTooltip) {\n const tickValues = _tickValues.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 labelWidth += Math.ceil(longestLabelWidth);\n }\n // Case: wrapped labels\n else if (props.wrapXAxisLables) {\n const words: string[] = [];\n _tickValues.forEach((val: string) => {\n words.push(...val.toString().split(/\\s+/));\n });\n\n const longestLabelWidth = calculateLongestLabelWidth(words, `.${classes.xAxis} text`);\n labelWidth += Math.max(Math.ceil(longestLabelWidth), 10);\n }\n // Default case\n else {\n const longestLabelWidth = calculateLongestLabelWidth(_tickValues, `.${classes.xAxis} text`);\n labelWidth += Math.ceil(longestLabelWidth);\n }\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 /**\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) => (chartContainer.current = rootElem)}\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 {...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 content={props.xAxisTitle}\n textProps={{\n x: margins.left! + startFromX + xAxisTitleMaximumAllowedWidth / 2,\n y: svgDimensions.height - titleMargin,\n className: classes.axisTitle!,\n textAnchor: 'middle',\n }}\n maxWidth={xAxisTitleMaximumAllowedWidth}\n wrapContent={wrapContent}\n showBackground={true}\n />\n )}\n <g\n ref={(e: SVGSVGElement | null) => {\n yAxisElement.current = e!;\n }}\n id={`yAxisGElement${idForGraph}`}\n transform={`translate(${\n _useRtl ? svgDimensions.width - margins.right! - startFromX : margins.left! + startFromX\n }, 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(${\n _useRtl ? margins.left! + startFromX : svgDimensions.width - margins.right! - startFromX\n }, 0)`}\n className={classes.yAxis}\n />\n {props.secondaryYAxistitle !== undefined && props.secondaryYAxistitle !== '' && (\n <SVGTooltipText\n content={props.secondaryYAxistitle}\n textProps={{\n x: (yAxisTitleMaximumAllowedHeight - margins.bottom!) / 2 + removalValueForTextTuncate!,\n y: _useRtl ? startFromX - titleMargin : svgDimensions.width - margins.right!,\n textAnchor: 'middle',\n transform: `translate(${\n _useRtl ? margins.right! / 2 - titleMargin : margins.right! / 2 + titleMargin\n },\n ${svgDimensions.height - margins.bottom! - margins.top! - titleMargin})rotate(-90)`,\n className: classes.axisTitle!,\n }}\n maxWidth={yAxisTitleMaximumAllowedHeight}\n wrapContent={wrapContent}\n showBackground={true}\n />\n )}\n </g>\n )}\n {children}\n {props.yAxisTitle !== undefined && props.yAxisTitle !== '' && (\n <SVGTooltipText\n content={props.yAxisTitle}\n textProps={{\n x: (yAxisTitleMaximumAllowedHeight - margins.bottom!) / 2 + removalValueForTextTuncate!,\n y: _useRtl\n ? svgDimensions.width - margins.right! / 2 + titleMargin\n : margins.left! / 2 + startFromX - titleMargin,\n textAnchor: 'middle',\n transform: `translate(0,\n ${svgDimensions.height - margins.bottom! - margins.top! - titleMargin})rotate(-90)`,\n className: classes.axisTitle!,\n }}\n maxWidth={yAxisTitleMaximumAllowedHeight}\n wrapContent={wrapContent}\n showBackground={true}\n />\n )}\n </svg>\n </div>\n\n {!props.hideLegend && (\n <div ref={(e: HTMLDivElement) => (legendContainer = e)} className={classes.legendContainer}>\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","createNumericXAxis","createStringXAxis","getDomainNRangeValues","createDateXAxis","createYAxis","createStringYAxis","getMinMaxOfYAxis","XAxisTypes","YAxisType","createWrapOfXLabels","rotateXAxisLabels","calculateLongestLabelWidth","createYAxisLabels","ChartTypes","wrapContent","useRtl","SVGTooltipText","ChartPopover","useFocusableGroup","useArrowNavigationGroup","CartesianChart","forwardRef","props","forwardedRef","chartContainer","useRef","legendContainer","minLegendContainerHeight","xAxisElement","yAxisElement","yAxisElementSecondary","margins","idForGraph","_reqID","_useRtl","_tickValues","titleMargin","_isFirstRender","_xScale","isIntegralDataset","containerWidth","setContainerWidth","useState","containerHeight","setContainerHeight","isRemoveValCalculated","setIsRemoveValCalculated","removalValueForTextTuncate","setRemovalValueForTextTuncate","startFromX","setStartFromX","prevProps","setPrevProps","chartTypesToCheck","HorizontalBarChartWithAxis","HeatMapChart","top","bottom","right","left","secondaryYScaleOptions","xAxisTitle","undefined","yAxisTitle","secondaryYAxistitle","classes","focusAttributes","arrowAttributes","axis","useEffect","_fitParentContainer","includes","chartType","showYAxisLables","maxYAxisLabelLength","calculateMaxYAxisLabelLength","points","yAxis","some","point","y","cancelAnimationFrame","height","width","wrapXAxisLables","rotateXAxisLables","xAxisType","StringAxis","rotateLabelProps","node","current","xAxis","rotatedHeight","useImperativeHandle","componentRef","_generateCallout","calloutProps","className","data","map","svgProps","culture","dateLocalizeOptions","timeFormatLocale","customDateTimeFormatter","parentRef","margin","getmargins","callout","children","enableFirstRenderOptimization","XAxisParams","domainNRangeValues","getDomainMargins","barwidth","tickValues","showRoundOffXTickValues","xAxisCount","xAxisTickCount","xAxistickSize","tickPadding","showXAxisLablesTooltip","xAxisPadding","xAxisInnerPadding","xAxisOuterPadding","hideTickOverlap","YAxisParams","yAxisTickFormat","yAxisTickCount","yMinValue","yMaxValue","maxOfYVal","yMinMaxValues","yAxisType","yAxisPadding","xScale","NumericAxis","tickParams","DateAxis","useUTC","datasetForXAxisDomain","wrapLabelProps","noOfCharsToTruncate","temp","yScale","yScaleSecondary","axisData","yAxisDomainValues","stringDatasetForYAxisDomain","YAxisParamsSecondary","roundedTicks","showYAxisLablesTooltip","_getData","getGraphData","getAxisData","hideTooltip","isPopoverOpen","svgDimensions","xAxisTitleMaximumAllowedWidth","yAxisTitleMaximumAllowedHeight","legendContainerHeight","hideLegend","legendContainerComputedStyles","getComputedStyle","getBoundingClientRect","parseFloat","marginTop","marginBottom","container","currentContainerWidth","reflowProps","mode","Math","max","_calculateChartMinWidth","currentContainerHeight","shouldResize","_onChartLeave","onChartMouseLeave","labelWidth","longestLabelWidth","ceil","cos","PI","val","numChars","toString","length","slice","words","forEach","push","split","minChartWidth","GroupedVerticalBarChart","VerticalBarChart","VerticalStackedBarChart","minDomainMargin","div","id","root","role","ref","rootElem","onMouseLeave","chartWrapper","svg","aria-label","chartTitle","style","display","g","e","transform","content","textProps","x","axisTitle","textAnchor","maxWidth","showBackground","legendBars","Suspense","fallback","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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IAAIV;YAC5DiC,GAAG9C,UACC2H,cAAc1E,KAAK,GAAGpD,QAAQ2B,KAAK,GAAI,IAAItB,cAC3CL,QAAQ4B,IAAI,GAAI,IAAIV,aAAab;YACrCsL,YAAY;YACZL,WAAW,CAAC;iBACX,EAAExD,cAAc3E,MAAM,GAAGnD,QAAQ0B,MAAM,GAAI1B,QAAQyB,GAAG,GAAIpB,YAAY,YAAY,CAAC;YACpF6D,WAAWhC,QAAQwJ,SAAS;QAC9B;QACAE,UAAU5D;QACVjJ,aAAaA;QACb8M,gBAAgB;UAMvB,CAACtM,MAAM2I,UAAU,kBAChB,oBAACqC;QAAII,KAAK,CAACU,IAAuB1L,kBAAkB0L;QAAInH,WAAWhC,QAAQvC,eAAe;OACvFJ,MAAMuM,UAAU,GAIpBjH,yBAAW,oBAAC9G,MAAMgO,QAAQ;QAACC,wBAAU,oBAACzB,aAAI;OAAmB1F;AAGpE,GAAG;AACHxF,eAAe4M,WAAW,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["CartesianChart.types.ts"],"sourcesContent":["import * as React from 'react';\nimport { LegendsProps } from '../Legends/index';\nimport { AccessibilityProps, Chart, Margins } from '../../types/index';\nimport { ChartTypes, XAxisTypes, YAxisType } from '../../utilities/index';\nimport { TimeLocaleDefinition } from 'd3-time-format';\nimport { ChartPopoverProps } from './ChartPopover.types';\n/**\n * Cartesian Chart style properties\n * {@docCategory CartesianChart}\n */\nexport interface CartesianChartStyleProps {\n /**\n * Additional CSS class(es) to apply to the Chart.\n */\n className?: string;\n\n /**\n * Width of the chart.\n */\n width?: number;\n\n /**\n * Height of the chart.\n */\n height?: number;\n\n /**\n * Color of the chart.\n */\n color?: string;\n\n /**\n * Link to redirect if click action for graph\n */\n href?: string;\n\n /**\n * prop to check if the chart is selected or hovered upon to determine opacity\n */\n shouldHighlight?: boolean;\n\n /**\n * prop to check if the Page is in Rtl\n */\n useRtl?: boolean;\n\n /**\n * color of the line\n */\n lineColor?: string;\n\n /**\n * boolean flag which determines if shape is drawn in callout\n */\n toDrawShape?: boolean;\n}\n\n/**\n * Cartesian Chart styles\n * {@docCategory CartesianChart}\n */\nexport interface CartesianChartStyles {\n /**\n * Style for the root element.\n */\n root?: string;\n\n /**\n * Style for the element containing the x-axis.\n */\n xAxis?: string;\n\n /**\n * Style for the element containing the y-axis.\n */\n yAxis?: string;\n\n /**\n * Style for legend container\n */\n legendContainer?: string;\n\n /**\n * line hover box css\n */\n hover?: string;\n\n /**\n * styles for callout root-content\n */\n calloutContentRoot?: string;\n\n /**\n * styles for callout x-content\n */\n calloutContentX?: string;\n\n /**\n * styles for callout y-content\n */\n calloutContentY?: string;\n\n /**\n * styles for description message\n */\n descriptionMessage?: string;\n\n /**\n * styles for callout Date time container\n */\n calloutDateTimeContainer?: string;\n\n /**\n * styles for callout info container\n */\n calloutInfoContainer?: string;\n\n /**\n * styles for callout block container\n */\n calloutBlockContainer?: string;\n\n /**\n * Styles for callout block container when toDrawShape is false\n */\n calloutBlockContainertoDrawShapefalse?: string;\n\n /**\n * Styles for callout block container when toDrawShape is true\n */\n calloutBlockContainertoDrawShapetrue?: string;\n\n /**\n * styles for callout legend text\n */\n calloutlegendText?: string;\n\n /**\n * styles for tooltip\n */\n tooltip?: string;\n\n /**\n * styles for tooltip\n */\n axisTitle?: string;\n\n /**\n * Style for the chart Title.\n */\n chartTitle?: string;\n\n /**\n * Style to change the opacity of bars in dataviz when we hover on a single bar or legends\n */\n opacityChangeOnHover?: string;\n\n /**\n * styles for the shape object in the callout\n */\n shapeStyles?: string;\n\n /**\n * Styles for the chart wrapper div\n */\n chartWrapper?: string;\n}\n\n/**\n * Cartesian Chart properties\n * {@docCategory CartesianChart}\n */\nexport interface CartesianChartProps {\n /**\n * Below height used for resizing of the chart\n * Wrap chart in your container and send the updated height and width to these props.\n * These values decide wheather chart re render or not. Please check examples for reference\n */\n height?: number;\n\n /**\n * Below width used for resizing of the chart\n * Wrap chart in your container and send the updated height and width to these props.\n * These values decide wheather chart re render or not. Please check examples for reference\n */\n width?: number;\n\n /**\n * this prop takes its parent as a HTML element to define the width and height of the chart\n */\n parentRef?: HTMLElement | null;\n\n /**\n * Additional CSS class(es) to apply to the Chart.\n */\n className?: string;\n\n /**\n * Margins for the chart\n * @default `{ top: 20, bottom: 35, left: 40, right: 20 }`\n * To avoid edge cuttings to the chart, we recommend you use default values or greater then default values\n */\n margins?: Margins;\n\n /** decides wether to show/hide legends\n * @defaultvalue false\n */\n hideLegend?: boolean;\n\n /**\n * Do not show tooltips in chart\n * @default false\n */\n hideTooltip?: boolean;\n\n /**\n * this prop takes values that you want the chart to render on x-axis\n * This is a optional parameter if not specified D3 will decide which values appear on the x-axis for you\n * Please look at https://github.com/d3/d3-scale for more information on how D3 decides what data to appear on the axis of chart\n */\n tickValues?: number[] | Date[] | string[] | undefined;\n\n /**\n * the format for the data on x-axis. For date object this can be specified to your requirement. Eg: '%m/%d', '%d'\n * Please look at https://github.com/d3/d3-time-format for all the formats supported for date axis\n * Only applicable for date axis. For y-axis format use yAxisTickFormat prop.\n */\n tickFormat?: string;\n\n /**\n * Width of line stroke\n */\n strokeWidth?: number;\n\n /**\n * x Axis labels tick padding. This defines the gap between tick labels and tick lines.\n * @default 10\n */\n xAxisTickPadding?: number;\n\n /**\n * the format in for the data on y-axis. For data object this can be specified to your requirement.\n * Eg: d3.format(\".0%\")(0.123),d3.format(\"+20\")(42);\n * Please look at https://github.com/d3/d3-format for all the formats supported\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n yAxisTickFormat?: any;\n\n /**\n * Secondary y-scale options\n * By default this is not defined, meaning there will be no secondary y-scale.\n */\n secondaryYScaleOptions?: {\n /** Minimum value (0 by default) */\n yMinValue?: number;\n /** Maximum value (100 by default) */\n yMaxValue?: number;\n };\n\n /**\n * minimum data value point in y-axis\n */\n yMinValue?: number;\n\n /**\n * maximum data value point in y-axis\n */\n yMaxValue?: number;\n\n /**\n * maximum data value point in x-axis\n */\n xMaxValue?: number;\n\n /**\n * Number of ticks on the y-axis.\n * Tick count should be factor of difference between (yMinValue, yMaxValue)?\n * @default 4\n */\n yAxisTickCount?: number;\n\n /**\n * defines the number of ticks on the x-axis. Tries to match the nearest interval satisfying the count.\n * Does not work for string axis.\n * @default 6\n */\n xAxisTickCount?: number;\n\n /**\n * define the size of the tick lines on the x-axis\n * @default 10\n */\n xAxistickSize?: number;\n\n /**\n * defines the space between the tick line and the data label\n * @default 10\n */\n tickPadding?: number;\n\n /**\n * Url that the data-viz needs to redirect to upon clicking on it\n */\n href?: string;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n legendsOverflowText?: any;\n\n /**\n * Enable the legends to wrap lines if there is not enough space to show all legends on a single line\n */\n enabledLegendsWrapLines?: boolean;\n\n /*\n * props for the legends in the chart\n */\n legendProps?: Partial<LegendsProps>;\n\n /**\n *@default false\n *Used for to elipse x axis labes and show tooltip on x axis labels\n */\n showXAxisLablesTooltip?: boolean;\n\n /**\n * @default 4\n * Used for X axis labels\n * While Giving showXAxisLablesTooltip prop, need to define after how many chars, we need to truncate the word.\n */\n noOfCharsToTruncate?: number;\n\n /**\n * @default false\n * Used to wrap x axis labels values (whole value)\n */\n wrapXAxisLables?: boolean;\n\n /**\n * @default false\n * Used to rotate x axis labels by 45 degrees\n */\n rotateXAxisLables?: boolean;\n\n /**\n * The prop used to define the date time localization options\n */\n dateLocalizeOptions?: Intl.DateTimeFormatOptions;\n\n /**\n * The prop used to define a custom locale for the date time format.\n */\n timeFormatLocale?: TimeLocaleDefinition;\n\n /**\n * The prop used to define a custom datetime formatter for date axis.\n */\n customDateTimeFormatter?: (dateTime: Date) => string;\n\n /**\n * Call to provide customized styling that will layer on top of the variant rules.\n */\n styles?: CartesianChartStyles;\n\n /**\n * Callout customization props\n */\n calloutProps?: Partial<ChartPopoverProps>;\n\n /**\n * props for the svg; use this to include aria-* or other attributes on the tag\n */\n svgProps?: React.SVGProps<SVGSVGElement>;\n\n /**\n * Props related to reflow behavior of the chart\n */\n reflowProps?: {\n /**\n * Determines the reflow behavior of the chart.\n * When set to `'min-width'`, the chart will not shrink below a certain width and will enable scrolling if it overflows.\n * @default 'none'\n */\n mode: 'none' | 'min-width';\n };\n\n /**\n * Prop to set the x axis title\n * @default undefined\n * Minimum bottom margin required for x axis title is 55px\n */\n\n xAxisTitle?: string;\n\n /**\n * Prop to set the y axis title\n * @default undefined\n * Minimum left margin required for y axis title is 60px and for RTL is 40px\n * Minimum right margin required for y axis title is 40px and for RTL is 60px\n */\n yAxisTitle?: string;\n\n /**\n * Prop to set the secondary y axis title\n * @default undefined\n * If RTL is enabled, minimum left and right margins required for secondary y axis title is 60px\n */\n secondaryYAxistitle?: string;\n\n /**\n * Whether to use UTC time for axis scale, ticks, and the time display in callouts.\n * When set to `true`, time is displayed equally, regardless of the user's timezone settings.\n * @default true\n */\n useUTC?: string | boolean;\n\n /**\n * Determines whether overlapping x-axis tick labels should be hidden.\n * @default false\n */\n hideTickOverlap?: boolean;\n\n /**\n * Define a custom callout props override\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n calloutPropsPerDataPoint?: (dataPointCalloutProps: any) => ChartPopoverProps;\n\n /**\n * Optional callback to access the Chart interface. Use this instead of ref for accessing\n * the public methods and properties of the component.\n */\n componentRef?: React.RefObject<Chart>;\n}\n\nexport interface YValueHover {\n legend?: string;\n y?: number;\n color?: string;\n data?: string | number;\n shouldDrawBorderBottom?: boolean;\n yAxisCalloutData?: string | { [id: string]: number };\n index?: number;\n callOutAccessibilityData?: AccessibilityProps;\n}\n\nexport interface ChildProps {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n xScale?: any;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n yScale?: any;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n yScaleSecondary?: any;\n containerHeight?: number;\n containerWidth?: number;\n optimizeLargeData?: boolean;\n}\n\n// Only used for Cartesian chart base\nexport interface ModifiedCartesianChartProps extends CartesianChartProps {\n /**\n * Define the chart title\n */\n chartTitle?: string;\n\n /**\n * Only used for Area chart\n * Value used to draw y axis of that chart.\n */\n maxOfYVal?: number;\n\n /**\n * Data of the chart\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n points: any;\n\n /**\n * Define type of the chart\n */\n chartType: ChartTypes;\n\n /** X axis type */\n xAxisType: XAxisTypes;\n\n /** Y axis type */\n yAxisType?: YAxisType;\n\n /**\n * Legends of the chart.\n */\n legendBars: JSX.Element | null;\n\n /**\n * Callout props\n */\n calloutProps?: ChartPopoverProps;\n\n /**\n * Callback method used for to get margins to the chart.\n */\n getmargins?: (margins: Margins) => void;\n\n /**\n * This is a call back method to the chart from cartesian chart.\n * params are xScale, yScale, containerHeight, containerWidth. These values were used to draw the graph.\n * It also contians an optional param xAxisElement - defines as x axis scale element.\n * This param used to enable feature word wrap of Xaxis.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n getGraphData?: any;\n\n /**\n * Used for bar chart graphs.\n * To define width of the bar\n */\n barwidth?: number;\n\n /**\n * Used for tick styles of the x axis of the chart\n * Tick params are applicable for date axis only.\n */\n tickParams?: {\n tickValues?: number[] | Date[] | string[];\n tickFormat?: string;\n };\n\n /**\n * it's padding between bar's or lines in the graph\n */\n xAxisPadding?: number;\n\n /**\n * it's padding between bar's or lines in the graph\n */\n yAxisPadding?: number;\n\n /**\n * Children elements specific to derived chart types.\n */\n children(props: ChildProps): React.ReactNode;\n\n /** dataset values to find out domain of the String axis\n * Present using for only vertical stacked bar chart and grouped vertical bar chart\n */\n datasetForXAxisDomain?: string[];\n\n /**\n * if the data points for the y-axis is of type string, then we need to give this\n * prop to construct the y-axis\n */\n stringDatasetForYAxisDomain?: string[];\n\n /**\n * The prop used to define the culture to localize the numbers and date\n */\n culture?: string;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n getAxisData?: any;\n\n /**\n * Callback method used when mouse leaves the chart boundary.\n */\n onChartMouseLeave?: () => void;\n\n /** Callback method to get extra margins for domain */\n getDomainMargins?: (containerWidth: number) => Margins;\n\n /** Padding between each bar/line-point */\n xAxisInnerPadding?: number;\n\n /** Padding before first bar/line-point and after last bar/line-point */\n xAxisOuterPadding?: number;\n\n /**\n *@default false\n *Used for to elipse y axis labes and show tooltip on x axis labels\n */\n showYAxisLablesTooltip?: boolean;\n\n /**\n *@default false\n *Used for showing complete y axis lables */\n showYAxisLables?: boolean;\n\n /**\n * @default false\n * Used to control the first render cycle Performance optimization code.\n */\n enableFirstRenderOptimization?: boolean;\n}\n"],"names":["React"],"rangeMappings":"","mappings":"AAAA,YAAYA,WAAW,QAAQ"}
|
|
1
|
+
{"version":3,"sources":["CartesianChart.types.ts"],"sourcesContent":["import * as React from 'react';\nimport { LegendsProps } from '../Legends/index';\nimport { AccessibilityProps, Chart, Margins } from '../../types/index';\nimport { ChartTypes, XAxisTypes, YAxisType } from '../../utilities/index';\nimport { TimeLocaleDefinition } from 'd3-time-format';\nimport { ChartPopoverProps } from './ChartPopover.types';\n/**\n * Cartesian Chart style properties\n * {@docCategory CartesianChart}\n */\nexport interface CartesianChartStyleProps {\n /**\n * Additional CSS class(es) to apply to the Chart.\n */\n className?: string;\n\n /**\n * Width of the chart.\n */\n width?: number;\n\n /**\n * Height of the chart.\n */\n height?: number;\n\n /**\n * Color of the chart.\n */\n color?: string;\n\n /**\n * Link to redirect if click action for graph\n */\n href?: string;\n\n /**\n * prop to check if the chart is selected or hovered upon to determine opacity\n */\n shouldHighlight?: boolean;\n\n /**\n * prop to check if the Page is in Rtl\n */\n useRtl?: boolean;\n\n /**\n * color of the line\n */\n lineColor?: string;\n\n /**\n * boolean flag which determines if shape is drawn in callout\n */\n toDrawShape?: boolean;\n}\n\n/**\n * Cartesian Chart styles\n * {@docCategory CartesianChart}\n */\nexport interface CartesianChartStyles {\n /**\n * Style for the root element.\n */\n root?: string;\n\n /**\n * Style for the element containing the x-axis.\n */\n xAxis?: string;\n\n /**\n * Style for the element containing the y-axis.\n */\n yAxis?: string;\n\n /**\n * Style for legend container\n */\n legendContainer?: string;\n\n /**\n * line hover box css\n */\n hover?: string;\n\n /**\n * styles for callout root-content\n */\n calloutContentRoot?: string;\n\n /**\n * styles for callout x-content\n */\n calloutContentX?: string;\n\n /**\n * styles for callout y-content\n */\n calloutContentY?: string;\n\n /**\n * styles for description message\n */\n descriptionMessage?: string;\n\n /**\n * styles for callout Date time container\n */\n calloutDateTimeContainer?: string;\n\n /**\n * styles for callout info container\n */\n calloutInfoContainer?: string;\n\n /**\n * styles for callout block container\n */\n calloutBlockContainer?: string;\n\n /**\n * Styles for callout block container when toDrawShape is false\n */\n calloutBlockContainertoDrawShapefalse?: string;\n\n /**\n * Styles for callout block container when toDrawShape is true\n */\n calloutBlockContainertoDrawShapetrue?: string;\n\n /**\n * styles for callout legend text\n */\n calloutlegendText?: string;\n\n /**\n * styles for tooltip\n */\n tooltip?: string;\n\n /**\n * styles for tooltip\n */\n axisTitle?: string;\n\n /**\n * Style for the chart Title.\n */\n chartTitle?: string;\n\n /**\n * Style to change the opacity of bars in dataviz when we hover on a single bar or legends\n */\n opacityChangeOnHover?: string;\n\n /**\n * styles for the shape object in the callout\n */\n shapeStyles?: string;\n\n /**\n * Styles for the chart wrapper div\n */\n chartWrapper?: string;\n}\n\n/**\n * Cartesian Chart properties\n * {@docCategory CartesianChart}\n */\nexport interface CartesianChartProps {\n /**\n * Below height used for resizing of the chart\n * Wrap chart in your container and send the updated height and width to these props.\n * These values decide wheather chart re render or not. Please check examples for reference\n */\n height?: number;\n\n /**\n * Below width used for resizing of the chart\n * Wrap chart in your container and send the updated height and width to these props.\n * These values decide wheather chart re render or not. Please check examples for reference\n */\n width?: number;\n\n /**\n * this prop takes its parent as a HTML element to define the width and height of the chart\n */\n parentRef?: HTMLElement | null;\n\n /**\n * Additional CSS class(es) to apply to the Chart.\n */\n className?: string;\n\n /**\n * Margins for the chart\n * @default `{ top: 20, bottom: 35, left: 40, right: 20 }`\n * To avoid edge cuttings to the chart, we recommend you use default values or greater then default values\n */\n margins?: Margins;\n\n /** decides wether to show/hide legends\n * @defaultvalue false\n */\n hideLegend?: boolean;\n\n /**\n * Do not show tooltips in chart\n * @default false\n */\n hideTooltip?: boolean;\n\n /**\n * this prop takes values that you want the chart to render on x-axis\n * This is a optional parameter if not specified D3 will decide which values appear on the x-axis for you\n * Please look at https://github.com/d3/d3-scale for more information on how D3 decides what data to appear on the axis of chart\n */\n tickValues?: number[] | Date[] | string[] | undefined;\n\n /**\n * the format for the data on x-axis. For date object this can be specified to your requirement. Eg: '%m/%d', '%d'\n * Please look at https://github.com/d3/d3-time-format for all the formats supported for date axis\n * Only applicable for date axis. For y-axis format use yAxisTickFormat prop.\n */\n tickFormat?: string;\n\n /**\n * Width of line stroke\n */\n strokeWidth?: number;\n\n /**\n * x Axis labels tick padding. This defines the gap between tick labels and tick lines.\n * @default 10\n */\n xAxisTickPadding?: number;\n\n /**\n * the format in for the data on y-axis. For data object this can be specified to your requirement.\n * Eg: d3.format(\".0%\")(0.123),d3.format(\"+20\")(42);\n * Please look at https://github.com/d3/d3-format for all the formats supported\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n yAxisTickFormat?: any;\n\n /**\n * Secondary y-scale options\n * By default this is not defined, meaning there will be no secondary y-scale.\n */\n secondaryYScaleOptions?: {\n /** Minimum value (0 by default) */\n yMinValue?: number;\n /** Maximum value (100 by default) */\n yMaxValue?: number;\n };\n\n /**\n * minimum data value point in y-axis\n */\n yMinValue?: number;\n\n /**\n * maximum data value point in y-axis\n */\n yMaxValue?: number;\n\n /**\n * maximum data value point in x-axis\n */\n xMaxValue?: number;\n\n /**\n * Number of ticks on the y-axis.\n * Tick count should be factor of difference between (yMinValue, yMaxValue)?\n * @default 4\n */\n yAxisTickCount?: number;\n\n /**\n * defines the number of ticks on the x-axis. Tries to match the nearest interval satisfying the count.\n * Does not work for string axis.\n * @default 6\n */\n xAxisTickCount?: number;\n\n /**\n * define the size of the tick lines on the x-axis\n * @default 10\n */\n xAxistickSize?: number;\n\n /**\n * defines the space between the tick line and the data label\n * @default 10\n */\n tickPadding?: number;\n\n /**\n * Url that the data-viz needs to redirect to upon clicking on it\n */\n href?: string;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n legendsOverflowText?: any;\n\n /**\n * Enable the legends to wrap lines if there is not enough space to show all legends on a single line\n */\n enabledLegendsWrapLines?: boolean;\n\n /*\n * props for the legends in the chart\n */\n legendProps?: Partial<LegendsProps>;\n\n /**\n *@default false\n *Used for to elipse x axis labes and show tooltip on x axis labels\n */\n showXAxisLablesTooltip?: boolean;\n\n /**\n * @default 4\n * Used for X axis labels\n * While Giving showXAxisLablesTooltip prop, need to define after how many chars, we need to truncate the word.\n */\n noOfCharsToTruncate?: number;\n\n /**\n * @default false\n * Used to wrap x axis labels values (whole value)\n */\n wrapXAxisLables?: boolean;\n\n /**\n * @default false\n * Used to rotate x axis labels by 45 degrees\n */\n rotateXAxisLables?: boolean;\n\n /**\n * The prop used to define the date time localization options\n */\n dateLocalizeOptions?: Intl.DateTimeFormatOptions;\n\n /**\n * The prop used to define a custom locale for the date time format.\n */\n timeFormatLocale?: TimeLocaleDefinition;\n\n /**\n * The prop used to define a custom datetime formatter for date axis.\n */\n customDateTimeFormatter?: (dateTime: Date) => string;\n\n /**\n * Call to provide customized styling that will layer on top of the variant rules.\n */\n styles?: CartesianChartStyles;\n\n /**\n * Callout customization props\n */\n calloutProps?: Partial<ChartPopoverProps>;\n\n /**\n * props for the svg; use this to include aria-* or other attributes on the tag\n */\n svgProps?: React.SVGProps<SVGSVGElement>;\n\n /**\n * Props related to reflow behavior of the chart\n */\n reflowProps?: {\n /**\n * Determines the reflow behavior of the chart.\n * When set to `'min-width'`, the chart will not shrink below a certain width and will enable scrolling if it overflows.\n * @default 'none'\n */\n mode: 'none' | 'min-width';\n };\n\n /**\n * Prop to set the x axis title\n * @default undefined\n * Minimum bottom margin required for x axis title is 55px\n */\n\n xAxisTitle?: string;\n\n /**\n * Prop to set the y axis title\n * @default undefined\n * Minimum left margin required for y axis title is 60px and for RTL is 40px\n * Minimum right margin required for y axis title is 40px and for RTL is 60px\n */\n yAxisTitle?: string;\n\n /**\n * Prop to set the secondary y axis title\n * @default undefined\n * If RTL is enabled, minimum left and right margins required for secondary y axis title is 60px\n */\n secondaryYAxistitle?: string;\n\n /**\n * Whether to use UTC time for axis scale, ticks, and the time display in callouts.\n * When set to `true`, time is displayed equally, regardless of the user's timezone settings.\n * @default true\n */\n useUTC?: string | boolean;\n\n /**\n * @default false\n * The prop used to decide rounded ticks on y axis\n */\n roundedTicks?: boolean;\n\n /**\n * Determines whether overlapping x-axis tick labels should be hidden.\n * @default false\n */\n hideTickOverlap?: boolean;\n\n /**\n * Define a custom callout props override\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n calloutPropsPerDataPoint?: (dataPointCalloutProps: any) => ChartPopoverProps;\n\n /**\n * Optional callback to access the Chart interface. Use this instead of ref for accessing\n * the public methods and properties of the component.\n */\n componentRef?: React.RefObject<Chart>;\n}\n\nexport interface YValueHover {\n legend?: string;\n y?: number;\n color?: string;\n data?: string | number;\n shouldDrawBorderBottom?: boolean;\n yAxisCalloutData?: string | { [id: string]: number };\n index?: number;\n callOutAccessibilityData?: AccessibilityProps;\n}\n\nexport interface ChildProps {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n xScale?: any;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n yScale?: any;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n yScaleSecondary?: any;\n containerHeight?: number;\n containerWidth?: number;\n optimizeLargeData?: boolean;\n}\n\n// Only used for Cartesian chart base\nexport interface ModifiedCartesianChartProps extends CartesianChartProps {\n /**\n * Define the chart title\n */\n chartTitle?: string;\n\n /**\n * Only used for Area chart\n * Value used to draw y axis of that chart.\n */\n maxOfYVal?: number;\n\n /**\n * Data of the chart\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n points: any;\n\n /**\n * Define type of the chart\n */\n chartType: ChartTypes;\n\n /** X axis type */\n xAxisType: XAxisTypes;\n\n /** Y axis type */\n yAxisType?: YAxisType;\n\n /**\n * Legends of the chart.\n */\n legendBars: JSX.Element | null;\n\n /**\n * Callout props\n */\n calloutProps?: ChartPopoverProps;\n\n /**\n * Callback method used for to get margins to the chart.\n */\n getmargins?: (margins: Margins) => void;\n\n /**\n * This is a call back method to the chart from cartesian chart.\n * params are xScale, yScale, containerHeight, containerWidth. These values were used to draw the graph.\n * It also contians an optional param xAxisElement - defines as x axis scale element.\n * This param used to enable feature word wrap of Xaxis.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n getGraphData?: any;\n\n /**\n * Used for bar chart graphs.\n * To define width of the bar\n */\n barwidth?: number;\n\n /**\n * Used for tick styles of the x axis of the chart\n * Tick params are applicable for date axis only.\n */\n tickParams?: {\n tickValues?: number[] | Date[] | string[];\n tickFormat?: string;\n };\n\n /**\n * it's padding between bar's or lines in the graph\n */\n xAxisPadding?: number;\n\n /**\n * it's padding between bar's or lines in the graph\n */\n yAxisPadding?: number;\n\n /**\n * Children elements specific to derived chart types.\n */\n children(props: ChildProps): React.ReactNode;\n\n /**\n * To enable callout for individual bar or complete stack. Using for only Vertical stacked bar chart.\n * @default false\n * @type \\{boolean \\}\n */\n isCalloutForStack?: boolean;\n\n /** dataset values to find out domain of the String axis\n * Present using for only vertical stacked bar chart and grouped vertical bar chart\n */\n datasetForXAxisDomain?: string[];\n\n /** Own callout design */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n customizedCallout?: any;\n\n /**\n * if the data points for the y-axis is of type string, then we need to give this\n * prop to construct the y-axis\n */\n stringDatasetForYAxisDomain?: string[];\n\n /**\n * The prop used to define the culture to localize the numbers and date\n */\n culture?: string;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n getAxisData?: any;\n\n /**\n * Callback method used when mouse leaves the chart boundary.\n */\n onChartMouseLeave?: () => void;\n\n /** Callback method to get extra margins for domain */\n getDomainMargins?: (containerWidth: number) => Margins;\n\n /** Padding between each bar/line-point */\n xAxisInnerPadding?: number;\n\n /** Padding before first bar/line-point and after last bar/line-point */\n xAxisOuterPadding?: number;\n\n /**\n *@default false\n *Used for to elipse y axis labes and show tooltip on x axis labels\n */\n showYAxisLablesTooltip?: boolean;\n\n /**\n *@default false\n *Used for showing complete y axis lables */\n showYAxisLables?: boolean;\n\n /**\n * @default false\n * Used to control the first render cycle Performance optimization code.\n */\n enableFirstRenderOptimization?: boolean;\n}\n"],"names":["React"],"rangeMappings":"","mappings":"AAAA,YAAYA,WAAW,QAAQ"}
|
|
@@ -1,23 +1,57 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/naming-convention */ import * as React from 'react';
|
|
2
|
+
import { decodeBase64Fields, isArrayOrTypedArray, isDateArray, isNumberArray, mapFluentChart, sanitizeJson } from '@fluentui/chart-utilities';
|
|
3
|
+
import { tokens } from '@fluentui/react-theme';
|
|
4
|
+
import { ThemeContext_unstable as V9ThemeContext } from '@fluentui/react-shared-contexts';
|
|
5
|
+
import { webLightTheme } from '@fluentui/tokens';
|
|
6
|
+
import * as d3Color from 'd3-color';
|
|
7
|
+
import { isMonthArray, correctYearMonth, transformPlotlyJsonToDonutProps, transformPlotlyJsonToVSBCProps, transformPlotlyJsonToScatterChartProps, transformPlotlyJsonToHorizontalBarWithAxisProps, transformPlotlyJsonToHeatmapProps, transformPlotlyJsonToSankeyProps, transformPlotlyJsonToGaugeProps, transformPlotlyJsonToGVBCProps, transformPlotlyJsonToVBCProps } from './PlotlySchemaAdapter';
|
|
2
8
|
import { DonutChart } from '../DonutChart/index';
|
|
3
|
-
import {
|
|
9
|
+
import { VerticalStackedBarChart } from '../VerticalStackedBarChart/index';
|
|
4
10
|
import { LineChart } from '../LineChart/index';
|
|
11
|
+
import { HorizontalBarChartWithAxis } from '../HorizontalBarChartWithAxis/index';
|
|
12
|
+
import { AreaChart } from '../AreaChart/index';
|
|
13
|
+
import { HeatMapChart } from '../HeatMapChart/index';
|
|
14
|
+
import { SankeyChart } from '../SankeyChart/SankeyChart';
|
|
15
|
+
import { GaugeChart } from '../GaugeChart/index';
|
|
16
|
+
import { GroupedVerticalBarChart } from '../GroupedVerticalBarChart/index';
|
|
5
17
|
import { VerticalBarChart } from '../VerticalBarChart/index';
|
|
6
18
|
import { toImage } from './imageExporter';
|
|
7
|
-
import {
|
|
19
|
+
import { ScatterChart } from '../ScatterChart/index';
|
|
8
20
|
const useColorMapping = ()=>{
|
|
9
21
|
const colorMap = React.useRef(new Map());
|
|
10
22
|
return colorMap;
|
|
11
23
|
};
|
|
24
|
+
const useIsDarkTheme = ()=>{
|
|
25
|
+
const parentV9Theme = React.useContext(V9ThemeContext);
|
|
26
|
+
const v9Theme = parentV9Theme ? parentV9Theme : webLightTheme;
|
|
27
|
+
// Get background and foreground colors
|
|
28
|
+
const backgroundColor = d3Color.hsl(v9Theme.colorNeutralBackground1);
|
|
29
|
+
const foregroundColor = d3Color.hsl(v9Theme.colorNeutralForeground1);
|
|
30
|
+
const isDarkTheme = backgroundColor.l < foregroundColor.l;
|
|
31
|
+
return isDarkTheme;
|
|
32
|
+
};
|
|
12
33
|
/**
|
|
13
34
|
* DeclarativeChart component.
|
|
14
35
|
* {@docCategory DeclarativeChart}
|
|
15
36
|
*/ export const DeclarativeChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
16
37
|
const { plotlySchema } = sanitizeJson(props.chartSchema);
|
|
17
|
-
const
|
|
38
|
+
const chart = mapFluentChart(plotlySchema);
|
|
39
|
+
if (!chart.isValid) {
|
|
40
|
+
throw new Error(`Invalid chart schema: ${chart.errorMessage}`);
|
|
41
|
+
}
|
|
42
|
+
let plotlyInput = plotlySchema;
|
|
43
|
+
try {
|
|
44
|
+
plotlyInput = decodeBase64Fields(plotlyInput);
|
|
45
|
+
} catch (error) {
|
|
46
|
+
throw new Error(`Failed to decode plotly schema: ${error}`);
|
|
47
|
+
}
|
|
48
|
+
const plotlyInputWithValidData = {
|
|
49
|
+
...plotlyInput,
|
|
50
|
+
data: chart.validTracesInfo.map((trace)=>plotlyInput.data[trace[0]])
|
|
51
|
+
};
|
|
18
52
|
let { selectedLegends } = plotlySchema;
|
|
19
53
|
const colorMap = useColorMapping();
|
|
20
|
-
const isDarkTheme =
|
|
54
|
+
const isDarkTheme = useIsDarkTheme();
|
|
21
55
|
const chartRef = React.useRef(null);
|
|
22
56
|
if (!isArrayOrTypedArray(selectedLegends)) {
|
|
23
57
|
selectedLegends = [];
|
|
@@ -52,37 +86,47 @@ const useColorMapping = ()=>{
|
|
|
52
86
|
legendProps: multiSelectLegendProps,
|
|
53
87
|
componentRef: chartRef
|
|
54
88
|
};
|
|
55
|
-
const
|
|
56
|
-
var
|
|
57
|
-
const
|
|
89
|
+
const renderLineAreaScatter = (plotlyData, isAreaChart)=>{
|
|
90
|
+
var _plotlyData_;
|
|
91
|
+
const isScatterMarkers = ((_plotlyData_ = plotlyData[0]) === null || _plotlyData_ === void 0 ? void 0 : _plotlyData_.mode) === 'markers';
|
|
92
|
+
const chartProps = {
|
|
93
|
+
...transformPlotlyJsonToScatterChartProps({
|
|
94
|
+
data: plotlyData,
|
|
95
|
+
layout: plotlyInput.layout
|
|
96
|
+
}, isAreaChart, colorMap, isDarkTheme),
|
|
97
|
+
...commonProps
|
|
98
|
+
};
|
|
99
|
+
if (isAreaChart) {
|
|
100
|
+
return /*#__PURE__*/ React.createElement(AreaChart, chartProps);
|
|
101
|
+
}
|
|
102
|
+
if (isScatterMarkers) {
|
|
103
|
+
return /*#__PURE__*/ React.createElement(ScatterChart, chartProps);
|
|
104
|
+
}
|
|
105
|
+
return /*#__PURE__*/ React.createElement(LineChart, chartProps);
|
|
106
|
+
};
|
|
107
|
+
const checkAndRenderChart = (isAreaChart = false)=>{
|
|
108
|
+
let fallbackVSBC = false;
|
|
109
|
+
const xValues = plotlyInputWithValidData.data[0].x;
|
|
58
110
|
const isXDate = isDateArray(xValues);
|
|
59
111
|
const isXNumber = isNumberArray(xValues);
|
|
60
112
|
const isXMonth = isMonthArray(xValues);
|
|
61
113
|
if (isXDate || isXNumber) {
|
|
62
|
-
|
|
63
|
-
...transformPlotlyJsonToScatterChartProps({
|
|
64
|
-
data: plotlyInput.data,
|
|
65
|
-
layout: plotlyInput.layout
|
|
66
|
-
}, isAreaChart, colorMap, isDarkTheme),
|
|
67
|
-
...commonProps
|
|
68
|
-
};
|
|
69
|
-
return renderChartJsx(chartProps);
|
|
114
|
+
return renderLineAreaScatter(plotlyInputWithValidData.data, isAreaChart);
|
|
70
115
|
} else if (isXMonth) {
|
|
71
|
-
const updatedData =
|
|
116
|
+
const updatedData = plotlyInputWithValidData.data.map((dataPoint)=>({
|
|
72
117
|
...dataPoint,
|
|
73
|
-
x:
|
|
118
|
+
x: correctYearMonth(dataPoint.x)
|
|
74
119
|
}));
|
|
75
|
-
|
|
76
|
-
...transformPlotlyJsonToScatterChartProps({
|
|
77
|
-
data: updatedData,
|
|
78
|
-
layout: plotlyInput.layout
|
|
79
|
-
}, isAreaChart, colorMap, isDarkTheme),
|
|
80
|
-
...commonProps
|
|
81
|
-
};
|
|
82
|
-
return renderChartJsx(chartProps);
|
|
120
|
+
return renderLineAreaScatter(updatedData, isAreaChart);
|
|
83
121
|
}
|
|
84
|
-
|
|
122
|
+
// Unsupported schema, render as VerticalStackedBarChart
|
|
123
|
+
fallbackVSBC = true;
|
|
124
|
+
return /*#__PURE__*/ React.createElement(VerticalStackedBarChart, {
|
|
125
|
+
...transformPlotlyJsonToVSBCProps(plotlyInputWithValidData, colorMap, isDarkTheme, fallbackVSBC),
|
|
126
|
+
...commonProps
|
|
127
|
+
});
|
|
85
128
|
};
|
|
129
|
+
// TODO
|
|
86
130
|
const exportAsImage = React.useCallback((opts)=>{
|
|
87
131
|
var _chartRef_current;
|
|
88
132
|
return toImage((_chartRef_current = chartRef.current) === null || _chartRef_current === void 0 ? void 0 : _chartRef_current.chartContainer, {
|
|
@@ -96,55 +140,58 @@ const useColorMapping = ()=>{
|
|
|
96
140
|
}), [
|
|
97
141
|
exportAsImage
|
|
98
142
|
]);
|
|
99
|
-
switch(
|
|
100
|
-
case '
|
|
143
|
+
switch(chart.type){
|
|
144
|
+
case 'donut':
|
|
101
145
|
return /*#__PURE__*/ React.createElement(DonutChart, {
|
|
102
|
-
...transformPlotlyJsonToDonutProps(
|
|
146
|
+
...transformPlotlyJsonToDonutProps(plotlyInputWithValidData, colorMap, isDarkTheme),
|
|
147
|
+
...commonProps
|
|
148
|
+
});
|
|
149
|
+
case 'horizontalbar':
|
|
150
|
+
return /*#__PURE__*/ React.createElement(HorizontalBarChartWithAxis, {
|
|
151
|
+
...transformPlotlyJsonToHorizontalBarWithAxisProps(plotlyInputWithValidData, colorMap, isDarkTheme),
|
|
152
|
+
...commonProps
|
|
153
|
+
});
|
|
154
|
+
case 'groupedverticalbar':
|
|
155
|
+
return /*#__PURE__*/ React.createElement(GroupedVerticalBarChart, {
|
|
156
|
+
...transformPlotlyJsonToGVBCProps(plotlyInputWithValidData, colorMap, isDarkTheme),
|
|
157
|
+
...commonProps
|
|
158
|
+
});
|
|
159
|
+
case 'verticalstackedbar':
|
|
160
|
+
return /*#__PURE__*/ React.createElement(VerticalStackedBarChart, {
|
|
161
|
+
...transformPlotlyJsonToVSBCProps(plotlyInputWithValidData, colorMap, isDarkTheme),
|
|
103
162
|
...commonProps
|
|
104
163
|
});
|
|
105
|
-
case 'bar':
|
|
106
|
-
var _plotlyInput_data_;
|
|
107
|
-
throw new Error(`Unsupported chart type :${(_plotlyInput_data_ = plotlyInput.data[0]) === null || _plotlyInput_data_ === void 0 ? void 0 : _plotlyInput_data_.type}`);
|
|
108
|
-
case 'scatter':
|
|
109
|
-
if (plotlyInput.data[0].mode === 'markers') {
|
|
110
|
-
var _plotlyInput_data_1, _plotlyInput_data_2;
|
|
111
|
-
throw new Error(`Unsupported chart - type :${(_plotlyInput_data_1 = plotlyInput.data[0]) === null || _plotlyInput_data_1 === void 0 ? void 0 : _plotlyInput_data_1.type}, mode: ${(_plotlyInput_data_2 = plotlyInput.data[0]) === null || _plotlyInput_data_2 === void 0 ? void 0 : _plotlyInput_data_2.mode}`);
|
|
112
|
-
}
|
|
113
|
-
const isAreaChart = plotlyInput.data.some((series)=>series.fill === 'tonexty' || series.fill === 'tozeroy');
|
|
114
|
-
const renderChartJsx = (chartProps)=>{
|
|
115
|
-
if (isAreaChart) {
|
|
116
|
-
var _plotlyInput_data_, _plotlyInput_data_1;
|
|
117
|
-
throw new Error(`Unsupported chart type :${(_plotlyInput_data_ = plotlyInput.data[0]) === null || _plotlyInput_data_ === void 0 ? void 0 : _plotlyInput_data_.type}, fill: ${(_plotlyInput_data_1 = plotlyInput.data[0]) === null || _plotlyInput_data_1 === void 0 ? void 0 : _plotlyInput_data_1.fill}`);
|
|
118
|
-
}
|
|
119
|
-
return /*#__PURE__*/ React.createElement(LineChart, chartProps);
|
|
120
|
-
};
|
|
121
|
-
return checkAndRenderChart(renderChartJsx, isAreaChart);
|
|
122
164
|
case 'heatmap':
|
|
123
|
-
|
|
124
|
-
|
|
165
|
+
return /*#__PURE__*/ React.createElement(HeatMapChart, {
|
|
166
|
+
...transformPlotlyJsonToHeatmapProps(plotlyInputWithValidData),
|
|
167
|
+
...commonProps,
|
|
168
|
+
legendProps: {}
|
|
169
|
+
});
|
|
125
170
|
case 'sankey':
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
171
|
+
return /*#__PURE__*/ React.createElement(SankeyChart, {
|
|
172
|
+
...transformPlotlyJsonToSankeyProps(plotlyInputWithValidData, colorMap, isDarkTheme),
|
|
173
|
+
...commonProps
|
|
174
|
+
});
|
|
129
175
|
case 'gauge':
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
176
|
+
return /*#__PURE__*/ React.createElement(GaugeChart, {
|
|
177
|
+
...transformPlotlyJsonToGaugeProps(plotlyInputWithValidData, colorMap, isDarkTheme),
|
|
178
|
+
...commonProps
|
|
179
|
+
});
|
|
180
|
+
case 'verticalbar':
|
|
133
181
|
return /*#__PURE__*/ React.createElement(VerticalBarChart, {
|
|
134
|
-
...transformPlotlyJsonToVBCProps(
|
|
182
|
+
...transformPlotlyJsonToVBCProps(plotlyInputWithValidData, colorMap, isDarkTheme),
|
|
135
183
|
...commonProps
|
|
136
184
|
});
|
|
185
|
+
// TODO: Add 'scatter' as a separate chart type
|
|
186
|
+
case 'area':
|
|
187
|
+
case 'line':
|
|
188
|
+
case 'fallback':
|
|
189
|
+
// Need recheck for area chart as we don't have ability to check for valid months in previous step
|
|
190
|
+
const isAreaChart = plotlyInputWithValidData.data.some((series)=>series.fill === 'tonexty' || series.fill === 'tozeroy' || !!series.stackgroup);
|
|
191
|
+
return checkAndRenderChart(isAreaChart);
|
|
137
192
|
default:
|
|
138
|
-
var
|
|
139
|
-
|
|
140
|
-
const yValues = plotlyInput.data[0].y;
|
|
141
|
-
if (xValues && yValues && xValues.length > 0 && yValues.length > 0) {
|
|
142
|
-
const renderLineChartJsx = (chartProps)=>{
|
|
143
|
-
return /*#__PURE__*/ React.createElement(LineChart, chartProps);
|
|
144
|
-
};
|
|
145
|
-
return checkAndRenderChart(renderLineChartJsx);
|
|
146
|
-
}
|
|
147
|
-
throw new Error(`Unsupported chart type :${(_plotlyInput_data_7 = plotlyInput.data[0]) === null || _plotlyInput_data_7 === void 0 ? void 0 : _plotlyInput_data_7.type}`);
|
|
193
|
+
var _plotlyInputWithValidData_data_;
|
|
194
|
+
throw new Error(`Unsupported chart type :${(_plotlyInputWithValidData_data_ = plotlyInputWithValidData.data[0]) === null || _plotlyInputWithValidData_data_ === void 0 ? void 0 : _plotlyInputWithValidData_data_.type}`);
|
|
148
195
|
}
|
|
149
196
|
});
|
|
150
197
|
DeclarativeChart.displayName = 'DeclarativeChart';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["DeclarativeChart.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport * as React from 'react';\nimport { DonutChart } from '../DonutChart/index';\nimport { PlotData, PlotlySchema } from './PlotlySchema';\nimport {\n isArrayOrTypedArray,\n isDateArray,\n isNumberArray,\n isMonthArray,\n sanitizeJson,\n updateXValues,\n transformPlotlyJsonToDonutProps,\n transformPlotlyJsonToScatterChartProps,\n transformPlotlyJsonToVBCProps,\n} from './PlotlySchemaAdapter';\nimport { LineChart, LineChartProps } from '../LineChart/index';\nimport { VerticalBarChart } from '../VerticalBarChart/index';\nimport { ImageExportOptions, toImage } from './imageExporter';\nimport { Chart } from '../../types/index';\nimport { tokens } from '@fluentui/react-theme';\n\n/**\n * DeclarativeChart schema.\n * {@docCategory DeclarativeChart}\n */\nexport interface Schema {\n /**\n * Plotly schema represented as JSON object\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n plotlySchema: any;\n}\n\n/**\n * DeclarativeChart props.\n * {@docCategory DeclarativeChart}\n */\nexport interface DeclarativeChartProps extends React.RefAttributes<HTMLDivElement> {\n /**\n * The schema representing the chart data, layout and configuration\n */\n chartSchema: Schema;\n\n /**\n * Callback when an event occurs\n */\n onSchemaChange?: (eventData: Schema) => void;\n\n /**\n * Optional callback to access the IDeclarativeChart interface. Use this instead of ref for accessing\n * the public methods and properties of the component.\n */\n componentRef?: React.RefObject<IDeclarativeChart>;\n}\n\n/**\n * {@docCategory DeclarativeChart}\n */\nexport interface IDeclarativeChart {\n exportAsImage: (opts?: ImageExportOptions) => Promise<string>;\n}\n\nconst useColorMapping = () => {\n const colorMap = React.useRef(new Map<string, string>());\n return colorMap;\n};\n\n/**\n * DeclarativeChart component.\n * {@docCategory DeclarativeChart}\n */\nexport const DeclarativeChart: React.FunctionComponent<DeclarativeChartProps> = React.forwardRef<\n HTMLDivElement,\n DeclarativeChartProps\n>((props, forwardedRef) => {\n const { plotlySchema } = sanitizeJson(props.chartSchema);\n const plotlyInput = plotlySchema as PlotlySchema;\n let { selectedLegends } = plotlySchema;\n const colorMap = useColorMapping();\n const isDarkTheme = false;\n const chartRef = React.useRef<Chart>(null);\n\n if (!isArrayOrTypedArray(selectedLegends)) {\n selectedLegends = [];\n }\n\n const [activeLegends, setActiveLegends] = React.useState<string[]>(selectedLegends);\n const onActiveLegendsChange = (keys: string[]) => {\n setActiveLegends(keys);\n if (props.onSchemaChange) {\n props.onSchemaChange({ plotlySchema: { plotlyInput, selectedLegends: keys } });\n }\n };\n\n React.useEffect(() => {\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const { plotlySchema } = sanitizeJson(props.chartSchema);\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const { selectedLegends } = plotlySchema;\n setActiveLegends(selectedLegends ?? []);\n }, [props.chartSchema]);\n\n const multiSelectLegendProps = {\n canSelectMultipleLegends: true,\n onChange: onActiveLegendsChange,\n selectedLegends: activeLegends,\n };\n\n const commonProps = {\n legendProps: multiSelectLegendProps,\n componentRef: chartRef,\n };\n\n const checkAndRenderChart = (\n renderChartJsx: (chartProps: LineChartProps) => JSX.Element,\n isAreaChart: boolean = false,\n ) => {\n const xValues = (plotlyInput.data[0] as PlotData).x;\n const isXDate = isDateArray(xValues);\n const isXNumber = isNumberArray(xValues);\n const isXMonth = isMonthArray(xValues);\n if (isXDate || isXNumber) {\n const chartProps: LineChartProps = {\n ...transformPlotlyJsonToScatterChartProps(\n { data: plotlyInput.data, layout: plotlyInput.layout },\n isAreaChart,\n colorMap,\n isDarkTheme,\n ),\n ...commonProps,\n };\n return renderChartJsx(chartProps);\n } else if (isXMonth) {\n const updatedData = plotlyInput.data.map((dataPoint: PlotData) => ({\n ...dataPoint,\n x: updateXValues(dataPoint.x),\n }));\n const chartProps: LineChartProps = {\n ...transformPlotlyJsonToScatterChartProps(\n { data: updatedData, layout: plotlyInput.layout },\n isAreaChart,\n colorMap,\n isDarkTheme,\n ),\n ...commonProps,\n };\n return renderChartJsx(chartProps);\n }\n throw new Error(`Unsupported chart type :${plotlyInput.data[0]?.type}`);\n };\n\n const exportAsImage = React.useCallback((opts?: ImageExportOptions) => {\n return toImage(chartRef.current?.chartContainer, {\n background: tokens.colorNeutralBackground1,\n scale: 5,\n ...opts,\n });\n }, []);\n\n React.useImperativeHandle(\n props.componentRef,\n () => ({\n exportAsImage,\n }),\n [exportAsImage],\n );\n\n switch (plotlyInput.data[0].type) {\n case 'pie':\n return <DonutChart {...transformPlotlyJsonToDonutProps(plotlySchema, colorMap, isDarkTheme)} {...commonProps} />;\n case 'bar':\n throw new Error(`Unsupported chart type :${plotlyInput.data[0]?.type}`);\n case 'scatter':\n if (plotlyInput.data[0].mode === 'markers') {\n throw new Error(`Unsupported chart - type :${plotlyInput.data[0]?.type}, mode: ${plotlyInput.data[0]?.mode}`);\n }\n const isAreaChart = plotlyInput.data.some(\n (series: PlotData) => series.fill === 'tonexty' || series.fill === 'tozeroy',\n );\n const renderChartJsx = (chartProps: LineChartProps) => {\n if (isAreaChart) {\n throw new Error(\n `Unsupported chart type :${plotlyInput.data[0]?.type}, fill: ${\n (plotlyInput.data[0] as Partial<PlotData>)?.fill\n }`,\n );\n }\n return <LineChart {...chartProps} />;\n };\n return checkAndRenderChart(renderChartJsx, isAreaChart);\n case 'heatmap':\n throw new Error(`Unsupported chart type :${plotlyInput.data[0]?.type}`);\n case 'sankey':\n throw new Error(`Unsupported chart type :${plotlyInput.data[0]?.type}`);\n case 'indicator':\n case 'gauge':\n throw new Error(`Unsupported chart - type: ${plotlyInput.data[0]?.type}, mode: ${plotlyInput.data[0]?.mode}`);\n case 'histogram':\n return (\n <VerticalBarChart {...transformPlotlyJsonToVBCProps(plotlySchema, colorMap, isDarkTheme)} {...commonProps} />\n );\n default:\n const xValues = (plotlyInput.data[0] as PlotData).x;\n const yValues = (plotlyInput.data[0] as PlotData).y;\n if (xValues && yValues && xValues.length > 0 && yValues.length > 0) {\n const renderLineChartJsx = (chartProps: LineChartProps) => {\n return <LineChart {...chartProps} />;\n };\n return checkAndRenderChart(renderLineChartJsx);\n }\n throw new Error(`Unsupported chart type :${plotlyInput.data[0]?.type}`);\n }\n});\nDeclarativeChart.displayName = 'DeclarativeChart';\n"],"names":["React","DonutChart","isArrayOrTypedArray","isDateArray","isNumberArray","isMonthArray","sanitizeJson","updateXValues","transformPlotlyJsonToDonutProps","transformPlotlyJsonToScatterChartProps","transformPlotlyJsonToVBCProps","LineChart","VerticalBarChart","toImage","tokens","useColorMapping","colorMap","useRef","Map","DeclarativeChart","forwardRef","props","forwardedRef","plotlySchema","chartSchema","plotlyInput","selectedLegends","isDarkTheme","chartRef","activeLegends","setActiveLegends","useState","onActiveLegendsChange","keys","onSchemaChange","useEffect","multiSelectLegendProps","canSelectMultipleLegends","onChange","commonProps","legendProps","componentRef","checkAndRenderChart","renderChartJsx","isAreaChart","xValues","data","x","isXDate","isXNumber","isXMonth","chartProps","layout","updatedData","map","dataPoint","Error","type","exportAsImage","useCallback","opts","current","chartContainer","background","colorNeutralBackground1","scale","useImperativeHandle","mode","some","series","fill","yValues","y","length","renderLineChartJsx","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,uDAAuD,GACvD,YAAYA,WAAW,QAAQ;AAC/B,SAASC,UAAU,QAAQ,sBAAsB;AAEjD,SACEC,mBAAmB,EACnBC,WAAW,EACXC,aAAa,EACbC,YAAY,EACZC,YAAY,EACZC,aAAa,EACbC,+BAA+B,EAC/BC,sCAAsC,EACtCC,6BAA6B,QACxB,wBAAwB;AAC/B,SAASC,SAAS,QAAwB,qBAAqB;AAC/D,SAASC,gBAAgB,QAAQ,4BAA4B;AAC7D,SAA6BC,OAAO,QAAQ,kBAAkB;AAE9D,SAASC,MAAM,QAAQ,wBAAwB;AA2C/C,MAAMC,kBAAkB;IACtB,MAAMC,WAAWhB,MAAMiB,MAAM,CAAC,IAAIC;IAClC,OAAOF;AACT;AAEA;;;CAGC,GACD,OAAO,MA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BAAAA,YAAYqB,IAAI,CAAC,EAAE,cAAnBrB,0CAAAA,oBAAqBgC,IAAI,CAAC,QAAQ,GAAEhC,sBAAAA,YAAYqB,IAAI,CAAC,EAAE,cAAnBrB,0CAAAA,oBAAqB0C,IAAI,CAAC,CAAC;QAC9G,KAAK;YACH,qBACE,oBAACvD;gBAAkB,GAAGF,8BAA8Ba,cAAcP,UAAUW,YAAY;gBAAG,GAAGY,WAAW;;QAE7G;gBAS6Cd;YAR3C,MAAMoB,UAAU,AAACpB,YAAYqB,IAAI,CAAC,EAAE,CAAcC,CAAC;YACnD,MAAMwB,UAAU,AAAC9C,YAAYqB,IAAI,CAAC,EAAE,CAAc0B,CAAC;YACnD,IAAI3B,WAAW0B,WAAW1B,QAAQ4B,MAAM,GAAG,KAAKF,QAAQE,MAAM,GAAG,GAAG;gBAClE,MAAMC,qBAAqB,CAACvB;oBAC1B,qBAAO,oBAACxC,WAAcwC;gBACxB;gBACA,OAAOT,oBAAoBgC;YAC7B;YACA,MAAM,IAAIlB,MAAM,CAAC,wBAAwB,GAAE/B,sBAAAA,YAAYqB,IAAI,CAAC,EAAE,cAAnBrB,0CAAAA,oBAAqBgC,IAAI,CAAC,CAAC;IAC1E;AACF,GAAG;AACHtC,iBAAiBwD,WAAW,GAAG"}
|
|
1
|
+
{"version":3,"sources":["DeclarativeChart.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport * as React from 'react';\nimport type { Data, PlotData, PlotlySchema, OutputChartType } from '@fluentui/chart-utilities';\nimport {\n decodeBase64Fields,\n isArrayOrTypedArray,\n isDateArray,\n isNumberArray,\n mapFluentChart,\n sanitizeJson,\n} from '@fluentui/chart-utilities';\nimport { tokens } from '@fluentui/react-theme';\nimport { ThemeContext_unstable as V9ThemeContext } from '@fluentui/react-shared-contexts';\nimport { Theme, webLightTheme } from '@fluentui/tokens';\nimport * as d3Color from 'd3-color';\n\nimport {\n isMonthArray,\n correctYearMonth,\n transformPlotlyJsonToDonutProps,\n transformPlotlyJsonToVSBCProps,\n transformPlotlyJsonToScatterChartProps,\n transformPlotlyJsonToHorizontalBarWithAxisProps,\n transformPlotlyJsonToHeatmapProps,\n transformPlotlyJsonToSankeyProps,\n transformPlotlyJsonToGaugeProps,\n transformPlotlyJsonToGVBCProps,\n transformPlotlyJsonToVBCProps,\n} from './PlotlySchemaAdapter';\nimport { DonutChart } from '../DonutChart/index';\nimport { VerticalStackedBarChart } from '../VerticalStackedBarChart/index';\nimport { LineChart, LineChartProps } from '../LineChart/index';\nimport { HorizontalBarChartWithAxis } from '../HorizontalBarChartWithAxis/index';\nimport { AreaChart, AreaChartProps } from '../AreaChart/index';\nimport { HeatMapChart } from '../HeatMapChart/index';\nimport { SankeyChart } from '../SankeyChart/SankeyChart';\nimport { GaugeChart } from '../GaugeChart/index';\nimport { GroupedVerticalBarChart } from '../GroupedVerticalBarChart/index';\nimport { VerticalBarChart } from '../VerticalBarChart/index';\nimport { ImageExportOptions, toImage } from './imageExporter';\nimport { Chart } from '../../types/index';\nimport { ScatterChart } from '../ScatterChart/index';\n// TODO\n// import { withResponsiveContainer } from '../ResponsiveContainer/withResponsiveContainer';\n\n// const ResponsiveDonutChart = withResponsiveContainer(DonutChart);\n// const ResponsiveVerticalStackedBarChart = withResponsiveContainer(VerticalStackedBarChart);\n// const ResponsiveLineChart = withResponsiveContainer(LineChart);\n// const ResponsiveHorizontalBarChartWithAxis = withResponsiveContainer(HorizontalBarChartWithAxis);\n// const ResponsiveAreaChart = withResponsiveContainer(AreaChart);\n// const ResponsiveHeatMapChart = withResponsiveContainer(HeatMapChart);\n// const ResponsiveSankeyChart = withResponsiveContainer(SankeyChart);\n// const ResponsiveGaugeChart = withResponsiveContainer(GaugeChart);\n// const ResponsiveGroupedVerticalBarChart = withResponsiveContainer(GroupedVerticalBarChart);\n// const ResponsiveVerticalBarChart = withResponsiveContainer(VerticalBarChart);\n\n/**\n * DeclarativeChart schema.\n * {@docCategory DeclarativeChart}\n */\nexport interface Schema {\n /**\n * Plotly schema represented as JSON object\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n plotlySchema: any;\n}\n\n/**\n * DeclarativeChart props.\n * {@docCategory DeclarativeChart}\n */\nexport interface DeclarativeChartProps extends React.RefAttributes<HTMLDivElement> {\n /**\n * The schema representing the chart data, layout and configuration\n */\n chartSchema: Schema;\n\n /**\n * Callback when an event occurs\n */\n onSchemaChange?: (eventData: Schema) => void;\n\n /**\n * Optional callback to access the IDeclarativeChart interface. Use this instead of ref for accessing\n * the public methods and properties of the component.\n */\n componentRef?: React.RefObject<IDeclarativeChart>;\n}\n\n/**\n * {@docCategory DeclarativeChart}\n */\nexport interface IDeclarativeChart {\n exportAsImage: (opts?: ImageExportOptions) => Promise<string>;\n}\n\nconst useColorMapping = () => {\n const colorMap = React.useRef(new Map<string, string>());\n return colorMap;\n};\n\nconst useIsDarkTheme = (): boolean => {\n const parentV9Theme = React.useContext(V9ThemeContext) as Theme;\n const v9Theme: Theme = parentV9Theme ? parentV9Theme : webLightTheme;\n\n // Get background and foreground colors\n const backgroundColor = d3Color.hsl(v9Theme.colorNeutralBackground1);\n const foregroundColor = d3Color.hsl(v9Theme.colorNeutralForeground1);\n\n const isDarkTheme = backgroundColor.l < foregroundColor.l;\n\n return isDarkTheme;\n};\n\n/**\n * DeclarativeChart component.\n * {@docCategory DeclarativeChart}\n */\nexport const DeclarativeChart: React.FunctionComponent<DeclarativeChartProps> = React.forwardRef<\n HTMLDivElement,\n DeclarativeChartProps\n>((props, forwardedRef) => {\n const { plotlySchema } = sanitizeJson(props.chartSchema);\n const chart: OutputChartType = mapFluentChart(plotlySchema);\n if (!chart.isValid) {\n throw new Error(`Invalid chart schema: ${chart.errorMessage}`);\n }\n let plotlyInput = plotlySchema as PlotlySchema;\n try {\n plotlyInput = decodeBase64Fields(plotlyInput);\n } catch (error) {\n throw new Error(`Failed to decode plotly schema: ${error}`);\n }\n const plotlyInputWithValidData: PlotlySchema = {\n ...plotlyInput,\n data: chart.validTracesInfo!.map(trace => plotlyInput.data[trace[0]]),\n };\n\n let { selectedLegends } = plotlySchema;\n const colorMap = useColorMapping();\n const isDarkTheme = useIsDarkTheme();\n const chartRef = React.useRef<Chart>(null);\n\n if (!isArrayOrTypedArray(selectedLegends)) {\n selectedLegends = [];\n }\n\n const [activeLegends, setActiveLegends] = React.useState<string[]>(selectedLegends);\n const onActiveLegendsChange = (keys: string[]) => {\n setActiveLegends(keys);\n if (props.onSchemaChange) {\n props.onSchemaChange({ plotlySchema: { plotlyInput, selectedLegends: keys } });\n }\n };\n\n React.useEffect(() => {\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const { plotlySchema } = sanitizeJson(props.chartSchema);\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const { selectedLegends } = plotlySchema;\n setActiveLegends(selectedLegends ?? []);\n }, [props.chartSchema]);\n\n const multiSelectLegendProps = {\n canSelectMultipleLegends: true,\n onChange: onActiveLegendsChange,\n selectedLegends: activeLegends,\n };\n\n const commonProps = {\n legendProps: multiSelectLegendProps,\n componentRef: chartRef,\n };\n\n const renderLineAreaScatter = (plotlyData: Data[], isAreaChart: boolean): JSX.Element => {\n const isScatterMarkers = (plotlyData[0] as PlotData)?.mode === 'markers';\n const chartProps: LineChartProps | AreaChartProps = {\n ...transformPlotlyJsonToScatterChartProps(\n { data: plotlyData, layout: plotlyInput.layout },\n isAreaChart,\n colorMap,\n isDarkTheme,\n ),\n ...commonProps,\n };\n if (isAreaChart) {\n return <AreaChart {...chartProps} />;\n }\n if (isScatterMarkers) {\n return <ScatterChart {...chartProps} />;\n }\n return <LineChart {...chartProps} />;\n };\n\n const checkAndRenderChart = (isAreaChart: boolean = false) => {\n let fallbackVSBC = false;\n const xValues = (plotlyInputWithValidData.data[0] as PlotData).x;\n const isXDate = isDateArray(xValues);\n const isXNumber = isNumberArray(xValues);\n const isXMonth = isMonthArray(xValues);\n if (isXDate || isXNumber) {\n return renderLineAreaScatter(plotlyInputWithValidData.data, isAreaChart);\n } else if (isXMonth) {\n const updatedData = plotlyInputWithValidData.data.map((dataPoint: PlotData) => ({\n ...dataPoint,\n x: correctYearMonth(dataPoint.x),\n }));\n return renderLineAreaScatter(updatedData, isAreaChart);\n }\n // Unsupported schema, render as VerticalStackedBarChart\n fallbackVSBC = true;\n return (\n <VerticalStackedBarChart\n {...transformPlotlyJsonToVSBCProps(plotlyInputWithValidData, colorMap, isDarkTheme, fallbackVSBC)}\n {...commonProps}\n />\n );\n };\n\n // TODO\n const exportAsImage = React.useCallback((opts?: ImageExportOptions) => {\n return toImage(chartRef.current?.chartContainer, {\n background: tokens.colorNeutralBackground1,\n scale: 5,\n ...opts,\n });\n }, []);\n\n React.useImperativeHandle(\n props.componentRef,\n () => ({\n exportAsImage,\n }),\n [exportAsImage],\n );\n\n switch (chart.type) {\n case 'donut':\n return (\n <DonutChart\n {...transformPlotlyJsonToDonutProps(plotlyInputWithValidData, colorMap, isDarkTheme)}\n {...commonProps}\n />\n );\n case 'horizontalbar':\n return (\n <HorizontalBarChartWithAxis\n {...transformPlotlyJsonToHorizontalBarWithAxisProps(plotlyInputWithValidData, colorMap, isDarkTheme)}\n {...commonProps}\n />\n );\n case 'groupedverticalbar':\n return (\n <GroupedVerticalBarChart\n {...transformPlotlyJsonToGVBCProps(plotlyInputWithValidData, colorMap, isDarkTheme)}\n {...commonProps}\n />\n );\n case 'verticalstackedbar':\n return (\n <VerticalStackedBarChart\n {...transformPlotlyJsonToVSBCProps(plotlyInputWithValidData, colorMap, isDarkTheme)}\n {...commonProps}\n />\n );\n case 'heatmap':\n return (\n <HeatMapChart\n {...transformPlotlyJsonToHeatmapProps(plotlyInputWithValidData)}\n {...commonProps}\n legendProps={{}}\n />\n );\n case 'sankey':\n return (\n <SankeyChart\n {...transformPlotlyJsonToSankeyProps(plotlyInputWithValidData, colorMap, isDarkTheme)}\n {...commonProps}\n />\n );\n case 'gauge':\n return (\n <GaugeChart\n {...transformPlotlyJsonToGaugeProps(plotlyInputWithValidData, colorMap, isDarkTheme)}\n {...commonProps}\n />\n );\n case 'verticalbar':\n return (\n <VerticalBarChart\n {...transformPlotlyJsonToVBCProps(plotlyInputWithValidData, colorMap, isDarkTheme)}\n {...commonProps}\n />\n );\n // TODO: Add 'scatter' as a separate chart type\n case 'area':\n case 'line':\n case 'fallback':\n // Need recheck for area chart as we don't have ability to check for valid months in previous step\n const isAreaChart = plotlyInputWithValidData.data.some(\n (series: PlotData) => series.fill === 'tonexty' || series.fill === 'tozeroy' || !!series.stackgroup,\n );\n return checkAndRenderChart(isAreaChart);\n default:\n throw new Error(`Unsupported chart type :${plotlyInputWithValidData.data[0]?.type}`);\n }\n});\nDeclarativeChart.displayName = 'DeclarativeChart';\n"],"names":["React","decodeBase64Fields","isArrayOrTypedArray","isDateArray","isNumberArray","mapFluentChart","sanitizeJson","tokens","ThemeContext_unstable","V9ThemeContext","webLightTheme","d3Color","isMonthArray","correctYearMonth","transformPlotlyJsonToDonutProps","transformPlotlyJsonToVSBCProps","transformPlotlyJsonToScatterChartProps","transformPlotlyJsonToHorizontalBarWithAxisProps","transformPlotlyJsonToHeatmapProps","transformPlotlyJsonToSankeyProps","transformPlotlyJsonToGaugeProps","transformPlotlyJsonToGVBCProps","transformPlotlyJsonToVBCProps","DonutChart","VerticalStackedBarChart","LineChart","HorizontalBarChartWithAxis","AreaChart","HeatMapChart","SankeyChart","GaugeChart","GroupedVerticalBarChart","VerticalBarChart","toImage","ScatterChart","useColorMapping","colorMap","useRef","Map","useIsDarkTheme","parentV9Theme","useContext","v9Theme","backgroundColor","hsl","colorNeutralBackground1","foregroundColor","colorNeutralForeground1","isDarkTheme","l","DeclarativeChart","forwardRef","props","forwardedRef","plotlySchema","chartSchema","chart","isValid","Error","errorMessage","plotlyInput","error","plotlyInputWithValidData","data","validTracesInfo","map","trace","selectedLegends","chartRef","activeLegends","setActiveLegends","useState","onActiveLegendsChange","keys","onSchemaChange","useEffect","multiSelectLegendProps","canSelectMultipleLegends","onChange","commonProps","legendProps","componentRef","renderLineAreaScatter","plotlyData","isAreaChart","isScatterMarkers","mode","chartProps","layout","checkAndRenderChart","fallbackVSBC","xValues","x","isXDate","isXNumber","isXMonth","updatedData","dataPoint","exportAsImage","useCallback","opts","current","chartContainer","background","scale","useImperativeHandle","type","some","series","fill","stackgroup","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,uDAAuD,GACvD,YAAYA,WAAW,QAAQ;AAE/B,SACEC,kBAAkB,EAClBC,mBAAmB,EACnBC,WAAW,EACXC,aAAa,EACbC,cAAc,EACdC,YAAY,QACP,4BAA4B;AACnC,SAASC,MAAM,QAAQ,wBAAwB;AAC/C,SAASC,yBAAyBC,cAAc,QAAQ,kCAAkC;AAC1F,SAAgBC,aAAa,QAAQ,mBAAmB;AACxD,YAAYC,aAAa,WAAW;AAEpC,SACEC,YAAY,EACZC,gBAAgB,EAChBC,+BAA+B,EAC/BC,8BAA8B,EAC9BC,sCAAsC,EACtCC,+CAA+C,EAC/CC,iCAAiC,EACjCC,gCAAgC,EAChCC,+BAA+B,EAC/BC,8BAA8B,EAC9BC,6BAA6B,QACxB,wBAAwB;AAC/B,SAASC,UAAU,QAAQ,sBAAsB;AACjD,SAASC,uBAAuB,QAAQ,mCAAmC;AAC3E,SAASC,SAAS,QAAwB,qBAAqB;AAC/D,SAASC,0BAA0B,QAAQ,sCAAsC;AACjF,SAASC,SAAS,QAAwB,qBAAqB;AAC/D,SAASC,YAAY,QAAQ,wBAAwB;AACrD,SAASC,WAAW,QAAQ,6BAA6B;AACzD,SAASC,UAAU,QAAQ,sBAAsB;AACjD,SAASC,uBAAuB,QAAQ,mCAAmC;A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