@fluentui/react-charting 5.16.44 → 5.16.46

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 (125) hide show
  1. package/CHANGELOG.json +43 -1
  2. package/CHANGELOG.md +22 -2
  3. package/dist/react-charting.js +1 -1
  4. package/dist/react-charting.min.js +1 -1
  5. package/docs/TestPlans/GaugeChart/ComponentTests.md +31 -0
  6. package/lib/GaugeChart.d.ts +1 -0
  7. package/lib/GaugeChart.js +2 -0
  8. package/lib/GaugeChart.js.map +1 -0
  9. package/lib/components/GaugeChart/GaugeChart.base.d.ts +67 -0
  10. package/lib/components/GaugeChart/GaugeChart.base.js +376 -0
  11. package/lib/components/GaugeChart/GaugeChart.base.js.map +1 -0
  12. package/lib/components/GaugeChart/GaugeChart.d.ts +3 -0
  13. package/lib/components/GaugeChart/GaugeChart.js +5 -0
  14. package/lib/components/GaugeChart/GaugeChart.js.map +1 -0
  15. package/lib/components/GaugeChart/GaugeChart.styles.d.ts +2 -0
  16. package/lib/components/GaugeChart/GaugeChart.styles.js +118 -0
  17. package/lib/components/GaugeChart/GaugeChart.styles.js.map +1 -0
  18. package/lib/components/GaugeChart/GaugeChart.types.d.ts +207 -0
  19. package/lib/components/GaugeChart/GaugeChart.types.js +6 -0
  20. package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -0
  21. package/lib/components/GaugeChart/index.d.ts +2 -0
  22. package/lib/components/GaugeChart/index.js +3 -0
  23. package/lib/components/GaugeChart/index.js.map +1 -0
  24. package/lib/components/LineChart/LineChart.base.js +1 -1
  25. package/lib/components/LineChart/LineChart.base.js.map +1 -1
  26. package/lib/components/LineChart/LineChart.types.d.ts +2 -2
  27. package/lib/components/LineChart/LineChart.types.js.map +1 -1
  28. package/lib/components/LineChart/eventAnnotation/EventAnnotation.d.ts +2 -0
  29. package/lib/components/LineChart/eventAnnotation/EventAnnotation.js +6 -3
  30. package/lib/components/LineChart/eventAnnotation/EventAnnotation.js.map +1 -1
  31. package/lib/components/LineChart/eventAnnotation/LabelLink.d.ts +3 -1
  32. package/lib/components/LineChart/eventAnnotation/LabelLink.js +6 -3
  33. package/lib/components/LineChart/eventAnnotation/LabelLink.js.map +1 -1
  34. package/lib/index.d.ts +1 -0
  35. package/lib/index.js +1 -0
  36. package/lib/index.js.map +1 -1
  37. package/lib/utilities/SVGTooltipText.d.ts +81 -0
  38. package/lib/utilities/SVGTooltipText.js +173 -0
  39. package/lib/utilities/SVGTooltipText.js.map +1 -0
  40. package/lib/utilities/utilities.d.ts +1 -0
  41. package/lib/utilities/utilities.js +11 -0
  42. package/lib/utilities/utilities.js.map +1 -1
  43. package/lib/version.js +1 -1
  44. package/lib/version.js.map +1 -1
  45. package/lib-amd/GaugeChart.d.ts +1 -0
  46. package/lib-amd/GaugeChart.js +6 -0
  47. package/lib-amd/GaugeChart.js.map +1 -0
  48. package/lib-amd/components/GaugeChart/GaugeChart.base.d.ts +67 -0
  49. package/lib-amd/components/GaugeChart/GaugeChart.base.js +370 -0
  50. package/lib-amd/components/GaugeChart/GaugeChart.base.js.map +1 -0
  51. package/lib-amd/components/GaugeChart/GaugeChart.d.ts +3 -0
  52. package/lib-amd/components/GaugeChart/GaugeChart.js +7 -0
  53. package/lib-amd/components/GaugeChart/GaugeChart.js.map +1 -0
  54. package/lib-amd/components/GaugeChart/GaugeChart.styles.d.ts +2 -0
  55. package/lib-amd/components/GaugeChart/GaugeChart.styles.js +122 -0
  56. package/lib-amd/components/GaugeChart/GaugeChart.styles.js.map +1 -0
  57. package/lib-amd/components/GaugeChart/GaugeChart.types.d.ts +207 -0
  58. package/lib-amd/components/GaugeChart/GaugeChart.types.js +11 -0
  59. package/lib-amd/components/GaugeChart/GaugeChart.types.js.map +1 -0
  60. package/lib-amd/components/GaugeChart/index.d.ts +2 -0
  61. package/lib-amd/components/GaugeChart/index.js +7 -0
  62. package/lib-amd/components/GaugeChart/index.js.map +1 -0
  63. package/lib-amd/components/LineChart/LineChart.base.js +1 -1
  64. package/lib-amd/components/LineChart/LineChart.base.js.map +1 -1
  65. package/lib-amd/components/LineChart/LineChart.types.d.ts +2 -2
  66. package/lib-amd/components/LineChart/LineChart.types.js.map +1 -1
  67. package/lib-amd/components/LineChart/eventAnnotation/EventAnnotation.d.ts +2 -0
  68. package/lib-amd/components/LineChart/eventAnnotation/EventAnnotation.js +6 -4
  69. package/lib-amd/components/LineChart/eventAnnotation/EventAnnotation.js.map +1 -1
  70. package/lib-amd/components/LineChart/eventAnnotation/LabelLink.d.ts +3 -1
  71. package/lib-amd/components/LineChart/eventAnnotation/LabelLink.js +6 -4
  72. package/lib-amd/components/LineChart/eventAnnotation/LabelLink.js.map +1 -1
  73. package/lib-amd/index.d.ts +1 -0
  74. package/lib-amd/index.js +2 -1
  75. package/lib-amd/index.js.map +1 -1
  76. package/lib-amd/utilities/SVGTooltipText.d.ts +81 -0
  77. package/lib-amd/utilities/SVGTooltipText.js +174 -0
  78. package/lib-amd/utilities/SVGTooltipText.js.map +1 -0
  79. package/lib-amd/utilities/utilities.d.ts +1 -0
  80. package/lib-amd/utilities/utilities.js +13 -2
  81. package/lib-amd/utilities/utilities.js.map +1 -1
  82. package/lib-amd/version.js +1 -1
  83. package/lib-amd/version.js.map +1 -1
  84. package/lib-commonjs/GaugeChart.d.ts +1 -0
  85. package/lib-commonjs/GaugeChart.js +5 -0
  86. package/lib-commonjs/GaugeChart.js.map +1 -0
  87. package/lib-commonjs/components/GaugeChart/GaugeChart.base.d.ts +67 -0
  88. package/lib-commonjs/components/GaugeChart/GaugeChart.base.js +379 -0
  89. package/lib-commonjs/components/GaugeChart/GaugeChart.base.js.map +1 -0
  90. package/lib-commonjs/components/GaugeChart/GaugeChart.d.ts +3 -0
  91. package/lib-commonjs/components/GaugeChart/GaugeChart.js +8 -0
  92. package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -0
  93. package/lib-commonjs/components/GaugeChart/GaugeChart.styles.d.ts +2 -0
  94. package/lib-commonjs/components/GaugeChart/GaugeChart.styles.js +122 -0
  95. package/lib-commonjs/components/GaugeChart/GaugeChart.styles.js.map +1 -0
  96. package/lib-commonjs/components/GaugeChart/GaugeChart.types.d.ts +207 -0
  97. package/lib-commonjs/components/GaugeChart/GaugeChart.types.js +9 -0
  98. package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +1 -0
  99. package/lib-commonjs/components/GaugeChart/index.d.ts +2 -0
  100. package/lib-commonjs/components/GaugeChart/index.js +6 -0
  101. package/lib-commonjs/components/GaugeChart/index.js.map +1 -0
  102. package/lib-commonjs/components/LineChart/LineChart.base.js +1 -1
  103. package/lib-commonjs/components/LineChart/LineChart.base.js.map +1 -1
  104. package/lib-commonjs/components/LineChart/LineChart.types.d.ts +2 -2
  105. package/lib-commonjs/components/LineChart/LineChart.types.js.map +1 -1
  106. package/lib-commonjs/components/LineChart/eventAnnotation/EventAnnotation.d.ts +2 -0
  107. package/lib-commonjs/components/LineChart/eventAnnotation/EventAnnotation.js +6 -3
  108. package/lib-commonjs/components/LineChart/eventAnnotation/EventAnnotation.js.map +1 -1
  109. package/lib-commonjs/components/LineChart/eventAnnotation/LabelLink.d.ts +3 -1
  110. package/lib-commonjs/components/LineChart/eventAnnotation/LabelLink.js +6 -3
  111. package/lib-commonjs/components/LineChart/eventAnnotation/LabelLink.js.map +1 -1
  112. package/lib-commonjs/index.d.ts +1 -0
  113. package/lib-commonjs/index.js +1 -0
  114. package/lib-commonjs/index.js.map +1 -1
  115. package/lib-commonjs/utilities/SVGTooltipText.d.ts +81 -0
  116. package/lib-commonjs/utilities/SVGTooltipText.js +176 -0
  117. package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -0
  118. package/lib-commonjs/utilities/utilities.d.ts +1 -0
  119. package/lib-commonjs/utilities/utilities.js +13 -1
  120. package/lib-commonjs/utilities/utilities.js.map +1 -1
  121. package/lib-commonjs/version.js +1 -1
  122. package/lib-commonjs/version.js.map +1 -1
  123. package/package.json +4 -4
  124. package/src/components/GaugeChart/GaugeChart.types.ts +258 -0
  125. package/src/components/LineChart/LineChart.types.ts +2 -2
@@ -4,9 +4,11 @@ exports.LabelLink = void 0;
4
4
  var React = require("react");
5
5
  var react_1 = require("@fluentui/react");
6
6
  var Textbox_1 = require("./Textbox");
7
+ var colors_1 = require("../../../utilities/colors");
7
8
  var LabelLink = function (props) {
9
+ var _a, _b;
8
10
  var gRef = React.useRef(null);
9
- var _a = React.useState(false), showCard = _a[0], setShowCard = _a[1];
11
+ var _c = React.useState(false), showCard = _c[0], setShowCard = _c[1];
10
12
  var onDismiss = function () { return setShowCard(false); };
11
13
  var onClick = function () { return setShowCard(true); };
12
14
  var onRenderCell = function (i) { return React.createElement("div", { "data-is-focusable": true }, i && i()); };
@@ -24,8 +26,9 @@ var LabelLink = function (props) {
24
26
  }
25
27
  }
26
28
  var text;
27
- var darkThemeMq = window.matchMedia('(prefers-color-scheme: dark)');
28
- var fill = darkThemeMq.matches ? 'rgb(255,255,255)' : props.textColor;
29
+ var fill = props.textColor
30
+ ? (0, colors_1.getColorFromToken)(props.textColor, (_a = props.theme) === null || _a === void 0 ? void 0 : _a.isInverted)
31
+ : (_b = props.theme) === null || _b === void 0 ? void 0 : _b.palette.black;
29
32
  if (props.labelDef.aggregatedIdx.length === 1) {
30
33
  text = props.lineDefs[props.labelDef.aggregatedIdx[0]].event;
31
34
  }
@@ -1 +1 @@
1
- {"version":3,"file":"LabelLink.js","sourceRoot":"../src/","sources":["components/LineChart/eventAnnotation/LabelLink.tsx"],"names":[],"mappings":";;;AAAA,6BAA+B;AAC/B,yCAA+E;AAE/E,qCAAoC;AAuB7B,IAAM,SAAS,GAA6C,UAAA,KAAK;IACtE,IAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAc,IAAI,CAAC,CAAC;IACvC,IAAA,KAA0B,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,EAA9C,QAAQ,QAAA,EAAE,WAAW,QAAyB,CAAC;IACtD,IAAM,SAAS,GAAG,cAAM,OAAA,W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,CAAC,MAAM,KAAK,CAAC,EAAE;QAC7C,IAAI,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;KAC9D;SAAM;QACL,IAAI,GAAG,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;KAC/D;IAED,OAAO,CACL;QACE,2BAAG,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,uBAAqB,KAAK,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE;YACpF,oBAAC,iBAAO,IACN,IAAI,EAAE,IAAI,EACV,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,EACnB,CAAC,EAAE,KAAK,CAAC,KAAK,EACd,KAAK,EAAE,KAAK,CAAC,SAAS,EACtB,UAAU,EAAE,KAAK,CAAC,cAAc,EAChC,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC,MAAM,EACjC,QAAQ,EAAE,KAAK,CAAC,YAAY,EAC5B,IAAI,EAAE,IAAI,GACV,CACA;QACH,OAAO,CACP,CACJ,CAAC;AACJ,CAAC,CAAC;AAzDW,QAAA,SAAS,aAyDpB","sourcesContent":["import * as React from 'react';\nimport { Callout, FocusZone, FocusZoneDirection, List } from '@fluentui/react';\nimport { IEventAnnotation } from '../../../types/IEventAnnotation';\nimport { Textbox } from './Textbox';\n\nexport interface ILineDef extends IEventAnnotation {\n x: number;\n}\n\nexport interface ILabelDef {\n x: number;\n aggregatedIdx: number[];\n anchor: 'start' | 'end';\n}\n\ninterface ILabelLinkProps {\n lineDefs: ILineDef[];\n labelDef: ILabelDef;\n textY: number;\n textWidth: number;\n textLineHeight: number;\n textFontSize: string;\n textColor: string;\n mergedLabel: (count: number) => string;\n}\n\nexport const LabelLink: React.FunctionComponent<ILabelLinkProps> = props => {\n const gRef = React.useRef<SVGGElement>(null);\n const [showCard, setShowCard] = React.useState(false);\n const onDismiss = () => setShowCard(false);\n const onClick = () => setShowCard(true);\n const onRenderCell = (i: (() => React.ReactNode) | undefined) => <div data-is-focusable={true}>{i && i()}</div>;\n\n let callout: React.ReactNode = null;\n if (showCard) {\n const cards = props.labelDef.aggregatedIdx.map(i => props.lineDefs[i].onRenderCard!).filter(c => !!c);\n if (cards.length > 0) {\n callout = (\n <Callout\n target={gRef.current}\n // eslint-disable-next-line react/jsx-no-bind\n onDismiss={onDismiss}\n setInitialFocus={true}\n role=\"dialog\"\n >\n <FocusZone isCircularNavigation={true} direction={FocusZoneDirection.vertical}>\n <List<() => React.ReactNode>\n items={cards}\n // eslint-disable-next-line react/jsx-no-bind\n onRenderCell={onRenderCell}\n />\n </FocusZone>\n </Callout>\n );\n }\n }\n\n let text: string;\n const darkThemeMq = window.matchMedia('(prefers-color-scheme: dark)');\n const fill: string | undefined = darkThemeMq.matches ? 'rgb(255,255,255)' : props.textColor;\n if (props.labelDef.aggregatedIdx.length === 1) {\n text = props.lineDefs[props.labelDef.aggregatedIdx[0]].event;\n } else {\n text = props.mergedLabel(props.labelDef.aggregatedIdx.length);\n }\n\n return (\n <>\n <g ref={gRef} onClick={onClick} data-is-focusable={false} style={{ cursor: 'pointer' }}>\n <Textbox\n text={text}\n x={props.labelDef.x}\n y={props.textY}\n width={props.textWidth}\n lineHeight={props.textLineHeight}\n textAnchor={props.labelDef.anchor}\n fontSize={props.textFontSize}\n fill={fill}\n />\n </g>\n {callout}\n </>\n );\n};\n"]}
1
+ {"version":3,"file":"LabelLink.js","sourceRoot":"../src/","sources":["components/LineChart/eventAnnotation/LabelLink.tsx"],"names":[],"mappings":";;;AAAA,6BAA+B;AAC/B,yCAA+E;AAE/E,qCAAoC;AAEpC,oDAA8D;AAwBvD,IAAM,SAAS,GAA6C,UAAA,KAAK;;IACtE,IAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAc,IAAI,CAAC,CAAC;IACvC,IAAA,KAA0B,KAAK,CAA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KAAK,CAAC,KAAK,0CAAE,UAAU,CAAC;QAC7D,CAAC,CAAC,MAAA,KAAK,CAAC,KAAK,0CAAE,OAAO,CAAC,KAAK,CAAC;IAE/B,IAAI,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE;QAC7C,IAAI,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;KAC9D;SAAM;QACL,IAAI,GAAG,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;KAC/D;IAED,OAAO,CACL;QACE,2BAAG,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,uBAAqB,KAAK,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE;YACpF,oBAAC,iBAAO,IACN,IAAI,EAAE,IAAI,EACV,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,EACnB,CAAC,EAAE,KAAK,CAAC,KAAK,EACd,KAAK,EAAE,KAAK,CAAC,SAAS,EACtB,UAAU,EAAE,KAAK,CAAC,cAAc,EAChC,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC,MAAM,EACjC,QAAQ,EAAE,KAAK,CAAC,YAAY,EAC5B,IAAI,EAAE,IAAI,GACV,CACA;QACH,OAAO,CACP,CACJ,CAAC;AACJ,CAAC,CAAC;AA3DW,QAAA,SAAS,aA2DpB","sourcesContent":["import * as React from 'react';\nimport { Callout, FocusZone, FocusZoneDirection, List } from '@fluentui/react';\nimport { IEventAnnotation } from '../../../types/IEventAnnotation';\nimport { Textbox } from './Textbox';\nimport { ITheme } from '@fluentui/react/lib/Styling';\nimport { getColorFromToken } from '../../../utilities/colors';\n\nexport interface ILineDef extends IEventAnnotation {\n x: number;\n}\n\nexport interface ILabelDef {\n x: number;\n aggregatedIdx: number[];\n anchor: 'start' | 'end';\n}\n\ninterface ILabelLinkProps {\n lineDefs: ILineDef[];\n labelDef: ILabelDef;\n textY: number;\n textWidth: number;\n textLineHeight: number;\n textFontSize: string;\n textColor: string | undefined;\n theme: ITheme | undefined;\n mergedLabel: (count: number) => string;\n}\n\nexport const LabelLink: React.FunctionComponent<ILabelLinkProps> = props => {\n const gRef = React.useRef<SVGGElement>(null);\n const [showCard, setShowCard] = React.useState(false);\n const onDismiss = () => setShowCard(false);\n const onClick = () => setShowCard(true);\n const onRenderCell = (i: (() => React.ReactNode) | undefined) => <div data-is-focusable={true}>{i && i()}</div>;\n\n let callout: React.ReactNode = null;\n if (showCard) {\n const cards = props.labelDef.aggregatedIdx.map(i => props.lineDefs[i].onRenderCard!).filter(c => !!c);\n if (cards.length > 0) {\n callout = (\n <Callout\n target={gRef.current}\n // eslint-disable-next-line react/jsx-no-bind\n onDismiss={onDismiss}\n setInitialFocus={true}\n role=\"dialog\"\n >\n <FocusZone isCircularNavigation={true} direction={FocusZoneDirection.vertical}>\n <List<() => React.ReactNode>\n items={cards}\n // eslint-disable-next-line react/jsx-no-bind\n onRenderCell={onRenderCell}\n />\n </FocusZone>\n </Callout>\n );\n }\n }\n\n let text: string;\n const fill: string | undefined = props.textColor\n ? getColorFromToken(props.textColor, props.theme?.isInverted)\n : props.theme?.palette.black;\n\n if (props.labelDef.aggregatedIdx.length === 1) {\n text = props.lineDefs[props.labelDef.aggregatedIdx[0]].event;\n } else {\n text = props.mergedLabel(props.labelDef.aggregatedIdx.length);\n }\n\n return (\n <>\n <g ref={gRef} onClick={onClick} data-is-focusable={false} style={{ cursor: 'pointer' }}>\n <Textbox\n text={text}\n x={props.labelDef.x}\n y={props.textY}\n width={props.textWidth}\n lineHeight={props.textLineHeight}\n textAnchor={props.labelDef.anchor}\n fontSize={props.textFontSize}\n fill={fill}\n />\n </g>\n {callout}\n </>\n );\n};\n"]}
@@ -17,4 +17,5 @@ export * from './TreeChart';
17
17
  export * from './Sparkline';
18
18
  export * from './HorizontalBarChartWithAxis';
19
19
  export * from './utilities/colors';
20
+ export * from './GaugeChart';
20
21
  import './version';
@@ -20,5 +20,6 @@ tslib_1.__exportStar(require("./TreeChart"), exports);
20
20
  tslib_1.__exportStar(require("./Sparkline"), exports);
21
21
  tslib_1.__exportStar(require("./HorizontalBarChartWithAxis"), exports);
22
22
  tslib_1.__exportStar(require("./utilities/colors"), exports);
23
+ tslib_1.__exportStar(require("./GaugeChart"), exports);
23
24
  require("./version");
24
25
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["index.ts"],"names":[],"mappings":";;;AAAA,+DAAqC;AACrC,uDAA6B;AAC7B,oDAA0B;AAC1B,sDAA4B;AAC5B,sDAA4B;AAC5B,qDAA2B;AAC3B,4DAAkC;AAClC,6DAAmC;AACnC,oEAA0C;AAC1C,oEAA0C;AAC1C,2DAAiC;AACjC,wDAA8B;AAC9B,2EAAiD;AACjD,yDAA+B;AAC/B,wDAA8B;AAC9B,sDAA4B;AAC5B,sDAA4B;AAC5B,uEAA6C;AAC7C,6DAAmC;AAEnC,qBAAmB","sourcesContent":["export * from './HorizontalBarChart';\nexport * from './DonutChart';\nexport * from './Legends';\nexport * from './LineChart';\nexport * from './AreaChart';\nexport * from './PieChart';\nexport * from './StackedBarChart';\nexport * from './VerticalBarChart';\nexport * from './VerticalStackedBarChart';\nexport * from './GroupedVerticalBarChart';\nexport * from './CartesianChart';\nexport * from './types/index';\nexport * from './utilities/ChartHoverCard/index';\nexport * from './HeatMapChart';\nexport * from './SankeyChart';\nexport * from './TreeChart';\nexport * from './Sparkline';\nexport * from './HorizontalBarChartWithAxis';\nexport * from './utilities/colors';\n\nimport './version';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["index.ts"],"names":[],"mappings":";;;AAAA,+DAAqC;AACrC,uDAA6B;AAC7B,oDAA0B;AAC1B,sDAA4B;AAC5B,sDAA4B;AAC5B,qDAA2B;AAC3B,4DAAkC;AAClC,6DAAmC;AACnC,oEAA0C;AAC1C,oEAA0C;AAC1C,2DAAiC;AACjC,wDAA8B;AAC9B,2EAAiD;AACjD,yDAA+B;AAC/B,wDAA8B;AAC9B,sDAA4B;AAC5B,sDAA4B;AAC5B,uEAA6C;AAC7C,6DAAmC;AACnC,uDAA6B;AAE7B,qBAAmB","sourcesContent":["export * from './HorizontalBarChart';\nexport * from './DonutChart';\nexport * from './Legends';\nexport * from './LineChart';\nexport * from './AreaChart';\nexport * from './PieChart';\nexport * from './StackedBarChart';\nexport * from './VerticalBarChart';\nexport * from './VerticalStackedBarChart';\nexport * from './GroupedVerticalBarChart';\nexport * from './CartesianChart';\nexport * from './types/index';\nexport * from './utilities/ChartHoverCard/index';\nexport * from './HeatMapChart';\nexport * from './SankeyChart';\nexport * from './TreeChart';\nexport * from './Sparkline';\nexport * from './HorizontalBarChartWithAxis';\nexport * from './utilities/colors';\nexport * from './GaugeChart';\n\nimport './version';\n"]}
@@ -0,0 +1,81 @@
1
+ import * as React from 'react';
2
+ import { ITooltipHost, ITooltipProps, TooltipDelay } from '@fluentui/react/lib/Tooltip';
3
+ interface ISVGTooltipTextProps {
4
+ /**
5
+ * Number of milliseconds to delay closing the tooltip, so that the user has time to hover over
6
+ * the tooltip and interact with it. Hovering over the tooltip will count as hovering over the
7
+ * host, so that the tooltip will stay open if the user is actively interacting with it.
8
+ */
9
+ closeDelay?: number;
10
+ /**
11
+ * Content to display in the Tooltip.
12
+ */
13
+ content?: string;
14
+ /**
15
+ * Length of delay before showing the tooltip on hover.
16
+ * @defaultvalue TooltipDelay.medium
17
+ */
18
+ delay?: TooltipDelay;
19
+ /**
20
+ * Additional properties to pass through for Tooltip.
21
+ */
22
+ tooltipProps?: ITooltipProps;
23
+ /**
24
+ * Additional properties to pass through for SVG <text>.
25
+ */
26
+ textProps?: React.SVGAttributes<SVGTextElement>;
27
+ /**
28
+ * Max width of text
29
+ */
30
+ maxWidth?: number;
31
+ /**
32
+ * Max height of text
33
+ */
34
+ maxHeight?: number;
35
+ /**
36
+ * Function to wrap text within specified width and height
37
+ * and return a boolean value indicating whether the text overflowed
38
+ */
39
+ wrapContent?: (content: string, id: string, maxWidth: number, maxHeight?: number) => boolean;
40
+ }
41
+ interface ISVGTooltipTextState {
42
+ isTooltipVisible: boolean;
43
+ isOverflowing: boolean;
44
+ }
45
+ /**
46
+ * Component to render an SVG text element with an optional tooltip.
47
+ * The tooltip appears on hovering and focusing the element when its content overflows.
48
+ */
49
+ export declare class SVGTooltipText extends React.Component<ISVGTooltipTextProps, ISVGTooltipTextState> implements ITooltipHost {
50
+ static defaultProps: {
51
+ delay: TooltipDelay;
52
+ };
53
+ private static _currentVisibleTooltip;
54
+ /** The element that gets the hover events */
55
+ private _tooltipHost;
56
+ private _async;
57
+ private _dismissTimerId;
58
+ private _openTimerId;
59
+ private _tooltipHostId;
60
+ private _ignoreNextFocusEvent;
61
+ constructor(props: ISVGTooltipTextProps);
62
+ render(): React.ReactNode;
63
+ componentDidMount(): void;
64
+ componentDidUpdate(prevProps: Readonly<ISVGTooltipTextProps>): void;
65
+ componentWillUnmount(): void;
66
+ show: () => void;
67
+ dismiss: () => void;
68
+ private _getTargetElement;
69
+ private _onTooltipFocus;
70
+ private _onTooltipBlur;
71
+ private _onTooltipMouseEnter;
72
+ private _onTooltipMouseLeave;
73
+ private _onTooltipKeyDown;
74
+ private _clearDismissTimer;
75
+ private _clearOpenTimer;
76
+ private _hideTooltip;
77
+ private _toggleTooltip;
78
+ private _getDelayTime;
79
+ private _wrapContent;
80
+ }
81
+ export {};
@@ -0,0 +1,176 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SVGTooltipText = void 0;
4
+ var tslib_1 = require("tslib");
5
+ var React = require("react");
6
+ var Tooltip_1 = require("@fluentui/react/lib/Tooltip");
7
+ var Utilities_1 = require("../Utilities");
8
+ /**
9
+ * Component to render an SVG text element with an optional tooltip.
10
+ * The tooltip appears on hovering and focusing the element when its content overflows.
11
+ */
12
+ var SVGTooltipText = /** @class */ (function (_super) {
13
+ tslib_1.__extends(SVGTooltipText, _super);
14
+ function SVGTooltipText(props) {
15
+ var _this = _super.call(this, props) || this;
16
+ /** The element that gets the hover events */
17
+ _this._tooltipHost = React.createRef();
18
+ _this._tooltipHostId = (0, Utilities_1.getId)('tooltip-host');
19
+ _this.show = function () {
20
+ _this._toggleTooltip(true);
21
+ };
22
+ _this.dismiss = function () {
23
+ _this._hideTooltip();
24
+ };
25
+ _this._getTargetElement = function () {
26
+ if (!_this._tooltipHost.current) {
27
+ return undefined;
28
+ }
29
+ return _this._tooltipHost.current;
30
+ };
31
+ _this._onTooltipFocus = function (ev) {
32
+ if (_this._ignoreNextFocusEvent) {
33
+ _this._ignoreNextFocusEvent = false;
34
+ return;
35
+ }
36
+ _this._onTooltipMouseEnter(ev);
37
+ };
38
+ _this._onTooltipBlur = function (ev) {
39
+ // The focused element gets a blur event when the document loses focus
40
+ // (e.g. switching tabs in the browser), but we don't want to show the
41
+ // tooltip again when the document gets focus back. Handle this case by
42
+ // checking if the blurred element is still the document's activeElement,
43
+ // and ignoring when it next gets focus back.
44
+ // See https://github.com/microsoft/fluentui/issues/13541
45
+ _this._ignoreNextFocusEvent = (document === null || document === void 0 ? void 0 : document.activeElement) === ev.target;
46
+ _this._dismissTimerId = _this._async.setTimeout(function () {
47
+ _this._hideTooltip();
48
+ }, 0);
49
+ };
50
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
51
+ _this._onTooltipMouseEnter = function (ev) {
52
+ var delay = _this.props.delay;
53
+ if (SVGTooltipText._currentVisibleTooltip && SVGTooltipText._currentVisibleTooltip !== _this) {
54
+ SVGTooltipText._currentVisibleTooltip.dismiss();
55
+ }
56
+ SVGTooltipText._currentVisibleTooltip = _this;
57
+ if (!_this.state.isOverflowing) {
58
+ return;
59
+ }
60
+ if (ev.target && (0, Utilities_1.portalContainsElement)(ev.target, _this._getTargetElement())) {
61
+ // Do not show tooltip when target is inside a portal relative to TooltipHost.
62
+ return;
63
+ }
64
+ _this._clearDismissTimer();
65
+ _this._clearOpenTimer();
66
+ if (delay !== Tooltip_1.TooltipDelay.zero) {
67
+ var delayTime = _this._getDelayTime(delay); // non-null assertion because we set it in `defaultProps`
68
+ _this._openTimerId = _this._async.setTimeout(function () {
69
+ _this._toggleTooltip(true);
70
+ }, delayTime);
71
+ }
72
+ else {
73
+ _this._toggleTooltip(true);
74
+ }
75
+ };
76
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
77
+ _this._onTooltipMouseLeave = function (ev) {
78
+ var closeDelay = _this.props.closeDelay;
79
+ _this._clearDismissTimer();
80
+ _this._clearOpenTimer();
81
+ if (closeDelay) {
82
+ _this._dismissTimerId = _this._async.setTimeout(function () {
83
+ _this._toggleTooltip(false);
84
+ }, closeDelay);
85
+ }
86
+ else {
87
+ _this._toggleTooltip(false);
88
+ }
89
+ if (SVGTooltipText._currentVisibleTooltip === _this) {
90
+ SVGTooltipText._currentVisibleTooltip = undefined;
91
+ }
92
+ };
93
+ _this._onTooltipKeyDown = function (ev) {
94
+ // eslint-disable-next-line deprecation/deprecation
95
+ if ((ev.which === Utilities_1.KeyCodes.escape || ev.ctrlKey) && _this.state.isTooltipVisible) {
96
+ _this._hideTooltip();
97
+ ev.stopPropagation();
98
+ }
99
+ };
100
+ _this._clearDismissTimer = function () {
101
+ _this._async.clearTimeout(_this._dismissTimerId);
102
+ };
103
+ _this._clearOpenTimer = function () {
104
+ _this._async.clearTimeout(_this._openTimerId);
105
+ };
106
+ _this._hideTooltip = function () {
107
+ _this._clearOpenTimer();
108
+ _this._clearDismissTimer();
109
+ _this._toggleTooltip(false);
110
+ };
111
+ _this._toggleTooltip = function (isTooltipVisible) {
112
+ if (_this.state.isTooltipVisible !== isTooltipVisible) {
113
+ _this.setState({ isTooltipVisible: isTooltipVisible });
114
+ }
115
+ };
116
+ _this._getDelayTime = function (delay) {
117
+ switch (delay) {
118
+ case Tooltip_1.TooltipDelay.medium:
119
+ return 300;
120
+ case Tooltip_1.TooltipDelay.long:
121
+ return 500;
122
+ default:
123
+ return 0;
124
+ }
125
+ };
126
+ _this._wrapContent = function () {
127
+ var _a = _this.props, content = _a.content, wrapContent = _a.wrapContent, _b = _a.maxWidth, maxWidth = _b === void 0 ? Number.POSITIVE_INFINITY : _b, maxHeight = _a.maxHeight;
128
+ var isOverflowing = false;
129
+ if (content && wrapContent && wrapContent(content, _this._tooltipHostId, maxWidth, maxHeight)) {
130
+ isOverflowing = true;
131
+ }
132
+ if (_this.state.isOverflowing !== isOverflowing) {
133
+ _this.setState({ isOverflowing: isOverflowing });
134
+ }
135
+ };
136
+ _this.state = {
137
+ isTooltipVisible: false,
138
+ isOverflowing: false,
139
+ };
140
+ _this._async = new Utilities_1.Async(_this);
141
+ return _this;
142
+ }
143
+ SVGTooltipText.prototype.render = function () {
144
+ var _a = this.props, content = _a.content, tooltipProps = _a.tooltipProps, textProps = _a.textProps;
145
+ var isTooltipVisible = this.state.isTooltipVisible;
146
+ var tooltipRenderProps = tslib_1.__assign({ content: content, targetElement: this._getTargetElement(), calloutProps: {
147
+ onDismiss: this._hideTooltip,
148
+ onMouseEnter: this._onTooltipMouseEnter,
149
+ onMouseLeave: this._onTooltipMouseLeave,
150
+ }, onMouseEnter: this._onTooltipMouseEnter, onMouseLeave: this._onTooltipMouseLeave }, tooltipProps);
151
+ var showTooltip = isTooltipVisible && !!content;
152
+ return (React.createElement(React.Fragment, null,
153
+ React.createElement("text", tslib_1.__assign({}, textProps, { id: this._tooltipHostId, ref: this._tooltipHost, onFocusCapture: this._onTooltipFocus, onBlurCapture: this._onTooltipBlur, onMouseEnter: this._onTooltipMouseEnter, onMouseLeave: this._onTooltipMouseLeave, onKeyDown: this._onTooltipKeyDown, "data-is-focusable": this.state.isOverflowing }), content),
154
+ showTooltip && React.createElement(Tooltip_1.Tooltip, tslib_1.__assign({}, tooltipRenderProps))));
155
+ };
156
+ SVGTooltipText.prototype.componentDidMount = function () {
157
+ this._wrapContent();
158
+ };
159
+ SVGTooltipText.prototype.componentDidUpdate = function (prevProps) {
160
+ if (this.props.maxWidth !== prevProps.maxWidth || this.props.maxHeight !== prevProps.maxHeight) {
161
+ this._wrapContent();
162
+ }
163
+ };
164
+ SVGTooltipText.prototype.componentWillUnmount = function () {
165
+ if (SVGTooltipText._currentVisibleTooltip && SVGTooltipText._currentVisibleTooltip === this) {
166
+ SVGTooltipText._currentVisibleTooltip = undefined;
167
+ }
168
+ this._async.dispose();
169
+ };
170
+ SVGTooltipText.defaultProps = {
171
+ delay: Tooltip_1.TooltipDelay.medium,
172
+ };
173
+ return SVGTooltipText;
174
+ }(React.Component));
175
+ exports.SVGTooltipText = SVGTooltipText;
176
+ //# sourceMappingURL=SVGTooltipText.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SVGTooltipText.js","sourceRoot":"../src/","sources":["utilities/SVGTooltipText.tsx"],"names":[],"mappings":";;;;AAAA,6BAA+B;AAC/B,uDAAiG;AACjG,0CAA6E;AAqD7E;;;GAGG;AACH;IACU,0CAA2D;IAkBnE,wBAAY,KAA2B;QAAvC,YACE,kBAAM,KAAK,CAAC,SAQb;QAlBD,6CAA6C;QACrC,kBAAY,GAAG,KAAK,CAAC,SAAS,EAAkB,CAAC;QAKjD,oBAAc,GAAG,IAAA,iBAAK,EAAC,cAAc,CAAC,CAAC;QAuExC,UAAI,GAAG;YACZ,KAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QAC5B,CAAC,CAAC;QAEK,aAAO,GAAG;YACf,KAAI,CAAC,YAAY,EAAE,CAAC;QACtB,CAAC,CAAC;QAEM,uBAAiB,GAAG;YAC1B,IAAI,CAAC,KAAI,CAAC,YAAY,CAAC,OAAO,EAAE;gBAC9B,OAAO,SAAS,CAAC;aAClB;YAED,OAAO,KAAI,CAAC,YAAY,CAAC,OAAiC,CAAC;QAC7D,CAAC,CAAC;QAEM,qBAAe,GAAG,UAAC,EAAgC;YACzD,IAAI,KAAI,CAA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0B,SAAyC;QACjE,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,KAAK,SAAS,CAAC,QAAQ,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,KAAK,SAAS,CAAC,SAAS,EAAE;YAC9F,IAAI,CAAC,YAAY,EAAE,CAAC;SACrB;IACH,CAAC;IAEM,6CAAoB,GAA3B;QACE,IAAI,cAAc,CAAC,sBAAsB,IAAI,cAAc,CAAC,sBAAsB,KAAK,IAAI,EAAE;YAC3F,cAAc,CAAC,sBAAsB,GAAG,SAAS,CAAC;SACnD;QAED,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;IACxB,CAAC;IAjFa,2BAAY,GAAG;QAC3B,KAAK,EAAE,sBAAY,CAAC,MAAM;KAC3B,CAAC;IA+NJ,qBAAC;CAAA,AArOD,CACU,KAAK,CAAC,SAAS,GAoOxB;AArOY,wCAAc","sourcesContent":["import * as React from 'react';\nimport { ITooltipHost, ITooltipProps, Tooltip, TooltipDelay } from '@fluentui/react/lib/Tooltip';\nimport { Async, KeyCodes, getId, portalContainsElement } from '../Utilities';\n\ninterface ISVGTooltipTextProps {\n /**\n * Number of milliseconds to delay closing the tooltip, so that the user has time to hover over\n * the tooltip and interact with it. Hovering over the tooltip will count as hovering over the\n * host, so that the tooltip will stay open if the user is actively interacting with it.\n */\n closeDelay?: number;\n\n /**\n * Content to display in the Tooltip.\n */\n content?: string;\n\n /**\n * Length of delay before showing the tooltip on hover.\n * @defaultvalue TooltipDelay.medium\n */\n delay?: TooltipDelay;\n\n /**\n * Additional properties to pass through for Tooltip.\n */\n tooltipProps?: ITooltipProps;\n\n /**\n * Additional properties to pass through for SVG <text>.\n */\n textProps?: React.SVGAttributes<SVGTextElement>;\n\n /**\n * Max width of text\n */\n maxWidth?: number;\n\n /**\n * Max height of text\n */\n maxHeight?: number;\n\n /**\n * Function to wrap text within specified width and height\n * and return a boolean value indicating whether the text overflowed\n */\n wrapContent?: (content: string, id: string, maxWidth: number, maxHeight?: number) => boolean;\n}\n\ninterface ISVGTooltipTextState {\n isTooltipVisible: boolean;\n isOverflowing: boolean;\n}\n\n/**\n * Component to render an SVG text element with an optional tooltip.\n * The tooltip appears on hovering and focusing the element when its content overflows.\n */\nexport class SVGTooltipText\n extends React.Component<ISVGTooltipTextProps, ISVGTooltipTextState>\n implements ITooltipHost\n{\n public static defaultProps = {\n delay: TooltipDelay.medium,\n };\n\n private static _currentVisibleTooltip: ITooltipHost | undefined;\n\n /** The element that gets the hover events */\n private _tooltipHost = React.createRef<SVGTextElement>();\n\n private _async: Async;\n private _dismissTimerId: number;\n private _openTimerId: number;\n private _tooltipHostId = getId('tooltip-host');\n private _ignoreNextFocusEvent: boolean;\n\n constructor(props: ISVGTooltipTextProps) {\n super(props);\n\n this.state = {\n isTooltipVisible: false,\n isOverflowing: false,\n };\n\n this._async = new Async(this);\n }\n\n public render(): React.ReactNode {\n const { content, tooltipProps, textProps } = this.props;\n const { isTooltipVisible } = this.state;\n\n const tooltipRenderProps: ITooltipProps = {\n content,\n targetElement: this._getTargetElement(),\n calloutProps: {\n onDismiss: this._hideTooltip,\n onMouseEnter: this._onTooltipMouseEnter,\n onMouseLeave: this._onTooltipMouseLeave,\n },\n onMouseEnter: this._onTooltipMouseEnter,\n onMouseLeave: this._onTooltipMouseLeave,\n ...tooltipProps,\n };\n\n const showTooltip = isTooltipVisible && !!content;\n\n return (\n <>\n <text\n {...textProps}\n id={this._tooltipHostId}\n ref={this._tooltipHost}\n onFocusCapture={this._onTooltipFocus}\n onBlurCapture={this._onTooltipBlur}\n onMouseEnter={this._onTooltipMouseEnter}\n onMouseLeave={this._onTooltipMouseLeave}\n onKeyDown={this._onTooltipKeyDown}\n data-is-focusable={this.state.isOverflowing}\n >\n {content}\n </text>\n {showTooltip && <Tooltip {...tooltipRenderProps} />}\n </>\n );\n }\n\n public componentDidMount(): void {\n this._wrapContent();\n }\n\n public componentDidUpdate(prevProps: Readonly<ISVGTooltipTextProps>): void {\n if (this.props.maxWidth !== prevProps.maxWidth || this.props.maxHeight !== prevProps.maxHeight) {\n this._wrapContent();\n }\n }\n\n public componentWillUnmount(): void {\n if (SVGTooltipText._currentVisibleTooltip && SVGTooltipText._currentVisibleTooltip === this) {\n SVGTooltipText._currentVisibleTooltip = undefined;\n }\n\n this._async.dispose();\n }\n\n public show = (): void => {\n this._toggleTooltip(true);\n };\n\n public dismiss = (): void => {\n this._hideTooltip();\n };\n\n private _getTargetElement = (): HTMLElement | undefined => {\n if (!this._tooltipHost.current) {\n return undefined;\n }\n\n return this._tooltipHost.current as unknown as HTMLElement;\n };\n\n private _onTooltipFocus = (ev: React.FocusEvent<SVGElement>) => {\n if (this._ignoreNextFocusEvent) {\n this._ignoreNextFocusEvent = false;\n return;\n }\n\n this._onTooltipMouseEnter(ev);\n };\n\n private _onTooltipBlur = (ev: React.FocusEvent<SVGElement>) => {\n // The focused element gets a blur event when the document loses focus\n // (e.g. switching tabs in the browser), but we don't want to show the\n // tooltip again when the document gets focus back. Handle this case by\n // checking if the blurred element is still the document's activeElement,\n // and ignoring when it next gets focus back.\n // See https://github.com/microsoft/fluentui/issues/13541\n this._ignoreNextFocusEvent = document?.activeElement === ev.target;\n\n this._dismissTimerId = this._async.setTimeout(() => {\n this._hideTooltip();\n }, 0);\n };\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _onTooltipMouseEnter = (ev: any): void => {\n const { delay } = this.props;\n\n if (SVGTooltipText._currentVisibleTooltip && SVGTooltipText._currentVisibleTooltip !== this) {\n SVGTooltipText._currentVisibleTooltip.dismiss();\n }\n SVGTooltipText._currentVisibleTooltip = this;\n\n if (!this.state.isOverflowing) {\n return;\n }\n\n if (ev.target && portalContainsElement(ev.target as HTMLElement, this._getTargetElement())) {\n // Do not show tooltip when target is inside a portal relative to TooltipHost.\n return;\n }\n\n this._clearDismissTimer();\n this._clearOpenTimer();\n\n if (delay !== TooltipDelay.zero) {\n const delayTime = this._getDelayTime(delay!); // non-null assertion because we set it in `defaultProps`\n\n this._openTimerId = this._async.setTimeout(() => {\n this._toggleTooltip(true);\n }, delayTime);\n } else {\n this._toggleTooltip(true);\n }\n };\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _onTooltipMouseLeave = (ev: any): void => {\n const { closeDelay } = this.props;\n\n this._clearDismissTimer();\n this._clearOpenTimer();\n\n if (closeDelay) {\n this._dismissTimerId = this._async.setTimeout(() => {\n this._toggleTooltip(false);\n }, closeDelay);\n } else {\n this._toggleTooltip(false);\n }\n\n if (SVGTooltipText._currentVisibleTooltip === this) {\n SVGTooltipText._currentVisibleTooltip = undefined;\n }\n };\n\n private _onTooltipKeyDown = (ev: React.KeyboardEvent<SVGElement>): void => {\n // eslint-disable-next-line deprecation/deprecation\n if ((ev.which === KeyCodes.escape || ev.ctrlKey) && this.state.isTooltipVisible) {\n this._hideTooltip();\n ev.stopPropagation();\n }\n };\n\n private _clearDismissTimer = (): void => {\n this._async.clearTimeout(this._dismissTimerId);\n };\n\n private _clearOpenTimer = (): void => {\n this._async.clearTimeout(this._openTimerId);\n };\n\n private _hideTooltip = (): void => {\n this._clearOpenTimer();\n this._clearDismissTimer();\n this._toggleTooltip(false);\n };\n\n private _toggleTooltip = (isTooltipVisible: boolean): void => {\n if (this.state.isTooltipVisible !== isTooltipVisible) {\n this.setState({ isTooltipVisible });\n }\n };\n\n private _getDelayTime = (delay: TooltipDelay): number => {\n switch (delay) {\n case TooltipDelay.medium:\n return 300;\n case TooltipDelay.long:\n return 500;\n default:\n return 0;\n }\n };\n\n private _wrapContent = () => {\n const { content, wrapContent, maxWidth = Number.POSITIVE_INFINITY, maxHeight } = this.props;\n\n let isOverflowing = false;\n if (content && wrapContent && wrapContent(content, this._tooltipHostId, maxWidth, maxHeight)) {\n isOverflowing = true;\n }\n\n if (this.state.isOverflowing !== isOverflowing) {\n this.setState({ isOverflowing });\n }\n };\n}\n"]}
@@ -425,4 +425,5 @@ declare type LocaleStringDataProps = number | string | Date | undefined;
425
425
  export declare const convertToLocaleString: (data: LocaleStringDataProps, culture?: string) => LocaleStringDataProps;
426
426
  export declare function rotateXAxisLabels(rotateLabelProps: IRotateLabelProps): number | undefined;
427
427
  export declare function wrapTextInsideDonut(selectorClass: string, maxWidth: number): void;
428
+ export declare function formatValueWithSIPrefix(value: number): string;
428
429
  export {};
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.wrapTextInsideDonut = exports.rotateXAxisLabels = exports.convertToLocaleString = exports.getAccessibleDataObject = exports.pointTypes = exports.CustomPoints = exports.Points = exports.getTypeOfAxis = exports.getMinMaxOfYAxis = exports.findHBCWANumericMinMaxOfY = exports.findVerticalNumericMinMaxOfY = exports.findVSBCNumericMinMaxOfY = exports.findNumericMinMaxOfY = exports.getDomainNRangeValues = exports.domainRageOfVerticalNumeric = exports.domainRangeOfVSBCNumeric = exports.domainRangeOfXStringAxis = exports.domainRangeOfNumericForHorizontalBarChartWithAxis = exports.domainRangeOfNumericForAreaChart = exports.domainRangeOfDateForAreaChart = exports.getXAxisType = exports.tooltipOfXAxislabels = exports.calculateLongestLabelWidth = exports.createYAxisLabels = exports.createWrapOfXLabels = exports.silceOrAppendToArray = exports.getUnique = exports.calloutData = exports.createStringYAxisForOtherCharts = exports.createStringYAxisForHorizontalBarChartWithAxis = exports.createStringYAxis = exports.createYAxisForOtherCharts = exports.createYAxisForHorizontalBarChartWithAxis = exports.createYAxis = exports.prepareDatapoints = exports.createStringXAxis = exports.createDateXAxis = exports.createNumericXAxis = exports.YAxisType = exports.XAxisTypes = exports.ChartTypes = void 0;
4
+ exports.formatValueWithSIPrefix = exports.wrapTextInsideDonut = exports.rotateXAxisLabels = exports.convertToLocaleString = exports.getAccessibleDataObject = exports.pointTypes = exports.CustomPoints = exports.Points = exports.getTypeOfAxis = exports.getMinMaxOfYAxis = exports.findHBCWANumericMinMaxOfY = exports.findVerticalNumericMinMaxOfY = exports.findVSBCNumericMinMaxOfY = exports.findNumericMinMaxOfY = exports.getDomainNRangeValues = exports.domainRageOfVerticalNumeric = exports.domainRangeOfVSBCNumeric = exports.domainRangeOfXStringAxis = exports.domainRangeOfNumericForHorizontalBarChartWithAxis = exports.domainRangeOfNumericForAreaChart = exports.domainRangeOfDateForAreaChart = exports.getXAxisType = exports.tooltipOfXAxislabels = exports.calculateLongestLabelWidth = exports.createYAxisLabels = exports.createWrapOfXLabels = exports.silceOrAppendToArray = exports.getUnique = exports.calloutData = exports.createStringYAxisForOtherCharts = exports.createStringYAxisForHorizontalBarChartWithAxis = exports.createStringYAxis = exports.createYAxisForOtherCharts = exports.createYAxisForHorizontalBarChartWithAxis = exports.createYAxis = exports.prepareDatapoints = exports.createStringXAxis = exports.createDateXAxis = exports.createNumericXAxis = exports.YAxisType = exports.XAxisTypes = exports.ChartTypes = void 0;
5
5
  var tslib_1 = require("tslib");
6
6
  var d3_axis_1 = require("d3-axis");
7
7
  var d3_array_1 = require("d3-array");
@@ -10,6 +10,7 @@ var d3_selection_1 = require("d3-selection");
10
10
  var d3_format_1 = require("d3-format");
11
11
  var d3TimeFormat = require("d3-time-format");
12
12
  var d3_time_1 = require("d3-time");
13
+ var d3_format_2 = require("d3-format");
13
14
  var ChartTypes;
14
15
  (function (ChartTypes) {
15
16
  ChartTypes[ChartTypes["AreaChart"] = 0] = "AreaChart";
@@ -1081,4 +1082,15 @@ function wrapTextInsideDonut(selectorClass, maxWidth) {
1081
1082
  });
1082
1083
  }
1083
1084
  exports.wrapTextInsideDonut = wrapTextInsideDonut;
1085
+ function formatValueWithSIPrefix(value) {
1086
+ var specifier;
1087
+ if (value < 1000) {
1088
+ specifier = '.2~'; // upto 2 decimal places without insignificant trailing zeros
1089
+ }
1090
+ else {
1091
+ specifier = '.1'; // upto 1 decimal place
1092
+ }
1093
+ return (0, d3_format_2.formatPrefix)(specifier, value)(value);
1094
+ }
1095
+ exports.formatValueWithSIPrefix = formatValueWithSIPrefix;
1084
1096
  //# sourceMappingURL=utilities.js.map