@fluentui/react-charts 0.0.0-nightly-20250908-0407.1 → 0.0.0-nightly-20250909-0406.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +54 -15
- package/dist/index.d.ts +1 -1
- package/lib/components/ChartTable/ChartTable.js +9 -5
- package/lib/components/ChartTable/ChartTable.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.js +5 -5
- package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/CommonComponents/ChartPopover.js +5 -1
- package/lib/components/CommonComponents/ChartPopover.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +22 -64
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/Arc/useArcStyles.styles.js +2 -2
- package/lib/components/DonutChart/Arc/useArcStyles.styles.js.map +1 -1
- package/lib/components/DonutChart/Arc/useArcStyles.styles.raw.js +1 -1
- package/lib/components/DonutChart/Arc/useArcStyles.styles.raw.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +5 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +1 -1
- package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -1
- package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js +1 -1
- package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.js +5 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +5 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib/utilities/utilities.js +6 -6
- package/lib/utilities/utilities.js.map +1 -1
- package/lib-commonjs/components/ChartTable/ChartTable.js +9 -5
- package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +5 -5
- package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/ChartPopover.js +5 -1
- package/lib-commonjs/components/CommonComponents/ChartPopover.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +22 -64
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.js +2 -2
- package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.raw.js +1 -1
- package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +5 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +1 -1
- package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js +1 -1
- package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +5 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +5 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib-commonjs/utilities/utilities.js +6 -6
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +12 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/CommonComponents/ChartPopover.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Popover, PopoverSurface } from '@fluentui/react-popover';\nimport { mergeClasses } from '@griffel/react';\nimport type { PositioningVirtualElement } from '@fluentui/react-positioning';\nimport { tokens } from '@fluentui/react-theme';\nimport { useId } from '@fluentui/react-utilities';\nimport { getAccessibleDataObject, Points, pointTypes } from '../../utilities/index';\nimport { formatToLocaleString } from '@fluentui/chart-utilities';\nimport { Shape } from '../Legends/shape';\nimport { usePopoverStyles_unstable } from './useChartPopoverStyles.styles';\nimport { YValueHover } from './CartesianChart.types';\nimport { LegendShape } from '../Legends/Legends.types';\nimport { ChartPopoverProps } from './ChartPopover.types';\n\n/* This component is a wrapper over Popover component which implements the logic for rendering popovers for any chart\ncombining the logic for Callout and ChartHoverCard in v8 charts. */\nexport const ChartPopover: React.FunctionComponent<ChartPopoverProps> = React.forwardRef<\n HTMLDivElement,\n ChartPopoverProps\n>((props, forwardedRef) => {\n const virtualElement: PositioningVirtualElement = {\n getBoundingClientRect: () => ({\n top: props.clickPosition!.y,\n left: props.clickPosition!.x,\n right: props.clickPosition!.x,\n bottom: props.clickPosition!.y,\n x: props.clickPosition!.x,\n y: props.clickPosition!.y,\n width: 0,\n height: 0,\n }),\n };\n props = { ...props, ...props.customCallout?.customCalloutProps };\n const classes = usePopoverStyles_unstable(props);\n const legend = props.xCalloutValue ? props.xCalloutValue : props.legend;\n const YValue = props.yCalloutValue ? props.yCalloutValue : props.YValue;\n return (\n <div id={useId('callout')} ref={forwardedRef} className={classes.calloutContainer}>\n <Popover\n positioning={{ target: virtualElement, autoSize: 'always', offset: 20, coverTarget: false }}\n open={props.isPopoverOpen}\n inline\n >\n <PopoverSurface>\n {/** Given custom callout, then it will render */}\n {props.customCallout && props.customCallout.customizedCallout && props.customCallout.customizedCallout}\n {/** single x point its corresponding y points of all the bars/lines in chart will render in callout */}\n {(!props.customCallout || !props.customCallout.customizedCallout) &&\n props.isCalloutForStack &&\n _multiValueCallout()}\n {/** single x point its corresponding y point of single line/bar in the chart will render in callout */}\n {(!props.customCallout || !props.customCallout.customizedCallout) && !props.isCalloutForStack && (\n <div className={classes.calloutContentRoot}>\n <div className={classes.calloutDateTimeContainer}>\n <div className={classes.calloutContentX}>{props.XValue} </div>\n {/*TO DO if we add time for callout then will use this */}\n {/* <div className={classNames.calloutContentX}>07:00am</div> */}\n </div>\n <div\n className={classes.calloutInfoContainer}\n style={{\n ...(props.ratio && {\n display: 'flex',\n alignItems: 'flex-end',\n }),\n borderInlineStart: `4px solid ${props.color}`,\n marginTop: '11px',\n }}\n >\n <div className={classes.calloutBlockContainer}>\n <div className={classes.calloutlegendText}>\n {formatToLocaleString(legend, props.culture) as React.ReactNode}\n </div>\n <div\n className={classes.calloutContentY}\n style={{ color: props.color ? props.color : tokens.colorNeutralForeground1 }}\n >\n {formatToLocaleString(YValue, props.culture) as React.ReactNode}\n </div>\n </div>\n {!!props.ratio && (\n <div className={classes.ratio}>\n <>\n <span className={classes.numerator}>\n {formatToLocaleString(props.ratio[0], props.culture) as React.ReactNode}\n </span>\n /\n <span className={classes.denominator}>\n {formatToLocaleString(props.ratio[1], props.culture) as React.ReactNode}\n </span>\n </>\n </div>\n )}\n </div>\n {!!props.descriptionMessage && (\n <div className={classes.descriptionMessage}>{props.descriptionMessage}</div>\n )}\n </div>\n )}\n </PopoverSurface>\n </Popover>\n </div>\n );\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n function _multiValueCallout() {\n const yValueHoverSubCountsExists: boolean = _yValueHoverSubCountsExists(props.YValueHover) ?? false;\n return (\n <div className={classes.calloutContentRoot}>\n <div\n className={classes.calloutDateTimeContainer}\n style={yValueHoverSubCountsExists ? { marginBottom: '11px' } : {}}\n >\n <div\n className={classes.calloutContentX}\n {...getAccessibleDataObject(props!.xAxisCalloutAccessibilityData, 'text', false)}\n >\n {formatToLocaleString(props!.hoverXValue, props.culture) as React.ReactNode}\n </div>\n </div>\n <div style={yValueHoverSubCountsExists ? { display: 'flex' } : {}}>\n {props!.YValueHover &&\n props!.YValueHover.map((yValue: YValueHover, index: number, yValues: YValueHover[]) => {\n const isLast: boolean = index + 1 === yValues.length;\n const { shouldDrawBorderBottom = false } = yValue;\n return (\n <div\n {...getAccessibleDataObject(yValue.callOutAccessibilityData, 'text', false)}\n key={`callout-content-${index}`}\n style={\n yValueHoverSubCountsExists\n ? {\n display: 'inline-block',\n ...(shouldDrawBorderBottom && {\n borderBottom: `1px solid ${tokens.colorNeutralStroke2}`,\n paddingBottom: '10px',\n }),\n }\n : {\n ...(shouldDrawBorderBottom && {\n borderBottom: `1px solid ${tokens.colorNeutralStroke2}`,\n paddingBottom: '10px',\n }),\n }\n }\n >\n {_getCalloutContent(yValue, index, yValueHoverSubCountsExists, isLast)}\n </div>\n );\n })}\n {!!props.descriptionMessage && <div className={classes.descriptionMessage}>{props.descriptionMessage}</div>}\n </div>\n </div>\n );\n }\n\n function _yValueHoverSubCountsExists(yValueHover?: YValueHover[]): boolean | undefined {\n return (\n yValueHover &&\n yValueHover.some(\n (yValue: {\n legend?: string;\n y?: number;\n color?: string;\n yAxisCalloutData?: string | { [id: string]: number };\n }) => yValue.yAxisCalloutData && typeof yValue.yAxisCalloutData !== 'string',\n )\n );\n }\n\n function _getCalloutContent(\n xValue: YValueHover,\n index: number,\n yValueHoverSubCountsExists: boolean,\n isLast: boolean,\n ): React.ReactNode {\n const marginStyle: React.CSSProperties = isLast ? {} : { marginRight: '16px' };\n const toDrawShape = xValue.index !== undefined && xValue.index !== -1;\n const { culture } = props;\n const yValue = formatToLocaleString(xValue.y, culture) as React.ReactNode;\n if (!xValue.yAxisCalloutData || typeof xValue.yAxisCalloutData === 'string') {\n return (\n <div style={yValueHoverSubCountsExists ? marginStyle : {}}>\n {yValueHoverSubCountsExists && (\n <div className=\"ms-fontWeight-semibold\" style={{ fontSize: '12pt' }}>\n {xValue.legend!} ({yValue})\n </div>\n )}\n <div\n id={`${index}_${xValue.y}`}\n className={classes.calloutBlockContainer}\n style={{\n marginTop: props.XValue ? '13px' : 'unset',\n ...(!toDrawShape\n ? {\n borderInlineStart: `4px solid ${xValue.color}`,\n }\n : {}),\n }}\n >\n {toDrawShape && (\n <Shape\n svgProps={{\n className: classes.shapeStyles,\n }}\n pathProps={{ fill: xValue.color }}\n shape={Points[xValue.index! % Object.keys(pointTypes).length] as LegendShape}\n />\n )}\n <div\n className={mergeClasses(\n classes.calloutBlockContainer,\n toDrawShape\n ? classes.calloutBlockContainertoDrawShapetrue\n : classes.calloutBlockContainertoDrawShapefalse,\n )}\n >\n <div className={classes.calloutlegendText}> {xValue.legend}</div>\n <div className={classes.calloutContentY}>\n {\n formatToLocaleString(\n xValue.yAxisCalloutData ? xValue.yAxisCalloutData : xValue.y ?? xValue.data,\n culture,\n ) as React.ReactNode\n }\n </div>\n </div>\n </div>\n </div>\n );\n } else {\n const subcounts: { [id: string]: number } = xValue.yAxisCalloutData as { [id: string]: number };\n return (\n <div style={marginStyle}>\n <div className=\"ms-fontWeight-semibold\" style={{ fontSize: '12pt' }}>\n {xValue.legend!} ({yValue})\n </div>\n {Object.keys(subcounts).map((subcountName: string) => {\n return (\n <div key={subcountName} className={classes.calloutBlockContainer}>\n <div className={classes.calloutlegendText}>\n {' '}\n {formatToLocaleString(subcountName, culture) as React.ReactNode}\n </div>\n <div\n className={classes.calloutContentY}\n style={{ color: props.color ? props.color : tokens.colorNeutralForeground1 }}\n >\n {formatToLocaleString(subcounts[subcountName], culture) as React.ReactNode}\n </div>\n </div>\n );\n })}\n </div>\n );\n }\n }\n});\nChartPopover.displayName = 'ChartPopover';\n"],"names":["React","Popover","PopoverSurface","mergeClasses","tokens","useId","getAccessibleDataObject","Points","pointTypes","formatToLocaleString","Shape","usePopoverStyles_unstable","ChartPopover","forwardRef","props","forwardedRef","virtualElement","getBoundingClientRect","top","clickPosition","y","left","x","right","bottom","width","height","customCallout","customCalloutProps","classes","legend","xCalloutValue","YValue","yCalloutValue","div","id","ref","className","calloutContainer","positioning","target","autoSize","offset","coverTarget","open","isPopoverOpen","inline","customizedCallout","isCalloutForStack","_multiValueCallout","calloutContentRoot","calloutDateTimeContainer","calloutContentX","XValue","calloutInfoContainer","style","ratio","display","alignItems","borderInlineStart","color","marginTop","calloutBlockContainer","calloutlegendText","culture","calloutContentY","colorNeutralForeground1","span","numerator","denominator","descriptionMessage","_yValueHoverSubCountsExists","yValueHoverSubCountsExists","YValueHover","marginBottom","xAxisCalloutAccessibilityData","hoverXValue","map","yValue","index","yValues","isLast","length","shouldDrawBorderBottom","callOutAccessibilityData","key","borderBottom","colorNeutralStroke2","paddingBottom","_getCalloutContent","yValueHover","some","yAxisCalloutData","xValue","marginStyle","marginRight","toDrawShape","undefined","fontSize","svgProps","shapeStyles","pathProps","fill","shape","Object","keys","calloutBlockContainertoDrawShapetrue","calloutBlockContainertoDrawShapefalse","data","subcounts","subcountName","displayName"],"mappings":";;;;+BAgBaY;;;;;;;iEAhBU,QAAQ;8BACS,0BAA0B;wBACrC,iBAAiB;4BAEvB,wBAAwB;gCACzB,4BAA4B;uBACU,wBAAwB;gCAC/C,4BAA4B;uBAC3C,mBAAmB;6CACC,iCAAiC;AAOpE,qBAAMA,WAAAA,GAA2DZ,OAAMa,UAAU,CAGtF,CAACC,OAAOC;QAaeD;IAZvB,MAAME,iBAA4C;QAChDC,uBAAuB,IAAO,CAAA;gBAC5BC,KAAKJ,MAAMK,aAAa,CAAEC,CAAC;gBAC3BC,MAAMP,MAAMK,aAAa,CAAEG,CAAC;gBAC5BC,OAAOT,MAAMK,aAAa,CAAEG,CAAC;gBAC7BE,QAAQV,MAAMK,aAAa,CAAEC,CAAC;gBAC9BE,GAAGR,MAAMK,aAAa,CAAEG,CAAC;gBACzBF,GAAGN,MAAMK,aAAa,CAAEC,CAAC;gBACzBK,OAAO;gBACPC,QAAQ;aACV,CAAA;IACF;IACAZ,QAAQ;QA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czE,WAAWR,QAAQiC,qBAAqB;iCAC9D,OAAA,aAAA,CAAC5B,OAAAA;oBAAIG,WAAWR,QAAQkC,iBAAiB;mBACtC,SACAtD,oCAAAA,EAAqBqG,cAAc9C,WAAAA,WAAAA,GAEtC,OAAA,aAAA,CAAC9B,OAAAA;oBACCG,WAAWR,QAAQoC,eAAe;oBAClCV,OAAO;wBAAEK,OAAO9C,MAAM8C,KAAK,GAAG9C,MAAM8C,KAAK,GAAGxD,kBAAAA,CAAO8D,uBAAuB;oBAAC;uBAE1EzD,oCAAAA,EAAqBoG,SAAS,CAACC,aAAa,EAAE9C;YAIvD;QAGN;IACF;AACF,GAAG;AACHpD,aAAamG,WAAW,GAAG"}
|
|
1
|
+
{"version":3,"sources":["../src/components/CommonComponents/ChartPopover.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Popover, PopoverSurface } from '@fluentui/react-popover';\nimport { mergeClasses } from '@griffel/react';\nimport type { PositioningVirtualElement } from '@fluentui/react-positioning';\nimport { tokens } from '@fluentui/react-theme';\nimport { useId } from '@fluentui/react-utilities';\nimport { getAccessibleDataObject, Points, pointTypes } from '../../utilities/index';\nimport { formatToLocaleString } from '@fluentui/chart-utilities';\nimport { Shape } from '../Legends/shape';\nimport { usePopoverStyles_unstable } from './useChartPopoverStyles.styles';\nimport { YValueHover } from './CartesianChart.types';\nimport { LegendShape } from '../Legends/Legends.types';\nimport { ChartPopoverProps } from './ChartPopover.types';\n\n/* This component is a wrapper over Popover component which implements the logic for rendering popovers for any chart\ncombining the logic for Callout and ChartHoverCard in v8 charts. */\nexport const ChartPopover: React.FunctionComponent<ChartPopoverProps> = React.forwardRef<\n HTMLDivElement,\n ChartPopoverProps\n>((props, forwardedRef) => {\n const virtualElement: PositioningVirtualElement = {\n getBoundingClientRect: () => ({\n top: props.clickPosition!.y,\n left: props.clickPosition!.x,\n right: props.clickPosition!.x,\n bottom: props.clickPosition!.y,\n x: props.clickPosition!.x,\n y: props.clickPosition!.y,\n width: 0,\n height: 0,\n }),\n };\n props = { ...props, ...props.customCallout?.customCalloutProps };\n const classes = usePopoverStyles_unstable(props);\n const legend = props.xCalloutValue ? props.xCalloutValue : props.legend;\n const YValue = props.yCalloutValue ? props.yCalloutValue : props.YValue;\n return (\n <div id={useId('callout')} ref={forwardedRef} className={classes.calloutContainer}>\n <Popover\n positioning={{ target: virtualElement, autoSize: 'always', offset: 20, coverTarget: false }}\n open={props.isPopoverOpen}\n inline\n >\n <PopoverSurface>\n {/** Given custom callout, then it will render */}\n {props.customCallout && props.customCallout.customizedCallout && props.customCallout.customizedCallout}\n {/** single x point its corresponding y points of all the bars/lines in chart will render in callout */}\n {(!props.customCallout || !props.customCallout.customizedCallout) &&\n props.isCalloutForStack &&\n _multiValueCallout()}\n {/** single x point its corresponding y point of single line/bar in the chart will render in callout */}\n {(!props.customCallout || !props.customCallout.customizedCallout) && !props.isCalloutForStack && (\n <div className={classes.calloutContentRoot}>\n <div className={classes.calloutDateTimeContainer}>\n <div className={classes.calloutContentX}>{props.XValue} </div>\n {/*TO DO if we add time for callout then will use this */}\n {/* <div className={classNames.calloutContentX}>07:00am</div> */}\n </div>\n <div\n className={classes.calloutInfoContainer}\n style={{\n ...(props.ratio && {\n display: 'flex',\n alignItems: 'flex-end',\n }),\n borderInlineStart: `4px solid ${props.color}`,\n marginTop: '11px',\n }}\n >\n <div className={classes.calloutBlockContainer}>\n <div className={classes.calloutlegendText}>\n {formatToLocaleString(legend, props.culture) as React.ReactNode}\n </div>\n <div\n className={classes.calloutContentY}\n style={{ color: props.color ? props.color : tokens.colorNeutralForeground1 }}\n >\n {formatToLocaleString(YValue, props.culture) as React.ReactNode}\n </div>\n </div>\n {!!props.ratio && (\n <div className={classes.ratio}>\n <>\n <span className={classes.numerator}>\n {formatToLocaleString(props.ratio[0], props.culture) as React.ReactNode}\n </span>\n /\n <span className={classes.denominator}>\n {formatToLocaleString(props.ratio[1], props.culture) as React.ReactNode}\n </span>\n </>\n </div>\n )}\n </div>\n {!!props.descriptionMessage && (\n <div className={classes.descriptionMessage}>{props.descriptionMessage}</div>\n )}\n </div>\n )}\n </PopoverSurface>\n </Popover>\n </div>\n );\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n function _multiValueCallout() {\n const yValueHoverSubCountsExists: boolean = _yValueHoverSubCountsExists(props.YValueHover) ?? false;\n return (\n <div className={classes.calloutContentRoot}>\n <div\n className={classes.calloutDateTimeContainer}\n style={yValueHoverSubCountsExists ? { marginBottom: '11px' } : {}}\n >\n <div\n className={classes.calloutContentX}\n {...getAccessibleDataObject(props!.xAxisCalloutAccessibilityData, 'text', false)}\n >\n {formatToLocaleString(props!.hoverXValue, props.culture) as React.ReactNode}\n </div>\n </div>\n <div style={yValueHoverSubCountsExists ? { display: 'flex' } : {}}>\n {props!.YValueHover &&\n props!.YValueHover.map((yValue: YValueHover, index: number, yValues: YValueHover[]) => {\n const isLast: boolean = index + 1 === yValues.length;\n const { shouldDrawBorderBottom = false } = yValue;\n return (\n <div\n {...getAccessibleDataObject(yValue.callOutAccessibilityData, 'text', false)}\n key={`callout-content-${index}`}\n style={\n yValueHoverSubCountsExists\n ? {\n display: 'inline-block',\n ...(shouldDrawBorderBottom && {\n borderBottom: `1px solid ${tokens.colorNeutralStroke2}`,\n paddingBottom: '10px',\n }),\n }\n : {\n ...(shouldDrawBorderBottom && {\n borderBottom: `1px solid ${tokens.colorNeutralStroke2}`,\n paddingBottom: '10px',\n }),\n }\n }\n >\n {_getCalloutContent(yValue, index, yValueHoverSubCountsExists, isLast)}\n </div>\n );\n })}\n {!!props.descriptionMessage && <div className={classes.descriptionMessage}>{props.descriptionMessage}</div>}\n </div>\n </div>\n );\n }\n\n function _yValueHoverSubCountsExists(yValueHover?: YValueHover[]): boolean | undefined {\n return (\n yValueHover &&\n yValueHover.some(\n (yValue: {\n legend?: string;\n y?: number;\n color?: string;\n yAxisCalloutData?: string | { [id: string]: number };\n }) => yValue.yAxisCalloutData && typeof yValue.yAxisCalloutData !== 'string',\n )\n );\n }\n\n function _getCalloutContent(\n xValue: YValueHover,\n index: number,\n yValueHoverSubCountsExists: boolean,\n isLast: boolean,\n ): React.ReactNode {\n const marginStyle: React.CSSProperties = isLast ? {} : { marginRight: '16px' };\n const toDrawShape = xValue.index !== undefined && xValue.index !== -1;\n const { culture } = props;\n const yValue = formatToLocaleString(xValue.y, culture) as React.ReactNode;\n if (!xValue.yAxisCalloutData || typeof xValue.yAxisCalloutData === 'string') {\n return (\n <div style={yValueHoverSubCountsExists ? marginStyle : {}}>\n {yValueHoverSubCountsExists && (\n <div className=\"ms-fontWeight-semibold\" style={{ fontSize: '12pt' }}>\n {xValue.legend!} ({yValue})\n </div>\n )}\n <div\n id={`${index}_${xValue.y}`}\n className={classes.calloutBlockContainer}\n style={{\n marginTop: props.XValue ? '13px' : 'unset',\n ...(!toDrawShape\n ? {\n borderInlineStart: `4px solid ${xValue.color}`,\n }\n : {}),\n }}\n >\n {toDrawShape && (\n <Shape\n svgProps={{\n className: classes.shapeStyles,\n }}\n pathProps={{ fill: xValue.color }}\n shape={Points[xValue.index! % Object.keys(pointTypes).length] as LegendShape}\n />\n )}\n <div\n className={mergeClasses(\n classes.calloutBlockContainer,\n toDrawShape\n ? classes.calloutBlockContainertoDrawShapetrue\n : classes.calloutBlockContainertoDrawShapefalse,\n )}\n >\n <div className={classes.calloutlegendText}> {xValue.legend}</div>\n <div className={classes.calloutContentY} style={{ direction: 'ltr', unicodeBidi: 'isolate' }}>\n {\n formatToLocaleString(\n xValue.yAxisCalloutData ? xValue.yAxisCalloutData : xValue.y ?? xValue.data,\n culture,\n ) as React.ReactNode\n }\n </div>\n </div>\n </div>\n </div>\n );\n } else {\n const subcounts: { [id: string]: number } = xValue.yAxisCalloutData as { [id: string]: number };\n return (\n <div style={marginStyle}>\n <div className=\"ms-fontWeight-semibold\" style={{ fontSize: '12pt' }}>\n {xValue.legend!} ({yValue})\n </div>\n {Object.keys(subcounts).map((subcountName: string) => {\n return (\n <div key={subcountName} className={classes.calloutBlockContainer}>\n <div className={classes.calloutlegendText}>\n {' '}\n {formatToLocaleString(subcountName, culture) as React.ReactNode}\n </div>\n <div\n className={classes.calloutContentY}\n style={{ color: props.color ? props.color : tokens.colorNeutralForeground1 }}\n >\n {formatToLocaleString(subcounts[subcountName], culture) as React.ReactNode}\n </div>\n </div>\n );\n })}\n </div>\n );\n }\n }\n});\nChartPopover.displayName = 'ChartPopover';\n"],"names":["React","Popover","PopoverSurface","mergeClasses","tokens","useId","getAccessibleDataObject","Points","pointTypes","formatToLocaleString","Shape","usePopoverStyles_unstable","ChartPopover","forwardRef","props","forwardedRef","virtualElement","getBoundingClientRect","top","clickPosition","y","left","x","right","bottom","width","height","customCallout","customCalloutProps","classes","legend","xCalloutValue","YValue","yCalloutValue","div","id","ref","className","calloutContainer","positioning","target","autoSize","offset","coverTarget","open","isPopoverOpen","inline","customizedCallout","isCalloutForStack","_multiValueCallout","calloutContentRoot","calloutDateTimeContainer","calloutContentX","XValue","calloutInfoContainer","style","ratio","display","alignItems","borderInlineStart","color","marginTop","calloutBlockContainer","calloutlegendText","culture","calloutContentY","colorNeutralForeground1","span","numerator","denominator","descriptionMessage","_yValueHoverSubCountsExists","yValueHoverSubCountsExists","YValueHover","marginBottom","xAxisCalloutAccessibilityData","hoverXValue","map","yValue","index","yValues","isLast","length","shouldDrawBorderBottom","callOutAccessibilityData","key","borderBottom","colorNeutralStroke2","paddingBottom","_getCalloutContent","yValueHover","some","yAxisCalloutData","xValue","marginStyle","marginRight","toDrawShape","undefined","fontSize","svgProps","shapeStyles","pathProps","fill","shape","Object","keys","calloutBlockContainertoDrawShapetrue","calloutBlockContainertoDrawShapefalse","direction","unicodeBidi","data","subcounts","subcountName","displayName"],"mappings":";;;;+BAgBaY;;;;;;;iEAhBU,QAAQ;8BACS,0BAA0B;wBACrC,iBAAiB;4BAEvB,wBAAwB;gCACzB,4BAA4B;uBACU,wBAAwB;gCAC/C,4BAA4B;uBAC3C,mBAAmB;6CACC,iCAAiC;AAOp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gBAAgB,GAAGC,CAAAA,YAAAA,QAAOzE,AAAC,MAAA,QAARyE,cAAAA,KAAAA,IAAAA,YAAYA,OAAOiB,IAAI,EAC3E9C;QAQhB,OAAO;YACL,MAAM+C,YAAsClB,OAAOD,gBAAgB;YACnE,OAAA,WAAA,GACE,OAAA,aAAA,CAAC1D,OAAAA;gBAAIqB,OAAOuC;6BACV,OAAA,aAAA,CAAC5D,OAAAA;gBAAIG,WAAU;gBAAyBkB,OAAO;oBAAE2C,UAAU;gBAAO;eAC/DL,OAAO/D,MAAM,EAAE,MAAGgD,QAAO,MAE3B0B,OAAOC,IAAI,CAACM,WAAWlC,GAAG,CAAC,CAACmC;gBAC3B,OAAA,WAAA,GACE,OAAA,aAAA,CAAC9E,OAAAA;oBAAImD,KAAK2B;oBAAc3E,WAAWR,QAAQiC,qBAAqB;iCAC9D,OAAA,aAAA,CAAC5B,OAAAA;oBAAIG,WAAWR,QAAQkC,iBAAiB;mBACtC,SACAtD,oCAAAA,EAAqBuG,cAAchD,WAAAA,WAAAA,GAEtC,OAAA,aAAA,CAAC9B,OAAAA;oBACCG,WAAWR,QAAQoC,eAAe;oBAClCV,OAAO;wBAAEK,OAAO9C,MAAM8C,KAAK,GAAG9C,MAAM8C,KAAK,GAAGxD,kBAAAA,CAAO8D,uBAAuB;oBAAC;uBAE1EzD,oCAAAA,EAAqBsG,SAAS,CAACC,aAAa,EAAEhD;YAIvD;QAGN;IACF;AACF,GAAG;AACHpD,aAAaqG,WAAW,GAAG"}
|
|
@@ -1300,6 +1300,18 @@ const formatValue = (value, colIndex, cells)=>{
|
|
|
1300
1300
|
}
|
|
1301
1301
|
return `${prefix !== null && prefix !== void 0 ? prefix : ''}${formatted}${suffix !== null && suffix !== void 0 ? suffix : ''}`;
|
|
1302
1302
|
};
|
|
1303
|
+
function resolveCellStyle(raw, rowIndex, colIndex) {
|
|
1304
|
+
if (Array.isArray(raw)) {
|
|
1305
|
+
var _raw_colIndex;
|
|
1306
|
+
const rowEntry = (_raw_colIndex = raw[colIndex]) !== null && _raw_colIndex !== void 0 ? _raw_colIndex : raw[0];
|
|
1307
|
+
if (Array.isArray(rowEntry)) {
|
|
1308
|
+
var _rowEntry_rowIndex;
|
|
1309
|
+
return (_rowEntry_rowIndex = rowEntry[rowIndex]) !== null && _rowEntry_rowIndex !== void 0 ? _rowEntry_rowIndex : rowEntry[0];
|
|
1310
|
+
}
|
|
1311
|
+
return rowEntry;
|
|
1312
|
+
}
|
|
1313
|
+
return raw;
|
|
1314
|
+
}
|
|
1303
1315
|
const transformPlotlyJsonToChartTableProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
1304
1316
|
var _tableData_cells, _input_layout_template_data_table_, _input_layout_template_data_table, _input_layout_template_data, _input_layout_template, _input_layout, _input_layout_font, _input_layout1, _tableData_header, _input_layout_template_data1, _input_layout_template1, _input_layout2, _input_layout3, _input_layout4;
|
|
1305
1317
|
const tableData = input.data[0];
|
|
@@ -1307,36 +1319,12 @@ const transformPlotlyJsonToChartTableProps = (input, isMultiPlot, colorMap, colo
|
|
|
1307
1319
|
const cleanedValues = Array.isArray(values[0]) ? values.map((row)=>row.map((cell)=>cleanText(cell)).filter(Boolean).join(' ')) : values.map((cell)=>cleanText(cell));
|
|
1308
1320
|
return cleanedValues.map((value, colIndex)=>{
|
|
1309
1321
|
var _header_font, _header_font1, _header_fill;
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
fontColor = typeof colorEntry[0] === 'string' ? colorEntry[0] : undefined;
|
|
1317
|
-
} else if (typeof colorEntry === 'string') {
|
|
1318
|
-
fontColor = colorEntry;
|
|
1319
|
-
}
|
|
1320
|
-
} else if (typeof fontColorRaw === 'string') {
|
|
1321
|
-
fontColor = fontColorRaw;
|
|
1322
|
-
}
|
|
1323
|
-
const fontSizeRaw = header === null || header === void 0 ? void 0 : (_header_font1 = header.font) === null || _header_font1 === void 0 ? void 0 : _header_font1.size;
|
|
1324
|
-
let fontSize;
|
|
1325
|
-
if (Array.isArray(fontSizeRaw)) {
|
|
1326
|
-
var _fontSizeRaw_colIndex;
|
|
1327
|
-
const fontSizeEntry = (_fontSizeRaw_colIndex = fontSizeRaw[colIndex]) !== null && _fontSizeRaw_colIndex !== void 0 ? _fontSizeRaw_colIndex : fontSizeRaw[0];
|
|
1328
|
-
var _fontSizeRaw__colIndex;
|
|
1329
|
-
fontSize = Array.isArray(fontSizeRaw[0]) ? (_fontSizeRaw__colIndex = fontSizeRaw[0][colIndex]) !== null && _fontSizeRaw__colIndex !== void 0 ? _fontSizeRaw__colIndex : fontSizeRaw[0][0] : typeof fontSizeEntry === 'number' ? fontSizeEntry : undefined;
|
|
1330
|
-
} else if (typeof fontSizeRaw === 'number') {
|
|
1331
|
-
fontSize = fontSizeRaw;
|
|
1332
|
-
}
|
|
1333
|
-
const updatedColIndex = colIndex >= 1 ? 1 : 0;
|
|
1334
|
-
const fillColorRaw = header === null || header === void 0 ? void 0 : (_header_fill = header.fill) === null || _header_fill === void 0 ? void 0 : _header_fill.color;
|
|
1335
|
-
var _fillColorRaw_updatedColIndex;
|
|
1336
|
-
const backgroundColor = Array.isArray(fillColorRaw) ? (_fillColorRaw_updatedColIndex = fillColorRaw[updatedColIndex]) !== null && _fillColorRaw_updatedColIndex !== void 0 ? _fillColorRaw_updatedColIndex : fillColorRaw[0] : fillColorRaw;
|
|
1337
|
-
const textAlignRaw = header === null || header === void 0 ? void 0 : header.align;
|
|
1338
|
-
var _textAlignRaw_colIndex;
|
|
1339
|
-
const textAlign = Array.isArray(textAlignRaw) ? (_textAlignRaw_colIndex = textAlignRaw[colIndex]) !== null && _textAlignRaw_colIndex !== void 0 ? _textAlignRaw_colIndex : textAlignRaw[0] : textAlignRaw;
|
|
1322
|
+
//headers are at first row only
|
|
1323
|
+
const rowIndex = 0;
|
|
1324
|
+
const fontColor = resolveCellStyle(header === null || header === void 0 ? void 0 : (_header_font = header.font) === null || _header_font === void 0 ? void 0 : _header_font.color, rowIndex, colIndex);
|
|
1325
|
+
const fontSize = resolveCellStyle(header === null || header === void 0 ? void 0 : (_header_font1 = header.font) === null || _header_font1 === void 0 ? void 0 : _header_font1.size, rowIndex, colIndex);
|
|
1326
|
+
const backgroundColor = resolveCellStyle(header === null || header === void 0 ? void 0 : (_header_fill = header.fill) === null || _header_fill === void 0 ? void 0 : _header_fill.color, rowIndex, colIndex);
|
|
1327
|
+
const textAlign = resolveCellStyle(header === null || header === void 0 ? void 0 : header.align, rowIndex, colIndex);
|
|
1340
1328
|
const style = {
|
|
1341
1329
|
...typeof fontColor === 'string' ? {
|
|
1342
1330
|
color: fontColor
|
|
@@ -1365,40 +1353,10 @@ const transformPlotlyJsonToChartTableProps = (input, isMultiPlot, colorMap, colo
|
|
|
1365
1353
|
const cellValue = col[rowIndex];
|
|
1366
1354
|
const cleanValue = typeof cellValue === 'string' ? cleanText(cellValue) : cellValue;
|
|
1367
1355
|
const formattedValue = typeof cleanValue === 'string' || typeof cleanValue === 'number' ? formatValue(cleanValue, colIndex, cells) : cleanValue;
|
|
1368
|
-
const
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
const entry = (_rawFontColor_colIndex = rawFontColor[colIndex]) !== null && _rawFontColor_colIndex !== void 0 ? _rawFontColor_colIndex : rawFontColor[0];
|
|
1373
|
-
const colorValue = Array.isArray(entry) ? entry[rowIndex] : entry;
|
|
1374
|
-
fontColor = typeof colorValue === 'string' ? colorValue : undefined;
|
|
1375
|
-
} else if (typeof rawFontColor === 'string') {
|
|
1376
|
-
fontColor = rawFontColor;
|
|
1377
|
-
}
|
|
1378
|
-
const rawFontSize = cells === null || cells === void 0 ? void 0 : (_cells_font1 = cells.font) === null || _cells_font1 === void 0 ? void 0 : _cells_font1.size;
|
|
1379
|
-
let fontSize;
|
|
1380
|
-
if (Array.isArray(rawFontSize)) {
|
|
1381
|
-
var _rawFontSize_colIndex;
|
|
1382
|
-
const entry = (_rawFontSize_colIndex = rawFontSize[colIndex]) !== null && _rawFontSize_colIndex !== void 0 ? _rawFontSize_colIndex : rawFontSize[0];
|
|
1383
|
-
const fontSizeValue = Array.isArray(entry) ? entry[rowIndex] : entry;
|
|
1384
|
-
fontSize = typeof fontSizeValue === 'number' ? fontSizeValue : undefined;
|
|
1385
|
-
} else if (typeof rawFontSize === 'number') {
|
|
1386
|
-
fontSize = rawFontSize;
|
|
1387
|
-
}
|
|
1388
|
-
const updatedColIndex = colIndex >= 1 ? 1 : 0;
|
|
1389
|
-
const rawBackgroundColor = cells === null || cells === void 0 ? void 0 : (_cells_fill = cells.fill) === null || _cells_fill === void 0 ? void 0 : _cells_fill.color;
|
|
1390
|
-
let backgroundColor;
|
|
1391
|
-
if (Array.isArray(rawBackgroundColor)) {
|
|
1392
|
-
var _rawBackgroundColor_updatedColIndex;
|
|
1393
|
-
const entry = (_rawBackgroundColor_updatedColIndex = rawBackgroundColor[updatedColIndex]) !== null && _rawBackgroundColor_updatedColIndex !== void 0 ? _rawBackgroundColor_updatedColIndex : rawBackgroundColor[0];
|
|
1394
|
-
const colorValue = Array.isArray(entry) ? entry[rowIndex] : entry;
|
|
1395
|
-
backgroundColor = typeof colorValue === 'string' ? colorValue : undefined;
|
|
1396
|
-
} else if (typeof rawBackgroundColor === 'string') {
|
|
1397
|
-
backgroundColor = rawBackgroundColor;
|
|
1398
|
-
}
|
|
1399
|
-
var _cells_align_colIndex;
|
|
1400
|
-
const rawTextAlign = Array.isArray(cells === null || cells === void 0 ? void 0 : cells.align) ? (_cells_align_colIndex = cells.align[colIndex]) !== null && _cells_align_colIndex !== void 0 ? _cells_align_colIndex : cells.align[0] : cells === null || cells === void 0 ? void 0 : cells.align;
|
|
1401
|
-
const textAlign = rawTextAlign;
|
|
1356
|
+
const fontColor = resolveCellStyle(cells === null || cells === void 0 ? void 0 : (_cells_font = cells.font) === null || _cells_font === void 0 ? void 0 : _cells_font.color, rowIndex, colIndex);
|
|
1357
|
+
const fontSize = resolveCellStyle(cells === null || cells === void 0 ? void 0 : (_cells_font1 = cells.font) === null || _cells_font1 === void 0 ? void 0 : _cells_font1.size, rowIndex, colIndex);
|
|
1358
|
+
const backgroundColor = resolveCellStyle(cells === null || cells === void 0 ? void 0 : (_cells_fill = cells.fill) === null || _cells_fill === void 0 ? void 0 : _cells_fill.color, rowIndex, colIndex);
|
|
1359
|
+
const textAlign = resolveCellStyle(cells === null || cells === void 0 ? void 0 : cells.align, rowIndex, colIndex);
|
|
1402
1360
|
const style = {
|
|
1403
1361
|
...fontColor ? {
|
|
1404
1362
|
color: fontColor
|