@fluentui/react-charting 5.23.22 → 5.23.23
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.json +34 -1
- package/CHANGELOG.md +14 -2
- package/dist/react-charting.d.ts +40 -5
- package/dist/react-charting.js +1 -1
- package/dist/react-charting.min.js +1 -1
- package/etc/react-charting.api.md +2 -0
- package/lib/components/DeclarativeChart/DeclarativeChart.d.ts +1 -0
- package/lib/components/DeclarativeChart/DeclarativeChart.js +16 -10
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +9 -9
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +21 -21
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/Legends/Legends.base.d.ts +14 -8
- package/lib/components/Legends/Legends.base.js +53 -34
- package/lib/components/Legends/Legends.base.js.map +1 -1
- package/lib/components/Legends/Legends.types.d.ts +40 -5
- package/lib/components/Legends/Legends.types.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/DeclarativeChart.d.ts +1 -0
- package/lib-amd/components/DeclarativeChart/DeclarativeChart.js +18 -12
- package/lib-amd/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +9 -9
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +21 -21
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-amd/components/Legends/Legends.base.d.ts +14 -8
- package/lib-amd/components/Legends/Legends.base.js +53 -34
- package/lib-amd/components/Legends/Legends.base.js.map +1 -1
- package/lib-amd/components/Legends/Legends.types.d.ts +40 -5
- package/lib-amd/components/Legends/Legends.types.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.d.ts +1 -0
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +18 -11
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +9 -9
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +21 -21
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/Legends/Legends.base.d.ts +14 -8
- package/lib-commonjs/components/Legends/Legends.base.js +53 -34
- package/lib-commonjs/components/Legends/Legends.base.js.map +1 -1
- package/lib-commonjs/components/Legends/Legends.types.d.ts +40 -5
- package/lib-commonjs/components/Legends/Legends.types.js.map +1 -1
- package/package.json +3 -3
- package/src/components/Legends/Legends.types.ts +42 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Legends.base.js","sourceRoot":"../src/","sources":["components/Legends/Legends.base.tsx"],"names":[],"mappings":";;;;IAmBA,IAAM,aAAa,GAAG,IAAA,8BAAkB,GAAqC,CAAC;IAuB9E;QAAiC,uCAA4C;QAM3E,qBAAmB,KAAoB;;;YAAvC,YACE,kBAAM,KAAK,CAAC,SAcb;YAlBD,oEAAoE;YAC5D,uBAAiB,GAAG,KAAK,CAAC;YAyE1B,mBAAa,GAAG,UAAC,IAAiD;gBAClE,IAAA,KAAkF,KAAI,CAAC,KAAK,EAA1F,aAAa,mBAAA,EAAE,2BAA0B,EAA1B,mBAAmB,mBAAG,IAAI,KAAA,EAAE,gCAAgC,EAAhC,wBAAwB,mBAAG,KAAK,KAAe,CAAC;gBACnG,IAAM,UAAU,GAAG;oBACjB,IAAI,EAAE;wBACJ,cAAc,EAAE,KAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO;wBAC7D,QAAQ,EAAE,MAAM;qBACjB;iBACF,CAAC;gBACF,OAAO,CACL,oBAAC,uBAAS,uBACJ,CAAC,mBAAmB,IAAI;oBAC1B,IAAI,EAAE,SAAS;oBACf,YA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;oBACH,WAAW,GAAG,KAAM,CAAC,cAAc,CAAC,gBAAgB,CAAC;iBACtD;aACF;YACD,OAAO,WAAW,CAAC;QACrB,CAAC;QACH,kBAAC;IAAD,CAAC,AA9YD,CAAiC,KAAK,CAAC,SAAS,GA8Y/C;IA9YY,kCAAW","sourcesContent":["import * as React from 'react';\n\nimport { IContextualMenuItem } from '@fluentui/react/lib/ContextualMenu';\nimport { HoverCard, HoverCardType, IExpandingCardProps } from '@fluentui/react/lib/HoverCard';\nimport { classNamesFunction, find, getNativeProps, buttonProperties } from '@fluentui/react/lib/Utilities';\nimport { ResizeGroup } from '@fluentui/react/lib/ResizeGroup';\nimport { IProcessedStyleSet } from '@fluentui/react/lib/Styling';\nimport { OverflowSet, IOverflowSetItemProps } from '@fluentui/react/lib/OverflowSet';\nimport { FocusZone, FocusZoneDirection, FocusZoneTabbableElements } from '@fluentui/react-focus';\nimport {\n ILegend,\n ILegendsProps,\n LegendShape,\n ILegendsStyles,\n ILegendStyleProps,\n ILegendOverflowData,\n} from './Legends.types';\nimport { Shape } from './shape';\n\nconst getClassNames = classNamesFunction<ILegendStyleProps, ILegendsStyles>();\n\n// This is an internal interface used for rendering the legends with unique key\ninterface ILegendItem extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n name?: string;\n title: string;\n action: VoidFunction;\n hoverAction: VoidFunction;\n onMouseOutAction: VoidFunction;\n color: string;\n shape?: LegendShape;\n key: number;\n opacity?: number;\n stripePattern?: boolean;\n isLineLegendInBarChart?: boolean;\n}\n\nexport interface ILegendState {\n activeLegend: string;\n isHoverCardVisible: boolean;\n /** Set of legends selected, both for multiple selection and single selection */\n selectedLegends: { [key: string]: boolean };\n}\nexport class LegendsBase extends React.Component<ILegendsProps, ILegendState> {\n private _hoverCardRef: HTMLDivElement;\n private _classNames: IProcessedStyleSet<ILegendsStyles>;\n /** Boolean variable to check if one or more legends are selected */\n private _isLegendSelected = false;\n\n public constructor(props: ILegendsProps) {\n super(props);\n let defaultSelectedLegends = {};\n if (props.canSelectMultipleLegends) {\n defaultSelectedLegends =\n props.defaultSelectedLegends?.reduce((combinedDict, key) => ({ [key]: true, ...combinedDict }), {}) || {};\n } else if (props.defaultSelectedLegend) {\n defaultSelectedLegends = { [props.defaultSelectedLegend]: true };\n }\n\n this.state = {\n activeLegend: '',\n isHoverCardVisible: false,\n selectedLegends: defaultSelectedLegends,\n };\n }\n\n public render(): JSX.Element {\n const { theme, className, styles } = this.props;\n this._classNames = getClassNames(styles!, {\n theme: theme!,\n className,\n });\n this._isLegendSelected = Object.keys(this.state.selectedLegends).length > 0;\n const dataToRender = this._generateData();\n return (\n <div className={this._classNames.root}>\n {this.props.enabledWrapLines ? (\n this._onRenderData(dataToRender)\n ) : (\n <ResizeGroup\n data={dataToRender}\n onReduceData={this._onReduceData}\n onRenderData={this._onRenderData}\n onGrowData={this._onGrowData}\n />\n )}\n </div>\n );\n }\n\n private _generateData(): ILegendOverflowData {\n const { allowFocusOnLegends = true, shape } = this.props;\n const dataItems: ILegendItem[] = this.props.legends.map((legend: ILegend, index: number) => {\n return {\n ...(allowFocusOnLegends && {\n nativeButtonProps: getNativeProps<React.HTMLAttributes<HTMLButtonElement>>(legend, buttonProperties, [\n 'title',\n ]),\n 'aria-setsize': this.props.legends.length,\n 'aria-posinset': index + 1,\n }),\n title: legend.title,\n action: legend.action!,\n hoverAction: legend.hoverAction!,\n onMouseOutAction: legend.onMouseOutAction!,\n color: legend.color,\n shape: shape ? shape : legend.shape,\n stripePattern: legend.stripePattern,\n isLineLegendInBarChart: legend.isLineLegendInBarChart,\n opacity: legend.opacity,\n key: index,\n };\n });\n const result: ILegendOverflowData = {\n primary: dataItems,\n overflow: [],\n };\n return result;\n }\n\n private _onRenderData = (data: IOverflowSetItemProps | ILegendOverflowData): JSX.Element => {\n const { overflowProps, allowFocusOnLegends = true, canSelectMultipleLegends = false } = this.props;\n const rootStyles = {\n root: {\n justifyContent: this.props.centerLegends ? 'center' : 'unset',\n flexWrap: 'wrap',\n },\n };\n return (\n <FocusZone\n {...(allowFocusOnLegends && {\n role: 'listbox',\n 'aria-label': 'Legends',\n 'aria-multiselectable': canSelectMultipleLegends,\n })}\n >\n <OverflowSet\n items={data.primary}\n overflowItems={data.overflow}\n onRenderItem={this._renderButton}\n onRenderOverflowButton={this._renderOverflowItems}\n {...overflowProps}\n styles={{ ...rootStyles, ...overflowProps?.styles }}\n />\n </FocusZone>\n );\n };\n\n private _onReduceData = (currentdata: IOverflowSetItemProps): {} | void => {\n if (currentdata.primary.length === 0) {\n return;\n }\n const overflow = [...currentdata.primary.slice(-1), ...currentdata.overflow];\n const primary = currentdata.primary.slice(0, -1);\n return { primary, overflow };\n };\n\n private _onGrowData = (currentdata: IOverflowSetItemProps): {} | void => {\n if (currentdata.overflow.length === 0) {\n return;\n }\n const overflow = currentdata.overflow.slice(1);\n const primary = [...currentdata.primary, ...currentdata.overflow.slice(0, 1)];\n return { primary, overflow };\n };\n\n /**\n * This function will get called when there is an ability to\n * select multiple legends\n * @param legend ILegend\n */\n private _canSelectMultipleLegends = (legend: ILegend): { [key: string]: boolean } => {\n let selectedLegends = { ...this.state.selectedLegends };\n if (selectedLegends[legend.title]) {\n // Delete entry for the deselected legend to make\n // the number of keys equal to the number of selected legends\n delete selectedLegends[legend.title];\n } else {\n selectedLegends[legend.title] = true;\n // Clear set if all legends are selected\n if (Object.keys(selectedLegends).length === this.props.legends.length) {\n selectedLegends = {};\n }\n }\n this.setState({ selectedLegends });\n return selectedLegends;\n };\n\n /**\n * This function will get called when there is\n * ability to select only single legend\n * @param legend ILegend\n */\n\n private _canSelectOnlySingleLegend = (legend: ILegend): boolean => {\n if (this.state.selectedLegends[legend.title]) {\n this.setState({ selectedLegends: {} });\n return false;\n } else {\n this.setState({ selectedLegends: { [legend.title]: true } });\n return true;\n }\n };\n\n private _onClick = (legend: ILegend, event: React.MouseEvent<HTMLButtonElement>): void => {\n const { canSelectMultipleLegends = false } = this.props;\n let selectedLegends: string[] = [];\n if (canSelectMultipleLegends) {\n const nextSelectedLegends = this._canSelectMultipleLegends(legend);\n selectedLegends = Object.keys(nextSelectedLegends);\n } else {\n const isSelected = this._canSelectOnlySingleLegend(legend);\n selectedLegends = isSelected ? [legend.title] : [];\n }\n this.props.onChange?.(selectedLegends, event, legend);\n legend.action?.();\n };\n\n private _onRenderCompactCard = (expandingCard: IExpandingCardProps): JSX.Element => {\n const { allowFocusOnLegends = true, className, styles, theme, canSelectMultipleLegends = false } = this.props;\n const overflowHoverCardLegends: JSX.Element[] = [];\n const classNames = getClassNames(styles!, {\n theme: theme!,\n className,\n });\n expandingCard.renderData.forEach((legend: IOverflowSetItemProps, index: number) => {\n const hoverCardElement = this._renderButton(legend, index, true);\n overflowHoverCardLegends.push(hoverCardElement);\n });\n const hoverCardData = (\n <FocusZone\n {...(allowFocusOnLegends && {\n role: 'listbox',\n 'aria-label': 'Legends',\n 'aria-multiselectable': canSelectMultipleLegends,\n })}\n direction={FocusZoneDirection.vertical}\n handleTabKey={FocusZoneTabbableElements.all}\n isCircularNavigation={true}\n {...this.props.focusZonePropsInHoverCard}\n className={classNames.hoverCardRoot}\n >\n {overflowHoverCardLegends}\n </FocusZone>\n );\n return hoverCardData;\n };\n\n private _renderOverflowItems = (legends: ILegend[]) => {\n const { allowFocusOnLegends = true } = this.props;\n const items: IContextualMenuItem[] = [];\n legends.forEach((legend: ILegend, i: number) => {\n items.push({ key: i.toString(), name: legend.title, onClick: legend.action });\n });\n const renderOverflowData: IExpandingCardProps = { renderData: legends };\n const { theme, className, styles, overflowText } = this.props;\n const classNames = getClassNames(styles!, {\n theme: theme!,\n className,\n });\n const plainCardProps = {\n onRenderPlainCard: this._onRenderCompactCard,\n renderData: renderOverflowData,\n };\n\n const overflowString = overflowText ? overflowText : 'more';\n // execute similar to \"_onClick\" and \"_onLeave\" logic at HoverCard onCardHide event\n const onHoverCardHideHandler = () => {\n this.setState({ isHoverCardVisible: false });\n // Unhighlight the focused legend in the hover card\n const activeOverflowItem = find(legends, (legend: ILegend) => legend.title === this.state.activeLegend);\n if (activeOverflowItem) {\n this.setState({ activeLegend: '' });\n if (activeOverflowItem.onMouseOutAction) {\n activeOverflowItem.onMouseOutAction();\n }\n }\n };\n return (\n <HoverCard\n type={HoverCardType.plain}\n plainCardProps={plainCardProps}\n instantOpenOnClick={true}\n // eslint-disable-next-line react/jsx-no-bind\n onCardHide={onHoverCardHideHandler}\n setInitialFocus={true}\n trapFocus={true}\n onCardVisible={this._hoverCardVisible}\n styles={classNames.subComponentStyles.hoverCardStyles}\n cardDismissDelay={300}\n target={this._hoverCardRef}\n >\n {/* \"button\" role is not allowed as a child of parent role \"listbox\" */}\n <div role=\"option\">\n <div\n className={classNames.overflowIndicationTextStyle}\n ref={(rootElem: HTMLDivElement) => (this._hoverCardRef = rootElem)}\n {...(allowFocusOnLegends && {\n role: 'button',\n 'aria-expanded': this.state.isHoverCardVisible,\n 'aria-label': `${items.length} ${overflowString}`,\n })}\n data-is-focusable={allowFocusOnLegends}\n >\n {items.length} {overflowString}\n </div>\n </div>\n </HoverCard>\n );\n };\n\n private _hoverCardVisible = () => {\n this.setState({ isHoverCardVisible: true });\n };\n\n private _onHoverOverLegend = (legend: ILegend) => {\n if (legend.hoverAction) {\n this.setState({ activeLegend: legend.title });\n legend.hoverAction();\n }\n };\n\n private _onLeave = (legend: ILegend) => {\n if (legend.onMouseOutAction) {\n this.setState({ activeLegend: '' });\n legend.onMouseOutAction();\n }\n };\n\n private _renderButton = (data: IOverflowSetItemProps, index?: number, overflow?: boolean) => {\n const { allowFocusOnLegends = true } = this.props;\n const legend: ILegend = {\n title: data.title,\n color: data.color,\n shape: data.shape,\n action: data.action,\n hoverAction: data.hoverAction,\n onMouseOutAction: data.onMouseOutAction,\n stripePattern: data.stripePattern,\n isLineLegendInBarChart: data.isLineLegendInBarChart,\n opacity: data.opacity,\n };\n const color = this._getColor(legend.title, legend.color);\n const { theme, className, styles } = this.props;\n const classNames = getClassNames(styles!, {\n theme: theme!,\n className,\n colorOnSelectedState: color,\n borderColor: legend.color,\n overflow,\n stripePattern: legend.stripePattern,\n isLineLegendInBarChart: legend.isLineLegendInBarChart,\n opacity: legend.opacity,\n });\n const onClickHandler = (event: React.MouseEvent<HTMLButtonElement>) => {\n this._onClick(legend, event);\n };\n const onHoverHandler = () => {\n this._onHoverOverLegend(legend);\n };\n const onMouseOut = () => {\n this._onLeave(legend);\n };\n const shape = this._getShape(classNames, legend, color);\n return (\n <button\n {...(allowFocusOnLegends && {\n 'aria-selected': !!this.state.selectedLegends[legend.title],\n role: 'option',\n 'aria-label': `${legend.title}`,\n 'aria-setsize': data['aria-setsize'],\n 'aria-posinset': data['aria-posinset'],\n })}\n {...(data.nativeButtonProps && { ...data.nativeButtonProps })}\n key={index}\n className={classNames.legend}\n onClick={onClickHandler}\n onMouseOver={onHoverHandler}\n onMouseOut={onMouseOut}\n onFocus={onHoverHandler}\n onBlur={onMouseOut}\n data-is-focusable={allowFocusOnLegends}\n /* eslint-enable react/jsx-no-bind */\n >\n {shape}\n <div className={classNames.text}>{legend.title}</div>\n </button>\n );\n };\n\n private _getShape(\n classNames: IProcessedStyleSet<ILegendsStyles>,\n legend: ILegend,\n color: string,\n ): React.ReactNode | string {\n const svgParentProps: React.SVGAttributes<SVGElement> = {\n className: classNames.shape,\n };\n const svgChildProps: React.SVGAttributes<SVGElement> = {\n fill: color,\n strokeWidth: 2,\n stroke: legend.color,\n };\n return (\n <Shape\n svgProps={svgParentProps}\n pathProps={svgChildProps}\n shape={legend.shape as LegendShape}\n classNameForNonSvg={classNames.rect}\n />\n );\n }\n\n private _getColor(title: string, color: string): string {\n const { theme } = this.props;\n let legendColor = color;\n // if one or more legends are selected\n if (this._isLegendSelected) {\n // if the given legend (title) is one of the selected legends\n if (this.state.selectedLegends[title]) {\n legendColor = color;\n }\n // if the given legend is unselected\n else {\n legendColor = theme!.semanticColors.buttonBackground;\n }\n }\n // if no legend is selected\n else {\n // if the given legend is hovered\n // or none of the legends is hovered\n if (this.state.activeLegend === title || this.state.activeLegend === '') {\n legendColor = color;\n }\n // if there is a hovered legend but the given legend is not the one\n else {\n legendColor = theme!.semanticColors.buttonBackground;\n }\n }\n return legendColor;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Legends.base.js","sourceRoot":"../src/","sources":["components/Legends/Legends.base.tsx"],"names":[],"mappings":";;;;IAmBA,IAAM,aAAa,GAAG,IAAA,8BAAkB,GAAqC,CAAC;IAuB9E;QAAiC,uCAA4C;QA8B3E,qBAAmB,KAAoB;;;YAAvC,YACE,kBAAM,KAAK,CAAC,SAsBb;YAlDD,oEAAoE;YAC5D,uBAAiB,GAAG,KAAK,CAAC;YAyG1B,mBAAa,GAAG,UAAC,IAAiD;gBAClE,IAAA,KAAkF,KAAI,CAAC,KAAK,EAA1F,aAAa,mBAAA,EAAE,2BAA0B,EAA1B,mBAAmB,mBAAG,IAAI,KAAA,EAAE,gCAAgC,EAAhC,wBAAwB,mBAAG,KAAK,KAAe,CAAC;gBACnG,IAAM,UAAU,GAAG;oBACjB,IAAI,EAAE;wBACJ,cAAc,EAAE,KAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO;wBAC7D,QAAQ,EAAE,MAAM;qBACjB;iBACF,CAAC;gBACF,OAAO,CACL,oBAAC,uBAAS,uBACJ,CAAC,mBAAmB,IAAI;oBAC1B,IAAI,EAAE,SAAS;oBACf,YAAY,EAAE,SAAS;oBACvB,sBAAsB,EAAE,wBAAwB;iBACjD,CAAC;oBAEF,oBAAC,yBAAW,qBACV,KAAK,EAAE,IAAI,CAAC,OAAO,EACnB,aAAa,EAAE,IAAI,CAAC,QAAQ,EAC5B,YAAY,EAAE,KAAI,CAAC,aAAa,EAChC,sBAAsB,EAAE,KAAI,CAAC,oBAAoB,IAC7C,aAAa,IACjB,MAAM,wCAAO,UAAU,GAAK,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,MAAM,KACjD,CACQ,CACb,CAAC;YACJ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e,CAAC,KAAK,CAAC,EAAE;oBACrC,WAAW,GAAG,KAAK,CAAC;iBACrB;gBACD,oCAAoC;qBAC/B;oBACH,WAAW,GAAG,KAAM,CAAC,cAAc,CAAC,gBAAgB,CAAC;iBACtD;aACF;YACD,2BAA2B;iBACtB;gBACH,iCAAiC;gBACjC,oCAAoC;gBACpC,IAAI,IAAI,CAAC,KAAK,CAAC,YAAY,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,YAAY,KAAK,EAAE,EAAE;oBACvE,WAAW,GAAG,KAAK,CAAC;iBACrB;gBACD,mEAAmE;qBAC9D;oBACH,WAAW,GAAG,KAAM,CAAC,cAAc,CAAC,gBAAgB,CAAC;iBACtD;aACF;YACD,OAAO,WAAW,CAAC;QACrB,CAAC;QACH,kBAAC;IAAD,CAAC,AAhbD,CAAiC,KAAK,CAAC,SAAS,GAgb/C;IAhbY,kCAAW","sourcesContent":["import * as React from 'react';\n\nimport { IContextualMenuItem } from '@fluentui/react/lib/ContextualMenu';\nimport { HoverCard, HoverCardType, IExpandingCardProps } from '@fluentui/react/lib/HoverCard';\nimport { classNamesFunction, find, getNativeProps, buttonProperties } from '@fluentui/react/lib/Utilities';\nimport { ResizeGroup } from '@fluentui/react/lib/ResizeGroup';\nimport { IProcessedStyleSet } from '@fluentui/react/lib/Styling';\nimport { OverflowSet, IOverflowSetItemProps } from '@fluentui/react/lib/OverflowSet';\nimport { FocusZone, FocusZoneDirection, FocusZoneTabbableElements } from '@fluentui/react-focus';\nimport {\n ILegend,\n ILegendsProps,\n LegendShape,\n ILegendsStyles,\n ILegendStyleProps,\n ILegendOverflowData,\n} from './Legends.types';\nimport { Shape } from './shape';\n\nconst getClassNames = classNamesFunction<ILegendStyleProps, ILegendsStyles>();\n\n// This is an internal interface used for rendering the legends with unique key\ninterface ILegendItem extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n name?: string;\n title: string;\n action: VoidFunction;\n hoverAction: VoidFunction;\n onMouseOutAction: VoidFunction;\n color: string;\n shape?: LegendShape;\n key: number;\n opacity?: number;\n stripePattern?: boolean;\n isLineLegendInBarChart?: boolean;\n}\n\nexport interface ILegendState {\n activeLegend: string;\n isHoverCardVisible: boolean;\n /** Set of legends selected, both for multiple selection and single selection */\n selectedLegends: { [key: string]: boolean };\n}\nexport class LegendsBase extends React.Component<ILegendsProps, ILegendState> {\n private _hoverCardRef: HTMLDivElement;\n private _classNames: IProcessedStyleSet<ILegendsStyles>;\n /** Boolean variable to check if one or more legends are selected */\n private _isLegendSelected = false;\n\n public static getDerivedStateFromProps(newProps: ILegendsProps, prevState: ILegendState): ILegendState {\n const { selectedLegend, selectedLegends } = newProps;\n\n if (newProps.canSelectMultipleLegends && selectedLegends !== undefined) {\n return {\n ...prevState,\n selectedLegends: selectedLegends.reduce(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (combinedDict: any, key: any) => ({ [key]: true, ...combinedDict }),\n {},\n ),\n };\n }\n\n if (!newProps.canSelectMultipleLegends && selectedLegend !== undefined) {\n return {\n ...prevState,\n selectedLegends: { [selectedLegend]: true },\n };\n }\n\n return prevState;\n }\n\n public constructor(props: ILegendsProps) {\n super(props);\n //let defaultSelectedLegends = {};\n const initialSelectedLegends = props.selectedLegends ?? props.defaultSelectedLegends;\n const initialSelectedLegend = props.selectedLegend ?? props.defaultSelectedLegend;\n let selectedLegendsState = {};\n\n if (props.canSelectMultipleLegends) {\n selectedLegendsState =\n (initialSelectedLegends ?? [])?.reduce(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (combineDict: any, key: any) => ({ [key]: true, ...combineDict }),\n {},\n ) || {};\n } else if (initialSelectedLegend) {\n selectedLegendsState = { [initialSelectedLegend]: true };\n }\n\n this.state = {\n activeLegend: '',\n isHoverCardVisible: false,\n selectedLegends: selectedLegendsState,\n };\n }\n\n public render(): JSX.Element {\n const { theme, className, styles } = this.props;\n this._classNames = getClassNames(styles!, {\n theme: theme!,\n className,\n });\n this._isLegendSelected = Object.keys(this.state.selectedLegends).length > 0;\n const dataToRender = this._generateData();\n return (\n <div className={this._classNames.root}>\n {this.props.enabledWrapLines ? (\n this._onRenderData(dataToRender)\n ) : (\n <ResizeGroup\n data={dataToRender}\n onReduceData={this._onReduceData}\n onRenderData={this._onRenderData}\n onGrowData={this._onGrowData}\n />\n )}\n </div>\n );\n }\n\n private _generateData(): ILegendOverflowData {\n const { allowFocusOnLegends = true, shape } = this.props;\n const dataItems: ILegendItem[] = this.props.legends.map((legend: ILegend, index: number) => {\n return {\n ...(allowFocusOnLegends && {\n nativeButtonProps: getNativeProps<React.HTMLAttributes<HTMLButtonElement>>(legend, buttonProperties, [\n 'title',\n ]),\n 'aria-setsize': this.props.legends.length,\n 'aria-posinset': index + 1,\n }),\n title: legend.title,\n action: legend.action!,\n hoverAction: legend.hoverAction!,\n onMouseOutAction: legend.onMouseOutAction!,\n color: legend.color,\n shape: shape ? shape : legend.shape,\n stripePattern: legend.stripePattern,\n isLineLegendInBarChart: legend.isLineLegendInBarChart,\n opacity: legend.opacity,\n key: index,\n };\n });\n const result: ILegendOverflowData = {\n primary: dataItems,\n overflow: [],\n };\n return result;\n }\n\n private _onRenderData = (data: IOverflowSetItemProps | ILegendOverflowData): JSX.Element => {\n const { overflowProps, allowFocusOnLegends = true, canSelectMultipleLegends = false } = this.props;\n const rootStyles = {\n root: {\n justifyContent: this.props.centerLegends ? 'center' : 'unset',\n flexWrap: 'wrap',\n },\n };\n return (\n <FocusZone\n {...(allowFocusOnLegends && {\n role: 'listbox',\n 'aria-label': 'Legends',\n 'aria-multiselectable': canSelectMultipleLegends,\n })}\n >\n <OverflowSet\n items={data.primary}\n overflowItems={data.overflow}\n onRenderItem={this._renderButton}\n onRenderOverflowButton={this._renderOverflowItems}\n {...overflowProps}\n styles={{ ...rootStyles, ...overflowProps?.styles }}\n />\n </FocusZone>\n );\n };\n\n private _onReduceData = (currentdata: IOverflowSetItemProps): {} | void => {\n if (currentdata.primary.length === 0) {\n return;\n }\n const overflow = [...currentdata.primary.slice(-1), ...currentdata.overflow];\n const primary = currentdata.primary.slice(0, -1);\n return { primary, overflow };\n };\n\n private _onGrowData = (currentdata: IOverflowSetItemProps): {} | void => {\n if (currentdata.overflow.length === 0) {\n return;\n }\n const overflow = currentdata.overflow.slice(1);\n const primary = [...currentdata.primary, ...currentdata.overflow.slice(0, 1)];\n return { primary, overflow };\n };\n\n /**\n * Determine whether the component is in \"controlled\" mode for selections, where the selected legend(s) are\n * determined entirely by props passed in from the parent component.\n */\n private _isInControlledMode = (): boolean => {\n return this.props.canSelectMultipleLegends\n ? this.props.selectedLegends !== undefined\n : this.props.selectedLegend !== undefined;\n };\n\n /**\n * Get the new selected legends based on the legend that was clicked when multi-select is enabled.\n * @param legend The legend that was clicked\n * @returns An object with the new selected legend(s) state data.\n */\n private _getNewSelectedLegendsForMultiselect = (legend: ILegend): { [key: string]: boolean } => {\n let selectedLegends = { ...this.state.selectedLegends };\n if (selectedLegends[legend.title]) {\n // Delete entry for the deselected legend to make\n // the number of keys equal to the number of selected legends\n delete selectedLegends[legend.title];\n } else {\n selectedLegends[legend.title] = true;\n // Clear set if all legends are selected\n if (Object.keys(selectedLegends).length === this.props.legends.length) {\n selectedLegends = {};\n }\n }\n return selectedLegends;\n };\n\n /**\n * Get the new selected legends based on the legend that was clicked when single-select is enabled.\n * @param legend The legend that was clicked\n * @returns An object with the new selected legend state data.\n */\n\n private _getNewSelectedLegendsForSingleSelect = (legend: ILegend): { [key: string]: boolean } => {\n return this.state.selectedLegends[legend.title] ? {} : { [legend.title]: true };\n };\n\n private _onClick = (legend: ILegend, event: React.MouseEvent<HTMLButtonElement>): void => {\n const { canSelectMultipleLegends = false } = this.props;\n const nextSelectedLegends = canSelectMultipleLegends\n ? this._getNewSelectedLegendsForMultiselect(legend)\n : this._getNewSelectedLegendsForSingleSelect(legend);\n\n if (!this._isInControlledMode()) {\n this.setState({ selectedLegends: nextSelectedLegends });\n }\n this.props.onChange?.(Object.keys(nextSelectedLegends), event, legend);\n legend.action?.();\n };\n\n private _onRenderCompactCard = (expandingCard: IExpandingCardProps): JSX.Element => {\n const { allowFocusOnLegends = true, className, styles, theme, canSelectMultipleLegends = false } = this.props;\n const overflowHoverCardLegends: JSX.Element[] = [];\n const classNames = getClassNames(styles!, {\n theme: theme!,\n className,\n });\n expandingCard.renderData.forEach((legend: IOverflowSetItemProps, index: number) => {\n const hoverCardElement = this._renderButton(legend, index, true);\n overflowHoverCardLegends.push(hoverCardElement);\n });\n const hoverCardData = (\n <FocusZone\n {...(allowFocusOnLegends && {\n role: 'listbox',\n 'aria-label': 'Legends',\n 'aria-multiselectable': canSelectMultipleLegends,\n })}\n direction={FocusZoneDirection.vertical}\n handleTabKey={FocusZoneTabbableElements.all}\n isCircularNavigation={true}\n {...this.props.focusZonePropsInHoverCard}\n className={classNames.hoverCardRoot}\n >\n {overflowHoverCardLegends}\n </FocusZone>\n );\n return hoverCardData;\n };\n\n private _renderOverflowItems = (legends: ILegend[]) => {\n const { allowFocusOnLegends = true } = this.props;\n const items: IContextualMenuItem[] = [];\n legends.forEach((legend: ILegend, i: number) => {\n items.push({ key: i.toString(), name: legend.title, onClick: legend.action });\n });\n const renderOverflowData: IExpandingCardProps = { renderData: legends };\n const { theme, className, styles, overflowText } = this.props;\n const classNames = getClassNames(styles!, {\n theme: theme!,\n className,\n });\n const plainCardProps = {\n onRenderPlainCard: this._onRenderCompactCard,\n renderData: renderOverflowData,\n };\n\n const overflowString = overflowText ? overflowText : 'more';\n // execute similar to \"_onClick\" and \"_onLeave\" logic at HoverCard onCardHide event\n const onHoverCardHideHandler = () => {\n this.setState({ isHoverCardVisible: false });\n // Unhighlight the focused legend in the hover card\n const activeOverflowItem = find(legends, (legend: ILegend) => legend.title === this.state.activeLegend);\n if (activeOverflowItem) {\n this.setState({ activeLegend: '' });\n if (activeOverflowItem.onMouseOutAction) {\n activeOverflowItem.onMouseOutAction();\n }\n }\n };\n return (\n <HoverCard\n type={HoverCardType.plain}\n plainCardProps={plainCardProps}\n instantOpenOnClick={true}\n // eslint-disable-next-line react/jsx-no-bind\n onCardHide={onHoverCardHideHandler}\n setInitialFocus={true}\n trapFocus={true}\n onCardVisible={this._hoverCardVisible}\n styles={classNames.subComponentStyles.hoverCardStyles}\n cardDismissDelay={300}\n target={this._hoverCardRef}\n >\n {/* \"button\" role is not allowed as a child of parent role \"listbox\" */}\n <div role=\"option\">\n <div\n className={classNames.overflowIndicationTextStyle}\n ref={(rootElem: HTMLDivElement) => (this._hoverCardRef = rootElem)}\n {...(allowFocusOnLegends && {\n role: 'button',\n 'aria-expanded': this.state.isHoverCardVisible,\n 'aria-label': `${items.length} ${overflowString}`,\n })}\n data-is-focusable={allowFocusOnLegends}\n >\n {items.length} {overflowString}\n </div>\n </div>\n </HoverCard>\n );\n };\n\n private _hoverCardVisible = () => {\n this.setState({ isHoverCardVisible: true });\n };\n\n private _onHoverOverLegend = (legend: ILegend) => {\n if (legend.hoverAction) {\n this.setState({ activeLegend: legend.title });\n legend.hoverAction();\n }\n };\n\n private _onLeave = (legend: ILegend) => {\n if (legend.onMouseOutAction) {\n this.setState({ activeLegend: '' });\n legend.onMouseOutAction();\n }\n };\n\n private _renderButton = (data: IOverflowSetItemProps, index?: number, overflow?: boolean) => {\n const { allowFocusOnLegends = true } = this.props;\n const legend: ILegend = {\n title: data.title,\n color: data.color,\n shape: data.shape,\n action: data.action,\n hoverAction: data.hoverAction,\n onMouseOutAction: data.onMouseOutAction,\n stripePattern: data.stripePattern,\n isLineLegendInBarChart: data.isLineLegendInBarChart,\n opacity: data.opacity,\n };\n const color = this._getColor(legend.title, legend.color);\n const { theme, className, styles } = this.props;\n const classNames = getClassNames(styles!, {\n theme: theme!,\n className,\n colorOnSelectedState: color,\n borderColor: legend.color,\n overflow,\n stripePattern: legend.stripePattern,\n isLineLegendInBarChart: legend.isLineLegendInBarChart,\n opacity: legend.opacity,\n });\n const onClickHandler = (event: React.MouseEvent<HTMLButtonElement>) => {\n this._onClick(legend, event);\n };\n const onHoverHandler = () => {\n this._onHoverOverLegend(legend);\n };\n const onMouseOut = () => {\n this._onLeave(legend);\n };\n const shape = this._getShape(classNames, legend, color);\n return (\n <button\n {...(allowFocusOnLegends && {\n 'aria-selected': !!this.state.selectedLegends[legend.title],\n role: 'option',\n 'aria-label': `${legend.title}`,\n 'aria-setsize': data['aria-setsize'],\n 'aria-posinset': data['aria-posinset'],\n })}\n {...(data.nativeButtonProps && { ...data.nativeButtonProps })}\n key={index}\n className={classNames.legend}\n onClick={onClickHandler}\n onMouseOver={onHoverHandler}\n onMouseOut={onMouseOut}\n onFocus={onHoverHandler}\n onBlur={onMouseOut}\n data-is-focusable={allowFocusOnLegends}\n /* eslint-enable react/jsx-no-bind */\n >\n {shape}\n <div className={classNames.text}>{legend.title}</div>\n </button>\n );\n };\n\n private _getShape(\n classNames: IProcessedStyleSet<ILegendsStyles>,\n legend: ILegend,\n color: string,\n ): React.ReactNode | string {\n const svgParentProps: React.SVGAttributes<SVGElement> = {\n className: classNames.shape,\n };\n const svgChildProps: React.SVGAttributes<SVGElement> = {\n fill: color,\n strokeWidth: 2,\n stroke: legend.color,\n };\n return (\n <Shape\n svgProps={svgParentProps}\n pathProps={svgChildProps}\n shape={legend.shape as LegendShape}\n classNameForNonSvg={classNames.rect}\n />\n );\n }\n\n private _getColor(title: string, color: string): string {\n const { theme } = this.props;\n let legendColor = color;\n // if one or more legends are selected\n if (this._isLegendSelected) {\n // if the given legend (title) is one of the selected legends\n if (this.state.selectedLegends[title]) {\n legendColor = color;\n }\n // if the given legend is unselected\n else {\n legendColor = theme!.semanticColors.buttonBackground;\n }\n }\n // if no legend is selected\n else {\n // if the given legend is hovered\n // or none of the legends is hovered\n if (this.state.activeLegend === title || this.state.activeLegend === '') {\n legendColor = color;\n }\n // if there is a hovered legend but the given legend is not the one\n else {\n legendColor = theme!.semanticColors.buttonBackground;\n }\n }\n return legendColor;\n }\n}\n"]}
|
|
@@ -185,16 +185,51 @@ export interface ILegendsProps {
|
|
|
185
185
|
*/
|
|
186
186
|
onChange?: (selectedLegends: string[], event: React.MouseEvent<HTMLButtonElement>, currentLegend?: ILegend) => void;
|
|
187
187
|
/**
|
|
188
|
-
* Keys (title) that will be initially used to set selected items.
|
|
189
|
-
*
|
|
190
|
-
*
|
|
188
|
+
* Keys (title) that will be initially used to set selected items. This prop is used for multi-select scenarios when
|
|
189
|
+
* canSelectMultipleLegends is true; for single-select, use defaultSelectedLegend.
|
|
190
|
+
*
|
|
191
|
+
* Updating this prop does not change the selection after the component has been initialized. For controlled
|
|
192
|
+
* selections, use selectedLegends instead.
|
|
193
|
+
*
|
|
194
|
+
* @see selectedLegends for setting the selected legends in controlled mode.
|
|
195
|
+
* @see defaultSelectedLegend for setting the initially selected legend when canSelectMultipleLegends is false.
|
|
191
196
|
*/
|
|
192
197
|
defaultSelectedLegends?: string[];
|
|
193
198
|
/**
|
|
194
|
-
* Key that will be initially used to set selected item.
|
|
195
|
-
*
|
|
199
|
+
* Key that will be initially used to set selected item. This prop is used for single-select scenarios when
|
|
200
|
+
* canSelectMultipleLegends is false or unspecified; for multi-select, use defaultSelectedLegends.
|
|
201
|
+
*
|
|
202
|
+
* Updating this prop does not change the selection after the component has been initialized. For controlled
|
|
203
|
+
* selections, use selectedLegend instead.
|
|
204
|
+
*
|
|
205
|
+
* @see selectedLegend for setting the selected legend in controlled mode.
|
|
206
|
+
* @see defaultSelectedLegends for setting the initially selected legends when canSelectMultipleLegends is true.
|
|
196
207
|
*/
|
|
197
208
|
defaultSelectedLegend?: string;
|
|
209
|
+
/**
|
|
210
|
+
* Keys (title) that will be used to set selected items in multi-select scenarios when canSelectMultipleLegends is
|
|
211
|
+
* true. For single-select, use selectedLegend.
|
|
212
|
+
*
|
|
213
|
+
* When this prop is provided, the component is controlled and does not automatically update the selection based on
|
|
214
|
+
* user interactions; the parent component must update the value passed to this property by handling the onChange
|
|
215
|
+
* event.
|
|
216
|
+
*
|
|
217
|
+
* @see defaultSelectedLegends for setting the initially-selected legends in uncontrolled mode.
|
|
218
|
+
* @see selectedLegends for setting the selected legends when `canSelectMultipleLegends` is `true`.
|
|
219
|
+
*/
|
|
220
|
+
selectedLegends?: string[];
|
|
221
|
+
/**
|
|
222
|
+
* Key (title) that will be used to set the selected item in single-select scenarios when canSelectMultipleLegends is
|
|
223
|
+
* false or unspecified. For multi-select, use selectedLegends.
|
|
224
|
+
*
|
|
225
|
+
* When this prop is provided, the component is controlled and does not automatically update the selection based on
|
|
226
|
+
* user interactions; the parent component must update the value passed to this property by handling the onChange
|
|
227
|
+
* event.
|
|
228
|
+
*
|
|
229
|
+
* @see defaultSelectedLegend for setting the initially-selected legend in uncontrolled mode.
|
|
230
|
+
* @see selectedLegend for setting the selected legend when `canSelectMultipleLegends` is `false`.
|
|
231
|
+
*/
|
|
232
|
+
selectedLegend?: string;
|
|
198
233
|
/**
|
|
199
234
|
* The shape for the legend.
|
|
200
235
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Legends.types.js","sourceRoot":"../src/","sources":["components/Legends/Legends.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport { ITheme, IStyle } from '@fluentui/react/lib/Styling';\nimport { IStyleFunctionOrObject } from '@fluentui/react/lib/Utilities';\nimport { IHoverCardStyleProps, IHoverCardStyles } from '@fluentui/react/lib/HoverCard';\nimport { IOverflowSetProps } from '@fluentui/react/lib/OverflowSet';\nimport { IFocusZoneProps } from '@fluentui/react-focus';\nimport { CustomPoints, Points } from '../../utilities/utilities';\n\nexport interface ILegendOverflowData {\n primary: ILegend[];\n\n overflow?: ILegend[];\n}\n\n/**\n * @public\n * {@docCategory Legends}\n */\nexport interface ILegendSubComponentStyles {\n hoverCardStyles: IStyleFunctionOrObject<IHoverCardStyleProps, IHoverCardStyles>;\n}\n\n/**\n * @public\n * Legends styles\n * {@docCategory Legends}\n */\nexport interface ILegendsStyles {\n /**\n * Style set for the root of the legend component\n */\n root: IStyle;\n\n /**\n * Style set for Legend. This is a wrapping class for text of legend and the rectange box that represents a legend\n */\n legend: IStyle;\n\n /**\n * Style set for the rectangle that represents a legend\n */\n rect: IStyle;\n\n /**\n * styles set for the shape that represents a legend\n */\n shape: IStyle;\n\n /**\n * Style set for the triangle that represents a legend\n */\n triangle: IStyle;\n\n /**\n * Style for the legend text\n */\n text: IStyle;\n\n /**\n * Style for the legend text\n */\n hoverChange: IStyle;\n\n /**\n * Style for the text that indicates the no.of legends that are in hovercard due to lack of space\n */\n overflowIndicationTextStyle: IStyle;\n\n /**\n * Style for the overflow container\n */\n hoverCardRoot: IStyle;\n\n /**\n * sub component styles\n */\n subComponentStyles: ILegendSubComponentStyles;\n}\n\n/**\n * @public\n * ILegend interface\n * {@docCategory Legends}\n */\nexport interface ILegend {\n /**\n * Defines the title of the legend\n */\n title: string;\n\n /**\n * Defines the function that is executed on clicking this legend\n */\n action?: VoidFunction;\n\n /**\n * Defines the function that is executed upon hovering over the legend\n */\n hoverAction?: VoidFunction;\n\n /**\n * Defines the function that is executed upon moving the mouse away from the legend\n */\n onMouseOutAction?: (isLegendFocused?: boolean) => void;\n\n /**\n * The color for the legend\n */\n color: string;\n\n /**\n * The opacity of the legend color\n */\n opacity?: number;\n\n /**\n * The shape for the legend\n */\n shape?: LegendShape;\n\n /**\n * Indicated whether or not to apply stripe pattern\n */\n stripePattern?: boolean;\n\n /**\n * Indicates if the legend belongs to a line in the Bar Chart\n */\n isLineLegendInBarChart?: boolean;\n\n /*\n * native button props for the legend button\n */\n nativeButtonProps?: React.ButtonHTMLAttributes<HTMLButtonElement>;\n}\n\n/**\n * @public\n * Legend style properties\n * {@docCategory Legends}\n */\nexport interface ILegendStyleProps {\n theme?: ITheme;\n className?: string;\n colorOnSelectedState?: string;\n borderColor?: string;\n opacity?: number;\n overflow?: boolean;\n stripePattern?: boolean;\n isLineLegendInBarChart?: boolean;\n}\n\n/**\n * @public\n * Legend properties\n * {@docCategory Legends}\n */\nexport interface ILegendsProps {\n /**\n * Prop that takes list of legends\n */\n legends: ILegend[];\n\n /**\n * Additional CSS class(es) to apply to the legneds component.\n */\n className?: string;\n\n /**\n * Theme (provided through customization.)\n */\n theme?: ITheme;\n\n /**\n * Call to provide customized styling that will layer on top of the variant rules.\n */\n styles?: IStyleFunctionOrObject<ILegendStyleProps, ILegendsStyles>;\n\n /**\n * This prop makes the legends component align itself to the center in the container it is sitting in\n */\n centerLegends?: boolean;\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 enabledWrapLines?: boolean;\n\n /**\n * props for the overflow set component\n */\n overflowProps?: Partial<IOverflowSetProps>;\n\n /**\n * focus zone props in hover card\n */\n focusZonePropsInHoverCard?: IFocusZoneProps;\n\n /**\n * text for overflow legends string\n */\n overflowText?: string;\n\n /**\n * prop that decides if legends are focusable\n * @default true\n */\n allowFocusOnLegends?: boolean;\n\n /**\n * prop that decide if we can select multiple legends or single legend at a time\n * @default false\n */\n canSelectMultipleLegends?: boolean;\n\n /**\n * Defines the function that is executed upon hiding of hover card\n * make sure to send prop when the prop is canSelectMultipleLegends is set to true\n * and empty the selected state legends\n */\n onLegendHoverCardLeave?: VoidFunction;\n\n /**\n * Callback issued when the selected option changes.\n */\n onChange?: (selectedLegends: string[], event: React.MouseEvent<HTMLButtonElement>, currentLegend?: ILegend) => void;\n\n /**\n * Keys (title) that will be initially used to set selected items.\n * This prop is used for
|
|
1
|
+
{"version":3,"file":"Legends.types.js","sourceRoot":"../src/","sources":["components/Legends/Legends.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport { ITheme, IStyle } from '@fluentui/react/lib/Styling';\nimport { IStyleFunctionOrObject } from '@fluentui/react/lib/Utilities';\nimport { IHoverCardStyleProps, IHoverCardStyles } from '@fluentui/react/lib/HoverCard';\nimport { IOverflowSetProps } from '@fluentui/react/lib/OverflowSet';\nimport { IFocusZoneProps } from '@fluentui/react-focus';\nimport { CustomPoints, Points } from '../../utilities/utilities';\n\nexport interface ILegendOverflowData {\n primary: ILegend[];\n\n overflow?: ILegend[];\n}\n\n/**\n * @public\n * {@docCategory Legends}\n */\nexport interface ILegendSubComponentStyles {\n hoverCardStyles: IStyleFunctionOrObject<IHoverCardStyleProps, IHoverCardStyles>;\n}\n\n/**\n * @public\n * Legends styles\n * {@docCategory Legends}\n */\nexport interface ILegendsStyles {\n /**\n * Style set for the root of the legend component\n */\n root: IStyle;\n\n /**\n * Style set for Legend. This is a wrapping class for text of legend and the rectange box that represents a legend\n */\n legend: IStyle;\n\n /**\n * Style set for the rectangle that represents a legend\n */\n rect: IStyle;\n\n /**\n * styles set for the shape that represents a legend\n */\n shape: IStyle;\n\n /**\n * Style set for the triangle that represents a legend\n */\n triangle: IStyle;\n\n /**\n * Style for the legend text\n */\n text: IStyle;\n\n /**\n * Style for the legend text\n */\n hoverChange: IStyle;\n\n /**\n * Style for the text that indicates the no.of legends that are in hovercard due to lack of space\n */\n overflowIndicationTextStyle: IStyle;\n\n /**\n * Style for the overflow container\n */\n hoverCardRoot: IStyle;\n\n /**\n * sub component styles\n */\n subComponentStyles: ILegendSubComponentStyles;\n}\n\n/**\n * @public\n * ILegend interface\n * {@docCategory Legends}\n */\nexport interface ILegend {\n /**\n * Defines the title of the legend\n */\n title: string;\n\n /**\n * Defines the function that is executed on clicking this legend\n */\n action?: VoidFunction;\n\n /**\n * Defines the function that is executed upon hovering over the legend\n */\n hoverAction?: VoidFunction;\n\n /**\n * Defines the function that is executed upon moving the mouse away from the legend\n */\n onMouseOutAction?: (isLegendFocused?: boolean) => void;\n\n /**\n * The color for the legend\n */\n color: string;\n\n /**\n * The opacity of the legend color\n */\n opacity?: number;\n\n /**\n * The shape for the legend\n */\n shape?: LegendShape;\n\n /**\n * Indicated whether or not to apply stripe pattern\n */\n stripePattern?: boolean;\n\n /**\n * Indicates if the legend belongs to a line in the Bar Chart\n */\n isLineLegendInBarChart?: boolean;\n\n /*\n * native button props for the legend button\n */\n nativeButtonProps?: React.ButtonHTMLAttributes<HTMLButtonElement>;\n}\n\n/**\n * @public\n * Legend style properties\n * {@docCategory Legends}\n */\nexport interface ILegendStyleProps {\n theme?: ITheme;\n className?: string;\n colorOnSelectedState?: string;\n borderColor?: string;\n opacity?: number;\n overflow?: boolean;\n stripePattern?: boolean;\n isLineLegendInBarChart?: boolean;\n}\n\n/**\n * @public\n * Legend properties\n * {@docCategory Legends}\n */\nexport interface ILegendsProps {\n /**\n * Prop that takes list of legends\n */\n legends: ILegend[];\n\n /**\n * Additional CSS class(es) to apply to the legneds component.\n */\n className?: string;\n\n /**\n * Theme (provided through customization.)\n */\n theme?: ITheme;\n\n /**\n * Call to provide customized styling that will layer on top of the variant rules.\n */\n styles?: IStyleFunctionOrObject<ILegendStyleProps, ILegendsStyles>;\n\n /**\n * This prop makes the legends component align itself to the center in the container it is sitting in\n */\n centerLegends?: boolean;\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 enabledWrapLines?: boolean;\n\n /**\n * props for the overflow set component\n */\n overflowProps?: Partial<IOverflowSetProps>;\n\n /**\n * focus zone props in hover card\n */\n focusZonePropsInHoverCard?: IFocusZoneProps;\n\n /**\n * text for overflow legends string\n */\n overflowText?: string;\n\n /**\n * prop that decides if legends are focusable\n * @default true\n */\n allowFocusOnLegends?: boolean;\n\n /**\n * prop that decide if we can select multiple legends or single legend at a time\n * @default false\n */\n canSelectMultipleLegends?: boolean;\n\n /**\n * Defines the function that is executed upon hiding of hover card\n * make sure to send prop when the prop is canSelectMultipleLegends is set to true\n * and empty the selected state legends\n */\n onLegendHoverCardLeave?: VoidFunction;\n\n /**\n * Callback issued when the selected option changes.\n */\n onChange?: (selectedLegends: string[], event: React.MouseEvent<HTMLButtonElement>, currentLegend?: ILegend) => void;\n\n /**\n * Keys (title) that will be initially used to set selected items. This prop is used for multi-select scenarios when\n * canSelectMultipleLegends is true; for single-select, use defaultSelectedLegend.\n *\n * Updating this prop does not change the selection after the component has been initialized. For controlled\n * selections, use selectedLegends instead.\n *\n * @see selectedLegends for setting the selected legends in controlled mode.\n * @see defaultSelectedLegend for setting the initially selected legend when canSelectMultipleLegends is false.\n */\n defaultSelectedLegends?: string[];\n\n /**\n * Key that will be initially used to set selected item. This prop is used for single-select scenarios when\n * canSelectMultipleLegends is false or unspecified; for multi-select, use defaultSelectedLegends.\n *\n * Updating this prop does not change the selection after the component has been initialized. For controlled\n * selections, use selectedLegend instead.\n *\n * @see selectedLegend for setting the selected legend in controlled mode.\n * @see defaultSelectedLegends for setting the initially selected legends when canSelectMultipleLegends is true.\n */\n defaultSelectedLegend?: string;\n\n /**\n * Keys (title) that will be used to set selected items in multi-select scenarios when canSelectMultipleLegends is\n * true. For single-select, use selectedLegend.\n *\n * When this prop is provided, the component is controlled and does not automatically update the selection based on\n * user interactions; the parent component must update the value passed to this property by handling the onChange\n * event.\n *\n * @see defaultSelectedLegends for setting the initially-selected legends in uncontrolled mode.\n * @see selectedLegends for setting the selected legends when `canSelectMultipleLegends` is `true`.\n */\n selectedLegends?: string[];\n\n /**\n * Key (title) that will be used to set the selected item in single-select scenarios when canSelectMultipleLegends is\n * false or unspecified. For multi-select, use selectedLegends.\n *\n * When this prop is provided, the component is controlled and does not automatically update the selection based on\n * user interactions; the parent component must update the value passed to this property by handling the onChange\n * event.\n *\n * @see defaultSelectedLegend for setting the initially-selected legend in uncontrolled mode.\n * @see selectedLegend for setting the selected legend when `canSelectMultipleLegends` is `false`.\n */\n selectedLegend?: string;\n\n /**\n * The shape for the legend.\n */\n shape?: LegendShape;\n}\n\n/**\n * @public\n * The shape for the legend\n * default: show the rect legend\n * triangle: show the triangle legend\n * {@docCategory Legends}\n */\nexport type LegendShape = 'default' | 'triangle' | keyof typeof Points | keyof typeof CustomPoints;\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DeclarativeChart = void 0;
|
|
3
|
+
exports.DeclarativeChart = exports.UseIsDarkTheme = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
6
6
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
@@ -16,6 +16,12 @@ var SankeyChart_1 = require("../SankeyChart/SankeyChart");
|
|
|
16
16
|
var index_7 = require("../GaugeChart/index");
|
|
17
17
|
var index_8 = require("../GroupedVerticalBarChart/index");
|
|
18
18
|
var index_9 = require("../VerticalBarChart/index");
|
|
19
|
+
var react_1 = require("@fluentui/react");
|
|
20
|
+
var UseIsDarkTheme = function () {
|
|
21
|
+
var theme = (0, react_1.useTheme)();
|
|
22
|
+
return theme.isInverted;
|
|
23
|
+
};
|
|
24
|
+
exports.UseIsDarkTheme = UseIsDarkTheme;
|
|
19
25
|
var useColorMapping = function () {
|
|
20
26
|
var colorMap = React.useRef(new Map());
|
|
21
27
|
return colorMap;
|
|
@@ -31,40 +37,41 @@ exports.DeclarativeChart = React.forwardRef(function (props, forwardedRef) {
|
|
|
31
37
|
var isXDate = (0, PlotlySchemaAdapter_1.isDateArray)(xValues);
|
|
32
38
|
var isXNumber = (0, PlotlySchemaAdapter_1.isNumberArray)(xValues);
|
|
33
39
|
var colorMap = useColorMapping();
|
|
40
|
+
var isDarkTheme = (0, exports.UseIsDarkTheme)();
|
|
34
41
|
switch (plotlySchema.data[0].type) {
|
|
35
42
|
case 'pie':
|
|
36
|
-
return React.createElement(index_1.DonutChart, tslib_1.__assign({}, (0, PlotlySchemaAdapter_1.transformPlotlyJsonToDonutProps)(plotlySchema, colorMap)));
|
|
43
|
+
return React.createElement(index_1.DonutChart, tslib_1.__assign({}, (0, PlotlySchemaAdapter_1.transformPlotlyJsonToDonutProps)(plotlySchema, colorMap, isDarkTheme)));
|
|
37
44
|
case 'bar':
|
|
38
45
|
var orientation_1 = plotlySchema.data[0].orientation;
|
|
39
46
|
if (orientation_1 === 'h') {
|
|
40
|
-
return (React.createElement(index_4.HorizontalBarChartWithAxis, tslib_1.__assign({}, (0, PlotlySchemaAdapter_1.transformPlotlyJsonToHorizontalBarWithAxisProps)(plotlySchema, colorMap))));
|
|
47
|
+
return (React.createElement(index_4.HorizontalBarChartWithAxis, tslib_1.__assign({}, (0, PlotlySchemaAdapter_1.transformPlotlyJsonToHorizontalBarWithAxisProps)(plotlySchema, colorMap, isDarkTheme))));
|
|
41
48
|
}
|
|
42
49
|
else {
|
|
43
50
|
if (['group', 'overlay'].includes((_a = plotlySchema === null || plotlySchema === void 0 ? void 0 : plotlySchema.layout) === null || _a === void 0 ? void 0 : _a.barmode)) {
|
|
44
|
-
return React.createElement(index_8.GroupedVerticalBarChart, tslib_1.__assign({}, (0, PlotlySchemaAdapter_1.transformPlotlyJsonToGVBCProps)(plotlySchema, colorMap)));
|
|
51
|
+
return React.createElement(index_8.GroupedVerticalBarChart, tslib_1.__assign({}, (0, PlotlySchemaAdapter_1.transformPlotlyJsonToGVBCProps)(plotlySchema, colorMap, isDarkTheme)));
|
|
45
52
|
}
|
|
46
|
-
return React.createElement(index_2.VerticalStackedBarChart, tslib_1.__assign({}, (0, PlotlySchemaAdapter_1.transformPlotlyJsonToVSBCProps)(plotlySchema, colorMap)));
|
|
53
|
+
return React.createElement(index_2.VerticalStackedBarChart, tslib_1.__assign({}, (0, PlotlySchemaAdapter_1.transformPlotlyJsonToVSBCProps)(plotlySchema, colorMap, isDarkTheme)));
|
|
47
54
|
}
|
|
48
55
|
case 'scatter':
|
|
49
56
|
var isAreaChart = plotlySchema.data.some(function (series) { return series.fill === 'tonexty'; });
|
|
50
57
|
if (isXDate || isXNumber) {
|
|
51
58
|
if (isAreaChart) {
|
|
52
|
-
return React.createElement(index_5.AreaChart, tslib_1.__assign({}, (0, PlotlySchemaAdapter_1.transformPlotlyJsonToScatterChartProps)(plotlySchema, true, colorMap)));
|
|
59
|
+
return React.createElement(index_5.AreaChart, tslib_1.__assign({}, (0, PlotlySchemaAdapter_1.transformPlotlyJsonToScatterChartProps)(plotlySchema, true, colorMap, isDarkTheme)));
|
|
53
60
|
}
|
|
54
|
-
return React.createElement(index_3.LineChart, tslib_1.__assign({}, (0, PlotlySchemaAdapter_1.transformPlotlyJsonToScatterChartProps)(plotlySchema, false, colorMap)));
|
|
61
|
+
return React.createElement(index_3.LineChart, tslib_1.__assign({}, (0, PlotlySchemaAdapter_1.transformPlotlyJsonToScatterChartProps)(plotlySchema, false, colorMap, isDarkTheme)));
|
|
55
62
|
}
|
|
56
|
-
return React.createElement(index_2.VerticalStackedBarChart, tslib_1.__assign({}, (0, PlotlySchemaAdapter_1.transformPlotlyJsonToVSBCProps)(plotlySchema, colorMap)));
|
|
63
|
+
return React.createElement(index_2.VerticalStackedBarChart, tslib_1.__assign({}, (0, PlotlySchemaAdapter_1.transformPlotlyJsonToVSBCProps)(plotlySchema, colorMap, isDarkTheme)));
|
|
57
64
|
case 'heatmap':
|
|
58
65
|
return React.createElement(index_6.HeatMapChart, tslib_1.__assign({}, (0, PlotlySchemaAdapter_1.transformPlotlyJsonToHeatmapProps)(plotlySchema)));
|
|
59
66
|
case 'sankey':
|
|
60
|
-
return React.createElement(SankeyChart_1.SankeyChart, tslib_1.__assign({}, (0, PlotlySchemaAdapter_1.transformPlotlyJsonToSankeyProps)(plotlySchema, colorMap)));
|
|
67
|
+
return React.createElement(SankeyChart_1.SankeyChart, tslib_1.__assign({}, (0, PlotlySchemaAdapter_1.transformPlotlyJsonToSankeyProps)(plotlySchema, colorMap, isDarkTheme)));
|
|
61
68
|
case 'indicator':
|
|
62
69
|
if ((_d = (_c = (_b = plotlySchema === null || plotlySchema === void 0 ? void 0 : plotlySchema.data) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.mode) === null || _d === void 0 ? void 0 : _d.includes('gauge')) {
|
|
63
|
-
return React.createElement(index_7.GaugeChart, tslib_1.__assign({}, (0, PlotlySchemaAdapter_1.transformPlotlyJsonToGaugeProps)(plotlySchema, colorMap)));
|
|
70
|
+
return React.createElement(index_7.GaugeChart, tslib_1.__assign({}, (0, PlotlySchemaAdapter_1.transformPlotlyJsonToGaugeProps)(plotlySchema, colorMap, isDarkTheme)));
|
|
64
71
|
}
|
|
65
72
|
return React.createElement("div", null, "Unsupported Schema");
|
|
66
73
|
case 'histogram':
|
|
67
|
-
return React.createElement(index_9.VerticalBarChart, tslib_1.__assign({}, (0, PlotlySchemaAdapter_1.transformPlotlyJsonToVBCProps)(plotlySchema, colorMap)));
|
|
74
|
+
return React.createElement(index_9.VerticalBarChart, tslib_1.__assign({}, (0, PlotlySchemaAdapter_1.transformPlotlyJsonToVBCProps)(plotlySchema, colorMap, isDarkTheme)));
|
|
68
75
|
default:
|
|
69
76
|
return React.createElement("div", null, "Unsupported Schema");
|
|
70
77
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeclarativeChart.js","sourceRoot":"../src/","sources":["components/DeclarativeChart/DeclarativeChart.tsx"],"names":[],"mappings":";;;;AAAA,yDAAyD;AACzD,uDAAuD;AACvD,6BAA+B;AAC/B,6CAAiD;AACjD,0DAA2E;AAC3E,6DAY+B;AAC/B,4CAA+C;AAC/C,6DAAiF;AACjF,4CAA+C;AAC/C,+CAAqD;AACrD,0DAAyD;AACzD,6CAAiD;AACjD,0DAA2E;AAC3E,mDAA6D;
|
|
1
|
+
{"version":3,"file":"DeclarativeChart.js","sourceRoot":"../src/","sources":["components/DeclarativeChart/DeclarativeChart.tsx"],"names":[],"mappings":";;;;AAAA,yDAAyD;AACzD,uDAAuD;AACvD,6BAA+B;AAC/B,6CAAiD;AACjD,0DAA2E;AAC3E,6DAY+B;AAC/B,4CAA+C;AAC/C,6DAAiF;AACjF,4CAA+C;AAC/C,+CAAqD;AACrD,0DAAyD;AACzD,6CAAiD;AACjD,0DAA2E;AAC3E,mDAA6D;AAE7D,yCAA2C;AAEpC,IAAM,cAAc,GAAG;IAC5B,IAAM,KAAK,GAAG,IAAA,gBAAQ,GAAE,CAAC;IACzB,OAAO,KAAK,CAAC,UAAU,CAAC;AAC1B,CAAC,CAAC;AAHW,QA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C,EAAI,CAAC;aACjG;YACD,OAAO,sDAA6B,CAAC;QACvC,KAAK,WAAW;YACd,OAAO,oBAAC,wBAAgB,uBAAK,IAAA,mDAA6B,EAAC,YAAY,EAAE,QAAQ,EAAE,WAAW,CAAC,EAAI,CAAC;QACtG;YACE,OAAO,sDAA6B,CAAC;KACxC;AACH,CAAC,CAAC,CAAC;AACH,wBAAgB,CAAC,WAAW,GAAG,kBAAkB,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport * as React from 'react';\nimport { DonutChart } from '../DonutChart/index';\nimport { VerticalStackedBarChart } from '../VerticalStackedBarChart/index';\nimport {\n transformPlotlyJsonToDonutProps,\n transformPlotlyJsonToVSBCProps,\n transformPlotlyJsonToScatterChartProps,\n transformPlotlyJsonToHorizontalBarWithAxisProps,\n isDateArray,\n isNumberArray,\n transformPlotlyJsonToHeatmapProps,\n transformPlotlyJsonToSankeyProps,\n transformPlotlyJsonToGaugeProps,\n transformPlotlyJsonToGVBCProps,\n transformPlotlyJsonToVBCProps,\n} from './PlotlySchemaAdapter';\nimport { LineChart } from '../LineChart/index';\nimport { HorizontalBarChartWithAxis } from '../HorizontalBarChartWithAxis/index';\nimport { AreaChart } 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';\n\nimport { useTheme } from '@fluentui/react';\n\nexport const UseIsDarkTheme = (): boolean => {\n const theme = useTheme();\n return theme.isInverted;\n};\n\nexport interface Schema {\n /**\n * Plotly schema represented as JSON object\n */\n plotlySchema: any;\n\n /**\n * The legends selected by the user to persist in the chart\n */\n selectedLegends?: string[];\n\n /**\n * Dictionary for localizing the accessibility labels\n */\n accesibilityLabels?: { [key: string]: string };\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\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 } = props.chartSchema;\n const xValues = plotlySchema.data[0].x;\n const isXDate = isDateArray(xValues);\n const isXNumber = isNumberArray(xValues);\n const colorMap = useColorMapping();\n const isDarkTheme = UseIsDarkTheme();\n\n switch (plotlySchema.data[0].type) {\n case 'pie':\n return <DonutChart {...transformPlotlyJsonToDonutProps(plotlySchema, colorMap, isDarkTheme)} />;\n case 'bar':\n const orientation = plotlySchema.data[0].orientation;\n if (orientation === 'h') {\n return (\n <HorizontalBarChartWithAxis\n {...transformPlotlyJsonToHorizontalBarWithAxisProps(plotlySchema, colorMap, isDarkTheme)}\n />\n );\n } else {\n if (['group', 'overlay'].includes(plotlySchema?.layout?.barmode)) {\n return <GroupedVerticalBarChart {...transformPlotlyJsonToGVBCProps(plotlySchema, colorMap, isDarkTheme)} />;\n }\n return <VerticalStackedBarChart {...transformPlotlyJsonToVSBCProps(plotlySchema, colorMap, isDarkTheme)} />;\n }\n case 'scatter':\n const isAreaChart = plotlySchema.data.some((series: any) => series.fill === 'tonexty');\n if (isXDate || isXNumber) {\n if (isAreaChart) {\n return <AreaChart {...transformPlotlyJsonToScatterChartProps(plotlySchema, true, colorMap, isDarkTheme)} />;\n }\n return <LineChart {...transformPlotlyJsonToScatterChartProps(plotlySchema, false, colorMap, isDarkTheme)} />;\n }\n return <VerticalStackedBarChart {...transformPlotlyJsonToVSBCProps(plotlySchema, colorMap, isDarkTheme)} />;\n case 'heatmap':\n return <HeatMapChart {...transformPlotlyJsonToHeatmapProps(plotlySchema)} />;\n case 'sankey':\n return <SankeyChart {...transformPlotlyJsonToSankeyProps(plotlySchema, colorMap, isDarkTheme)} />;\n case 'indicator':\n if (plotlySchema?.data?.[0]?.mode?.includes('gauge')) {\n return <GaugeChart {...transformPlotlyJsonToGaugeProps(plotlySchema, colorMap, isDarkTheme)} />;\n }\n return <div>Unsupported Schema</div>;\n case 'histogram':\n return <VerticalBarChart {...transformPlotlyJsonToVBCProps(plotlySchema, colorMap, isDarkTheme)} />;\n default:\n return <div>Unsupported Schema</div>;\n }\n});\nDeclarativeChart.displayName = 'DeclarativeChart';\n"]}
|
|
@@ -11,16 +11,16 @@ import { IGroupedVerticalBarChartProps } from '../GroupedVerticalBarChart/index'
|
|
|
11
11
|
import { IVerticalBarChartProps } from '../VerticalBarChart/index';
|
|
12
12
|
export declare const isDateArray: (array: any[]) => boolean;
|
|
13
13
|
export declare const isNumberArray: (array: any[]) => boolean;
|
|
14
|
-
export declare const getColor: (legendLabel: string, colorMap: React.MutableRefObject<Map<string, string
|
|
15
|
-
export declare const transformPlotlyJsonToDonutProps: (jsonObj: any, colorMap: React.MutableRefObject<Map<string, string
|
|
16
|
-
export declare const transformPlotlyJsonToVSBCProps: (jsonObj: any, colorMap: React.MutableRefObject<Map<string, string
|
|
17
|
-
export declare const transformPlotlyJsonToGVBCProps: (jsonObj: any, colorMap: React.MutableRefObject<Map<string, string
|
|
18
|
-
export declare const transformPlotlyJsonToVBCProps: (jsonObj: any, colorMap: React.MutableRefObject<Map<string, string
|
|
19
|
-
export declare const transformPlotlyJsonToScatterChartProps: (jsonObj: any, isAreaChart: boolean, colorMap: React.MutableRefObject<Map<string, string
|
|
20
|
-
export declare const transformPlotlyJsonToHorizontalBarWithAxisProps: (jsonObj: any, colorMap: React.MutableRefObject<Map<string, string
|
|
14
|
+
export declare const getColor: (legendLabel: string, colorMap: React.MutableRefObject<Map<string, string>>, isDarkTheme?: boolean) => string;
|
|
15
|
+
export declare const transformPlotlyJsonToDonutProps: (jsonObj: any, colorMap: React.MutableRefObject<Map<string, string>>, isDarkTheme?: boolean) => IDonutChartProps;
|
|
16
|
+
export declare const transformPlotlyJsonToVSBCProps: (jsonObj: any, colorMap: React.MutableRefObject<Map<string, string>>, isDarkTheme?: boolean) => IVerticalStackedBarChartProps;
|
|
17
|
+
export declare const transformPlotlyJsonToGVBCProps: (jsonObj: any, colorMap: React.MutableRefObject<Map<string, string>>, isDarkTheme?: boolean) => IGroupedVerticalBarChartProps;
|
|
18
|
+
export declare const transformPlotlyJsonToVBCProps: (jsonObj: any, colorMap: React.MutableRefObject<Map<string, string>>, isDarkTheme?: boolean) => IVerticalBarChartProps;
|
|
19
|
+
export declare const transformPlotlyJsonToScatterChartProps: (jsonObj: any, isAreaChart: boolean, colorMap: React.MutableRefObject<Map<string, string>>, isDarkTheme?: boolean) => ILineChartProps | IAreaChartProps;
|
|
20
|
+
export declare const transformPlotlyJsonToHorizontalBarWithAxisProps: (jsonObj: any, colorMap: React.MutableRefObject<Map<string, string>>, isDarkTheme?: boolean) => IHorizontalBarChartWithAxisProps;
|
|
21
21
|
export declare const transformPlotlyJsonToHeatmapProps: (jsonObj: any) => IHeatMapChartProps;
|
|
22
|
-
export declare const transformPlotlyJsonToSankeyProps: (jsonObj: any, colorMap: React.MutableRefObject<Map<string, string
|
|
23
|
-
export declare const transformPlotlyJsonToGaugeProps: (jsonObj: any, colorMap: React.MutableRefObject<Map<string, string
|
|
22
|
+
export declare const transformPlotlyJsonToSankeyProps: (jsonObj: any, colorMap: React.MutableRefObject<Map<string, string>>, isDarkTheme?: boolean) => ISankeyChartProps;
|
|
23
|
+
export declare const transformPlotlyJsonToGaugeProps: (jsonObj: any, colorMap: React.MutableRefObject<Map<string, string>>, isDarkTheme?: boolean) => IGaugeChartProps;
|
|
24
24
|
/**
|
|
25
25
|
* Interate iteratively through the trace object and find all the array attributes.
|
|
26
26
|
* 1 trace record = 1 series of data
|
|
@@ -12,22 +12,22 @@ var isDateArray = function (array) { return isArrayOrTypedArray(array) && array.
|
|
|
12
12
|
exports.isDateArray = isDateArray;
|
|
13
13
|
var isNumberArray = function (array) { return isArrayOrTypedArray(array) && array.every(isNumber); };
|
|
14
14
|
exports.isNumberArray = isNumberArray;
|
|
15
|
-
var getColor = function (legendLabel, colorMap) {
|
|
15
|
+
var getColor = function (legendLabel, colorMap, isDarkTheme) {
|
|
16
16
|
if (!colorMap.current.has(legendLabel)) {
|
|
17
|
-
var nextColor = (0, colors_1.getNextColor)(colorMap.current.size + 1);
|
|
17
|
+
var nextColor = (0, colors_1.getNextColor)(colorMap.current.size + 1, 0, isDarkTheme);
|
|
18
18
|
colorMap.current.set(legendLabel, nextColor);
|
|
19
19
|
return nextColor;
|
|
20
20
|
}
|
|
21
21
|
return colorMap.current.get(legendLabel);
|
|
22
22
|
};
|
|
23
23
|
exports.getColor = getColor;
|
|
24
|
-
var transformPlotlyJsonToDonutProps = function (jsonObj, colorMap) {
|
|
24
|
+
var transformPlotlyJsonToDonutProps = function (jsonObj, colorMap, isDarkTheme) {
|
|
25
25
|
var _a, _b;
|
|
26
26
|
var data = jsonObj.data, layout = jsonObj.layout;
|
|
27
27
|
var firstData = data[0];
|
|
28
28
|
var donutData = (_a = firstData.labels) === null || _a === void 0 ? void 0 : _a.map(function (label, index) {
|
|
29
29
|
var _a;
|
|
30
|
-
var color = (0, exports.getColor)(label, colorMap);
|
|
30
|
+
var color = (0, exports.getColor)(label, colorMap, isDarkTheme);
|
|
31
31
|
return {
|
|
32
32
|
legend: label,
|
|
33
33
|
data: (_a = firstData.values) === null || _a === void 0 ? void 0 : _a[index],
|
|
@@ -64,7 +64,7 @@ var transformPlotlyJsonToDonutProps = function (jsonObj, colorMap) {
|
|
|
64
64
|
};
|
|
65
65
|
};
|
|
66
66
|
exports.transformPlotlyJsonToDonutProps = transformPlotlyJsonToDonutProps;
|
|
67
|
-
var transformPlotlyJsonToVSBCProps = function (jsonObj, colorMap) {
|
|
67
|
+
var transformPlotlyJsonToVSBCProps = function (jsonObj, colorMap, isDarkTheme) {
|
|
68
68
|
var data = jsonObj.data, layout = jsonObj.layout;
|
|
69
69
|
var mapXToDataPoints = {};
|
|
70
70
|
var yMaxValue = 0;
|
|
@@ -77,7 +77,7 @@ var transformPlotlyJsonToVSBCProps = function (jsonObj, colorMap) {
|
|
|
77
77
|
}
|
|
78
78
|
var legend = series.name || "Series ".concat(index1 + 1);
|
|
79
79
|
if (series.type === 'bar') {
|
|
80
|
-
var color = (0, exports.getColor)(legend, colorMap);
|
|
80
|
+
var color = (0, exports.getColor)(legend, colorMap, isDarkTheme);
|
|
81
81
|
mapXToDataPoints[x].chartData.push({
|
|
82
82
|
legend: legend,
|
|
83
83
|
data: (_a = series.y) === null || _a === void 0 ? void 0 : _a[index2],
|
|
@@ -85,7 +85,7 @@ var transformPlotlyJsonToVSBCProps = function (jsonObj, colorMap) {
|
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
87
|
else if (series.type === 'line') {
|
|
88
|
-
var color = (0, exports.getColor)(legend, colorMap);
|
|
88
|
+
var color = (0, exports.getColor)(legend, colorMap, isDarkTheme);
|
|
89
89
|
mapXToDataPoints[x].lineData.push({
|
|
90
90
|
legend: legend,
|
|
91
91
|
y: (_b = series.y) === null || _b === void 0 ? void 0 : _b[index2],
|
|
@@ -105,7 +105,7 @@ var transformPlotlyJsonToVSBCProps = function (jsonObj, colorMap) {
|
|
|
105
105
|
};
|
|
106
106
|
};
|
|
107
107
|
exports.transformPlotlyJsonToVSBCProps = transformPlotlyJsonToVSBCProps;
|
|
108
|
-
var transformPlotlyJsonToGVBCProps = function (jsonObj, colorMap) {
|
|
108
|
+
var transformPlotlyJsonToGVBCProps = function (jsonObj, colorMap, isDarkTheme) {
|
|
109
109
|
var data = jsonObj.data, layout = jsonObj.layout;
|
|
110
110
|
var mapXToDataPoints = {};
|
|
111
111
|
data.forEach(function (series, index1) {
|
|
@@ -117,7 +117,7 @@ var transformPlotlyJsonToGVBCProps = function (jsonObj, colorMap) {
|
|
|
117
117
|
}
|
|
118
118
|
if (series.type === 'bar') {
|
|
119
119
|
var legend = series.name || "Series ".concat(index1 + 1);
|
|
120
|
-
var color = (0, exports.getColor)(legend, colorMap);
|
|
120
|
+
var color = (0, exports.getColor)(legend, colorMap, isDarkTheme);
|
|
121
121
|
mapXToDataPoints[x].series.push({
|
|
122
122
|
key: legend,
|
|
123
123
|
data: (_a = series.y) === null || _a === void 0 ? void 0 : _a[index2],
|
|
@@ -136,7 +136,7 @@ var transformPlotlyJsonToGVBCProps = function (jsonObj, colorMap) {
|
|
|
136
136
|
};
|
|
137
137
|
};
|
|
138
138
|
exports.transformPlotlyJsonToGVBCProps = transformPlotlyJsonToGVBCProps;
|
|
139
|
-
var transformPlotlyJsonToVBCProps = function (jsonObj, colorMap) {
|
|
139
|
+
var transformPlotlyJsonToVBCProps = function (jsonObj, colorMap, isDarkTheme) {
|
|
140
140
|
var data = jsonObj.data, layout = jsonObj.layout;
|
|
141
141
|
var vbcData = [];
|
|
142
142
|
data.forEach(function (series, index) {
|
|
@@ -169,7 +169,7 @@ var transformPlotlyJsonToVBCProps = function (jsonObj, colorMap) {
|
|
|
169
169
|
var totalDataPoints = (0, d3_array_1.merge)(buckets).length;
|
|
170
170
|
buckets.forEach(function (bucket) {
|
|
171
171
|
var legend = series.name || "Series ".concat(index + 1);
|
|
172
|
-
var color = (0, exports.getColor)(legend, colorMap);
|
|
172
|
+
var color = (0, exports.getColor)(legend, colorMap, isDarkTheme);
|
|
173
173
|
var y = bucket.length;
|
|
174
174
|
if (series.histnorm === 'percent') {
|
|
175
175
|
y = (bucket.length / totalDataPoints) * 100;
|
|
@@ -215,7 +215,7 @@ var transformPlotlyJsonToVBCProps = function (jsonObj, colorMap) {
|
|
|
215
215
|
};
|
|
216
216
|
};
|
|
217
217
|
exports.transformPlotlyJsonToVBCProps = transformPlotlyJsonToVBCProps;
|
|
218
|
-
var transformPlotlyJsonToScatterChartProps = function (jsonObj, isAreaChart, colorMap) {
|
|
218
|
+
var transformPlotlyJsonToScatterChartProps = function (jsonObj, isAreaChart, colorMap, isDarkTheme) {
|
|
219
219
|
var data = jsonObj.data, layout = jsonObj.layout;
|
|
220
220
|
var chartData = data.map(function (series, index) {
|
|
221
221
|
var xValues = series.x;
|
|
@@ -223,7 +223,7 @@ var transformPlotlyJsonToScatterChartProps = function (jsonObj, isAreaChart, col
|
|
|
223
223
|
var isXDate = (0, exports.isDateArray)(xValues);
|
|
224
224
|
var isXNumber = (0, exports.isNumberArray)(xValues);
|
|
225
225
|
var legend = series.name || "Series ".concat(index + 1);
|
|
226
|
-
var lineColor = (0, exports.getColor)(legend, colorMap);
|
|
226
|
+
var lineColor = (0, exports.getColor)(legend, colorMap, isDarkTheme);
|
|
227
227
|
return {
|
|
228
228
|
legend: legend,
|
|
229
229
|
data: xValues.map(function (x, i) { return ({
|
|
@@ -251,13 +251,13 @@ var transformPlotlyJsonToScatterChartProps = function (jsonObj, isAreaChart, col
|
|
|
251
251
|
}
|
|
252
252
|
};
|
|
253
253
|
exports.transformPlotlyJsonToScatterChartProps = transformPlotlyJsonToScatterChartProps;
|
|
254
|
-
var transformPlotlyJsonToHorizontalBarWithAxisProps = function (jsonObj, colorMap) {
|
|
254
|
+
var transformPlotlyJsonToHorizontalBarWithAxisProps = function (jsonObj, colorMap, isDarkTheme) {
|
|
255
255
|
var _a, _b;
|
|
256
256
|
var data = jsonObj.data, layout = jsonObj.layout;
|
|
257
257
|
var chartData = data
|
|
258
258
|
.map(function (series, index) {
|
|
259
259
|
return series.y.map(function (yValue, i) {
|
|
260
|
-
var color = (0, exports.getColor)(yValue, colorMap);
|
|
260
|
+
var color = (0, exports.getColor)(yValue, colorMap, isDarkTheme);
|
|
261
261
|
return {
|
|
262
262
|
x: series.x[i],
|
|
263
263
|
y: yValue,
|
|
@@ -325,7 +325,7 @@ var transformPlotlyJsonToHeatmapProps = function (jsonObj) {
|
|
|
325
325
|
};
|
|
326
326
|
};
|
|
327
327
|
exports.transformPlotlyJsonToHeatmapProps = transformPlotlyJsonToHeatmapProps;
|
|
328
|
-
var transformPlotlyJsonToSankeyProps = function (jsonObj, colorMap) {
|
|
328
|
+
var transformPlotlyJsonToSankeyProps = function (jsonObj, colorMap, isDarkTheme) {
|
|
329
329
|
var _a;
|
|
330
330
|
var data = jsonObj.data, layout = jsonObj.layout;
|
|
331
331
|
var _b = data[0], link = _b.link, node = _b.node;
|
|
@@ -340,7 +340,7 @@ var transformPlotlyJsonToSankeyProps = function (jsonObj, colorMap) {
|
|
|
340
340
|
.filter(function (x) { return x.source !== x.target; }); // Filter out self-references (circular links)
|
|
341
341
|
var sankeyChartData = {
|
|
342
342
|
nodes: node.label.map(function (label, index) {
|
|
343
|
-
var color = (0, exports.getColor)(label, colorMap);
|
|
343
|
+
var color = (0, exports.getColor)(label, colorMap, isDarkTheme);
|
|
344
344
|
return {
|
|
345
345
|
nodeId: index,
|
|
346
346
|
name: label,
|
|
@@ -372,14 +372,14 @@ var transformPlotlyJsonToSankeyProps = function (jsonObj, colorMap) {
|
|
|
372
372
|
};
|
|
373
373
|
};
|
|
374
374
|
exports.transformPlotlyJsonToSankeyProps = transformPlotlyJsonToSankeyProps;
|
|
375
|
-
var transformPlotlyJsonToGaugeProps = function (jsonObj, colorMap) {
|
|
375
|
+
var transformPlotlyJsonToGaugeProps = function (jsonObj, colorMap, isDarkTheme) {
|
|
376
376
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
377
377
|
var data = jsonObj.data, layout = jsonObj.layout;
|
|
378
378
|
var firstData = data[0];
|
|
379
379
|
var segments = (_b = (_a = firstData.gauge) === null || _a === void 0 ? void 0 : _a.steps) === null || _b === void 0 ? void 0 : _b.map(function (step, index) {
|
|
380
380
|
var _a, _b;
|
|
381
381
|
var legend = step.name || "Segment ".concat(index + 1);
|
|
382
|
-
var color = (0, exports.getColor)(legend, colorMap);
|
|
382
|
+
var color = (0, exports.getColor)(legend, colorMap, isDarkTheme);
|
|
383
383
|
return {
|
|
384
384
|
legend: legend,
|
|
385
385
|
size: ((_a = step.range) === null || _a === void 0 ? void 0 : _a[1]) - ((_b = step.range) === null || _b === void 0 ? void 0 : _b[0]),
|
|
@@ -392,12 +392,12 @@ var transformPlotlyJsonToGaugeProps = function (jsonObj, colorMap) {
|
|
|
392
392
|
var diff = firstData.value - firstData.delta.reference;
|
|
393
393
|
if (diff >= 0) {
|
|
394
394
|
sublabel = "\u25B2 ".concat(diff);
|
|
395
|
-
var color = (0, exports.getColor)(((_d = firstData.delta.increasing) === null || _d === void 0 ? void 0 : _d.color) || '', colorMap);
|
|
395
|
+
var color = (0, exports.getColor)(((_d = firstData.delta.increasing) === null || _d === void 0 ? void 0 : _d.color) || '', colorMap, isDarkTheme);
|
|
396
396
|
sublabelColor = color;
|
|
397
397
|
}
|
|
398
398
|
else {
|
|
399
399
|
sublabel = "\u25BC ".concat(Math.abs(diff));
|
|
400
|
-
var color = (0, exports.getColor)(((_e = firstData.delta.decreasing) === null || _e === void 0 ? void 0 : _e.color) || '', colorMap);
|
|
400
|
+
var color = (0, exports.getColor)(((_e = firstData.delta.decreasing) === null || _e === void 0 ? void 0 : _e.color) || '', colorMap, isDarkTheme);
|
|
401
401
|
sublabelColor = color;
|
|
402
402
|
}
|
|
403
403
|
}
|