@fluentui/react-charting 5.22.1 → 5.22.2

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.
Files changed (60) hide show
  1. package/CHANGELOG.json +22 -1
  2. package/CHANGELOG.md +12 -2
  3. package/dist/react-charting.d.ts +16 -0
  4. package/dist/react-charting.js +1 -1
  5. package/dist/react-charting.min.js +1 -1
  6. package/etc/react-charting.api.md +4 -0
  7. package/lib/components/DonutChart/Arc/Arc.js +9 -15
  8. package/lib/components/DonutChart/Arc/Arc.js.map +1 -1
  9. package/lib/components/DonutChart/Arc/Arc.styles.d.ts +2 -2
  10. package/lib/components/DonutChart/Arc/Arc.styles.js +9 -2
  11. package/lib/components/DonutChart/Arc/Arc.styles.js.map +1 -1
  12. package/lib/components/DonutChart/Arc/Arc.types.d.ts +26 -0
  13. package/lib/components/DonutChart/Arc/Arc.types.js.map +1 -1
  14. package/lib/components/GaugeChart/GaugeChart.base.js +9 -9
  15. package/lib/components/GaugeChart/GaugeChart.base.js.map +1 -1
  16. package/lib/components/GaugeChart/GaugeChart.styles.js +9 -1
  17. package/lib/components/GaugeChart/GaugeChart.styles.js.map +1 -1
  18. package/lib/components/GaugeChart/GaugeChart.types.d.ts +16 -0
  19. package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -1
  20. package/lib/utilities/gradients.js +2 -2
  21. package/lib/utilities/gradients.js.map +1 -1
  22. package/lib/version.js +1 -1
  23. package/lib/version.js.map +1 -1
  24. package/lib-amd/components/DonutChart/Arc/Arc.js +9 -15
  25. package/lib-amd/components/DonutChart/Arc/Arc.js.map +1 -1
  26. package/lib-amd/components/DonutChart/Arc/Arc.styles.d.ts +2 -2
  27. package/lib-amd/components/DonutChart/Arc/Arc.styles.js +9 -2
  28. package/lib-amd/components/DonutChart/Arc/Arc.styles.js.map +1 -1
  29. package/lib-amd/components/DonutChart/Arc/Arc.types.d.ts +26 -0
  30. package/lib-amd/components/DonutChart/Arc/Arc.types.js.map +1 -1
  31. package/lib-amd/components/GaugeChart/GaugeChart.base.js +9 -9
  32. package/lib-amd/components/GaugeChart/GaugeChart.base.js.map +1 -1
  33. package/lib-amd/components/GaugeChart/GaugeChart.styles.js +9 -1
  34. package/lib-amd/components/GaugeChart/GaugeChart.styles.js.map +1 -1
  35. package/lib-amd/components/GaugeChart/GaugeChart.types.d.ts +16 -0
  36. package/lib-amd/components/GaugeChart/GaugeChart.types.js.map +1 -1
  37. package/lib-amd/utilities/gradients.js +2 -2
  38. package/lib-amd/utilities/gradients.js.map +1 -1
  39. package/lib-amd/version.js +1 -1
  40. package/lib-amd/version.js.map +1 -1
  41. package/lib-commonjs/components/DonutChart/Arc/Arc.js +9 -15
  42. package/lib-commonjs/components/DonutChart/Arc/Arc.js.map +1 -1
  43. package/lib-commonjs/components/DonutChart/Arc/Arc.styles.d.ts +2 -2
  44. package/lib-commonjs/components/DonutChart/Arc/Arc.styles.js +9 -2
  45. package/lib-commonjs/components/DonutChart/Arc/Arc.styles.js.map +1 -1
  46. package/lib-commonjs/components/DonutChart/Arc/Arc.types.d.ts +26 -0
  47. package/lib-commonjs/components/DonutChart/Arc/Arc.types.js.map +1 -1
  48. package/lib-commonjs/components/GaugeChart/GaugeChart.base.js +9 -9
  49. package/lib-commonjs/components/GaugeChart/GaugeChart.base.js.map +1 -1
  50. package/lib-commonjs/components/GaugeChart/GaugeChart.styles.js +9 -1
  51. package/lib-commonjs/components/GaugeChart/GaugeChart.styles.js.map +1 -1
  52. package/lib-commonjs/components/GaugeChart/GaugeChart.types.d.ts +16 -0
  53. package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +1 -1
  54. package/lib-commonjs/utilities/gradients.js +2 -2
  55. package/lib-commonjs/utilities/gradients.js.map +1 -1
  56. package/lib-commonjs/version.js +1 -1
  57. package/lib-commonjs/version.js.map +1 -1
  58. package/package.json +1 -1
  59. package/src/components/DonutChart/Arc/Arc.types.ts +32 -0
  60. package/src/components/GaugeChart/GaugeChart.types.ts +20 -0
@@ -1 +1 @@
1
- {"version":3,"file":"GaugeChart.types.js","sourceRoot":"../src/","sources":["components/GaugeChart/GaugeChart.types.ts"],"names":[],"mappings":"AAqCA;;GAEG;AACH,MAAM,CAAN,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,6CAAyB,CAAA;IACzB,yCAAqB,CAAA;AACvB,CAAC,EAHW,gBAAgB,KAAhB,gBAAgB,QAG3B;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,qDAAgC,CAAA;IAChC,2DAAsC,CAAA;AACxC,CAAC,EAHW,iBAAiB,KAAjB,iBAAiB,QAG5B","sourcesContent":["import { IStyle, ITheme } from '@fluentui/react/lib/Styling';\nimport { IStyleFunctionOrObject } from '@fluentui/react/lib/Utilities';\nimport { ILegendsProps } from '../Legends/index';\nimport { IAccessibilityProps } from '../../types/index';\nimport { ICalloutProps } from '@fluentui/react/lib/Callout';\n\n/**\n * Gauge Chart segment interface.\n * {@docCategory GaugeChart}\n */\nexport interface IGaugeChartSegment {\n /**\n * Legend text for a segment\n */\n legend: string;\n\n /**\n * Size of the segment\n */\n size: number;\n\n /**\n * Color of the segment\n */\n color?: string;\n\n /**\n * Gradient color of the segment\n */\n gradient?: [string, string];\n\n /**\n * Accessibility data for the segment\n */\n accessibilityData?: IAccessibilityProps;\n}\n\n/**\n * {@docCategory GaugeChart}\n */\nexport enum GaugeValueFormat {\n Percentage = 'percentage',\n Fraction = 'fraction',\n}\n\n/**\n * {@docCategory GaugeChart}\n */\nexport enum GaugeChartVariant {\n SingleSegment = 'single-segment',\n MultipleSegments = 'multiple-segments',\n}\n\n/**\n * Gauge Chart properties\n * {@docCategory GaugeChart}\n */\nexport interface IGaugeChartProps {\n /**\n * Width of the chart\n */\n width?: number;\n\n /**\n * Height of the chart\n */\n height?: number;\n\n /**\n * Title of the chart\n */\n chartTitle?: string;\n\n /**\n * Current value of the gauge\n */\n chartValue: number;\n\n /**\n * Sections of the gauge\n */\n segments: IGaugeChartSegment[];\n\n /**\n * Minimum value of the gauge\n * @defaultvalue 0\n */\n minValue?: number;\n\n /**\n * Maximum value of the gauge\n */\n maxValue?: number;\n\n /**\n * Additional text to display below the chart value\n */\n sublabel?: string;\n\n /**\n * Hide the min and max values of the gauge\n * @defaultvalue false\n */\n hideMinMax?: boolean;\n\n /**\n * Format of the chart value\n * @defaultvalue GaugeValueFormat.Percentage\n */\n chartValueFormat?: GaugeValueFormat | ((sweepFraction: [number, number]) => string);\n\n /**\n * Decides whether to show/hide legends\n * @defaultvalue false\n */\n hideLegend?: boolean;\n\n /*\n * Props for the legends in the chart\n */\n legendProps?: Partial<ILegendsProps>;\n\n /**\n * Do not show tooltips in chart\n * @defaultvalue false\n */\n hideTooltip?: boolean;\n\n /**\n * Additional CSS class(es) to apply to the chart\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<IGaugeChartStyleProps, IGaugeChartStyles>;\n\n /**\n * Defines the culture to localize the numbers and dates\n */\n culture?: string;\n\n /**\n * Props for the callout in the chart\n */\n calloutProps?: Partial<ICalloutProps>;\n\n /**\n * Specifies the variant of GaugeChart to be rendered\n * @defaultvalue GaugeChartVariant.MultipleSegments\n */\n variant?: GaugeChartVariant;\n\n /**\n * Prop to enable the gradient in the chart\n * @default false\n */\n enableGradient?: boolean;\n\n /**\n * Prop to enable the round corners in the chart\n * @default false\n */\n roundCorners?: boolean;\n}\n\n/**\n * Gauge Chart style properties\n * {@docCategory GaugeChart}\n */\nexport interface IGaugeChartStyleProps {\n /**\n * Theme (provided through customization)\n */\n theme: ITheme;\n\n /**\n * Font size of the chart value\n */\n chartValueSize?: number;\n\n /**\n * Width of the chart\n */\n chartWidth?: number;\n\n /**\n * Height of the chart\n */\n chartHeight?: number;\n\n /**\n * Additional CSS class(es) to apply to the chart\n */\n className?: string;\n\n /**\n * Color of the line\n */\n lineColor?: string;\n\n /**\n * Boolean flag which determines if shape is drawn in callout\n */\n toDrawShape?: boolean;\n}\n\n/**\n * Gauge Chart styles\n * {@docCategory GaugeChart}\n */\nexport interface IGaugeChartStyles {\n /**\n * Styles for the root element\n */\n root?: IStyle;\n\n /**\n * Styles for the chart\n */\n chart?: IStyle;\n\n /**\n * Styles for the min and max values\n */\n limits?: IStyle;\n\n /**\n * Styles for the chart value\n */\n chartValue?: IStyle;\n\n /**\n * Styles for the sublabel\n */\n sublabel?: IStyle;\n\n /**\n * Styles for the needle\n */\n needle?: IStyle;\n\n /**\n * Styles for the chart title\n */\n chartTitle?: IStyle;\n\n /**\n * Styles for the segments\n */\n segment?: IStyle;\n\n /**\n * Styles for the legends container\n */\n legendsContainer?: IStyle;\n\n /**\n * Styles for callout root-content\n */\n calloutContentRoot?: IStyle;\n\n /**\n * Styles for callout x-content\n */\n calloutContentX?: IStyle;\n\n /**\n * Styles for callout y-content\n */\n calloutContentY?: IStyle;\n\n /**\n * Styles for description message\n */\n descriptionMessage?: IStyle;\n\n /**\n * Styles for callout Date time container\n */\n calloutDateTimeContainer?: IStyle;\n\n /**\n * Styles for callout info container\n */\n calloutInfoContainer?: IStyle;\n\n /**\n * Styles for callout block container\n */\n calloutBlockContainer?: IStyle;\n\n /**\n * Styles for callout legend text\n */\n calloutlegendText?: IStyle;\n\n /**\n * Styles for the shape object in the callout\n */\n shapeStyles?: IStyle;\n}\n"]}
1
+ {"version":3,"file":"GaugeChart.types.js","sourceRoot":"../src/","sources":["components/GaugeChart/GaugeChart.types.ts"],"names":[],"mappings":"AAqCA;;GAEG;AACH,MAAM,CAAN,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,6CAAyB,CAAA;IACzB,yCAAqB,CAAA;AACvB,CAAC,EAHW,gBAAgB,KAAhB,gBAAgB,QAG3B;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,qDAAgC,CAAA;IAChC,2DAAsC,CAAA;AACxC,CAAC,EAHW,iBAAiB,KAAjB,iBAAiB,QAG5B","sourcesContent":["import { IStyle, ITheme } from '@fluentui/react/lib/Styling';\nimport { IStyleFunctionOrObject } from '@fluentui/react/lib/Utilities';\nimport { ILegendsProps } from '../Legends/index';\nimport { IAccessibilityProps } from '../../types/index';\nimport { ICalloutProps } from '@fluentui/react/lib/Callout';\n\n/**\n * Gauge Chart segment interface.\n * {@docCategory GaugeChart}\n */\nexport interface IGaugeChartSegment {\n /**\n * Legend text for a segment\n */\n legend: string;\n\n /**\n * Size of the segment\n */\n size: number;\n\n /**\n * Color of the segment\n */\n color?: string;\n\n /**\n * Gradient color of the segment\n */\n gradient?: [string, string];\n\n /**\n * Accessibility data for the segment\n */\n accessibilityData?: IAccessibilityProps;\n}\n\n/**\n * {@docCategory GaugeChart}\n */\nexport enum GaugeValueFormat {\n Percentage = 'percentage',\n Fraction = 'fraction',\n}\n\n/**\n * {@docCategory GaugeChart}\n */\nexport enum GaugeChartVariant {\n SingleSegment = 'single-segment',\n MultipleSegments = 'multiple-segments',\n}\n\n/**\n * Gauge Chart properties\n * {@docCategory GaugeChart}\n */\nexport interface IGaugeChartProps {\n /**\n * Width of the chart\n */\n width?: number;\n\n /**\n * Height of the chart\n */\n height?: number;\n\n /**\n * Title of the chart\n */\n chartTitle?: string;\n\n /**\n * Current value of the gauge\n */\n chartValue: number;\n\n /**\n * Sections of the gauge\n */\n segments: IGaugeChartSegment[];\n\n /**\n * Minimum value of the gauge\n * @defaultvalue 0\n */\n minValue?: number;\n\n /**\n * Maximum value of the gauge\n */\n maxValue?: number;\n\n /**\n * Additional text to display below the chart value\n */\n sublabel?: string;\n\n /**\n * Hide the min and max values of the gauge\n * @defaultvalue false\n */\n hideMinMax?: boolean;\n\n /**\n * Format of the chart value\n * @defaultvalue GaugeValueFormat.Percentage\n */\n chartValueFormat?: GaugeValueFormat | ((sweepFraction: [number, number]) => string);\n\n /**\n * Decides whether to show/hide legends\n * @defaultvalue false\n */\n hideLegend?: boolean;\n\n /*\n * Props for the legends in the chart\n */\n legendProps?: Partial<ILegendsProps>;\n\n /**\n * Do not show tooltips in chart\n * @defaultvalue false\n */\n hideTooltip?: boolean;\n\n /**\n * Additional CSS class(es) to apply to the chart\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<IGaugeChartStyleProps, IGaugeChartStyles>;\n\n /**\n * Defines the culture to localize the numbers and dates\n */\n culture?: string;\n\n /**\n * Props for the callout in the chart\n */\n calloutProps?: Partial<ICalloutProps>;\n\n /**\n * Specifies the variant of GaugeChart to be rendered\n * @defaultvalue GaugeChartVariant.MultipleSegments\n */\n variant?: GaugeChartVariant;\n\n /**\n * Prop to enable the gradient in the chart\n * @default false\n */\n enableGradient?: boolean;\n\n /**\n * Prop to enable the round corners in the chart\n * @default false\n */\n roundCorners?: boolean;\n}\n\n/**\n * Gauge Chart style properties\n * {@docCategory GaugeChart}\n */\nexport interface IGaugeChartStyleProps {\n /**\n * Theme (provided through customization)\n */\n theme: ITheme;\n\n /**\n * Font size of the chart value\n */\n chartValueSize?: number;\n\n /**\n * Width of the chart\n */\n chartWidth?: number;\n\n /**\n * Height of the chart\n */\n chartHeight?: number;\n\n /**\n * Additional CSS class(es) to apply to the chart\n */\n className?: string;\n\n /**\n * Color of the line\n */\n lineColor?: string;\n\n /**\n * Boolean flag which determines if shape is drawn in callout\n */\n toDrawShape?: boolean;\n\n /**\n * solid color for the arc (when enableGradient is false)\n */\n solidFill?: string;\n\n /**\n * gradient for the arc (when enableGradient is true)\n */\n gradientFill?: string;\n\n /**\n * opacity of the arc\n */\n opacity?: number;\n}\n\n/**\n * Gauge Chart styles\n * {@docCategory GaugeChart}\n */\nexport interface IGaugeChartStyles {\n /**\n * Styles for the root element\n */\n root?: IStyle;\n\n /**\n * Styles for the chart\n */\n chart?: IStyle;\n\n /**\n * Styles for the min and max values\n */\n limits?: IStyle;\n\n /**\n * Styles for the chart value\n */\n chartValue?: IStyle;\n\n /**\n * Styles for the sublabel\n */\n sublabel?: IStyle;\n\n /**\n * Styles for the needle\n */\n needle?: IStyle;\n\n /**\n * Styles for the chart title\n */\n chartTitle?: IStyle;\n\n /**\n * Styles for the segments\n */\n segment?: IStyle;\n\n /**\n * Styles for gradient segments\n */\n gradientSegment?: IStyle;\n\n /**\n * Styles for the legends container\n */\n legendsContainer?: IStyle;\n\n /**\n * Styles for callout root-content\n */\n calloutContentRoot?: IStyle;\n\n /**\n * Styles for callout x-content\n */\n calloutContentX?: IStyle;\n\n /**\n * Styles for callout y-content\n */\n calloutContentY?: IStyle;\n\n /**\n * Styles for description message\n */\n descriptionMessage?: IStyle;\n\n /**\n * Styles for callout Date time container\n */\n calloutDateTimeContainer?: IStyle;\n\n /**\n * Styles for callout info container\n */\n calloutInfoContainer?: IStyle;\n\n /**\n * Styles for callout block container\n */\n calloutBlockContainer?: IStyle;\n\n /**\n * Styles for callout legend text\n */\n calloutlegendText?: IStyle;\n\n /**\n * Styles for the shape object in the callout\n */\n shapeStyles?: IStyle;\n}\n"]}
@@ -134,8 +134,8 @@ var semanticGradientPalette = {
134
134
  ['#D33F4C', '#DC626D'], // [cranberry.tint20, cranberry.tint30],
135
135
  ],
136
136
  disabled: [
137
- ['#E6E6E6', '#F0F0F0'],
138
- ['#E6E6E6', '#F0F0F0'],
137
+ ['#E6E6E6', '#E6E6E6'],
138
+ ['#E6E6E6', '#E6E6E6'],
139
139
  ],
140
140
  };
141
141
  var Gradients = {
@@ -1 +1 @@
1
- {"version":3,"file":"gradients.js","sourceRoot":"../src/","sources":["utilities/gradients.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,sBAAsB,GAAG;IACpC,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,WAAW;IACtB,S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esContent":["export const DataVizGradientPalette = {\n gradient1: 'default.1',\n gradient2: 'default.2',\n gradient3: 'default.3',\n gradient4: 'default.4',\n gradient5: 'default.5',\n gradient6: 'default.6',\n gradient7: 'default.7',\n gradient8: 'default.8',\n gradient9: 'default.9',\n gradient10: 'default.10',\n // extended gradients\n gradient1Ext: 'extended.1',\n gradient2Ext: 'extended.2',\n gradient3Ext: 'extended.3',\n gradient4Ext: 'extended.4',\n gradient5Ext: 'extended.5',\n gradient6Ext: 'extended.6',\n gradient7Ext: 'extended.7',\n gradient8Ext: 'extended.8',\n gradient9Ext: 'extended.9',\n gradient10Ext: 'extended.10',\n // status gradients\n success: 'semantic.success',\n highSuccess: 'semantic.highSuccess',\n warning: 'semantic.warning',\n error: 'semantic.error',\n highError: 'semantic.highError',\n disabled: 'semantic.disabled',\n};\n\n/**\n * Key: Color code.\n * Value:\n *\n * Index 0 - Default gradient for light theme\n * ├── Index 0 - start color of gradient\n * └── Index 1 - end color of gradient\n *\n * Index 1 - gradient for dark theme\n * ├── Index 0 - start color of gradient\n * └── Index 1 - end color of gradient\n */\ntype GradientPalette = { [key: string]: [string, string][] };\n\nconst defaultGradientPalette: GradientPalette = {\n '1': [\n ['#4760D5', '#637CEF'], // [cornflower.shade10, cornflower.tint10],\n ['#4F6BED', '#637CEF'], // [cornflower.shade10, cornflower.tint10],\n ],\n '2': [\n ['#795AA6', '#9373C0'], // [orchid.shade20, orchid.tint10],\n ['#8764B8', '#A083C9'], // [orchid.primary, orchid.tint20],\n ],\n '3': [\n ['#159195', '#2AA0A4'], // [teal.tint10, teal.tint20],\n ['#159195', '#2AA0A4'], // [teal.tint10, teal.tint20],\n ],\n '4': [\n ['#B146C2', '#C36BD1'], // [lilac.primary, lilac.tint20],\n ['#B146C2', '#C36BD1'], // [lilac.primary, lilac.tint20],\n ],\n '5': [\n ['#3487C7', '#3A96DD'], // [lightBlue.shade10, lightBlue.primary],\n ['#3487C7', '#3A96DD'], // [lightBlue.shade20, lightBlue.primary],\n ],\n '6': [\n ['#0E7A0B', '#13A10E'], // [lightGreen.shade20, lightGreen.primary],\n ['#11910D', '#27AC22'], // [lightGreen.shade10, lightGreen.tint10],\n ],\n '7': [\n ['#E61C99', '#EE5FB7'], // [hotPink.tint10, hotPink.tint30],\n ['#E61C99', '#EE5FB7'], // [hotPink.tint10, hotPink.tint30],\n ],\n '8': [\n ['#CA5010', '#D77440'], // [pumpkin.primary, pumpkin.tint20],\n ['#CA5010', '#D77440'], // [pumpkin.primary, pumpkin.tint10],\n ],\n '9': [\n ['#57811B', '#689920'], // [lime.shade20, lime.shade10],\n ['#57811B', '#689920'], // [lime.shade20, lime.shade10],\n ],\n '10': [\n ['#937700', '#AE8C00'], // [gold.shade20, gold.shade10],\n ['#937700', '#AE8C00'], // [gold.shade20, gold.shade10],\n ],\n};\n\nconst extendedGradientPalette: GradientPalette = {\n '1': [\n ['#2C3C85', '#3C51B4'], // [cornflower.shade30, cornflower.shade20],\n ['#93A4F4', '#C8D1FA'], // [cornflower.tint30, cornflower.tint40],\n ],\n '2': [\n ['#4C3867', '#674C8C'], // [orchid.shade30, orchid.shade20],\n ['#A083C9', '#B29AD4'], // [orchid.tint20, orchid.tint30],\n ],\n '3': [\n ['#02494C', '#038387'], // [teal.shade30, teal.primary],\n ['#4CB4B7', '#9BD9DB'], // [teal.tint30, teal.tint40],\n ],\n '4': [\n ['#63276D', '#863593'], // [lilac.shade30, lilac.shade20],\n ['#C36BD1', '#CF87DA'], // [lilac.tint20, lilac.tint30],\n ],\n '5': [\n ['#20547C', '#2C72A8'], // [lightBlue.shade30, lightBlue.shade20],\n ['#4FA1E1', '#83BDEB'], // [lightBlue.tint10, lightBlue.tint30],\n ],\n '6': [\n ['#0B5A08', '#0E7A0B'], // [lightGreen.shade30, lightGreen.shade20],\n ['#27AC22', '#5EC75A'], // [lightGreen.tint10, lightGreen.tint30],\n ],\n '7': [\n ['#AD006A', '#E3008C'], // [hotPink.shade20, hotPink.primary],\n ['#EE5FB7', '#F7ADDA'], // [hotPink.tint30, hotPink.tint40],\n ],\n '8': [\n ['#9A3D0C', '#CA5010'], // [pumpkin.shade20, pumpkin.primary],\n ['#D77440', '#DF8E64'], // [pumpkin.tint20, pumpkin.tint30],\n ],\n '9': [\n ['#405F14', '#57811B'], // [lime.shade30, lime.shade20],\n ['#73AA24', '#A4CC6C'], // [lime.primary, lime.tint30],\n ],\n '10': [\n ['#6D5700', '#937700'], // [gold.shade30, gold.shade20],\n ['#D0B232', '#DAC157'], // [gold.tint20, gold.tint30],\n ],\n};\n\nconst semanticGradientPalette: GradientPalette = {\n success: [\n ['#0C5E0C', '#107C10'], // [green.shade20, green.primary],\n ['#218C21', '#359B35'], // [green.tint10, green.tint20],\n ],\n highSuccess: [\n ['#107C10', '#359B35'], // [green.primary, green.tint20],\n ['#359B35', '#9FD89F'], // [green.tint20, green.tint40],\n ],\n warning: [\n ['#DE590B', '#F7630C'], // [orange.shade10, orange.primary],\n ['#DE590B', '#F87528'], // [orange.shade10, orange.tint10],\n ],\n error: [\n ['#B10E1C', '#CC2635'], // [cranberry.shade10, cranberry.tint10],\n ['#D33F4C', '#EEACB2'], // [cranberry.tint20, cranberry.tint40],\n ],\n highError: [\n ['#6E0811', '#B10E1C'], // [cranberry.shade30, cranberry.shade10],\n ['#D33F4C', '#DC626D'], // [cranberry.tint20, cranberry.tint30],\n ],\n disabled: [\n ['#E6E6E6', '#F0F0F0'],\n ['#E6E6E6', '#F0F0F0'],\n ],\n};\n\nconst Gradients: { [key: string]: GradientPalette } = {\n default: defaultGradientPalette, // base gradients\n semantic: semanticGradientPalette, // status gradients\n extended: extendedGradientPalette, // extended gradients\n};\n\nconst DEFAULT_COLORS = Object.values(defaultGradientPalette);\nconst TOKENS = Object.values(DataVizGradientPalette);\n\nconst getThemeSpecificGradient = (gradients: [string, string][], isDarkTheme: boolean): [string, string] => {\n if (gradients.length === 0) {\n return ['', ''];\n }\n\n const colorIdx = Number(isDarkTheme);\n\n if (colorIdx < gradients.length) {\n return gradients[colorIdx];\n }\n\n return gradients[0];\n};\n\nexport const getNextGradient = (index: number, offset: number = 0, isDarkTheme: boolean = false): [string, string] => {\n const gradients = DEFAULT_COLORS[(index + offset) % DEFAULT_COLORS.length];\n return getThemeSpecificGradient(gradients, isDarkTheme);\n};\n\nexport const getGradientFromToken = (token: string, isDarkTheme: boolean = false): [string, string] => {\n if (TOKENS.indexOf(token) >= 0) {\n const [paletteName, colorCode] = token.split('.');\n const colors = Gradients[paletteName][colorCode];\n\n return getThemeSpecificGradient(colors, isDarkTheme);\n }\n return [token, token];\n};\n"]}
1
+ {"version":3,"file":"gradients.js","sourceRoot":"../src/","sources":["utilities/gradients.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,sBAAsB,GAAG;IACpC,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,WAAW;IACtB,UAAU,EAAE,YAAY;IACxB,qBAAqB;IACrB,YAAY,EAAE,YAAY;IAC1B,YAAY,EAAE,YAAY;IAC1B,YAAY,EAAE,YAAY;IAC1B,YAAY,EAAE,YAAY;IAC1B,YAAY,EAAE,YAAY;IAC1B,YAAY,EAAE,YAAY;IAC1B,YAAY,EAAE,YAAY;IAC1B,YAAY,EAAE,YAAY;IAC1B,YAAY,EAAE,YAAY;IAC1B,aAAa,EAAE,aAAa;IAC5B,mBAAmB;IACnB,OAAO,EAAE,kBAAkB;IAC3B,WAAW,EAAE,sBAAsB;IACnC,OAAO,EAAE,kBAAkB;IAC3B,KAAK,EAAE,gBAAgB;IACvB,SAAS,EAAE,oBAAoB;IAC/B,QAAQ,EAAE,mBAAmB;CAC9B,CAAC;AAgBF,IAAM,sBAAsB,GAAoB;IAC9C,GAAG,EAAE;QACH,CAAC,SAA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K,GAAG,MAAM,CAAC,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IAC3E,OAAO,wBAAwB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;AAC1D,CAAC,CAAC;AAEF,MAAM,CAAC,IAAM,oBAAoB,GAAG,UAAC,KAAa,EAAE,WAA4B;IAA5B,4BAAA,EAAA,mBAA4B;IAC9E,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;QACxB,IAAA,KAA2B,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,EAA1C,WAAW,QAAA,EAAE,SAAS,QAAoB,CAAC;QAClD,IAAM,MAAM,GAAG,SAAS,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,CAAC;QAEjD,OAAO,wBAAwB,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;KACtD;IACD,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AACxB,CAAC,CAAC","sourcesContent":["export const DataVizGradientPalette = {\n gradient1: 'default.1',\n gradient2: 'default.2',\n gradient3: 'default.3',\n gradient4: 'default.4',\n gradient5: 'default.5',\n gradient6: 'default.6',\n gradient7: 'default.7',\n gradient8: 'default.8',\n gradient9: 'default.9',\n gradient10: 'default.10',\n // extended gradients\n gradient1Ext: 'extended.1',\n gradient2Ext: 'extended.2',\n gradient3Ext: 'extended.3',\n gradient4Ext: 'extended.4',\n gradient5Ext: 'extended.5',\n gradient6Ext: 'extended.6',\n gradient7Ext: 'extended.7',\n gradient8Ext: 'extended.8',\n gradient9Ext: 'extended.9',\n gradient10Ext: 'extended.10',\n // status gradients\n success: 'semantic.success',\n highSuccess: 'semantic.highSuccess',\n warning: 'semantic.warning',\n error: 'semantic.error',\n highError: 'semantic.highError',\n disabled: 'semantic.disabled',\n};\n\n/**\n * Key: Color code.\n * Value:\n *\n * Index 0 - Default gradient for light theme\n * ├── Index 0 - start color of gradient\n * └── Index 1 - end color of gradient\n *\n * Index 1 - gradient for dark theme\n * ├── Index 0 - start color of gradient\n * └── Index 1 - end color of gradient\n */\ntype GradientPalette = { [key: string]: [string, string][] };\n\nconst defaultGradientPalette: GradientPalette = {\n '1': [\n ['#4760D5', '#637CEF'], // [cornflower.shade10, cornflower.tint10],\n ['#4F6BED', '#637CEF'], // [cornflower.shade10, cornflower.tint10],\n ],\n '2': [\n ['#795AA6', '#9373C0'], // [orchid.shade20, orchid.tint10],\n ['#8764B8', '#A083C9'], // [orchid.primary, orchid.tint20],\n ],\n '3': [\n ['#159195', '#2AA0A4'], // [teal.tint10, teal.tint20],\n ['#159195', '#2AA0A4'], // [teal.tint10, teal.tint20],\n ],\n '4': [\n ['#B146C2', '#C36BD1'], // [lilac.primary, lilac.tint20],\n ['#B146C2', '#C36BD1'], // [lilac.primary, lilac.tint20],\n ],\n '5': [\n ['#3487C7', '#3A96DD'], // [lightBlue.shade10, lightBlue.primary],\n ['#3487C7', '#3A96DD'], // [lightBlue.shade20, lightBlue.primary],\n ],\n '6': [\n ['#0E7A0B', '#13A10E'], // [lightGreen.shade20, lightGreen.primary],\n ['#11910D', '#27AC22'], // [lightGreen.shade10, lightGreen.tint10],\n ],\n '7': [\n ['#E61C99', '#EE5FB7'], // [hotPink.tint10, hotPink.tint30],\n ['#E61C99', '#EE5FB7'], // [hotPink.tint10, hotPink.tint30],\n ],\n '8': [\n ['#CA5010', '#D77440'], // [pumpkin.primary, pumpkin.tint20],\n ['#CA5010', '#D77440'], // [pumpkin.primary, pumpkin.tint10],\n ],\n '9': [\n ['#57811B', '#689920'], // [lime.shade20, lime.shade10],\n ['#57811B', '#689920'], // [lime.shade20, lime.shade10],\n ],\n '10': [\n ['#937700', '#AE8C00'], // [gold.shade20, gold.shade10],\n ['#937700', '#AE8C00'], // [gold.shade20, gold.shade10],\n ],\n};\n\nconst extendedGradientPalette: GradientPalette = {\n '1': [\n ['#2C3C85', '#3C51B4'], // [cornflower.shade30, cornflower.shade20],\n ['#93A4F4', '#C8D1FA'], // [cornflower.tint30, cornflower.tint40],\n ],\n '2': [\n ['#4C3867', '#674C8C'], // [orchid.shade30, orchid.shade20],\n ['#A083C9', '#B29AD4'], // [orchid.tint20, orchid.tint30],\n ],\n '3': [\n ['#02494C', '#038387'], // [teal.shade30, teal.primary],\n ['#4CB4B7', '#9BD9DB'], // [teal.tint30, teal.tint40],\n ],\n '4': [\n ['#63276D', '#863593'], // [lilac.shade30, lilac.shade20],\n ['#C36BD1', '#CF87DA'], // [lilac.tint20, lilac.tint30],\n ],\n '5': [\n ['#20547C', '#2C72A8'], // [lightBlue.shade30, lightBlue.shade20],\n ['#4FA1E1', '#83BDEB'], // [lightBlue.tint10, lightBlue.tint30],\n ],\n '6': [\n ['#0B5A08', '#0E7A0B'], // [lightGreen.shade30, lightGreen.shade20],\n ['#27AC22', '#5EC75A'], // [lightGreen.tint10, lightGreen.tint30],\n ],\n '7': [\n ['#AD006A', '#E3008C'], // [hotPink.shade20, hotPink.primary],\n ['#EE5FB7', '#F7ADDA'], // [hotPink.tint30, hotPink.tint40],\n ],\n '8': [\n ['#9A3D0C', '#CA5010'], // [pumpkin.shade20, pumpkin.primary],\n ['#D77440', '#DF8E64'], // [pumpkin.tint20, pumpkin.tint30],\n ],\n '9': [\n ['#405F14', '#57811B'], // [lime.shade30, lime.shade20],\n ['#73AA24', '#A4CC6C'], // [lime.primary, lime.tint30],\n ],\n '10': [\n ['#6D5700', '#937700'], // [gold.shade30, gold.shade20],\n ['#D0B232', '#DAC157'], // [gold.tint20, gold.tint30],\n ],\n};\n\nconst semanticGradientPalette: GradientPalette = {\n success: [\n ['#0C5E0C', '#107C10'], // [green.shade20, green.primary],\n ['#218C21', '#359B35'], // [green.tint10, green.tint20],\n ],\n highSuccess: [\n ['#107C10', '#359B35'], // [green.primary, green.tint20],\n ['#359B35', '#9FD89F'], // [green.tint20, green.tint40],\n ],\n warning: [\n ['#DE590B', '#F7630C'], // [orange.shade10, orange.primary],\n ['#DE590B', '#F87528'], // [orange.shade10, orange.tint10],\n ],\n error: [\n ['#B10E1C', '#CC2635'], // [cranberry.shade10, cranberry.tint10],\n ['#D33F4C', '#EEACB2'], // [cranberry.tint20, cranberry.tint40],\n ],\n highError: [\n ['#6E0811', '#B10E1C'], // [cranberry.shade30, cranberry.shade10],\n ['#D33F4C', '#DC626D'], // [cranberry.tint20, cranberry.tint30],\n ],\n disabled: [\n ['#E6E6E6', '#E6E6E6'],\n ['#E6E6E6', '#E6E6E6'],\n ],\n};\n\nconst Gradients: { [key: string]: GradientPalette } = {\n default: defaultGradientPalette, // base gradients\n semantic: semanticGradientPalette, // status gradients\n extended: extendedGradientPalette, // extended gradients\n};\n\nconst DEFAULT_COLORS = Object.values(defaultGradientPalette);\nconst TOKENS = Object.values(DataVizGradientPalette);\n\nconst getThemeSpecificGradient = (gradients: [string, string][], isDarkTheme: boolean): [string, string] => {\n if (gradients.length === 0) {\n return ['', ''];\n }\n\n const colorIdx = Number(isDarkTheme);\n\n if (colorIdx < gradients.length) {\n return gradients[colorIdx];\n }\n\n return gradients[0];\n};\n\nexport const getNextGradient = (index: number, offset: number = 0, isDarkTheme: boolean = false): [string, string] => {\n const gradients = DEFAULT_COLORS[(index + offset) % DEFAULT_COLORS.length];\n return getThemeSpecificGradient(gradients, isDarkTheme);\n};\n\nexport const getGradientFromToken = (token: string, isDarkTheme: boolean = false): [string, string] => {\n if (TOKENS.indexOf(token) >= 0) {\n const [paletteName, colorCode] = token.split('.');\n const colors = Gradients[paletteName][colorCode];\n\n return getThemeSpecificGradient(colors, isDarkTheme);\n }\n return [token, token];\n};\n"]}
package/lib/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // Do not modify this file; it is generated as part of publish.
2
2
  // The checked in version is a placeholder only and will not be updated.
3
3
  import { setVersion } from '@fluentui/set-version';
4
- setVersion('@fluentui/react-charting', '5.22.1');
4
+ setVersion('@fluentui/react-charting', '5.22.2');
5
5
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"../src/","sources":["version.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,wEAAwE;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,UAAU,CAAC,0BAA0B,EAAE,QAAQ,CAAC,CAAC","sourcesContent":["// Do not modify this file; it is generated as part of publish.\n// The checked in version is a placeholder only and will not be updated.\nimport { setVersion } from '@fluentui/set-version';\nsetVersion('@fluentui/react-charting', '5.22.1');"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"../src/","sources":["version.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,wEAAwE;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,UAAU,CAAC,0BAA0B,EAAE,QAAQ,CAAC,CAAC","sourcesContent":["// Do not modify this file; it is generated as part of publish.\n// The checked in version is a placeholder only and will not be updated.\nimport { setVersion } from '@fluentui/set-version';\nsetVersion('@fluentui/react-charting', '5.22.2');"]}
@@ -53,34 +53,28 @@ define(["require", "exports", "tslib", "react", "d3-shape", "@fluentui/react/lib
53
53
  var _b, _c, _d, _e, _f;
54
54
  var arc = (_a = this.props, _a.arc), href = _a.href, focusedArcId = _a.focusedArcId;
55
55
  var getClassNames = (0, Utilities_1.classNamesFunction)();
56
- var classNames = getClassNames(Arc_styles_1.getStyles, {
57
- color: this.props.color,
58
- href: href,
59
- theme: this.props.theme,
60
- nextColor: this.props.nextColor,
61
- });
62
56
  var id = this.props.uniqText + this.props.data.data.legend.replace(/\s+/, '') + this.props.data.data.data;
63
57
  var opacity = this.props.activeArc === this.props.data.data.legend || this.props.activeArc === '' ? 1 : 0.1;
64
58
  var startAngle = (_c = (_b = this.props.data) === null || _b === void 0 ? void 0 : _b.startAngle) !== null && _c !== void 0 ? _c : 0;
65
59
  var endAngle = ((_e = (_d = this.props.data) === null || _d === void 0 ? void 0 : _d.endAngle) !== null && _e !== void 0 ? _e : 0) - startAngle;
66
60
  var cornerRadius = this.props.roundCorners ? 3 : 0;
61
+ var classNames = getClassNames(Arc_styles_1.getStyles, {
62
+ solidFill: this.props.enableGradient ? 'transparent' : this.props.color,
63
+ gradientFill: "conic-gradient(\n from ".concat(startAngle, "rad,\n ").concat(this.props.color, ",\n ").concat(this.props.nextColor, " ").concat(endAngle, "rad\n )"),
64
+ href: href,
65
+ theme: this.props.theme,
66
+ opacity: opacity,
67
+ });
67
68
  var clipId = (0, Utilities_1.getId)('Arc_clip') + "".concat(this.props.color, "_").concat(this.props.nextColor);
68
69
  return (React.createElement("g", { ref: this.currentRef },
69
70
  !!focusedArcId && focusedArcId === id && (React.createElement("path", { id: id + 'focusRing', d: arc.cornerRadius(cornerRadius)(this.props.focusData), className: classNames.focusRing })),
70
- React.createElement("path", { id: id, d: arc.cornerRadius(cornerRadius)(this.props.data), onFocus: this._onFocus.bind(this, this.props.data.data, id), className: classNames.root, fill: this.props.enableGradient ? 'transparent' : this.props.color, "data-is-focusable": this.props.activeArc === this.props.data.data.legend || this.props.activeArc === '', onMouseOver: this._hoverOn.bind(this, this.props.data.data), onMouseMove: this._hoverOn.bind(this, this.props.data.data), onMouseLeave: this._hoverOff, onBlur: this._onBlur, opacity: opacity, onClick: href ? this._redirectToUrl.bind(this, href) : (_f = this.props.data) === null || _f === void 0 ? void 0 : _f.data.onClick, "aria-label": this._getAriaLabel(), role: "img" }),
71
+ React.createElement("path", { id: id, d: arc.cornerRadius(cornerRadius)(this.props.data), onFocus: this._onFocus.bind(this, this.props.data.data, id), className: classNames.root, "data-is-focusable": this.props.activeArc === this.props.data.data.legend || this.props.activeArc === '', onMouseOver: this._hoverOn.bind(this, this.props.data.data), onMouseMove: this._hoverOn.bind(this, this.props.data.data), onMouseLeave: this._hoverOff, onBlur: this._onBlur, onClick: href ? this._redirectToUrl.bind(this, href) : (_f = this.props.data) === null || _f === void 0 ? void 0 : _f.data.onClick, "aria-label": this._getAriaLabel(), role: "img" }),
71
72
  this._renderArcLabel(classNames.arcLabel),
72
73
  this.props.enableGradient && (React.createElement(React.Fragment, null,
73
74
  React.createElement("clipPath", { id: clipId },
74
75
  React.createElement("path", { d: arc.cornerRadius(cornerRadius)(this.props.data) })),
75
76
  React.createElement("foreignObject", { x: "-50%", y: "-50%", width: "100%", height: "100%", clipPath: "url(#".concat(clipId, ")") },
76
- React.createElement("div", { style: {
77
- width: '100%',
78
- height: '100%',
79
- background: this.props.enableGradient
80
- ? "conic-gradient(\n from ".concat(startAngle, "rad,\n ").concat(this.props.color, ",\n ").concat(this.props.nextColor, " ").concat(endAngle, "rad\n )")
81
- : this.props.color,
82
- opacity: opacity,
83
- } }))))));
77
+ React.createElement("div", { className: classNames.gradientArc }))))));
84
78
  };
85
79
  Arc.prototype._onFocus = function (data, id) {
86
80
  this.props.onFocusCallback(data, id, this.currentRef.current);
@@ -1 +1 @@
1
- {"version":3,"file":"Arc.js","sourceRoot":"../src/","sources":["components/DonutChart/Arc/Arc.tsx"],"names":[],"mappings":";;;;IAaA;QAAyB,+BAAqC;QAA9D;YAAA,qEAyJC;YApJQ,WAAK,GAAO,EAAE,CAAC;YAEd,gBAAU,GAAG,KAAK,CAAC,SAAS,EAAkB,CAAC;YAC/C,YAAM,GAAY,IAAA,kBAAM,GAAE,CAAC;YA8F3B,eAAS,GAAG;gBAClB,KAAI,CAAC,KAAK,CAAC,kBAAmB,EAAE,CAAC;YACnC,CAAC,CAAC;YAEM,aAAO,GAAG;gBAChB,KAAI,CAAC,KAAK,CAAC,cAAe,EAAE,CAAC;YAC/B,CAAC,CAAC;YAMM,mBAAa,GAAG;;gBACtB,IAAM,KAAK,GAAG,KAAI,CAAC,KAAK,CAAC,IAAK,CAAC,IAAI,CAAC;gBACpC,IAAM,MAAM,GAAG,KAAK,CAAC,gBAAgB,IAAI,KAAK,CAAC,MAAM,CAAC;gBACtD,IAAM,MAAM,GAAG,KAAK,CAAC,gBAAgB,IAAI,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC;gBACzD,OAAO,CAAA,MAAA,KAAK,CAAC,wBAAwB,0CAAE,SAAS,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Ga,gBAAY,GAAuB;YAC/C,GAAG,EAAE,IAAA,cAAK,GAAE;SACb,AAFyB,CAExB;QAsJJ,UAAC;KAAA,AAzJD,CAAyB,KAAK,CAAC,SAAS,GAyJvC;IAED,SAAS,YAAY,CAAC,QAAmB;QACvC,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QAC/C,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IACjD,CAAC","sourcesContent":["import * as React from 'react';\nimport { arc as d3Arc } from 'd3-shape';\nimport { classNamesFunction, getId, getRTL } from '@fluentui/react/lib/Utilities';\nimport { getStyles } from './Arc.styles';\nimport { IChartDataPoint } from '../index';\nimport { IArcProps, IArcStyles } from './index';\nimport { format as d3Format } from 'd3-format';\nimport { formatValueWithSIPrefix } from '../../../utilities/index';\n\nexport interface IArcState {\n isCalloutVisible?: boolean;\n}\n\nexport class Arc extends React.Component<IArcProps, IArcState> {\n public static defaultProps: Partial<IArcProps> = {\n arc: d3Arc(),\n };\n\n public state: {} = {};\n\n private currentRef = React.createRef<SVGPathElement>();\n private _isRTL: boolean = getRTL();\n\n public static getDerivedStateFromProps(nextProps: Readonly<IArcProps>): Partial<IArcState> | null {\n _updateChart(nextProps);\n return null;\n }\n\n public updateChart(newProps: IArcProps): void {\n _updateChart(newProps);\n }\n\n public render(): JSX.Element {\n const { arc, href, focusedArcId } = this.props;\n const getClassNames = classNamesFunction<IArcProps, IArcStyles>();\n const classNames = getClassNames(getStyles, {\n color: this.props.color,\n href: href!,\n theme: this.props.theme!,\n nextColor: this.props.nextColor,\n });\n const id = this.props.uniqText! + this.props.data!.data.legend!.replace(/\\s+/, '') + this.props.data!.data.data;\n const opacity: number =\n this.props.activeArc === this.props.data!.data.legend || this.props.activeArc === '' ? 1 : 0.1;\n\n const startAngle = this.props.data?.startAngle ?? 0;\n const endAngle = (this.props.data?.endAngle ?? 0) - startAngle;\n const cornerRadius = this.props.roundCorners ? 3 : 0;\n\n const clipId = getId('Arc_clip') + `${this.props.color}_${this.props.nextColor}`;\n\n return (\n <g ref={this.currentRef}>\n {!!focusedArcId && focusedArcId === id && (\n <path\n id={id + 'focusRing'}\n d={arc.cornerRadius(cornerRadius)(this.props.focusData)}\n className={classNames.focusRing}\n />\n )}\n\n <path\n id={id}\n d={arc.cornerRadius(cornerRadius)(this.props.data)}\n onFocus={this._onFocus.bind(this, this.props.data!.data, id)}\n className={classNames.root}\n fill={this.props.enableGradient ? 'transparent' : this.props.color}\n data-is-focusable={this.props.activeArc === this.props.data!.data.legend || this.props.activeArc === ''}\n onMouseOver={this._hoverOn.bind(this, this.props.data!.data)}\n onMouseMove={this._hoverOn.bind(this, this.props.data!.data)}\n onMouseLeave={this._hoverOff}\n onBlur={this._onBlur}\n opacity={opacity}\n onClick={href ? this._redirectToUrl.bind(this, href) : this.props.data?.data.onClick}\n aria-label={this._getAriaLabel()}\n role=\"img\"\n />\n {this._renderArcLabel(classNames.arcLabel)}\n\n {this.props.enableGradient && (\n <>\n <clipPath id={clipId}>\n <path d={arc.cornerRadius(cornerRadius)(this.props.data)} />\n </clipPath>\n <foreignObject x=\"-50%\" y=\"-50%\" width=\"100%\" height=\"100%\" clipPath={`url(#${clipId})`}>\n <div\n style={{\n width: '100%',\n height: '100%',\n background: this.props.enableGradient\n ? `conic-gradient(\n from ${startAngle}rad,\n ${this.props.color},\n ${this.props.nextColor} ${endAngle}rad\n )`\n : this.props.color,\n opacity,\n }}\n />\n </foreignObject>\n </>\n )}\n </g>\n );\n }\n\n private _onFocus(data: IChartDataPoint, id: string): void {\n this.props.onFocusCallback!(data, id, this.currentRef.current);\n }\n\n private _hoverOn(data: IChartDataPoint, mouseEvent: React.MouseEvent<SVGPathElement>): void {\n mouseEvent.persist();\n this.props.hoverOnCallback!(data, mouseEvent);\n }\n\n private _hoverOff = (): void => {\n this.props.hoverLeaveCallback!();\n };\n\n private _onBlur = (): void => {\n this.props.onBlurCallback!();\n };\n\n private _redirectToUrl(href: string | undefined): void {\n href ? (window.location.href = href) : '';\n }\n\n private _getAriaLabel = (): string => {\n const point = this.props.data!.data;\n const legend = point.xAxisCalloutData || point.legend;\n const yValue = point.yAxisCalloutData || point.data || 0;\n return point.callOutAccessibilityData?.ariaLabel || (legend ? `${legend}, ` : '') + `${yValue}.`;\n };\n\n private _renderArcLabel = (className: string) => {\n const { arc, data, innerRadius, outerRadius, showLabelsInPercent, totalValue, hideLabels, activeArc } = this.props;\n\n if (\n hideLabels ||\n Math.abs(data!.endAngle - data!.startAngle) < Math.PI / 12 ||\n (activeArc !== data!.data.legend && activeArc !== '')\n ) {\n return null;\n }\n\n const [base, perp] = arc.centroid(data);\n const hyp = Math.sqrt(base * base + perp * perp);\n const labelRadius = Math.max(innerRadius!, outerRadius!) + 2;\n const angle = (data!.startAngle + data!.endAngle) / 2;\n const arcValue = data!.value;\n\n return (\n <text\n x={(hyp === 0 ? 0 : base / hyp) * labelRadius}\n y={(hyp === 0 ? 0 : perp / hyp) * labelRadius}\n textAnchor={angle > Math.PI !== this._isRTL ? 'end' : 'start'}\n dominantBaseline={angle > Math.PI / 2 && angle < (3 * Math.PI) / 2 ? 'hanging' : 'auto'}\n className={className}\n aria-hidden={true}\n >\n {showLabelsInPercent\n ? d3Format('.0%')(totalValue! === 0 ? 0 : arcValue / totalValue!)\n : formatValueWithSIPrefix(arcValue)}\n </text>\n );\n };\n}\n\nfunction _updateChart(newProps: IArcProps): void {\n newProps.arc.innerRadius(newProps.innerRadius);\n newProps.arc.outerRadius(newProps.outerRadius);\n}\n"]}
1
+ {"version":3,"file":"Arc.js","sourceRoot":"../src/","sources":["components/DonutChart/Arc/Arc.tsx"],"names":[],"mappings":";;;;IAaA;QAAyB,+BAAqC;QAA9D;YAAA,qEAgJC;YA3IQ,WAAK,GAAO,EAAE,CAAC;YAEd,gBAAU,GAAG,KAAK,CAAC,SAAS,EAAkB,CAAC;YAC/C,YAAM,GAAY,IAAA,kBA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;YACrB,IAAI,CAAC,KAAK,CAAC,eAAgB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QAChD,CAAC;QAUO,4BAAc,GAAtB,UAAuB,IAAwB;YAC7C,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5C,CAAC;QAtGa,gBAAY,GAAuB;YAC/C,GAAG,EAAE,IAAA,cAAK,GAAE;SACb,AAFyB,CAExB;QA6IJ,UAAC;KAAA,AAhJD,CAAyB,KAAK,CAAC,SAAS,GAgJvC;IAED,SAAS,YAAY,CAAC,QAAmB;QACvC,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QAC/C,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IACjD,CAAC","sourcesContent":["import * as React from 'react';\nimport { arc as d3Arc } from 'd3-shape';\nimport { classNamesFunction, getId, getRTL } from '@fluentui/react/lib/Utilities';\nimport { getStyles } from './Arc.styles';\nimport { IChartDataPoint } from '../index';\nimport { IArcProps, IArcStyleProps, IArcStyles } from './index';\nimport { format as d3Format } from 'd3-format';\nimport { formatValueWithSIPrefix } from '../../../utilities/index';\n\nexport interface IArcState {\n isCalloutVisible?: boolean;\n}\n\nexport class Arc extends React.Component<IArcProps, IArcState> {\n public static defaultProps: Partial<IArcProps> = {\n arc: d3Arc(),\n };\n\n public state: {} = {};\n\n private currentRef = React.createRef<SVGPathElement>();\n private _isRTL: boolean = getRTL();\n\n public static getDerivedStateFromProps(nextProps: Readonly<IArcProps>): Partial<IArcState> | null {\n _updateChart(nextProps);\n return null;\n }\n\n public updateChart(newProps: IArcProps): void {\n _updateChart(newProps);\n }\n\n public render(): JSX.Element {\n const { arc, href, focusedArcId } = this.props;\n const getClassNames = classNamesFunction<IArcStyleProps, IArcStyles>();\n const id = this.props.uniqText! + this.props.data!.data.legend!.replace(/\\s+/, '') + this.props.data!.data.data;\n const opacity: number =\n this.props.activeArc === this.props.data!.data.legend || this.props.activeArc === '' ? 1 : 0.1;\n\n const startAngle = this.props.data?.startAngle ?? 0;\n const endAngle = (this.props.data?.endAngle ?? 0) - startAngle;\n const cornerRadius = this.props.roundCorners ? 3 : 0;\n\n const classNames = getClassNames(getStyles, {\n solidFill: this.props.enableGradient ? 'transparent' : this.props.color,\n gradientFill: `conic-gradient(\n from ${startAngle}rad,\n ${this.props.color},\n ${this.props.nextColor} ${endAngle}rad\n )`,\n href: href!,\n theme: this.props.theme!,\n opacity,\n });\n\n const clipId = getId('Arc_clip') + `${this.props.color}_${this.props.nextColor}`;\n\n return (\n <g ref={this.currentRef}>\n {!!focusedArcId && focusedArcId === id && (\n <path\n id={id + 'focusRing'}\n d={arc.cornerRadius(cornerRadius)(this.props.focusData)}\n className={classNames.focusRing}\n />\n )}\n\n <path\n id={id}\n d={arc.cornerRadius(cornerRadius)(this.props.data)}\n onFocus={this._onFocus.bind(this, this.props.data!.data, id)}\n className={classNames.root}\n data-is-focusable={this.props.activeArc === this.props.data!.data.legend || this.props.activeArc === ''}\n onMouseOver={this._hoverOn.bind(this, this.props.data!.data)}\n onMouseMove={this._hoverOn.bind(this, this.props.data!.data)}\n onMouseLeave={this._hoverOff}\n onBlur={this._onBlur}\n onClick={href ? this._redirectToUrl.bind(this, href) : this.props.data?.data.onClick}\n aria-label={this._getAriaLabel()}\n role=\"img\"\n />\n {this._renderArcLabel(classNames.arcLabel)}\n\n {this.props.enableGradient && (\n <>\n <clipPath id={clipId}>\n <path d={arc.cornerRadius(cornerRadius)(this.props.data)} />\n </clipPath>\n <foreignObject x=\"-50%\" y=\"-50%\" width=\"100%\" height=\"100%\" clipPath={`url(#${clipId})`}>\n <div className={classNames.gradientArc} />\n </foreignObject>\n </>\n )}\n </g>\n );\n }\n\n private _onFocus(data: IChartDataPoint, id: string): void {\n this.props.onFocusCallback!(data, id, this.currentRef.current);\n }\n\n private _hoverOn(data: IChartDataPoint, mouseEvent: React.MouseEvent<SVGPathElement>): void {\n mouseEvent.persist();\n this.props.hoverOnCallback!(data, mouseEvent);\n }\n\n private _hoverOff = (): void => {\n this.props.hoverLeaveCallback!();\n };\n\n private _onBlur = (): void => {\n this.props.onBlurCallback!();\n };\n\n private _redirectToUrl(href: string | undefined): void {\n href ? (window.location.href = href) : '';\n }\n\n private _getAriaLabel = (): string => {\n const point = this.props.data!.data;\n const legend = point.xAxisCalloutData || point.legend;\n const yValue = point.yAxisCalloutData || point.data || 0;\n return point.callOutAccessibilityData?.ariaLabel || (legend ? `${legend}, ` : '') + `${yValue}.`;\n };\n\n private _renderArcLabel = (className: string) => {\n const { arc, data, innerRadius, outerRadius, showLabelsInPercent, totalValue, hideLabels, activeArc } = this.props;\n\n if (\n hideLabels ||\n Math.abs(data!.endAngle - data!.startAngle) < Math.PI / 12 ||\n (activeArc !== data!.data.legend && activeArc !== '')\n ) {\n return null;\n }\n\n const [base, perp] = arc.centroid(data);\n const hyp = Math.sqrt(base * base + perp * perp);\n const labelRadius = Math.max(innerRadius!, outerRadius!) + 2;\n const angle = (data!.startAngle + data!.endAngle) / 2;\n const arcValue = data!.value;\n\n return (\n <text\n x={(hyp === 0 ? 0 : base / hyp) * labelRadius}\n y={(hyp === 0 ? 0 : perp / hyp) * labelRadius}\n textAnchor={angle > Math.PI !== this._isRTL ? 'end' : 'start'}\n dominantBaseline={angle > Math.PI / 2 && angle < (3 * Math.PI) / 2 ? 'hanging' : 'auto'}\n className={className}\n aria-hidden={true}\n >\n {showLabelsInPercent\n ? d3Format('.0%')(totalValue! === 0 ? 0 : arcValue / totalValue!)\n : formatValueWithSIPrefix(arcValue)}\n </text>\n );\n };\n}\n\nfunction _updateChart(newProps: IArcProps): void {\n newProps.arc.innerRadius(newProps.innerRadius);\n newProps.arc.outerRadius(newProps.outerRadius);\n}\n"]}
@@ -1,2 +1,2 @@
1
- import { IArcProps, IArcStyles } from './Arc.types';
2
- export declare const getStyles: (props: IArcProps) => IArcStyles;
1
+ import { IArcStyleProps, IArcStyles } from './Arc.types';
2
+ export declare const getStyles: (props: IArcStyleProps) => IArcStyles;
@@ -3,10 +3,10 @@ define(["require", "exports", "@fluentui/react/lib/Styling"], function (require,
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.getStyles = void 0;
5
5
  var getStyles = function (props) {
6
- var color = props.color, href = props.href, theme = props.theme;
6
+ var solidFill = props.solidFill, gradientFill = props.gradientFill, href = props.href, theme = props.theme, opacity = props.opacity;
7
7
  return {
8
8
  root: {
9
- fill: color,
9
+ fill: solidFill,
10
10
  cursor: href ? 'pointer' : 'default',
11
11
  stroke: theme.semanticColors.bodyBackground,
12
12
  outline: 'transparent',
@@ -15,6 +15,13 @@ define(["require", "exports", "@fluentui/react/lib/Styling"], function (require,
15
15
  border: '0',
16
16
  },
17
17
  },
18
+ opacity: opacity,
19
+ },
20
+ gradientArc: {
21
+ width: '100%',
22
+ height: '100%',
23
+ background: gradientFill,
24
+ opacity: opacity,
18
25
  },
19
26
  focusRing: {
20
27
  stroke: theme.semanticColors.focusBorder,
@@ -1 +1 @@
1
- {"version":3,"file":"Arc.styles.js","sourceRoot":"../src/","sources":["components/DonutChart/Arc/Arc.styles.ts"],"names":[],"mappings":";;;;IAGO,IAAM,SAAS,GAAG,UAAC,KAAgB;QAChC,IAAA,KAAK,GAAkB,KAAK,MAAvB,EAAE,IAAI,GAAY,KAAK,KAAjB,EAAE,KAAK,GAAK,KAAK,MAAV,CAAW;QACrC,OAAO;YACL,IAAI,EAAE;gBACJ,IAAI,EAAE,KAAK;gBACX,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;gBACpC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,cAAc;gBAC3C,OAAO,EAAE,aAAa;gBACtB,SAAS,EAAE;oBACT,oBAAoB,EAAE;wBACpB,MAAM,EAAE,GAAG;qBACZ;iBACF;aACF;YACD,SAAS,EAAE;gBACT,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,WAAW;gBACxC,WAAW,EAAE,CAAC;gBACd,IAAI,EAAE,aAAa;aACpB;YACD,QAAQ,EAAE;gBACR,QAAQ,EAAE,mBAAS,CAAC,KAAK;gBACzB,UAAU,EAAE,qBAAW,CAAC,QAAQ;gBAChC,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,cAAc;aACnC;SACF,CAAC;IACJ,CAAC,CAAC;IAzBW,QAAA,SAAS,aAyBpB","sourcesContent":["import { IArcProps, IArcStyles } from './Arc.types';\nimport { FontSizes, FontWeights } from '@fluentui/react/lib/Styling';\n\nexport const getStyles = (props: IArcProps): IArcStyles => {\n const { color, href, theme } = props;\n return {\n root: {\n fill: color,\n cursor: href ? 'pointer' : 'default',\n stroke: theme.semanticColors.bodyBackground,\n outline: 'transparent',\n selectors: {\n '::-moz-focus-inner': {\n border: '0',\n },\n },\n },\n focusRing: {\n stroke: theme.semanticColors.focusBorder,\n strokeWidth: 4,\n fill: 'transparent',\n },\n arcLabel: {\n fontSize: FontSizes.small,\n fontWeight: FontWeights.semibold,\n fill: theme.palette.neutralPrimary,\n },\n };\n};\n"]}
1
+ {"version":3,"file":"Arc.styles.js","sourceRoot":"../src/","sources":["components/DonutChart/Arc/Arc.styles.ts"],"names":[],"mappings":";;;;IAGO,IAAM,SAAS,GAAG,UAAC,KAAqB;QACrC,IAAA,SAAS,GAAyC,KAAK,UAA9C,EAAE,YAAY,GAA2B,KAAK,aAAhC,EAAE,IAAI,GAAqB,KAAK,KAA1B,EAAE,KAAK,GAAc,KAAK,MAAnB,EAAE,OAAO,GAAK,KAAK,QAAV,CAAW;QAChE,OAAO;YACL,IAAI,EAAE;gBACJ,IAAI,EAAE,SAAS;gBACf,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;gBACpC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,cAAc;gBAC3C,OAAO,EAAE,aAAa;gBACtB,SAAS,EAAE;oBACT,oBAAoB,EAAE;wBACpB,MAAM,EAAE,GAAG;qBACZ;iBACF;gBACD,OAAO,SAAA;aACR;YACD,WAAW,EAAE;gBACX,KAAK,EAAE,MAAM;gBACb,MAAM,EAAE,MAAM;gBACd,UAAU,EAAE,YAAY;gBACxB,OAAO,SAAA;aACR;YACD,SAAS,EAAE;gBACT,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,WAAW;gBACxC,WAAW,EAAE,CAAC;gBACd,IAAI,EAAE,aAAa;aACpB;YACD,QAAQ,EAAE;gBACR,QAAQ,EAAE,mBAAS,CAAC,KAAK;gBACzB,UAAU,EAAE,qBAAW,CAAC,QAAQ;gBAChC,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,cAAc;aACnC;SACF,CAAC;IACJ,CAAC,CAAC;IAhCW,QAAA,SAAS,aAgCpB","sourcesContent":["import { IArcStyleProps, IArcStyles } from './Arc.types';\nimport { FontSizes, FontWeights } from '@fluentui/react/lib/Styling';\n\nexport const getStyles = (props: IArcStyleProps): IArcStyles => {\n const { solidFill, gradientFill, href, theme, opacity } = props;\n return {\n root: {\n fill: solidFill,\n cursor: href ? 'pointer' : 'default',\n stroke: theme.semanticColors.bodyBackground,\n outline: 'transparent',\n selectors: {\n '::-moz-focus-inner': {\n border: '0',\n },\n },\n opacity,\n },\n gradientArc: {\n width: '100%',\n height: '100%',\n background: gradientFill,\n opacity,\n },\n focusRing: {\n stroke: theme.semanticColors.focusBorder,\n strokeWidth: 4,\n fill: 'transparent',\n },\n arcLabel: {\n fontSize: FontSizes.small,\n fontWeight: FontWeights.semibold,\n fill: theme.palette.neutralPrimary,\n },\n };\n};\n"]}
@@ -123,11 +123,37 @@ export interface IArcData {
123
123
  */
124
124
  value: number;
125
125
  }
126
+ export interface IArcStyleProps {
127
+ /**
128
+ * Theme
129
+ */
130
+ theme: ITheme;
131
+ /**
132
+ * internal prop for href
133
+ */
134
+ href: string;
135
+ /**
136
+ * solid color for the arc (when enableGradient is false)
137
+ */
138
+ solidFill: string;
139
+ /**
140
+ * gradient for the arc (when enableGradient is true)
141
+ */
142
+ gradientFill: string;
143
+ /**
144
+ * wether gradients are enabled for the arc
145
+ */
146
+ opacity: number;
147
+ }
126
148
  export interface IArcStyles {
127
149
  /**
128
150
  * Style set for the card header component root
129
151
  */
130
152
  root: IStyle;
153
+ /**
154
+ * Style set for the gradient arc
155
+ */
156
+ gradientArc: IStyle;
131
157
  /**
132
158
  * styles for the focus
133
159
  */
@@ -1 +1 @@
1
- {"version":3,"file":"Arc.types.js","sourceRoot":"../src/","sources":["components/DonutChart/Arc/Arc.types.ts"],"names":[],"mappings":"","sourcesContent":["import { IStyle, ITheme } from '@fluentui/react/lib/Styling';\nimport { IChartDataPoint } from '../index';\nexport interface IArcProps {\n /**\n * Theme\n */\n theme: ITheme;\n /**\n * Data to render in the Arc.\n */\n data?: IArcData;\n\n /**\n * Data to render focused Arc\n */\n focusData?: IArcData;\n\n /**\n * id of the focused arc\n */\n focusedArcId?: string;\n /**\n * shape for Arc.\n */\n /* eslint-disable @typescript-eslint/no-explicit-any */\n arc?: any;\n\n /**\n * innerRadius of the Arc.\n */\n innerRadius?: number;\n\n /**\n * outerRadius of the Arc.\n */\n outerRadius?: number;\n\n /**\n * Color for the Arc.\n */\n color: string;\n\n /**\n * Defines the function that is executed upon hovering over the legend\n */\n hoverOnCallback?: Function;\n\n /**\n * Defines the function that is executed upon hovering over the legend\n */\n onFocusCallback?: Function;\n\n /**\n * Defines the function that is executed upon hovering Leave the legend\n */\n onBlurCallback?: Function;\n\n /**\n * Defines the function that is executed upon hovering Leave the legend\n */\n hoverLeaveCallback?: Function;\n\n /**\n * Uniq string for chart\n */\n uniqText?: string;\n\n /**\n * string for callout id\n */\n calloutId?: string;\n\n /**\n * Active Arc for chart\n */\n activeArc?: string;\n\n /**\n * internal prop for href\n */\n href?: string;\n\n /**\n * props for inside donut value\n */\n valueInsideDonut?: string | number;\n\n /**\n * Prop to show the arc labels in percentage format\n */\n showLabelsInPercent?: boolean;\n\n /**\n * Prop used to define the sum of all arc values\n */\n totalValue?: number;\n\n /**\n * Prop to hide the arc labels\n */\n hideLabels?: boolean;\n\n /**\n * Prop to enable the gradient in the arc\n * @default false\n */\n enableGradient?: boolean;\n\n /**\n * Prop to enable the round corners in the chart\n * @default false\n */\n roundCorners?: boolean;\n\n /**\n * Next color stop for the gradient\n * [Only used when enableGradient is True].\n */\n nextColor: string;\n}\n\nexport interface IArcData {\n /**\n * Data to render in the chart for individual arc.\n */\n data: IChartDataPoint;\n /**\n * endAngle of the Arc\n */\n endAngle: number;\n /**\n * index of the Arc\n */\n index: number;\n /**\n * padAngle of the Arc\n */\n padAngle: number;\n /**\n * startAngle of the Arc\n */\n startAngle: number;\n /**\n * value of the Arc\n */\n value: number;\n}\n\nexport interface IArcStyles {\n /**\n * Style set for the card header component root\n */\n root: IStyle;\n\n /**\n * styles for the focus\n */\n focusRing: IStyle;\n\n /**\n * Style for the arc labels\n */\n arcLabel: IStyle;\n}\n"]}
1
+ {"version":3,"file":"Arc.types.js","sourceRoot":"../src/","sources":["components/DonutChart/Arc/Arc.types.ts"],"names":[],"mappings":"","sourcesContent":["import { IStyle, ITheme } from '@fluentui/react/lib/Styling';\nimport { IChartDataPoint } from '../index';\nexport interface IArcProps {\n /**\n * Theme\n */\n theme: ITheme;\n /**\n * Data to render in the Arc.\n */\n data?: IArcData;\n\n /**\n * Data to render focused Arc\n */\n focusData?: IArcData;\n\n /**\n * id of the focused arc\n */\n focusedArcId?: string;\n /**\n * shape for Arc.\n */\n /* eslint-disable @typescript-eslint/no-explicit-any */\n arc?: any;\n\n /**\n * innerRadius of the Arc.\n */\n innerRadius?: number;\n\n /**\n * outerRadius of the Arc.\n */\n outerRadius?: number;\n\n /**\n * Color for the Arc.\n */\n color: string;\n\n /**\n * Defines the function that is executed upon hovering over the legend\n */\n hoverOnCallback?: Function;\n\n /**\n * Defines the function that is executed upon hovering over the legend\n */\n onFocusCallback?: Function;\n\n /**\n * Defines the function that is executed upon hovering Leave the legend\n */\n onBlurCallback?: Function;\n\n /**\n * Defines the function that is executed upon hovering Leave the legend\n */\n hoverLeaveCallback?: Function;\n\n /**\n * Uniq string for chart\n */\n uniqText?: string;\n\n /**\n * string for callout id\n */\n calloutId?: string;\n\n /**\n * Active Arc for chart\n */\n activeArc?: string;\n\n /**\n * internal prop for href\n */\n href?: string;\n\n /**\n * props for inside donut value\n */\n valueInsideDonut?: string | number;\n\n /**\n * Prop to show the arc labels in percentage format\n */\n showLabelsInPercent?: boolean;\n\n /**\n * Prop used to define the sum of all arc values\n */\n totalValue?: number;\n\n /**\n * Prop to hide the arc labels\n */\n hideLabels?: boolean;\n\n /**\n * Prop to enable the gradient in the arc\n * @default false\n */\n enableGradient?: boolean;\n\n /**\n * Prop to enable the round corners in the chart\n * @default false\n */\n roundCorners?: boolean;\n\n /**\n * Next color stop for the gradient\n * [Only used when enableGradient is True].\n */\n nextColor: string;\n}\n\nexport interface IArcData {\n /**\n * Data to render in the chart for individual arc.\n */\n data: IChartDataPoint;\n /**\n * endAngle of the Arc\n */\n endAngle: number;\n /**\n * index of the Arc\n */\n index: number;\n /**\n * padAngle of the Arc\n */\n padAngle: number;\n /**\n * startAngle of the Arc\n */\n startAngle: number;\n /**\n * value of the Arc\n */\n value: number;\n}\n\nexport interface IArcStyleProps {\n /**\n * Theme\n */\n theme: ITheme;\n\n /**\n * internal prop for href\n */\n href: string;\n\n /**\n * solid color for the arc (when enableGradient is false)\n */\n solidFill: string;\n\n /**\n * gradient for the arc (when enableGradient is true)\n */\n gradientFill: string;\n\n /**\n * wether gradients are enabled for the arc\n */\n opacity: number;\n}\n\nexport interface IArcStyles {\n /**\n * Style set for the card header component root\n */\n root: IStyle;\n\n /**\n * Style set for the gradient arc\n */\n gradientArc: IStyle;\n\n /**\n * styles for the focus\n */\n focusRing: IStyle;\n\n /**\n * Style for the arc labels\n */\n arcLabel: IStyle;\n}\n"]}
@@ -338,22 +338,22 @@ define(["require", "exports", "tslib", "react", "d3-shape", "@fluentui/react/lib
338
338
  React.createElement("text", { x: (this._isRTL ? 1 : -1) * (this._outerRadius + LABEL_OFFSET), y: 0, textAnchor: "end", className: this._classNames.limits, role: "img", "aria-label": "Min value: ".concat(this._minValue) }, (0, index_1.formatValueWithSIPrefix)(this._minValue)),
339
339
  React.createElement("text", { x: (this._isRTL ? -1 : 1) * (this._outerRadius + LABEL_OFFSET), y: 0, textAnchor: "start", className: this._classNames.limits, role: "img", "aria-label": "Max value: ".concat(this._maxValue) }, (0, index_1.formatValueWithSIPrefix)(this._maxValue)))),
340
340
  arcs.map(function (arc, index) {
341
+ var _a, _b;
341
342
  var segment = _this._segments[arc.segmentIndex];
342
343
  var clipId = (0, Utilities_1.getId)('Arc_clip') + "".concat(index, "_").concat(arc.startAngle, "_").concat(arc.endAngle);
344
+ var arcClassNames = getClassNames(_this.props.styles, {
345
+ theme: _this.props.theme,
346
+ solidFill: _this.props.enableGradient ? 'transparent' : segment.color,
347
+ gradientFill: "conic-gradient(\n from ".concat(arc.startAngle, "rad at 50% 100%,\n ").concat((_a = segment.gradient) === null || _a === void 0 ? void 0 : _a[0], ",\n ").concat((_b = segment.gradient) === null || _b === void 0 ? void 0 : _b[1], " ").concat(arc.endAngle - arc.startAngle, "rad\n )"),
348
+ opacity: _this._legendHighlighted(segment.legend) || _this._noLegendHighlighted() ? 1 : 0.1,
349
+ });
343
350
  return (React.createElement(React.Fragment, { key: index },
344
- React.createElement("path", tslib_1.__assign({ d: arc.d, fill: _this.props.enableGradient ? 'transparent' : segment.color, fillOpacity: _this._legendHighlighted(segment.legend) || _this._noLegendHighlighted() ? 1 : 0.1, strokeWidth: _this.state.focusedElement === segment.legend ? exports.ARC_PADDING : 0, className: _this._classNames.segment }, (0, index_1.getAccessibleDataObject)(tslib_1.__assign({ ariaLabel: (0, exports.getSegmentLabel)(segment, _this._minValue, _this._maxValue, _this.props.variant, true) }, segment.accessibilityData), 'img', true), { onFocus: function (e) { return _this._handleFocus(e, segment.legend); }, onBlur: _this._handleBlur, onMouseEnter: function (e) { return _this._handleMouseOver(e, segment.legend); }, onMouseMove: function (e) { return _this._handleMouseOver(e, segment.legend); }, "data-is-focusable": _this._legendHighlighted(segment.legend) || _this._noLegendHighlighted() })),
351
+ React.createElement("path", tslib_1.__assign({ d: arc.d, strokeWidth: _this.state.focusedElement === segment.legend ? exports.ARC_PADDING : 0, className: arcClassNames.segment }, (0, index_1.getAccessibleDataObject)(tslib_1.__assign({ ariaLabel: (0, exports.getSegmentLabel)(segment, _this._minValue, _this._maxValue, _this.props.variant, true) }, segment.accessibilityData), 'img', true), { onFocus: function (e) { return _this._handleFocus(e, segment.legend); }, onBlur: _this._handleBlur, onMouseEnter: function (e) { return _this._handleMouseOver(e, segment.legend); }, onMouseMove: function (e) { return _this._handleMouseOver(e, segment.legend); }, "data-is-focusable": _this._legendHighlighted(segment.legend) || _this._noLegendHighlighted() })),
345
352
  _this.props.enableGradient && (React.createElement(React.Fragment, null,
346
353
  React.createElement("clipPath", { id: clipId },
347
354
  React.createElement("path", { d: arc.d })),
348
355
  React.createElement("foreignObject", { x: "-50%", y: "-100%", width: "100%", height: "100%", clipPath: "url(#".concat(clipId, ")") },
349
- React.createElement("div", { style: {
350
- width: '100%',
351
- height: '100%',
352
- background: _this.props.enableGradient
353
- ? "conic-gradient(\n from ".concat(arc.startAngle, "rad at 50% 100%,\n ").concat(segment.gradient[0], ",\n ").concat(segment.gradient[1], " ").concat(arc.endAngle - arc.startAngle, "rad\n )")
354
- : segment.color,
355
- opacity: _this._legendHighlighted(segment.legend) || _this._noLegendHighlighted() ? 1 : 0.1,
356
- } }))))));
356
+ React.createElement("div", { className: arcClassNames.gradientSegment }))))));
357
357
  }),
358
358
  this._renderNeedle(),
359
359
  React.createElement("g", { onMouseEnter: function (e) { return _this._handleMouseOver(e, 'Chart value'); }, onMouseMove: function (e) { return _this._handleMouseOver(e, 'Chart value'); } },