@fluentui/react-charting 5.16.43 → 5.16.45

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 (150) hide show
  1. package/CHANGELOG.json +37 -1
  2. package/CHANGELOG.md +21 -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/CommonComponents/CartesianChart.base.d.ts +2 -0
  10. package/lib/components/CommonComponents/CartesianChart.base.js +59 -15
  11. package/lib/components/CommonComponents/CartesianChart.base.js.map +1 -1
  12. package/lib/components/CommonComponents/CartesianChart.styles.js +3 -0
  13. package/lib/components/CommonComponents/CartesianChart.styles.js.map +1 -1
  14. package/lib/components/CommonComponents/CartesianChart.types.d.ts +9 -0
  15. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  16. package/lib/components/GaugeChart/GaugeChart.base.d.ts +67 -0
  17. package/lib/components/GaugeChart/GaugeChart.base.js +376 -0
  18. package/lib/components/GaugeChart/GaugeChart.base.js.map +1 -0
  19. package/lib/components/GaugeChart/GaugeChart.d.ts +3 -0
  20. package/lib/components/GaugeChart/GaugeChart.js +5 -0
  21. package/lib/components/GaugeChart/GaugeChart.js.map +1 -0
  22. package/lib/components/GaugeChart/GaugeChart.styles.d.ts +2 -0
  23. package/lib/components/GaugeChart/GaugeChart.styles.js +118 -0
  24. package/lib/components/GaugeChart/GaugeChart.styles.js.map +1 -0
  25. package/lib/components/GaugeChart/GaugeChart.types.d.ts +207 -0
  26. package/lib/components/GaugeChart/GaugeChart.types.js +6 -0
  27. package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -0
  28. package/lib/components/GaugeChart/index.d.ts +2 -0
  29. package/lib/components/GaugeChart/index.js +3 -0
  30. package/lib/components/GaugeChart/index.js.map +1 -0
  31. package/lib/components/LineChart/LineChart.base.d.ts +1 -0
  32. package/lib/components/LineChart/LineChart.base.js +4 -1
  33. package/lib/components/LineChart/LineChart.base.js.map +1 -1
  34. package/lib/components/LineChart/LineChart.types.d.ts +2 -2
  35. package/lib/components/LineChart/LineChart.types.js.map +1 -1
  36. package/lib/components/LineChart/eventAnnotation/EventAnnotation.d.ts +2 -0
  37. package/lib/components/LineChart/eventAnnotation/EventAnnotation.js +6 -3
  38. package/lib/components/LineChart/eventAnnotation/EventAnnotation.js.map +1 -1
  39. package/lib/components/LineChart/eventAnnotation/LabelLink.d.ts +3 -1
  40. package/lib/components/LineChart/eventAnnotation/LabelLink.js +6 -3
  41. package/lib/components/LineChart/eventAnnotation/LabelLink.js.map +1 -1
  42. package/lib/index.d.ts +1 -0
  43. package/lib/index.js +1 -0
  44. package/lib/index.js.map +1 -1
  45. package/lib/utilities/SVGTooltipText.d.ts +81 -0
  46. package/lib/utilities/SVGTooltipText.js +173 -0
  47. package/lib/utilities/SVGTooltipText.js.map +1 -0
  48. package/lib/utilities/utilities.d.ts +15 -8
  49. package/lib/utilities/utilities.js +56 -28
  50. package/lib/utilities/utilities.js.map +1 -1
  51. package/lib/version.js +1 -1
  52. package/lib/version.js.map +1 -1
  53. package/lib-amd/GaugeChart.d.ts +1 -0
  54. package/lib-amd/GaugeChart.js +6 -0
  55. package/lib-amd/GaugeChart.js.map +1 -0
  56. package/lib-amd/components/CommonComponents/CartesianChart.base.d.ts +2 -0
  57. package/lib-amd/components/CommonComponents/CartesianChart.base.js +58 -14
  58. package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
  59. package/lib-amd/components/CommonComponents/CartesianChart.styles.js +3 -0
  60. package/lib-amd/components/CommonComponents/CartesianChart.styles.js.map +1 -1
  61. package/lib-amd/components/CommonComponents/CartesianChart.types.d.ts +9 -0
  62. package/lib-amd/components/CommonComponents/CartesianChart.types.js.map +1 -1
  63. package/lib-amd/components/GaugeChart/GaugeChart.base.d.ts +67 -0
  64. package/lib-amd/components/GaugeChart/GaugeChart.base.js +370 -0
  65. package/lib-amd/components/GaugeChart/GaugeChart.base.js.map +1 -0
  66. package/lib-amd/components/GaugeChart/GaugeChart.d.ts +3 -0
  67. package/lib-amd/components/GaugeChart/GaugeChart.js +7 -0
  68. package/lib-amd/components/GaugeChart/GaugeChart.js.map +1 -0
  69. package/lib-amd/components/GaugeChart/GaugeChart.styles.d.ts +2 -0
  70. package/lib-amd/components/GaugeChart/GaugeChart.styles.js +122 -0
  71. package/lib-amd/components/GaugeChart/GaugeChart.styles.js.map +1 -0
  72. package/lib-amd/components/GaugeChart/GaugeChart.types.d.ts +207 -0
  73. package/lib-amd/components/GaugeChart/GaugeChart.types.js +11 -0
  74. package/lib-amd/components/GaugeChart/GaugeChart.types.js.map +1 -0
  75. package/lib-amd/components/GaugeChart/index.d.ts +2 -0
  76. package/lib-amd/components/GaugeChart/index.js +7 -0
  77. package/lib-amd/components/GaugeChart/index.js.map +1 -0
  78. package/lib-amd/components/LineChart/LineChart.base.d.ts +1 -0
  79. package/lib-amd/components/LineChart/LineChart.base.js +4 -1
  80. package/lib-amd/components/LineChart/LineChart.base.js.map +1 -1
  81. package/lib-amd/components/LineChart/LineChart.types.d.ts +2 -2
  82. package/lib-amd/components/LineChart/LineChart.types.js.map +1 -1
  83. package/lib-amd/components/LineChart/eventAnnotation/EventAnnotation.d.ts +2 -0
  84. package/lib-amd/components/LineChart/eventAnnotation/EventAnnotation.js +6 -4
  85. package/lib-amd/components/LineChart/eventAnnotation/EventAnnotation.js.map +1 -1
  86. package/lib-amd/components/LineChart/eventAnnotation/LabelLink.d.ts +3 -1
  87. package/lib-amd/components/LineChart/eventAnnotation/LabelLink.js +6 -4
  88. package/lib-amd/components/LineChart/eventAnnotation/LabelLink.js.map +1 -1
  89. package/lib-amd/index.d.ts +1 -0
  90. package/lib-amd/index.js +2 -1
  91. package/lib-amd/index.js.map +1 -1
  92. package/lib-amd/utilities/SVGTooltipText.d.ts +81 -0
  93. package/lib-amd/utilities/SVGTooltipText.js +174 -0
  94. package/lib-amd/utilities/SVGTooltipText.js.map +1 -0
  95. package/lib-amd/utilities/utilities.d.ts +15 -8
  96. package/lib-amd/utilities/utilities.js +59 -31
  97. package/lib-amd/utilities/utilities.js.map +1 -1
  98. package/lib-amd/version.js +1 -1
  99. package/lib-amd/version.js.map +1 -1
  100. package/lib-commonjs/GaugeChart.d.ts +1 -0
  101. package/lib-commonjs/GaugeChart.js +5 -0
  102. package/lib-commonjs/GaugeChart.js.map +1 -0
  103. package/lib-commonjs/components/CommonComponents/CartesianChart.base.d.ts +2 -0
  104. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js +58 -14
  105. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
  106. package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js +3 -0
  107. package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js.map +1 -1
  108. package/lib-commonjs/components/CommonComponents/CartesianChart.types.d.ts +9 -0
  109. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  110. package/lib-commonjs/components/GaugeChart/GaugeChart.base.d.ts +67 -0
  111. package/lib-commonjs/components/GaugeChart/GaugeChart.base.js +379 -0
  112. package/lib-commonjs/components/GaugeChart/GaugeChart.base.js.map +1 -0
  113. package/lib-commonjs/components/GaugeChart/GaugeChart.d.ts +3 -0
  114. package/lib-commonjs/components/GaugeChart/GaugeChart.js +8 -0
  115. package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -0
  116. package/lib-commonjs/components/GaugeChart/GaugeChart.styles.d.ts +2 -0
  117. package/lib-commonjs/components/GaugeChart/GaugeChart.styles.js +122 -0
  118. package/lib-commonjs/components/GaugeChart/GaugeChart.styles.js.map +1 -0
  119. package/lib-commonjs/components/GaugeChart/GaugeChart.types.d.ts +207 -0
  120. package/lib-commonjs/components/GaugeChart/GaugeChart.types.js +9 -0
  121. package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +1 -0
  122. package/lib-commonjs/components/GaugeChart/index.d.ts +2 -0
  123. package/lib-commonjs/components/GaugeChart/index.js +6 -0
  124. package/lib-commonjs/components/GaugeChart/index.js.map +1 -0
  125. package/lib-commonjs/components/LineChart/LineChart.base.d.ts +1 -0
  126. package/lib-commonjs/components/LineChart/LineChart.base.js +4 -1
  127. package/lib-commonjs/components/LineChart/LineChart.base.js.map +1 -1
  128. package/lib-commonjs/components/LineChart/LineChart.types.d.ts +2 -2
  129. package/lib-commonjs/components/LineChart/LineChart.types.js.map +1 -1
  130. package/lib-commonjs/components/LineChart/eventAnnotation/EventAnnotation.d.ts +2 -0
  131. package/lib-commonjs/components/LineChart/eventAnnotation/EventAnnotation.js +6 -3
  132. package/lib-commonjs/components/LineChart/eventAnnotation/EventAnnotation.js.map +1 -1
  133. package/lib-commonjs/components/LineChart/eventAnnotation/LabelLink.d.ts +3 -1
  134. package/lib-commonjs/components/LineChart/eventAnnotation/LabelLink.js +6 -3
  135. package/lib-commonjs/components/LineChart/eventAnnotation/LabelLink.js.map +1 -1
  136. package/lib-commonjs/index.d.ts +1 -0
  137. package/lib-commonjs/index.js +1 -0
  138. package/lib-commonjs/index.js.map +1 -1
  139. package/lib-commonjs/utilities/SVGTooltipText.d.ts +81 -0
  140. package/lib-commonjs/utilities/SVGTooltipText.js +176 -0
  141. package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -0
  142. package/lib-commonjs/utilities/utilities.d.ts +15 -8
  143. package/lib-commonjs/utilities/utilities.js +59 -30
  144. package/lib-commonjs/utilities/utilities.js.map +1 -1
  145. package/lib-commonjs/version.js +1 -1
  146. package/lib-commonjs/version.js.map +1 -1
  147. package/package.json +1 -1
  148. package/src/components/CommonComponents/CartesianChart.types.ts +11 -0
  149. package/src/components/GaugeChart/GaugeChart.types.ts +258 -0
  150. package/src/components/LineChart/LineChart.types.ts +2 -2
@@ -1,10 +1,11 @@
1
- define(["require", "exports", "react", "@fluentui/react", "./Textbox"], function (require, exports, React, react_1, Textbox_1) {
1
+ define(["require", "exports", "react", "@fluentui/react", "./Textbox", "../../../utilities/colors"], function (require, exports, React, react_1, Textbox_1, colors_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.LabelLink = void 0;
5
5
  var LabelLink = function (props) {
6
+ var _a, _b;
6
7
  var gRef = React.useRef(null);
7
- var _a = React.useState(false), showCard = _a[0], setShowCard = _a[1];
8
+ var _c = React.useState(false), showCard = _c[0], setShowCard = _c[1];
8
9
  var onDismiss = function () { return setShowCard(false); };
9
10
  var onClick = function () { return setShowCard(true); };
10
11
  var onRenderCell = function (i) { return React.createElement("div", { "data-is-focusable": true }, i && i()); };
@@ -22,8 +23,9 @@ define(["require", "exports", "react", "@fluentui/react", "./Textbox"], function
22
23
  }
23
24
  }
24
25
  var text;
25
- var darkThemeMq = window.matchMedia('(prefers-color-scheme: dark)');
26
- var fill = darkThemeMq.matches ? 'rgb(255,255,255)' : props.textColor;
26
+ var fill = props.textColor
27
+ ? (0, colors_1.getColorFromToken)(props.textColor, (_a = props.theme) === null || _a === void 0 ? void 0 : _a.isInverted)
28
+ : (_b = props.theme) === null || _b === void 0 ? void 0 : _b.palette.black;
27
29
  if (props.labelDef.aggregatedIdx.length === 1) {
28
30
  text = props.lineDefs[props.labelDef.aggregatedIdx[0]].event;
29
31
  }
@@ -1 +1 @@
1
- {"version":3,"file":"LabelLink.js","sourceRoot":"../src/","sources":["components/LineChart/eventAnnotation/LabelLink.tsx"],"names":[],"mappings":";;;;IA0BO,IAAM,SAAS,GAA6C,UAAA,KAAK;QACtE,IAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAc,IAAI,CAAC,CAAC;QACvC,IAAA,KAA0B,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,EAA9C,QAAQ,QAAA,EAAE,WAAW,QAAyB,CAAC;QACtD,IAAM,SAAS,GAAG,cAAM,OAAA,WAAW,CAAC,KAAK,CAAC,EAAlB,CAA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AC7C,IAAI,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;SAC9D;aAAM;YACL,IAAI,GAAG,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;SAC/D;QAED,OAAO,CACL;YACE,2BAAG,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,uBAAqB,KAAK,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE;gBACpF,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;YACH,OAAO,CACP,CACJ,CAAC;IACJ,CAAC,CAAC;IAzDW,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":";;;;IA6BO,IAAM,SAAS,GAA6C,UAAA,KAAK;;QACtE,IAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAc,IAAI,CAAC,CAAC;QACvC,IAAA,KAA0B,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,EAA9C,QAAQ,QAAA,EAAE,WAAW,QAAyB,CAAC;QACtD,IAAM,SAAS,G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O,CAAC,KAAK,CAAC;QAE/B,IAAI,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE;YAC7C,IAAI,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;SAC9D;aAAM;YACL,IAAI,GAAG,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;SAC/D;QAED,OAAO,CACL;YACE,2BAAG,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,uBAAqB,KAAK,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE;gBACpF,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;YACH,OAAO,CACP,CACJ,CAAC;IACJ,CAAC,CAAC;IA3DW,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';
package/lib-amd/index.js CHANGED
@@ -1,4 +1,4 @@
1
- define(["require", "exports", "tslib", "./HorizontalBarChart", "./DonutChart", "./Legends", "./LineChart", "./AreaChart", "./PieChart", "./StackedBarChart", "./VerticalBarChart", "./VerticalStackedBarChart", "./GroupedVerticalBarChart", "./CartesianChart", "./types/index", "./utilities/ChartHoverCard/index", "./HeatMapChart", "./SankeyChart", "./TreeChart", "./Sparkline", "./HorizontalBarChartWithAxis", "./utilities/colors", "./version"], function (require, exports, tslib_1, HorizontalBarChart_1, DonutChart_1, Legends_1, LineChart_1, AreaChart_1, PieChart_1, StackedBarChart_1, VerticalBarChart_1, VerticalStackedBarChart_1, GroupedVerticalBarChart_1, CartesianChart_1, index_1, index_2, HeatMapChart_1, SankeyChart_1, TreeChart_1, Sparkline_1, HorizontalBarChartWithAxis_1, colors_1) {
1
+ define(["require", "exports", "tslib", "./HorizontalBarChart", "./DonutChart", "./Legends", "./LineChart", "./AreaChart", "./PieChart", "./StackedBarChart", "./VerticalBarChart", "./VerticalStackedBarChart", "./GroupedVerticalBarChart", "./CartesianChart", "./types/index", "./utilities/ChartHoverCard/index", "./HeatMapChart", "./SankeyChart", "./TreeChart", "./Sparkline", "./HorizontalBarChartWithAxis", "./utilities/colors", "./GaugeChart", "./version"], function (require, exports, tslib_1, HorizontalBarChart_1, DonutChart_1, Legends_1, LineChart_1, AreaChart_1, PieChart_1, StackedBarChart_1, VerticalBarChart_1, VerticalStackedBarChart_1, GroupedVerticalBarChart_1, CartesianChart_1, index_1, index_2, HeatMapChart_1, SankeyChart_1, TreeChart_1, Sparkline_1, HorizontalBarChartWithAxis_1, colors_1, GaugeChart_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  tslib_1.__exportStar(HorizontalBarChart_1, exports);
@@ -20,5 +20,6 @@ define(["require", "exports", "tslib", "./HorizontalBarChart", "./DonutChart", "
20
20
  tslib_1.__exportStar(Sparkline_1, exports);
21
21
  tslib_1.__exportStar(HorizontalBarChartWithAxis_1, exports);
22
22
  tslib_1.__exportStar(colors_1, exports);
23
+ tslib_1.__exportStar(GaugeChart_1, exports);
23
24
  });
24
25
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["index.ts"],"names":[],"mappings":";;;IAAA,oDAAqC;IACrC,4CAA6B;IAC7B,yCAA0B;IAC1B,2CAA4B;IAC5B,2CAA4B;IAC5B,0CAA2B;IAC3B,iDAAkC;IAClC,kDAAmC;IACnC,yDAA0C;IAC1C,yDAA0C;IAC1C,gDAAiC;IACjC,uCAA8B;IAC9B,uCAAiD;IACjD,8CAA+B;IAC/B,6CAA8B;IAC9B,2CAA4B;IAC5B,2CAA4B;IAC5B,4DAA6C;IAC7C,wCAAmC","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":";;;IAAA,oDAAqC;IACrC,4CAA6B;IAC7B,yCAA0B;IAC1B,2CAA4B;IAC5B,2CAA4B;IAC5B,0CAA2B;IAC3B,iDAAkC;IAClC,kDAAmC;IACnC,yDAA0C;IAC1C,yDAA0C;IAC1C,gDAAiC;IACjC,uCAA8B;IAC9B,uCAAiD;IACjD,8CAA+B;IAC/B,6CAA8B;IAC9B,2CAA4B;IAC5B,2CAA4B;IAC5B,4DAA6C;IAC7C,wCAAmC;IACnC,4CAA6B","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,174 @@
1
+ define(["require", "exports", "tslib", "react", "@fluentui/react/lib/Tooltip", "../Utilities"], function (require, exports, tslib_1, React, Tooltip_1, Utilities_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.SVGTooltipText = void 0;
5
+ /**
6
+ * Component to render an SVG text element with an optional tooltip.
7
+ * The tooltip appears on hovering and focusing the element when its content overflows.
8
+ */
9
+ var SVGTooltipText = /** @class */ (function (_super) {
10
+ tslib_1.__extends(SVGTooltipText, _super);
11
+ function SVGTooltipText(props) {
12
+ var _this = _super.call(this, props) || this;
13
+ /** The element that gets the hover events */
14
+ _this._tooltipHost = React.createRef();
15
+ _this._tooltipHostId = (0, Utilities_1.getId)('tooltip-host');
16
+ _this.show = function () {
17
+ _this._toggleTooltip(true);
18
+ };
19
+ _this.dismiss = function () {
20
+ _this._hideTooltip();
21
+ };
22
+ _this._getTargetElement = function () {
23
+ if (!_this._tooltipHost.current) {
24
+ return undefined;
25
+ }
26
+ return _this._tooltipHost.current;
27
+ };
28
+ _this._onTooltipFocus = function (ev) {
29
+ if (_this._ignoreNextFocusEvent) {
30
+ _this._ignoreNextFocusEvent = false;
31
+ return;
32
+ }
33
+ _this._onTooltipMouseEnter(ev);
34
+ };
35
+ _this._onTooltipBlur = function (ev) {
36
+ // The focused element gets a blur event when the document loses focus
37
+ // (e.g. switching tabs in the browser), but we don't want to show the
38
+ // tooltip again when the document gets focus back. Handle this case by
39
+ // checking if the blurred element is still the document's activeElement,
40
+ // and ignoring when it next gets focus back.
41
+ // See https://github.com/microsoft/fluentui/issues/13541
42
+ _this._ignoreNextFocusEvent = (document === null || document === void 0 ? void 0 : document.activeElement) === ev.target;
43
+ _this._dismissTimerId = _this._async.setTimeout(function () {
44
+ _this._hideTooltip();
45
+ }, 0);
46
+ };
47
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
48
+ _this._onTooltipMouseEnter = function (ev) {
49
+ var delay = _this.props.delay;
50
+ if (SVGTooltipText._currentVisibleTooltip && SVGTooltipText._currentVisibleTooltip !== _this) {
51
+ SVGTooltipText._currentVisibleTooltip.dismiss();
52
+ }
53
+ SVGTooltipText._currentVisibleTooltip = _this;
54
+ if (!_this.state.isOverflowing) {
55
+ return;
56
+ }
57
+ if (ev.target && (0, Utilities_1.portalContainsElement)(ev.target, _this._getTargetElement())) {
58
+ // Do not show tooltip when target is inside a portal relative to TooltipHost.
59
+ return;
60
+ }
61
+ _this._clearDismissTimer();
62
+ _this._clearOpenTimer();
63
+ if (delay !== Tooltip_1.TooltipDelay.zero) {
64
+ var delayTime = _this._getDelayTime(delay); // non-null assertion because we set it in `defaultProps`
65
+ _this._openTimerId = _this._async.setTimeout(function () {
66
+ _this._toggleTooltip(true);
67
+ }, delayTime);
68
+ }
69
+ else {
70
+ _this._toggleTooltip(true);
71
+ }
72
+ };
73
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
74
+ _this._onTooltipMouseLeave = function (ev) {
75
+ var closeDelay = _this.props.closeDelay;
76
+ _this._clearDismissTimer();
77
+ _this._clearOpenTimer();
78
+ if (closeDelay) {
79
+ _this._dismissTimerId = _this._async.setTimeout(function () {
80
+ _this._toggleTooltip(false);
81
+ }, closeDelay);
82
+ }
83
+ else {
84
+ _this._toggleTooltip(false);
85
+ }
86
+ if (SVGTooltipText._currentVisibleTooltip === _this) {
87
+ SVGTooltipText._currentVisibleTooltip = undefined;
88
+ }
89
+ };
90
+ _this._onTooltipKeyDown = function (ev) {
91
+ // eslint-disable-next-line deprecation/deprecation
92
+ if ((ev.which === Utilities_1.KeyCodes.escape || ev.ctrlKey) && _this.state.isTooltipVisible) {
93
+ _this._hideTooltip();
94
+ ev.stopPropagation();
95
+ }
96
+ };
97
+ _this._clearDismissTimer = function () {
98
+ _this._async.clearTimeout(_this._dismissTimerId);
99
+ };
100
+ _this._clearOpenTimer = function () {
101
+ _this._async.clearTimeout(_this._openTimerId);
102
+ };
103
+ _this._hideTooltip = function () {
104
+ _this._clearOpenTimer();
105
+ _this._clearDismissTimer();
106
+ _this._toggleTooltip(false);
107
+ };
108
+ _this._toggleTooltip = function (isTooltipVisible) {
109
+ if (_this.state.isTooltipVisible !== isTooltipVisible) {
110
+ _this.setState({ isTooltipVisible: isTooltipVisible });
111
+ }
112
+ };
113
+ _this._getDelayTime = function (delay) {
114
+ switch (delay) {
115
+ case Tooltip_1.TooltipDelay.medium:
116
+ return 300;
117
+ case Tooltip_1.TooltipDelay.long:
118
+ return 500;
119
+ default:
120
+ return 0;
121
+ }
122
+ };
123
+ _this._wrapContent = function () {
124
+ var _a = _this.props, content = _a.content, wrapContent = _a.wrapContent, _b = _a.maxWidth, maxWidth = _b === void 0 ? Number.POSITIVE_INFINITY : _b, maxHeight = _a.maxHeight;
125
+ var isOverflowing = false;
126
+ if (content && wrapContent && wrapContent(content, _this._tooltipHostId, maxWidth, maxHeight)) {
127
+ isOverflowing = true;
128
+ }
129
+ if (_this.state.isOverflowing !== isOverflowing) {
130
+ _this.setState({ isOverflowing: isOverflowing });
131
+ }
132
+ };
133
+ _this.state = {
134
+ isTooltipVisible: false,
135
+ isOverflowing: false,
136
+ };
137
+ _this._async = new Utilities_1.Async(_this);
138
+ return _this;
139
+ }
140
+ SVGTooltipText.prototype.render = function () {
141
+ var _a = this.props, content = _a.content, tooltipProps = _a.tooltipProps, textProps = _a.textProps;
142
+ var isTooltipVisible = this.state.isTooltipVisible;
143
+ var tooltipRenderProps = tslib_1.__assign({ content: content, targetElement: this._getTargetElement(), calloutProps: {
144
+ onDismiss: this._hideTooltip,
145
+ onMouseEnter: this._onTooltipMouseEnter,
146
+ onMouseLeave: this._onTooltipMouseLeave,
147
+ }, onMouseEnter: this._onTooltipMouseEnter, onMouseLeave: this._onTooltipMouseLeave }, tooltipProps);
148
+ var showTooltip = isTooltipVisible && !!content;
149
+ return (React.createElement(React.Fragment, null,
150
+ 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),
151
+ showTooltip && React.createElement(Tooltip_1.Tooltip, tslib_1.__assign({}, tooltipRenderProps))));
152
+ };
153
+ SVGTooltipText.prototype.componentDidMount = function () {
154
+ this._wrapContent();
155
+ };
156
+ SVGTooltipText.prototype.componentDidUpdate = function (prevProps) {
157
+ if (this.props.maxWidth !== prevProps.maxWidth || this.props.maxHeight !== prevProps.maxHeight) {
158
+ this._wrapContent();
159
+ }
160
+ };
161
+ SVGTooltipText.prototype.componentWillUnmount = function () {
162
+ if (SVGTooltipText._currentVisibleTooltip && SVGTooltipText._currentVisibleTooltip === this) {
163
+ SVGTooltipText._currentVisibleTooltip = undefined;
164
+ }
165
+ this._async.dispose();
166
+ };
167
+ SVGTooltipText.defaultProps = {
168
+ delay: Tooltip_1.TooltipDelay.medium,
169
+ };
170
+ return SVGTooltipText;
171
+ }(React.Component));
172
+ exports.SVGTooltipText = SVGTooltipText;
173
+ });
174
+ //# sourceMappingURL=SVGTooltipText.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SVGTooltipText.js","sourceRoot":"../src/","sources":["utilities/SVGTooltipText.tsx"],"names":[],"mappings":";;;;IAuDA;;;OAGG;IACH;QACU,0CAA2D;QAkBnE,wBAAY,KAA2B;YAAvC,YACE,kBAAM,KAAK,CAAC,SAQb;YAlBD,6CAA6C;YACrC,kBAAY,GAAG,KAAK,CAAC,SAAS,EAAkB,CAAC;YAKjD,oBAAc,GAAG,IAAA,iBAAK,EAAC,cAAc,CAAC,CAAC;YAuExC,UAAI,GAAG;gBACZ,KAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;YAC5B,CAAC,CAAC;YAEK,aAAO,GAAG;gBACf,KAAI,CAAC,YAAY,EAAE,CAAC;YACtB,CAAC,CAAC;YAEM,uBAAiB,GAAG;gBAC1B,IAAI,CAAC,KAAI,CAAC,YAAY,CAAC,OAAO,EAAE;oBAC9B,OAAO,SAAS,CAAC;iBAClB;gBAED,OAAO,KAAI,CAAC,YAAY,CAAC,OAAiC,CAAC;YAC7D,CAAC,CAAC;YAEM,qBAAe,GAAG,UAAC,EAAgC;gBACzD,IAAI,KAAI,CAAC,qBAAqB,EAAE;oBAC9B,KAAI,CAAC,qBAAqB,GAAG,KAAK,CAAC;oBACnC,OAAO;iBACR;gBAED,KAAI,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC;YAChC,CAAC,CAAC;YAEM,oBAAc,GAAG,UAAC,EAAgC;gBACxD,sEAAsE;gBACtE,sEAAsE;gBACtE,uEAAuE;gBACvE,yEAAyE;gBACzE,6CAA6C;gBAC7C,yDAAyD;gBACzD,KA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YACE,IAAI,cAAc,CAAC,sBAAsB,IAAI,cAAc,CAAC,sBAAsB,KAAK,IAAI,EAAE;gBAC3F,cAAc,CAAC,sBAAsB,GAAG,SAAS,CAAC;aACnD;YAED,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACxB,CAAC;QAjFa,2BAAY,GAAG;YAC3B,KAAK,EAAE,sBAAY,CAAC,MAAM;SAC3B,CAAC;QA+NJ,qBAAC;KAAA,AArOD,CACU,KAAK,CAAC,SAAS,GAoOxB;IArOY,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"]}
@@ -106,14 +106,20 @@ export interface IYAxisParams {
106
106
  * @export
107
107
  * @param {IXAxisParams} xAxisParams
108
108
  */
109
- export declare function createNumericXAxis(xAxisParams: IXAxisParams, chartType: ChartTypes, culture?: string): import("d3-scale").ScaleLinear<number, number, never>;
109
+ export declare function createNumericXAxis(xAxisParams: IXAxisParams, chartType: ChartTypes, culture?: string): {
110
+ xScale: import("d3-scale").ScaleLinear<number, number, never>;
111
+ tickValues: string[];
112
+ };
110
113
  /**
111
114
  * Creating Date x axis of the Chart
112
115
  * @export
113
116
  * @param {IXAxisParams} xAxisParams
114
117
  * @param {ITickParams} tickParams
115
118
  */
116
- export declare function createDateXAxis(xAxisParams: IXAxisParams, tickParams: ITickParams, culture?: string, options?: Intl.DateTimeFormatOptions, timeFormatLocale?: d3TimeFormat.TimeLocaleDefinition, customDateTimeFormatter?: (dateTime: Date) => string): import("d3-scale").ScaleTime<number, number, never>;
119
+ export declare function createDateXAxis(xAxisParams: IXAxisParams, tickParams: ITickParams, culture?: string, options?: Intl.DateTimeFormatOptions, timeFormatLocale?: d3TimeFormat.TimeLocaleDefinition, customDateTimeFormatter?: (dateTime: Date) => string): {
120
+ xScale: import("d3-scale").ScaleTime<number, number, never>;
121
+ tickValues: string[];
122
+ };
117
123
  /**
118
124
  * Create String X axis
119
125
  * Currently using for only Vetical stacked bar chart and grouped vertical bar chart
@@ -123,7 +129,10 @@ export declare function createDateXAxis(xAxisParams: IXAxisParams, tickParams: I
123
129
  * @param {string[]} dataset
124
130
  * @returns
125
131
  */
126
- export declare function createStringXAxis(xAxisParams: IXAxisParams, tickParams: ITickParams, dataset: string[], culture?: string): import("d3-scale").ScaleBand<string>;
132
+ export declare function createStringXAxis(xAxisParams: IXAxisParams, tickParams: ITickParams, dataset: string[], culture?: string): {
133
+ xScale: import("d3-scale").ScaleBand<string>;
134
+ tickValues: string[];
135
+ };
127
136
  /**
128
137
  * This method used for creating data points for the y axis.
129
138
  * @export
@@ -207,12 +216,9 @@ export declare function createWrapOfXLabels(wrapLabelProps: IWrapLabelProps): nu
207
216
  */
208
217
  export declare function createYAxisLabels(node: SVGElement | null, yAxis: any, noOfCharsToTruncate: number, truncateLabel: boolean, xValue: number, isRtl: boolean): void;
209
218
  /**
210
- * This function is calculating the length of longest Y axis label in px ,so that we are able to
211
- * create the cartesian chart by shifting that many points to the right/left.
212
- * @param points
213
- * @returns
219
+ * Calculates the width of the longest axis label in pixels
214
220
  */
215
- export declare function calculateLongestYAxisLabel(points: IHorizontalBarChartWithAxisDataPoint[], yAxisElement: SVGElement): number;
221
+ export declare const calculateLongestLabelWidth: (labels: (string | number)[], query?: string) => number;
216
222
  /**
217
223
  * This method displays a tooltip to the x axis lables(tick values)
218
224
  * when prop 'showXAxisLablesTooltip' enables to the respected chart.
@@ -419,4 +425,5 @@ declare type LocaleStringDataProps = number | string | Date | undefined;
419
425
  export declare const convertToLocaleString: (data: LocaleStringDataProps, culture?: string) => LocaleStringDataProps;
420
426
  export declare function rotateXAxisLabels(rotateLabelProps: IRotateLabelProps): number | undefined;
421
427
  export declare function wrapTextInsideDonut(selectorClass: string, maxWidth: number): void;
428
+ export declare function formatValueWithSIPrefix(value: number): string;
422
429
  export {};
@@ -1,8 +1,8 @@
1
- define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-selection", "d3-format", "d3-time-format", "d3-time"], function (require, exports, tslib_1, d3_axis_1, d3_array_1, d3_scale_1, d3_selection_1, d3_format_1, d3TimeFormat, d3_time_1) {
1
+ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-selection", "d3-format", "d3-time-format", "d3-time", "d3-format"], function (require, exports, tslib_1, d3_axis_1, d3_array_1, d3_scale_1, d3_selection_1, d3_format_1, d3TimeFormat, d3_time_1, d3_format_2) {
2
2
  "use strict";
3
3
  var _a;
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- 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.calculateLongestYAxisLabel = 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
+ 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;
6
6
  var ChartTypes;
7
7
  (function (ChartTypes) {
8
8
  ChartTypes[ChartTypes["AreaChart"] = 0] = "AreaChart";
@@ -50,18 +50,20 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
50
50
  if (xAxisElement) {
51
51
  (0, d3_selection_1.select)(xAxisElement).call(xAxis).selectAll('text').attr('aria-hidden', 'true');
52
52
  }
53
- return xAxisScale;
53
+ var tickValues = xAxisScale.ticks(xAxisCount).map(xAxis.tickFormat());
54
+ return { xScale: xAxisScale, tickValues: tickValues };
54
55
  }
55
56
  exports.createNumericXAxis = createNumericXAxis;
56
57
  function multiFormat(date, locale) {
57
- var formatMillisecond = locale.format('.%L');
58
- var formatSecond = locale.format(':%S');
59
- var formatMinute = locale.format('%I:%M');
60
- var formatHour = locale.format('%I %p');
61
- var formatDay = locale.format('%a %d');
62
- var formatWeek = locale.format('%b %d');
63
- var formatMonth = locale.format('%B');
64
- var formatYear = locale.format('%Y');
58
+ var timeFormat = locale ? locale.format : d3TimeFormat.timeFormat;
59
+ var formatMillisecond = timeFormat('.%L');
60
+ var formatSecond = timeFormat(':%S');
61
+ var formatMinute = timeFormat('%I:%M');
62
+ var formatHour = timeFormat('%I %p');
63
+ var formatDay = timeFormat('%a %d');
64
+ var formatWeek = timeFormat('%b %d');
65
+ var formatMonth = timeFormat('%B');
66
+ var formatYear = timeFormat('%Y');
65
67
  return ((0, d3_time_1.timeSecond)(date) < date
66
68
  ? formatMillisecond
67
69
  : (0, d3_time_1.timeMinute)(date) < date
@@ -85,7 +87,8 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
85
87
  * @param {ITickParams} tickParams
86
88
  */
87
89
  function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLocale, customDateTimeFormatter) {
88
- var domainNRangeValues = xAxisParams.domainNRangeValues, xAxisElement = xAxisParams.xAxisElement, _a = xAxisParams.tickPadding, tickPadding = _a === void 0 ? 6 : _a, _b = xAxisParams.xAxistickSize, xAxistickSize = _b === void 0 ? 6 : _b, _c = xAxisParams.xAxisCount, xAxisCount = _c === void 0 ? 6 : _c;
90
+ var _a;
91
+ var domainNRangeValues = xAxisParams.domainNRangeValues, xAxisElement = xAxisParams.xAxisElement, _b = xAxisParams.tickPadding, tickPadding = _b === void 0 ? 6 : _b, _c = xAxisParams.xAxistickSize, xAxistickSize = _c === void 0 ? 6 : _c, _d = xAxisParams.xAxisCount, xAxisCount = _d === void 0 ? 6 : _d;
89
92
  var xAxisScale = (0, d3_scale_1.scaleTime)()
90
93
  .domain([domainNRangeValues.dStartValue, domainNRangeValues.dEndValue])
91
94
  .range([domainNRangeValues.rStartValue, domainNRangeValues.rEndValue]);
@@ -113,7 +116,12 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
113
116
  if (xAxisElement) {
114
117
  (0, d3_selection_1.select)(xAxisElement).call(xAxis).selectAll('text').attr('aria-hidden', 'true');
115
118
  }
116
- return xAxisScale;
119
+ var tickValues = ((_a = tickParams.tickValues) !== null && _a !== void 0 ? _a : xAxisScale.ticks(xAxisCount)).map(function (val, idx) {
120
+ var tickFormat = xAxis.tickFormat();
121
+ // val is a Date object. So when the tick format is not set, format val as a string to calculate its width
122
+ return tickFormat ? tickFormat(val, idx) : multiFormat(val);
123
+ });
124
+ return { xScale: xAxisScale, tickValues: tickValues };
117
125
  }
118
126
  exports.createDateXAxis = createDateXAxis;
119
127
  /**
@@ -142,7 +150,8 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
142
150
  if (xAxisParams.xAxisElement) {
143
151
  (0, d3_selection_1.select)(xAxisParams.xAxisElement).call(xAxis).selectAll('text').attr('aria-hidden', 'true');
144
152
  }
145
- return xAxisScale;
153
+ var tickValues = dataset.map(xAxis.tickFormat());
154
+ return { xScale: xAxisScale, tickValues: tickValues };
146
155
  }
147
156
  exports.createStringXAxis = createStringXAxis;
148
157
  /**
@@ -497,24 +506,32 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
497
506
  }
498
507
  exports.createYAxisLabels = createYAxisLabels;
499
508
  /**
500
- * This function is calculating the length of longest Y axis label in px ,so that we are able to
501
- * create the cartesian chart by shifting that many points to the right/left.
502
- * @param points
503
- * @returns
509
+ * Calculates the width of the longest axis label in pixels
504
510
  */
505
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
506
- function calculateLongestYAxisLabel(points, yAxisElement) {
507
- var maxLabelLength = 0;
508
- points.forEach(function (point) {
509
- var canvas = document.createElement('canvas');
510
- var ctx = canvas.getContext('2d');
511
- ctx.font = window.getComputedStyle(yAxisElement, null).getPropertyValue('font-size');
512
- var wordLengthInPixel = ctx.measureText(point.y).width;
513
- maxLabelLength = Math.max(wordLengthInPixel, maxLabelLength);
514
- });
515
- return maxLabelLength;
516
- }
517
- exports.calculateLongestYAxisLabel = calculateLongestYAxisLabel;
511
+ var calculateLongestLabelWidth = function (labels, query) {
512
+ if (query === void 0) { query = 'none'; }
513
+ var maxLabelWidth = 0;
514
+ var canvas = document.createElement('canvas');
515
+ var ctx = canvas.getContext('2d');
516
+ if (ctx) {
517
+ var axisText = document.querySelector(query);
518
+ if (axisText) {
519
+ var styles = window.getComputedStyle(axisText, null);
520
+ var fontWeight = styles.getPropertyValue('font-weight');
521
+ var fontSize = styles.getPropertyValue('font-size');
522
+ var fontFamily = styles.getPropertyValue('font-family');
523
+ ctx.font = "".concat(fontWeight, " ").concat(fontSize, " ").concat(fontFamily);
524
+ }
525
+ else {
526
+ ctx.font = '600 10px "Segoe UI"';
527
+ }
528
+ labels.forEach(function (label) {
529
+ maxLabelWidth = Math.max(ctx.measureText(label.toString()).width, maxLabelWidth);
530
+ });
531
+ }
532
+ return maxLabelWidth;
533
+ };
534
+ exports.calculateLongestLabelWidth = calculateLongestLabelWidth;
518
535
  /**
519
536
  * This method displays a tooltip to the x axis lables(tick values)
520
537
  * when prop 'showXAxisLablesTooltip' enables to the respected chart.
@@ -1057,5 +1074,16 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
1057
1074
  });
1058
1075
  }
1059
1076
  exports.wrapTextInsideDonut = wrapTextInsideDonut;
1077
+ function formatValueWithSIPrefix(value) {
1078
+ var specifier;
1079
+ if (value < 1000) {
1080
+ specifier = '.2~'; // upto 2 decimal places without insignificant trailing zeros
1081
+ }
1082
+ else {
1083
+ specifier = '.1'; // upto 1 decimal place
1084
+ }
1085
+ return (0, d3_format_2.formatPrefix)(specifier, value)(value);
1086
+ }
1087
+ exports.formatValueWithSIPrefix = formatValueWithSIPrefix;
1060
1088
  });
1061
1089
  //# sourceMappingURL=utilities.js.map