@fluentui/react-charts 9.0.2 → 9.0.3

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 (185) hide show
  1. package/CHANGELOG.md +48 -7
  2. package/dist/index.d.ts +767 -0
  3. package/lib/AreaChart.js +1 -0
  4. package/lib/AreaChart.js.map +1 -0
  5. package/lib/HeatMapChart.js +1 -0
  6. package/lib/HeatMapChart.js.map +1 -0
  7. package/lib/HorizontalBarChartWithAxis.js +1 -0
  8. package/lib/HorizontalBarChartWithAxis.js.map +1 -0
  9. package/lib/SankeyChart.js +1 -0
  10. package/lib/SankeyChart.js.map +1 -0
  11. package/lib/VerticalStackedBarChart.js +1 -0
  12. package/lib/VerticalStackedBarChart.js.map +1 -0
  13. package/lib/components/AreaChart/AreaChart.js +775 -0
  14. package/lib/components/AreaChart/AreaChart.js.map +1 -0
  15. package/lib/components/AreaChart/AreaChart.types.js +4 -0
  16. package/lib/components/AreaChart/AreaChart.types.js.map +1 -0
  17. package/lib/components/AreaChart/index.js +3 -0
  18. package/lib/components/AreaChart/index.js.map +1 -0
  19. package/lib/components/AreaChart/useAreaChartStyles.styles.js +64 -0
  20. package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -0
  21. package/lib/components/CommonComponents/CartesianChart.js +30 -14
  22. package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
  23. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  24. package/lib/components/DeclarativeChart/DeclarativeChart.js +112 -65
  25. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  26. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +570 -159
  27. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  28. package/lib/components/DonutChart/Arc/Arc.js +1 -1
  29. package/lib/components/DonutChart/Arc/Arc.js.map +1 -1
  30. package/lib/components/DonutChart/DonutChart.js +1 -1
  31. package/lib/components/DonutChart/DonutChart.js.map +1 -1
  32. package/lib/components/GaugeChart/GaugeChart.js +3 -0
  33. package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
  34. package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -1
  35. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +9 -0
  36. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  37. package/lib/components/HeatMapChart/HeatMapChart.js +588 -0
  38. package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -0
  39. package/lib/components/HeatMapChart/HeatMapChart.types.js +4 -0
  40. package/lib/components/HeatMapChart/HeatMapChart.types.js.map +1 -0
  41. package/lib/components/HeatMapChart/index.js +3 -0
  42. package/lib/components/HeatMapChart/index.js.map +1 -0
  43. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js +46 -0
  44. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -0
  45. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +571 -0
  46. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -0
  47. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js +4 -0
  48. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -0
  49. package/lib/components/HorizontalBarChartWithAxis/index.js +3 -0
  50. package/lib/components/HorizontalBarChartWithAxis/index.js.map +1 -0
  51. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +76 -0
  52. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -0
  53. package/lib/components/Legends/Legends.js +38 -37
  54. package/lib/components/Legends/Legends.js.map +1 -1
  55. package/lib/components/LineChart/LineChart.js +43 -35
  56. package/lib/components/LineChart/LineChart.js.map +1 -1
  57. package/lib/components/SankeyChart/SankeyChart.js +1022 -0
  58. package/lib/components/SankeyChart/SankeyChart.js.map +1 -0
  59. package/lib/components/SankeyChart/SankeyChart.types.js +3 -0
  60. package/lib/components/SankeyChart/SankeyChart.types.js.map +1 -0
  61. package/lib/components/SankeyChart/index.js +3 -0
  62. package/lib/components/SankeyChart/index.js.map +1 -0
  63. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +109 -0
  64. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -0
  65. package/lib/components/ScatterChart/ScatterChart.js +46 -59
  66. package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
  67. package/lib/components/VerticalBarChart/VerticalBarChart.js +165 -88
  68. package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  69. package/lib/components/VerticalBarChart/VerticalBarChart.types.js.map +1 -1
  70. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +904 -0
  71. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -0
  72. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js +1 -0
  73. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -0
  74. package/lib/components/VerticalStackedBarChart/index.js +3 -0
  75. package/lib/components/VerticalStackedBarChart/index.js.map +1 -0
  76. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +73 -0
  77. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -0
  78. package/lib/index.js +5 -0
  79. package/lib/index.js.map +1 -1
  80. package/lib/types/DataPoint.js +1 -3
  81. package/lib/types/DataPoint.js.map +1 -1
  82. package/lib/utilities/SVGTooltipText.js +49 -4
  83. package/lib/utilities/SVGTooltipText.js.map +1 -1
  84. package/lib/utilities/colors.js +20 -0
  85. package/lib/utilities/colors.js.map +1 -1
  86. package/lib/utilities/string.js +32 -0
  87. package/lib/utilities/string.js.map +1 -0
  88. package/lib/utilities/test-data.js +53 -0
  89. package/lib/utilities/test-data.js.map +1 -1
  90. package/lib/utilities/utilities.js +90 -18
  91. package/lib/utilities/utilities.js.map +1 -1
  92. package/lib-commonjs/AreaChart.js +6 -0
  93. package/lib-commonjs/AreaChart.js.map +1 -0
  94. package/lib-commonjs/HeatMapChart.js +6 -0
  95. package/lib-commonjs/HeatMapChart.js.map +1 -0
  96. package/lib-commonjs/HorizontalBarChartWithAxis.js +6 -0
  97. package/lib-commonjs/HorizontalBarChartWithAxis.js.map +1 -0
  98. package/lib-commonjs/SankeyChart.js +6 -0
  99. package/lib-commonjs/SankeyChart.js.map +1 -0
  100. package/lib-commonjs/VerticalStackedBarChart.js +6 -0
  101. package/lib-commonjs/VerticalStackedBarChart.js.map +1 -0
  102. package/lib-commonjs/components/AreaChart/AreaChart.js +781 -0
  103. package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -0
  104. package/lib-commonjs/components/AreaChart/AreaChart.types.js +7 -0
  105. package/lib-commonjs/components/AreaChart/AreaChart.types.js.map +1 -0
  106. package/lib-commonjs/components/AreaChart/index.js +8 -0
  107. package/lib-commonjs/components/AreaChart/index.js.map +1 -0
  108. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +104 -0
  109. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -0
  110. package/lib-commonjs/components/CommonComponents/CartesianChart.js +29 -14
  111. package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
  112. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  113. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +120 -73
  114. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  115. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +592 -178
  116. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  117. package/lib-commonjs/components/DonutChart/Arc/Arc.js +1 -1
  118. package/lib-commonjs/components/DonutChart/Arc/Arc.js.map +1 -1
  119. package/lib-commonjs/components/DonutChart/DonutChart.js +1 -1
  120. package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
  121. package/lib-commonjs/components/GaugeChart/GaugeChart.js +3 -0
  122. package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
  123. package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +1 -1
  124. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +9 -0
  125. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  126. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +599 -0
  127. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -0
  128. package/lib-commonjs/components/HeatMapChart/HeatMapChart.types.js +7 -0
  129. package/lib-commonjs/components/HeatMapChart/HeatMapChart.types.js.map +1 -0
  130. package/lib-commonjs/components/HeatMapChart/index.js +8 -0
  131. package/lib-commonjs/components/HeatMapChart/index.js.map +1 -0
  132. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js +68 -0
  133. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -0
  134. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +580 -0
  135. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -0
  136. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js +7 -0
  137. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -0
  138. package/lib-commonjs/components/HorizontalBarChartWithAxis/index.js +8 -0
  139. package/lib-commonjs/components/HorizontalBarChartWithAxis/index.js.map +1 -0
  140. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +116 -0
  141. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -0
  142. package/lib-commonjs/components/Legends/Legends.js +37 -37
  143. package/lib-commonjs/components/Legends/Legends.js.map +1 -1
  144. package/lib-commonjs/components/LineChart/LineChart.js +41 -33
  145. package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
  146. package/lib-commonjs/components/SankeyChart/SankeyChart.js +1038 -0
  147. package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -0
  148. package/lib-commonjs/components/SankeyChart/SankeyChart.types.js +6 -0
  149. package/lib-commonjs/components/SankeyChart/SankeyChart.types.js.map +1 -0
  150. package/lib-commonjs/components/SankeyChart/index.js +8 -0
  151. package/lib-commonjs/components/SankeyChart/index.js.map +1 -0
  152. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +179 -0
  153. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -0
  154. package/lib-commonjs/components/ScatterChart/ScatterChart.js +45 -58
  155. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
  156. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +164 -87
  157. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  158. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.types.js.map +1 -1
  159. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +915 -0
  160. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -0
  161. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js +6 -0
  162. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -0
  163. package/lib-commonjs/components/VerticalStackedBarChart/index.js +8 -0
  164. package/lib-commonjs/components/VerticalStackedBarChart/index.js.map +1 -0
  165. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +120 -0
  166. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -0
  167. package/lib-commonjs/index.js +5 -0
  168. package/lib-commonjs/index.js.map +1 -1
  169. package/lib-commonjs/types/DataPoint.js +1 -3
  170. package/lib-commonjs/types/DataPoint.js.map +1 -1
  171. package/lib-commonjs/utilities/SVGTooltipText.js +49 -4
  172. package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -1
  173. package/lib-commonjs/utilities/colors.js +23 -0
  174. package/lib-commonjs/utilities/colors.js.map +1 -1
  175. package/lib-commonjs/utilities/string.js +29 -0
  176. package/lib-commonjs/utilities/string.js.map +1 -0
  177. package/lib-commonjs/utilities/test-data.js +59 -0
  178. package/lib-commonjs/utilities/test-data.js.map +1 -1
  179. package/lib-commonjs/utilities/utilities.js +94 -17
  180. package/lib-commonjs/utilities/utilities.js.map +1 -1
  181. package/package.json +11 -8
  182. package/lib/components/DeclarativeChart/PlotlySchema.js +0 -7
  183. package/lib/components/DeclarativeChart/PlotlySchema.js.map +0 -1
  184. package/lib-commonjs/components/DeclarativeChart/PlotlySchema.js +0 -10
  185. package/lib-commonjs/components/DeclarativeChart/PlotlySchema.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["SVGTooltipText.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useState, useRef, useEffect, useCallback } from 'react';\nimport { usePortalMountNode } from '@fluentui/react-shared-contexts';\nimport { Tooltip } from '@fluentui/react-tooltip';\nimport { Async } from './async-utils';\nimport { KeyCodes } from './KeyCodes';\nimport { useId } from '@fluentui/react-utilities';\n\ninterface SVGTooltipTextProps {\n closeDelay?: number;\n content: string;\n delay?: number;\n tooltipProps?: React.ComponentProps<typeof Tooltip>;\n textProps?: React.SVGAttributes<SVGTextElement>;\n maxWidth?: number;\n maxHeight?: number;\n shouldReceiveFocus?: boolean;\n isTooltipVisibleProp?: boolean;\n wrapContent?: (content: string, id: string, maxWidth: number, maxHeight?: number) => boolean;\n}\n\nexport const SVGTooltipText: React.FunctionComponent<SVGTooltipTextProps> = React.forwardRef<\n HTMLDivElement,\n SVGTooltipTextProps\n>((props, forwardedRef) => {\n const [isTooltipVisible, setIsTooltipVisible] = useState(false);\n const [isOverflowing, setIsOverflowing] = useState(false);\n const tooltipHostRef = useRef<SVGTextElement>(null);\n const async = useRef(new Async()).current;\n const dismissTimerId = useRef<number>();\n const openTimerId = useRef<number>();\n const tooltipHostId = useRef(useId('tooltip-host')).current;\n const ignoreNextFocusEvent = useRef(false);\n const portalMountNode = usePortalMountNode();\n\n const wrapContentCallback = useCallback(() => {\n if (\n props.content &&\n props.wrapContent &&\n props.wrapContent(props.content, tooltipHostId, props.maxWidth ?? 100, props.maxHeight) // ToDo - Specify a correct fallback value here\n ) {\n setIsOverflowing(true);\n } else {\n setIsOverflowing(false);\n }\n }, [props, tooltipHostId]);\n\n useEffect(() => {\n wrapContentCallback();\n return () => {\n async.dispose();\n };\n }, [wrapContentCallback, async]);\n\n useEffect(() => {\n wrapContentCallback();\n }, [props.maxWidth, props.maxHeight, wrapContentCallback]);\n\n const hideTooltip = useCallback(() => {\n async.clearTimeout(openTimerId.current!);\n async.clearTimeout(dismissTimerId.current!);\n setIsTooltipVisible(false);\n }, [async]);\n\n const onTooltipMouseEnter = useCallback(\n (ev: React.MouseEvent<SVGElement>) => {\n if (!isOverflowing) {\n return;\n }\n\n if (ev.target && portalMountNode?.contains(ev.target as HTMLElement)) {\n return;\n }\n\n async.clearTimeout(dismissTimerId.current!);\n async.clearTimeout(openTimerId.current!);\n\n if (props.delay !== 0) {\n openTimerId.current = async.setTimeout(() => {\n setIsTooltipVisible(true);\n }, props.delay!);\n } else {\n setIsTooltipVisible(true);\n }\n },\n [isOverflowing, portalMountNode, async, props.delay],\n );\n\n const onTooltipMouseLeave = useCallback(\n (ev: React.MouseEvent<SVGElement>) => {\n async.clearTimeout(dismissTimerId.current!);\n async.clearTimeout(openTimerId.current!);\n\n if (props.closeDelay) {\n dismissTimerId.current = async.setTimeout(() => {\n setIsTooltipVisible(false);\n }, props.closeDelay);\n } else {\n setIsTooltipVisible(false);\n }\n },\n [async, props.closeDelay],\n );\n\n const onTooltipFocus = useCallback(\n (ev: React.FocusEvent<SVGElement>) => {\n if (ignoreNextFocusEvent.current) {\n ignoreNextFocusEvent.current = false;\n return;\n }\n onTooltipMouseEnter(ev as unknown as React.MouseEvent<SVGElement>);\n },\n [onTooltipMouseEnter],\n );\n\n const onTooltipBlur = useCallback(\n (ev: React.FocusEvent<SVGElement>) => {\n ignoreNextFocusEvent.current = document?.activeElement === ev.target;\n dismissTimerId.current = async.setTimeout(() => {\n setIsTooltipVisible(false);\n }, 0);\n },\n [async],\n );\n\n const onTooltipKeyDown = useCallback(\n (ev: React.KeyboardEvent<SVGElement>) => {\n if ((ev.which === KeyCodes.escape || ev.ctrlKey) && isTooltipVisible) {\n hideTooltip();\n ev.stopPropagation();\n }\n },\n [isTooltipVisible, hideTooltip],\n );\n\n const showTooltip =\n (props.isTooltipVisibleProp && isOverflowing && !!props.content) || (isTooltipVisible && !!props.content);\n\n return (\n <>\n <Tooltip\n relationship=\"description\"\n {...props.tooltipProps}\n withArrow\n content={props.content}\n // targetElement={getTargetElement()} ToDo - This assignment is causing build failure. Needs to be fixed.\n visible={showTooltip}\n >\n <text\n {...props.textProps}\n id={tooltipHostId}\n ref={tooltipHostRef}\n onFocusCapture={onTooltipFocus}\n onBlurCapture={onTooltipBlur}\n onMouseEnter={onTooltipMouseEnter}\n onMouseLeave={onTooltipMouseLeave}\n onKeyDown={onTooltipKeyDown}\n data-is-focusable={props.shouldReceiveFocus && isOverflowing}\n >\n {props.content}\n </text>\n </Tooltip>\n </>\n );\n});\n\nSVGTooltipText.defaultProps = {\n delay: 0,\n};\n"],"names":["SVGTooltipText","React","forwardRef","props","forwardedRef","isTooltipVisible","setIsTooltipVisible","useState","isOverflowing","setIsOverflowing","tooltipHostRef","useRef","async","Async","current","dismissTimerId","openTimerId","tooltipHostId","useId","ignoreNextFocusEvent","portalMountNode","usePortalMountNode","wrapContentCallback","useCallback","content","wrapContent","maxWidth","maxHeight","useEffect","dispose","hideTooltip","clearTimeout","onTooltipMouseEnter","ev","target","contains","delay","setTimeout","onTooltipMouseLeave","closeDelay","onTooltipFocus","onTooltipBlur","document","activeElement","onTooltipKeyDown","which","KeyCodes","escape","ctrlKey","stopPropagation","showTooltip","isTooltipVisibleProp","createElement","Fragment","Tooltip","relationship","tooltipProps","withArrow","visible","text","textProps","id","ref","onFocusCapture","onBlurCapture","onMouseEnter","onMouseLeave","onKeyDown","data-is-focusable","shouldReceiveFocus","defaultProps"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAqBaA;;;eAAAA;;;;iEArBU;qCAEY;8BACX;4BACF;0BACG;gCACH;AAef,MAAMA,iBAAAA,WAAAA,GAA+DC,OAAMC,UAAU,CAG1F,CAACC,OAAOC;IACR,MAAM,CAACC,kBAAkBC,oBAAoB,GAAGC,IAAAA,eAAAA,EAAS;IACzD,MAAM,CAACC,eAAeC,iBAAiB,GAAGF,IAAAA,eAAAA,EAAS;IACnD,MAAMG,iBAAiBC,IAAAA,aAAAA,EAAuB;IAC9C,MAAMC,QAAQD,IAAAA,aAAAA,EAAO,IAAIE,iBAAAA,IAASC,OAAO;IACzC,MAAMC,iBAAiBJ,IAAAA,aAAAA;IACvB,MAAMK,cAAcL,IAAAA,aAAAA;IACpB,MAAMM,gBAAgBN,IAAAA,aAAAA,EAAOO,IAAAA,qBAAAA,EAAM,iBAAiBJ,OAAO;IAC3D,MAAMK,uBAAuBR,IAAAA,aAAAA,EAAO;IACpC,MAAMS,kBAAkBC,IAAAA,uCAAAA;IAExB,MAAMC,sBAAsBC,IAAAA,kBAAAA,EAAY;YAIYpB;QAHlD,IACEA,MAAMqB,OAAO,IACbrB,MAAMsB,WAAW,IACjBtB,MAAMsB,WAAW,CAACtB,MAAMqB,OAAO,EAAEP,eAAed,CAAAA,kBAAAA,MAAMuB,QAAQ,AAARA,MAAQ,QAAdvB,oBAAAA,K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O;QACtB,yGAAyG;QACzGkC,SAASR;qBAETjD,OAAAmD,aAAA,CAACO,QAAAA;QACE,GAAGxD,MAAMyD,SAAS;QACnBC,IAAI5C;QACJ6C,KAAKpD;QACLqD,gBAAgBvB;QAChBwB,eAAevB;QACfwB,cAAcjC;QACdkC,cAAc5B;QACd6B,WAAWvB;QACXwB,qBAAmBjE,MAAMkE,kBAAkB,IAAI7D;OAE9CL,MAAMqB,OAAO;AAKxB;AAEAxB,eAAesE,YAAY,GAAG;IAC5BlC,OAAO;AACT"}
1
+ {"version":3,"sources":["SVGTooltipText.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useState, useRef, useEffect, useCallback } from 'react';\nimport { usePortalMountNode } from '@fluentui/react-shared-contexts';\nimport { Tooltip } from '@fluentui/react-tooltip';\nimport { Async } from './async-utils';\nimport { KeyCodes } from './KeyCodes';\nimport { useId } from '@fluentui/react-utilities';\nimport { tokens } from '@fluentui/react-theme';\nimport { useRtl } from './utilities';\n\ninterface SVGTooltipTextProps {\n closeDelay?: number;\n content: string;\n delay?: number;\n tooltipProps?: React.ComponentProps<typeof Tooltip>;\n textProps?: React.SVGAttributes<SVGTextElement>;\n maxWidth?: number;\n maxHeight?: number;\n shouldReceiveFocus?: boolean;\n isTooltipVisibleProp?: boolean;\n wrapContent?: (content: string, id: string, maxWidth: number, maxHeight?: number) => boolean;\n showBackground?: boolean;\n}\n\nexport const SVGTooltipText: React.FunctionComponent<SVGTooltipTextProps> = React.forwardRef<\n HTMLDivElement,\n SVGTooltipTextProps\n>((props, forwardedRef) => {\n const [isTooltipVisible, setIsTooltipVisible] = useState(false);\n const [isOverflowing, setIsOverflowing] = useState(false);\n const [textX, setTextX] = useState(0);\n const [textY, setTextY] = useState(0);\n const [textWidth, setTextWidth] = useState(0);\n const [textHeight, setTextHeight] = useState(0);\n\n const tooltipHostRef = useRef<SVGTextElement>(null);\n const async = useRef(new Async()).current;\n const dismissTimerId = useRef<number>();\n const openTimerId = useRef<number>();\n const tooltipHostId = useRef(useId('tooltip-host')).current;\n const ignoreNextFocusEvent = useRef(false);\n const portalMountNode = usePortalMountNode();\n const PADDING = 4;\n\n const wrapContentCallback = useCallback(() => {\n if (\n props.content &&\n props.wrapContent &&\n props.wrapContent(props.content, tooltipHostId, props.maxWidth ?? 100, props.maxHeight)\n // ToDo - Specify a correct fallback value here\n ) {\n setIsOverflowing(true);\n } else {\n setIsOverflowing(false);\n }\n }, [props, tooltipHostId]);\n\n const measureText = useCallback((): void => {\n if (tooltipHostRef.current && typeof tooltipHostRef.current.getBBox === 'function') {\n const bbox = tooltipHostRef.current.getBBox();\n setTextX(bbox.x);\n setTextY(bbox.y);\n setTextWidth(bbox.width);\n setTextHeight(bbox.height);\n }\n }, []);\n\n useEffect(() => {\n wrapContentCallback();\n return () => {\n async.dispose();\n };\n }, [wrapContentCallback, async]);\n\n useEffect(() => {\n wrapContentCallback();\n }, [props.maxWidth, props.maxHeight, wrapContentCallback]);\n\n useEffect(() => {\n if (isTooltipVisible) {\n measureText();\n }\n }, [isTooltipVisible, measureText]);\n\n useEffect(() => {\n // Recalculate text dimensions when content or dimensions change\n measureText();\n }, [props.content, props.textProps, props.maxWidth, props.maxHeight, measureText]);\n\n const hideTooltip = useCallback(() => {\n async.clearTimeout(openTimerId.current!);\n async.clearTimeout(dismissTimerId.current!);\n setIsTooltipVisible(false);\n }, [async]);\n\n const onTooltipMouseEnter = useCallback(\n (ev: React.MouseEvent<SVGElement>) => {\n if (!isOverflowing) {\n return;\n }\n\n if (ev.target && portalMountNode?.contains(ev.target as HTMLElement)) {\n return;\n }\n\n async.clearTimeout(dismissTimerId.current!);\n async.clearTimeout(openTimerId.current!);\n\n if (props.delay !== 0) {\n openTimerId.current = async.setTimeout(() => {\n setIsTooltipVisible(true);\n }, props.delay!);\n } else {\n setIsTooltipVisible(true);\n }\n },\n [isOverflowing, portalMountNode, async, props.delay],\n );\n\n const onTooltipMouseLeave = useCallback(\n (ev: React.MouseEvent<SVGElement>) => {\n async.clearTimeout(dismissTimerId.current!);\n async.clearTimeout(openTimerId.current!);\n\n if (props.closeDelay) {\n dismissTimerId.current = async.setTimeout(() => {\n setIsTooltipVisible(false);\n }, props.closeDelay);\n } else {\n setIsTooltipVisible(false);\n }\n },\n [async, props.closeDelay],\n );\n\n const onTooltipFocus = useCallback(\n (ev: React.FocusEvent<SVGElement>) => {\n if (ignoreNextFocusEvent.current) {\n ignoreNextFocusEvent.current = false;\n return;\n }\n onTooltipMouseEnter(ev as unknown as React.MouseEvent<SVGElement>);\n },\n [onTooltipMouseEnter],\n );\n\n const onTooltipBlur = useCallback(\n (ev: React.FocusEvent<SVGElement>) => {\n ignoreNextFocusEvent.current = document?.activeElement === ev.target;\n dismissTimerId.current = async.setTimeout(() => {\n setIsTooltipVisible(false);\n }, 0);\n },\n [async],\n );\n\n const onTooltipKeyDown = useCallback(\n (ev: React.KeyboardEvent<SVGElement>) => {\n if ((ev.which === KeyCodes.escape || ev.ctrlKey) && isTooltipVisible) {\n hideTooltip();\n ev.stopPropagation();\n }\n },\n [isTooltipVisible, hideTooltip],\n );\n\n const showTooltip =\n (props.isTooltipVisibleProp && isOverflowing && !!props.content) || (isTooltipVisible && !!props.content);\n\n const backgroundColor = tokens.colorNeutralBackground1;\n const isRTL = useRtl();\n const rectX = isRTL ? (textX ?? 0) + (textWidth ?? 0) - PADDING : (textX ?? 0) - PADDING;\n\n return (\n <>\n {props.showBackground && (\n <rect\n x={rectX}\n y={(textY ?? 0) - PADDING}\n width={(textWidth ?? 0) + 2 * PADDING}\n height={(textHeight ?? 0) + 2 * PADDING}\n fill={backgroundColor}\n transform={props.textProps?.transform}\n />\n )}\n <Tooltip\n relationship=\"description\"\n {...props.tooltipProps}\n withArrow\n content={props.content}\n // targetElement={getTargetElement()} ToDo - This assignment is causing build failure. Needs to be fixed.\n visible={showTooltip}\n >\n <text\n {...props.textProps}\n id={tooltipHostId}\n ref={tooltipHostRef}\n onFocusCapture={onTooltipFocus}\n onBlurCapture={onTooltipBlur}\n onMouseEnter={onTooltipMouseEnter}\n onMouseLeave={onTooltipMouseLeave}\n onKeyDown={onTooltipKeyDown}\n data-is-focusable={props.shouldReceiveFocus && isOverflowing}\n >\n {props.content}\n </text>\n </Tooltip>\n </>\n );\n});\n\nSVGTooltipText.defaultProps = {\n delay: 0,\n showBackground: false,\n};\n"],"names":["SVGTooltipText","React","forwardRef","props","forwardedRef","isTooltipVisible","setIsTooltipVisible","useState","isOverflowing","setIsOverflowing","textX","setTextX","textY","setTextY","textWidth","setTextWidth","textHeight","setTextHeight","tooltipHostRef","useRef","async","Async","current","dismissTimerId","openTimerId","tooltipHostId","useId","ignoreNextFocusEvent","portalMountNode","usePortalMountNode","PADDING","wrapContentCallback","useCallback","content","wrapContent","maxWidth","maxHeight","measureText","getBBox","bbox","x","y","width","height","useEffect","dispose","textProps","hideTooltip","clearTimeout","onTooltipMouseEnter","ev","target","contains","delay","setTimeout","onTooltipMouseLeave","closeDelay","onTooltipFocus","onTooltipBlur","document","activeElement","onTooltipKeyDown","which","KeyCodes","escape","ctrlKey","stopPropagation","showTooltip","isTooltipVisibleProp","backgroundColor","tokens","colorNeutralBackground1","isRTL","useRtl","rectX","createElement","Fragment","showBackground","rect","fill","transform","Tooltip","relationship","tooltipProps","withArrow","visible","text","id","ref","onFocusCapture","onBlurCapture","onMouseEnter","onMouseLeave","onKeyDown","data-is-focusable","shouldReceiveFocus","defaultProps"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAwBaA;;;eAAAA;;;;iEAxBU;qCAEY;8BACX;4BACF;0BACG;gCACH;4BACC;2BACA;AAgBhB,MAAMA,iBAAAA,WAAAA,G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,CAACW,QAAAA;QACE,GAAGnF,MAAM2C,SAAS;QACnByC,IAAI9D;QACJ+D,KAAKtE;QACLuE,gBAAgBhC;QAChBiC,eAAehC;QACfiC,cAAc1C;QACd2C,cAAcrC;QACdsC,WAAWhC;QACXiC,qBAAmB3F,MAAM4F,kBAAkB,IAAIvF;OAE9CL,MAAM8B,OAAO;AAKxB;AAEAjC,eAAegG,YAAY,GAAG;IAC5B3C,OAAO;IACPwB,gBAAgB;AAClB"}
@@ -12,6 +12,9 @@ _export(exports, {
12
12
  DataVizPalette: function() {
13
13
  return DataVizPalette;
14
14
  },
15
+ getColorContrast: function() {
16
+ return getColorContrast;
17
+ },
15
18
  getColorFromToken: function() {
16
19
  return getColorFromToken;
17
20
  },
@@ -19,6 +22,7 @@ _export(exports, {
19
22
  return getNextColor;
20
23
  }
21
24
  });
25
+ const _d3color = require("d3-color");
22
26
  const DataVizPalette = {
23
27
  color1: 'qualitative.1',
24
28
  color2: 'qualitative.2',
@@ -268,3 +272,22 @@ const getColorFromToken = (token, isDarkTheme = false)=>{
268
272
  }
269
273
  return token;
270
274
  };
275
+ //For reference to how these numbers are calculated, refer https://www.w3.org/TR/WCAG/#dfn-contrast-ratio
276
+ const rgbLrgb1 = (v)=>{
277
+ return v <= 0.04045 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4;
278
+ };
279
+ const rgbLrgb = ({ r, g, b })=>{
280
+ return {
281
+ r: rgbLrgb1(r / 255),
282
+ g: rgbLrgb1(g / 255),
283
+ b: rgbLrgb1(b / 255)
284
+ };
285
+ };
286
+ const lrgbLuminance = ({ r, g, b })=>{
287
+ return 0.2126 * r + 0.7152 * g + 0.0722 * b;
288
+ };
289
+ const getColorContrast = (c1, c2)=>{
290
+ const l1 = lrgbLuminance(rgbLrgb((0, _d3color.rgb)(c1)));
291
+ const l2 = lrgbLuminance(rgbLrgb((0, _d3color.rgb)(c2)));
292
+ return (Math.max(l1, l2) + 0.05) / (Math.min(l1, l2) + 0.05);
293
+ };
@@ -1 +1 @@
1
- {"version":3,"sources":["colors.ts"],"sourcesContent":["export const DataVizPalette = {\n color1: 'qualitative.1',\n color2: 'qualitative.2',\n color3: 'qualitative.3',\n color4: 'qualitative.4',\n color5: 'qualitative.5',\n color6: 'qualitative.6',\n color7: 'qualitative.7',\n color8: 'qualitative.8',\n color9: 'qualitative.9',\n color10: 'qualitative.10',\n color11: 'qualitative.11',\n color12: 'qualitative.12',\n color13: 'qualitative.13',\n color14: 'qualitative.14',\n color15: 'qualitative.15',\n color16: 'qualitative.16',\n color17: 'qualitative.17',\n color18: 'qualitative.18',\n color19: 'qualitative.19',\n color20: 'qualitative.20',\n color21: 'qualitative.21',\n color22: 'qualitative.22',\n color23: 'qualitative.23',\n color24: 'qualitative.24',\n color25: 'qualitative.25',\n color26: 'qualitative.26',\n color27: 'qualitative.27',\n color28: 'qualitative.28',\n color29: 'qualitative.29',\n color30: 'qualitative.30',\n color31: 'qualitative.31',\n color32: 'qualitative.32',\n color33: 'qualitative.33',\n color34: 'qualitative.34',\n color35: 'qualitative.35',\n color36: 'qualitative.36',\n color37: 'qualitative.37',\n color38: 'qualitative.38',\n color39: 'qualitative.39',\n color40: 'qualitative.40',\n info: 'semantic.info',\n disabled: 'semantic.disabled',\n highError: 'semantic.highError',\n error: 'semantic.error',\n warning: 'semantic.warning',\n success: 'semantic.success',\n highSuccess: 'semantic.highSuccess',\n};\n\n/**\n * Key: Color code.\n * Value:\n * Index 0 - Default color / Color for light theme,\n * Index 1 - Color for dark theme\n */\ntype Palette = { [key: string]: string[] };\n\nconst QualitativePalette: Palette = {\n '1': ['#637cef'], // [cornflower.tint10],\n '2': ['#e3008c'], // [hotPink.primary],\n '3': ['#2aa0a4'], // [teal.tint20],\n '4': ['#9373c0'], // [orchid.tint10],\n '5': ['#13a10e'], // [lightGreen.primary],\n '6': ['#3a96dd'], // [lightBlue.primary],\n '7': ['#ca5010'], // [pumpkin.primary],\n '8': ['#57811b'], // [lime.shade20],\n '9': ['#b146c2'], // [lilac.primary],\n '10': ['#ae8c00'], // [gold.shade10],\n '11': ['#3c51b4', '#93a4f4'], // [cornflower.shade20, cornflower.tint30],\n '12': ['#ad006a', '#ee5fb7'], // [hotPink.shade20, hotPink.tint30],\n '13': ['#026467', '#4cb4b7'], // [teal.shade20, teal.tint30],\n '14': ['#674c8c', '#a083c9'], // [orchid.shade20, orchid.tint20],\n '15': ['#0e7a0b', '#27ac22'], // [lightGreen.shade20, lightGreen.tint10],\n '16': ['#2c72a8', '#4fa1e1'], // [lightBlue.shade20, lightBlue.tint10],\n '17': ['#9a3d0c', '#d77440'], // [pumpkin.shade20, pumpkin.tint20],\n '18': ['#405f14', '#73aa24'], // [lime.shade30, lime.primary],\n '19': ['#863593', '#c36bd1'], // [lilac.shade20, lilac.tint20],\n '20': ['#6d5700', '#d0b232'], // [gold.shade30, gold.tint20],\n '21': ['#4f6bed'], // [cornflower.primary],\n '22': ['#ea38a6'], // [hotPink.tint20],\n '23': ['#038387'], // [teal.primary],\n '24': ['#8764b8'], // [orchid.primary],\n '25': ['#11910d'], // [lightGreen.shade10],\n '26': ['#3487c7'], // [lightBlue.shade10],\n '27': ['#d06228'], // [pumpkin.tint10],\n '28': ['#689920'], // [lime.shade10],\n '29': ['#ba58c9'], // [lilac.tint10],\n '30': ['#937700', '#c19c00'], // [gold.shade20, gold.primary],\n '31': ['#2c3c85', '#c8d1fa'], // [cornflower.shade30, cornflower.tint40],\n '32': ['#7f004e', '#f7adda'], // [hotPink.shade30, hotPink.tint40],\n '33': ['#02494c', '#9bd9db'], // [teal.shade30, teal.tint40],\n '34': ['#4c3867', '#b29ad4'], // [orchid.shade30, orchid.tint30],\n '35': ['#0b5a08', '#a7e3a5'], // [lightGreen.shade30, lightGreen.tint40],\n '36': ['#20547c', '#83bdeb'], // [lightBlue.shade30, lightBlue.tint30],\n '37': ['#712d09', '#df8e64'], // [pumpkin.shade30, pumpkin.tint30],\n '38': ['#23330b', '#a4cc6c'], // [lime.shade40, lime.tint30],\n '39': ['#63276d', '#cf87da'], // [lilac.shade30, lilac.tint30],\n '40': ['#3a2f00', '#dac157'], // [gold.shade40, gold.tint30],\n};\n\nconst SemanticPalette: Palette = {\n info: ['#015cda'],\n disabled: ['#dbdbdb', '#4d4d4d'], // [grey[86], grey[30]]\n highError: ['#6e0811', '#cc2635'], // [cranberry.shade30, cranberry.tint10],\n error: ['#c50f1f', '#dc626d'], // [cranberry.primary, cranberry.tint30],\n warning: ['#f7630c', '#f87528'], // [orange.primary, orange.tint10],\n success: ['#107c10', '#54b054'], // [green.primary, green.tint30],\n highSuccess: ['#094509', '#218c21'], // [green.shade30, green.tint10],\n};\n\nconst Colors: { [key: string]: Palette } = {\n qualitative: QualitativePalette,\n semantic: SemanticPalette,\n};\n\nconst QUALITATIVE_COLORS = Object.values(QualitativePalette);\nconst TOKENS = Object.values(DataVizPalette);\n\nconst getThemeSpecificColor = (colors: string[], isDarkTheme: boolean): string => {\n if (colors.length === 0) {\n return '';\n }\n const colorIdx = Number(isDarkTheme);\n if (colorIdx < colors.length) {\n return colors[colorIdx];\n }\n return colors[0];\n};\n\nexport const getNextColor = (index: number, offset: number = 0, isDarkTheme: boolean = false): string => {\n const colors = QUALITATIVE_COLORS[(index + offset) % QUALITATIVE_COLORS.length];\n return getThemeSpecificColor(colors, isDarkTheme);\n};\n\nexport const getColorFromToken = (token: string, isDarkTheme: boolean = false): string => {\n if (TOKENS.indexOf(token) >= 0) {\n const [paletteName, colorCode] = token.split('.');\n const colors = Colors[paletteName][colorCode];\n return getThemeSpecificColor(colors, isDarkTheme);\n }\n return token;\n};\n"],"names":["DataVizPalette","getColorFromToken","getNextColor","color1","color2","color3","color4","color5","color6","color7","color8","color9","color10","color11","color12","color13","color14","color15","color16","color17","color18","color19","color20","color21","color22","color23","color24","color25","color26","color27","color28","color29","color30","color31","color32","color33","color34","color35","color36","color37","color38","color39","color40","info","disabled","highError","error","warning","success","highSuccess","QualitativePalette","SemanticPalette","Colors","qualitative","semantic","QUALITATIVE_COLORS","Object","values","TOKENS","getThemeSpecificColor","colors","isDarkTheme","length","colorIdx","Number","index","offset","token","indexOf","paletteName","colorCode","split"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAAaA,cAAAA;eAAAA;;IAuIAC,iBAAAA;eAAAA;;IALAC,YAAAA;eAAAA;;;AAlIN,MAAMF,iBAAiB;IAC5BG,QAAQ;IACRC,QAAQ;IACRC,QAAQ;IACRC,QAAQ;IACRC,QAAQ;IACRC,QAAQ;IACRC,QAAQ;IACRC,QAAQ;IACRC,QAAQ;IACRC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,MAAM;IACNC,UAAU;IACVC,WAAW;IACXC,OAAO;IACPC,SAAS;IACTC,SAAS;IACTC,aAAa;AACf;AAUA,MAAMC,qBAA8B;IAClC,KAAK;QAAC;KAAU;IAChB,KAAK;QAAC;KAAU;IAChB,KAAK;QAAC;KAAU;IAChB,KAAK;QAAC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KAAU;IAC/BC,aAAa;QAAC;QAAW;KAAU;AACrC;AAEA,MAAMG,SAAqC;IACzCC,aAAaH;IACbI,UAAUH;AACZ;AAEA,MAAMI,qBAAqBC,OAAOC,MAAM,CAACP;AACzC,MAAMQ,SAASF,OAAOC,MAAM,CAACzD;AAE7B,MAAM2D,wBAAwB,CAACC,QAAkBC;IAC/C,IAAID,OAAOE,MAAM,KAAK,GAAG;QACvB,OAAO;IACT;IACA,MAAMC,WAAWC,OAAOH;IACxB,IAAIE,WAAWH,OAAOE,MAAM,EAAE;QAC5B,OAAOF,MAAM,CAACG,SAAS;IACzB;IACA,OAAOH,MAAM,CAAC,EAAE;AAClB;AAEO,MAAM1D,eAAe,CAAC+D,OAAeC,SAAiB,CAAC,EAAEL,cAAuB,KAAK;IAC1F,MAAMD,SAASL,kBAAkB,CAAC,AAACU,CAAAA,QAAQC,MAAAA,IAAUX,mBAAmBO,MAAM,CAAC;IAC/E,OAAOH,sBAAsBC,QAAQC;AACvC;AAEO,MAAM5D,oBAAoB,CAACkE,OAAeN,cAAuB,KAAK;IAC3E,IAAIH,OAAOU,OAAO,CAACD,UAAU,GAAG;QAC9B,MAAM,CAACE,aAAaC,UAAU,GAAGH,MAAMI,KAAK,CAAC;QAC7C,MAAMX,SAASR,MAAM,CAACiB,YAAY,CAACC,UAAU;QAC7C,OAAOX,sBAAsBC,QAAQC;IACvC;IACA,OAAOM;AACT"}
1
+ {"version":3,"sources":["colors.ts"],"sourcesContent":["import { rgb as d3Rgb } from 'd3-color';\n\nexport const DataVizPalette = {\n color1: 'qualitative.1',\n color2: 'qualitative.2',\n color3: 'qualitative.3',\n color4: 'qualitative.4',\n color5: 'qualitative.5',\n color6: 'qualitative.6',\n color7: 'qualitative.7',\n color8: 'qualitative.8',\n color9: 'qualitative.9',\n color10: 'qualitative.10',\n color11: 'qualitative.11',\n color12: 'qualitative.12',\n color13: 'qualitative.13',\n color14: 'qualitative.14',\n color15: 'qualitative.15',\n color16: 'qualitative.16',\n color17: 'qualitative.17',\n color18: 'qualitative.18',\n color19: 'qualitative.19',\n color20: 'qualitative.20',\n color21: 'qualitative.21',\n color22: 'qualitative.22',\n color23: 'qualitative.23',\n color24: 'qualitative.24',\n color25: 'qualitative.25',\n color26: 'qualitative.26',\n color27: 'qualitative.27',\n color28: 'qualitative.28',\n color29: 'qualitative.29',\n color30: 'qualitative.30',\n color31: 'qualitative.31',\n color32: 'qualitative.32',\n color33: 'qualitative.33',\n color34: 'qualitative.34',\n color35: 'qualitative.35',\n color36: 'qualitative.36',\n color37: 'qualitative.37',\n color38: 'qualitative.38',\n color39: 'qualitative.39',\n color40: 'qualitative.40',\n info: 'semantic.info',\n disabled: 'semantic.disabled',\n highError: 'semantic.highError',\n error: 'semantic.error',\n warning: 'semantic.warning',\n success: 'semantic.success',\n highSuccess: 'semantic.highSuccess',\n};\n\n/**\n * Key: Color code.\n * Value:\n * Index 0 - Default color / Color for light theme,\n * Index 1 - Color for dark theme\n */\ntype Palette = { [key: string]: string[] };\n\nconst QualitativePalette: Palette = {\n '1': ['#637cef'], // [cornflower.tint10],\n '2': ['#e3008c'], // [hotPink.primary],\n '3': ['#2aa0a4'], // [teal.tint20],\n '4': ['#9373c0'], // [orchid.tint10],\n '5': ['#13a10e'], // [lightGreen.primary],\n '6': ['#3a96dd'], // [lightBlue.primary],\n '7': ['#ca5010'], // [pumpkin.primary],\n '8': ['#57811b'], // [lime.shade20],\n '9': ['#b146c2'], // [lilac.primary],\n '10': ['#ae8c00'], // [gold.shade10],\n '11': ['#3c51b4', '#93a4f4'], // [cornflower.shade20, cornflower.tint30],\n '12': ['#ad006a', '#ee5fb7'], // [hotPink.shade20, hotPink.tint30],\n '13': ['#026467', '#4cb4b7'], // [teal.shade20, teal.tint30],\n '14': ['#674c8c', '#a083c9'], // [orchid.shade20, orchid.tint20],\n '15': ['#0e7a0b', '#27ac22'], // [lightGreen.shade20, lightGreen.tint10],\n '16': ['#2c72a8', '#4fa1e1'], // [lightBlue.shade20, lightBlue.tint10],\n '17': ['#9a3d0c', '#d77440'], // [pumpkin.shade20, pumpkin.tint20],\n '18': ['#405f14', '#73aa24'], // [lime.shade30, lime.primary],\n '19': ['#863593', '#c36bd1'], // [lilac.shade20, lilac.tint20],\n '20': ['#6d5700', '#d0b232'], // [gold.shade30, gold.tint20],\n '21': ['#4f6bed'], // [cornflower.primary],\n '22': ['#ea38a6'], // [hotPink.tint20],\n '23': ['#038387'], // [teal.primary],\n '24': ['#8764b8'], // [orchid.primary],\n '25': ['#11910d'], // [lightGreen.shade10],\n '26': ['#3487c7'], // [lightBlue.shade10],\n '27': ['#d06228'], // [pumpkin.tint10],\n '28': ['#689920'], // [lime.shade10],\n '29': ['#ba58c9'], // [lilac.tint10],\n '30': ['#937700', '#c19c00'], // [gold.shade20, gold.primary],\n '31': ['#2c3c85', '#c8d1fa'], // [cornflower.shade30, cornflower.tint40],\n '32': ['#7f004e', '#f7adda'], // [hotPink.shade30, hotPink.tint40],\n '33': ['#02494c', '#9bd9db'], // [teal.shade30, teal.tint40],\n '34': ['#4c3867', '#b29ad4'], // [orchid.shade30, orchid.tint30],\n '35': ['#0b5a08', '#a7e3a5'], // [lightGreen.shade30, lightGreen.tint40],\n '36': ['#20547c', '#83bdeb'], // [lightBlue.shade30, lightBlue.tint30],\n '37': ['#712d09', '#df8e64'], // [pumpkin.shade30, pumpkin.tint30],\n '38': ['#23330b', '#a4cc6c'], // [lime.shade40, lime.tint30],\n '39': ['#63276d', '#cf87da'], // [lilac.shade30, lilac.tint30],\n '40': ['#3a2f00', '#dac157'], // [gold.shade40, gold.tint30],\n};\n\nconst SemanticPalette: Palette = {\n info: ['#015cda'],\n disabled: ['#dbdbdb', '#4d4d4d'], // [grey[86], grey[30]]\n highError: ['#6e0811', '#cc2635'], // [cranberry.shade30, cranberry.tint10],\n error: ['#c50f1f', '#dc626d'], // [cranberry.primary, cranberry.tint30],\n warning: ['#f7630c', '#f87528'], // [orange.primary, orange.tint10],\n success: ['#107c10', '#54b054'], // [green.primary, green.tint30],\n highSuccess: ['#094509', '#218c21'], // [green.shade30, green.tint10],\n};\n\nconst Colors: { [key: string]: Palette } = {\n qualitative: QualitativePalette,\n semantic: SemanticPalette,\n};\n\nconst QUALITATIVE_COLORS = Object.values(QualitativePalette);\nconst TOKENS = Object.values(DataVizPalette);\n\nconst getThemeSpecificColor = (colors: string[], isDarkTheme: boolean): string => {\n if (colors.length === 0) {\n return '';\n }\n const colorIdx = Number(isDarkTheme);\n if (colorIdx < colors.length) {\n return colors[colorIdx];\n }\n return colors[0];\n};\n\nexport const getNextColor = (index: number, offset: number = 0, isDarkTheme: boolean = false): string => {\n const colors = QUALITATIVE_COLORS[(index + offset) % QUALITATIVE_COLORS.length];\n return getThemeSpecificColor(colors, isDarkTheme);\n};\n\nexport const getColorFromToken = (token: string, isDarkTheme: boolean = false): string => {\n if (TOKENS.indexOf(token) >= 0) {\n const [paletteName, colorCode] = token.split('.');\n const colors = Colors[paletteName][colorCode];\n return getThemeSpecificColor(colors, isDarkTheme);\n }\n return token;\n};\n\n//For reference to how these numbers are calculated, refer https://www.w3.org/TR/WCAG/#dfn-contrast-ratio\nconst rgbLrgb1 = (v: number): number => {\n return v <= 0.04045 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4;\n};\n\nconst rgbLrgb = ({ r, g, b }: { r: number; g: number; b: number }): { r: number; g: number; b: number } => {\n return {\n r: rgbLrgb1(r / 255),\n g: rgbLrgb1(g / 255),\n b: rgbLrgb1(b / 255),\n };\n};\n\nconst lrgbLuminance = ({ r, g, b }: { r: number; g: number; b: number }): number => {\n return 0.2126 * r + 0.7152 * g + 0.0722 * b;\n};\n\nexport const getColorContrast = (c1: string, c2: string): number => {\n const l1 = lrgbLuminance(rgbLrgb(d3Rgb(c1)));\n const l2 = lrgbLuminance(rgbLrgb(d3Rgb(c2)));\n return (Math.max(l1, l2) + 0.05) / (Math.min(l1, l2) + 0.05);\n};\n"],"names":["DataVizPalette","getColorContrast","getColorFromToken","getNextColor","color1","color2","color3","color4","color5","color6","color7","color8","color9","color10","color11","color12","color13","color14","color15","color16","color17","color18","color19","color20","color21","color22","color23","color24","color25","color26","color27","color28","color29","color30","color31","color32","color33","color34","color35","color36","color37","color38","color39","color40","info","disabled","highError","error","warning","success","highSuccess","QualitativePalette","SemanticPalette","Colors","qualitative","semantic","QUALITATIVE_COLORS","Object","values","TOKENS","getThemeSpecificColor","colors","isDarkTheme","length","colorIdx","Number","index","offset","token","indexOf","paletteName","colorCode","split","rgbLrgb1","v","rgbLrgb","r","g","b","lrgbLuminance","c1","c2","l1","d3Rgb","l2","Math","max","min"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAEaA,cAAAA;eAAAA;;IAiKAC,gBAAAA;eAAAA;;IA1BAC,iBAAAA;eAAAA;;IALAC,YAAAA;eAAAA;;;yBApIgB;AAEtB,MAAMH,iBAAiB;IAC5BI,QAAQ;IACRC,QAAQ;IACRC,QAAQ;IACRC,QAAQ;IACRC,QAAQ;IACRC,QAAQ;IACRC,QAAQ;IACRC,QAAQ;IACRC,QAAQ;IACRC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,SAAS;IACTC,SA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GAAyG;AACzG,MAAMK,WAAW,CAACC;IAChB,OAAOA,KAAK,UAAUA,IAAI,QAAQ,AAAC,CAAA,AAACA,CAAAA,IAAI,KAAA,IAAS,KAAA,KAAU;AAC7D;AAEA,MAAMC,UAAU,CAAC,EAAEC,CAAC,EAAEC,CAAC,EAAEC,CAAC,EAAuC;IAC/D,OAAO;QACLF,GAAGH,SAASG,IAAI;QAChBC,GAAGJ,SAASI,IAAI;QAChBC,GAAGL,SAASK,IAAI;IAClB;AACF;AAEA,MAAMC,gBAAgB,CAAC,EAAEH,CAAC,EAAEC,CAAC,EAAEC,CAAC,EAAuC;IACrE,OAAO,SAASF,IAAI,SAASC,IAAI,SAASC;AAC5C;AAEO,MAAM7E,mBAAmB,CAAC+E,IAAYC;IAC3C,MAAMC,KAAKH,cAAcJ,QAAQQ,IAAAA,YAAAA,EAAMH;IACvC,MAAMI,KAAKL,cAAcJ,QAAQQ,IAAAA,YAAAA,EAAMF;IACvC,OAAO,AAACI,CAAAA,KAAKC,GAAG,CAACJ,IAAIE,MAAM,IAAA,IAASC,CAAAA,KAAKE,GAAG,CAACL,IAAIE,MAAM,IAAA;AACzD"}
@@ -0,0 +1,29 @@
1
+ // Regex that finds { and } so they can be removed on a lookup for string format
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "format", {
7
+ enumerable: true,
8
+ get: function() {
9
+ return format;
10
+ }
11
+ });
12
+ const FORMAT_ARGS_REGEX = /[\{\}]/g;
13
+ // Regex that finds {#} so it can be replaced by the arguments in string format
14
+ const FORMAT_REGEX = /\{\d+\}/g;
15
+ function format(s, ...values) {
16
+ const args = values;
17
+ // Callback match function
18
+ function replaceFunc(match) {
19
+ // looks up in the args
20
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
21
+ let replacement = args[match.replace(FORMAT_ARGS_REGEX, '')];
22
+ // catches undefined in nondebug and null in debug and nondebug
23
+ if (replacement === null || replacement === undefined) {
24
+ replacement = '';
25
+ }
26
+ return replacement;
27
+ }
28
+ return s.replace(FORMAT_REGEX, replaceFunc);
29
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["string.ts"],"sourcesContent":["// Regex that finds { and } so they can be removed on a lookup for string format\nconst FORMAT_ARGS_REGEX = /[\\{\\}]/g;\n\n// Regex that finds {#} so it can be replaced by the arguments in string format\nconst FORMAT_REGEX = /\\{\\d+\\}/g;\n\n/**\n * String format method, used for scenarios where at runtime you\n * need to evaluate a formatted string given a tokenized string. This\n * usually only is needed in localization scenarios.\n\n * @example\n * ```tsx\n * \"I love {0} every {1}\".format(\"CXP\")\n * ```\n * will result in a Debug Exception.\n *\n * @public\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function format(s: string, ...values: any[]): string {\n const args = values;\n // Callback match function\n function replaceFunc(match: string): string {\n // looks up in the args\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let replacement = args[match.replace(FORMAT_ARGS_REGEX, '') as any];\n\n // catches undefined in nondebug and null in debug and nondebug\n if (replacement === null || replacement === undefined) {\n replacement = '';\n }\n\n return replacement;\n }\n return s.replace(FORMAT_REGEX, replaceFunc);\n}\n"],"names":["format","FORMAT_ARGS_REGEX","FORMAT_REGEX","s","values","args","replaceFunc","match","replacement","replace","undefined"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,gFAAgF;;;;;+BAoBhEA;;;eAAAA;;;AAnBhB,MAAMC,oBAAoB;AAE1B,+EAA+E;AAC/E,MAAMC,eAAe;AAgBd,SAASF,OAAOG,CAAS,EAAE,GAAGC,MAAa;IAChD,MAAMC,OAAOD;IACb,0BAA0B;IAC1B,SAASE,YAAYC,KAAa;QAChC,uBAAuB;QACvB,8DAA8D;QAC9D,IAAIC,cAAcH,IAAI,CAACE,MAAME,OAAO,CAACR,mBAAmB,IAAW;QAEnE,+DAA+D;QAC/D,IAAIO,gBAAgB,QAAQA,gBAAgBE,WAAW;YACrDF,cAAc;QAChB;QAEA,OAAOA;IACT;IACA,OAAOL,EAAEM,OAAO,CAACP,cAAcI;AACjC"}
@@ -9,6 +9,9 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
+ allNegativeChartPointsVBC: function() {
13
+ return allNegativeChartPointsVBC;
14
+ },
12
15
  chartPoints2VSBC: function() {
13
16
  return chartPoints2VSBC;
14
17
  },
@@ -36,6 +39,9 @@ _export(exports, {
36
39
  emptychartPointsVSBC: function() {
37
40
  return emptychartPointsVSBC;
38
41
  },
42
+ negativeChartPointsVBC: function() {
43
+ return negativeChartPointsVBC;
44
+ },
39
45
  pointsDC: function() {
40
46
  return pointsDC;
41
47
  },
@@ -46,6 +52,7 @@ _export(exports, {
46
52
  return pointsHBCWA;
47
53
  }
48
54
  });
55
+ const _index = require("../index");
49
56
  const chartPointsVBC = [
50
57
  {
51
58
  x: 0,
@@ -322,3 +329,55 @@ const chartPointsWithAxisToolTipHBCWA = [
322
329
  color: 'blue'
323
330
  }
324
331
  ];
332
+ const allNegativeChartPointsVBC = [
333
+ {
334
+ x: 0,
335
+ y: -10000,
336
+ legend: 'First',
337
+ color: _index.DataVizPalette.color1,
338
+ xAxisCalloutData: '2020/04/30',
339
+ yAxisCalloutData: '10%'
340
+ },
341
+ {
342
+ x: 10000,
343
+ y: -50000,
344
+ legend: 'Second',
345
+ color: _index.DataVizPalette.color2,
346
+ xAxisCalloutData: '2020/04/30',
347
+ yAxisCalloutData: '20%'
348
+ },
349
+ {
350
+ x: 25000,
351
+ y: -30000,
352
+ legend: 'Third',
353
+ color: _index.DataVizPalette.color3,
354
+ xAxisCalloutData: '2020/04/30',
355
+ yAxisCalloutData: '37%'
356
+ }
357
+ ];
358
+ const negativeChartPointsVBC = [
359
+ {
360
+ x: 0,
361
+ y: 10000,
362
+ legend: 'First',
363
+ color: _index.DataVizPalette.color1,
364
+ xAxisCalloutData: '2020/04/30',
365
+ yAxisCalloutData: '10%'
366
+ },
367
+ {
368
+ x: 10000,
369
+ y: -50000,
370
+ legend: 'Second',
371
+ color: _index.DataVizPalette.color2,
372
+ xAxisCalloutData: '2020/04/30',
373
+ yAxisCalloutData: '20%'
374
+ },
375
+ {
376
+ x: 25000,
377
+ y: 30000,
378
+ legend: 'Third',
379
+ color: _index.DataVizPalette.color3,
380
+ xAxisCalloutData: '2020/04/30',
381
+ yAxisCalloutData: '37%'
382
+ }
383
+ ];
@@ -1 +1 @@
1
- {"version":3,"sources":["test-data.ts"],"sourcesContent":["import {\n ChartDataPoint,\n ChartProps,\n HorizontalBarChartWithAxisDataPoint,\n VSChartDataPoint,\n VerticalStackedChartProps,\n} from '../index';\n\nexport const chartPointsVBC = [\n {\n x: 0,\n y: 10000,\n legend: 'First',\n color: 'aqua',\n xAxisCalloutData: '2020/04/30',\n yAxisCalloutData: '10%',\n },\n {\n x: 10000,\n y: 50000,\n legend: 'Second',\n color: 'blue',\n xAxisCalloutData: '2020/04/30',\n yAxisCalloutData: '20%',\n },\n {\n x: 25000,\n y: 30000,\n legend: 'Third',\n color: 'navy',\n xAxisCalloutData: '2020/04/30',\n yAxisCalloutData: '37%',\n },\n];\n\nconst firstChartPointsVSBC: VSChartDataPoint[] = [\n {\n legend: 'Metadata1',\n data: 40,\n color: 'aqua',\n xAxisCalloutData: '2020/04/30',\n yAxisCalloutData: '40%',\n },\n {\n legend: 'Metadata2',\n data: 5,\n color: 'navy',\n xAxisCalloutData: '2020/04/30',\n yAxisCalloutData: '5%',\n },\n];\n\nconst secondChartPointsVSBC: VSChartDataPoint[] = [\n {\n legend: 'Metadata1',\n data: 30,\n color: 'aqua',\n xAxisCalloutData: '2020/04/30',\n yAxisCalloutData: '30%',\n },\n {\n legend: 'Metadata2',\n data: 20,\n color: 'navy',\n xAxisCalloutData: '2020/04/30',\n yAxisCalloutData: '20%',\n },\n];\n\nexport const chartPointsVSBC: VerticalStackedChartProps[] = [\n { chartData: firstChartPointsVSBC, xAxisPoint: 0 },\n { chartData: secondChartPointsVSBC, xAxisPoint: 20 },\n];\n\nexport const chartPoints2VSBC: VerticalStackedChartProps[] = [\n {\n chartData: firstChartPointsVSBC,\n xAxisPoint: 0,\n lineData: [{ y: 15, legend: 'Line1', color: 'yellow' }],\n },\n {\n chartData: secondChartPointsVSBC,\n xAxisPoint: 20,\n lineData: [{ y: 30, legend: 'Line1', color: 'yellow' }],\n },\n];\n\nexport const emptychartPointsVSBC: VerticalStackedChartProps[] = [{ chartData: [], xAxisPoint: 0 }];\n\nexport const pointsHBCWA = [\n {\n x: 10000,\n y: 5000,\n legend: 'Oranges',\n color: 'aqua',\n xAxisCalloutData: '2020/04/30',\n yAxisCalloutData: '10%',\n },\n {\n x: 20000,\n y: 50000,\n legend: 'Dogs',\n color: 'blue',\n xAxisCalloutData: '2020/04/30',\n yAxisCalloutData: '20%',\n },\n {\n x: 25000,\n y: 30000,\n legend: 'Apples',\n color: 'navy',\n xAxisCalloutData: '2020/04/30',\n yAxisCalloutData: '37%',\n },\n\n {\n x: 40000,\n y: 13000,\n legend: 'Bananas',\n color: 'teal',\n xAxisCalloutData: '2020/04/30',\n yAxisCalloutData: '88%',\n },\n];\n\nexport const pointsDC: ChartDataPoint[] = [\n { legend: 'first', data: 20000, color: '#E5E5E5', xAxisCalloutData: '2020/04/30' },\n { legend: 'second', data: 39000, color: '#0078D4', xAxisCalloutData: '2020/04/20' },\n { legend: 'third', data: 45000, color: '#DADADA', xAxisCalloutData: '2020/04/25' },\n];\n\nexport const pointsDCElevateMinimumsExample: ChartDataPoint[] = [\n { legend: 'first', data: 39000, color: '#E5E5E5', xAxisCalloutData: '2020/04/30' },\n { legend: 'second', data: 20, color: '#0078D4', xAxisCalloutData: '2020/04/20' },\n { legend: 'third', data: 20, color: '#DADADA', xAxisCalloutData: '2020/04/25' },\n { legend: 'fourth', data: 20, color: '#DADADA', xAxisCalloutData: '2020/04/25' },\n { legend: 'fifth', data: 20, color: '#DADADA', xAxisCalloutData: '2020/04/25' },\n { legend: 'sixth', data: 20, color: '#DADADA', xAxisCalloutData: '2020/04/25' },\n];\n\nexport const chartPointsDC: ChartProps = {\n chartTitle: 'Donut chart example',\n chartData: pointsDC,\n};\n\nexport const chartPointsDCElevateMinimums: ChartProps = {\n chartTitle: 'Donut chart example',\n chartData: pointsDC,\n};\n\nexport const chartPointsHBCWA: HorizontalBarChartWithAxisDataPoint[] = [\n {\n x: 10000,\n y: 5000,\n legend: 'Oranges',\n color: 'aqua',\n yAxisCalloutData: '2020/04/30',\n xAxisCalloutData: '10%',\n },\n {\n x: 20000,\n y: 50000,\n legend: 'Grapes',\n color: 'blue',\n yAxisCalloutData: '2020/04/30',\n xAxisCalloutData: '20%',\n },\n {\n x: 25000,\n y: 30000,\n legend: 'Apples',\n color: 'navy',\n yAxisCalloutData: '2020/04/30',\n xAxisCalloutData: '37%',\n },\n\n {\n x: 40000,\n y: 13000,\n legend: 'Bananas',\n color: 'teal',\n yAxisCalloutData: '2020/04/30',\n xAxisCalloutData: '88%',\n },\n];\n\nexport const chartPointsWithStringYAxisHBCWA: HorizontalBarChartWithAxisDataPoint[] = [\n {\n y: 'String One',\n x: 1000,\n color: 'aqua',\n },\n {\n y: 'String Two',\n x: 5000,\n color: 'blue',\n },\n {\n y: 'String Three',\n x: 3000,\n color: 'navy',\n },\n {\n y: 'String Four',\n x: 2000,\n color: 'blue',\n },\n];\n\nexport const chartPointsWithAxisToolTipHBCWA: HorizontalBarChartWithAxisDataPoint[] = [\n {\n x: 1000,\n y: 1000,\n color: 'aqua',\n },\n {\n x: 2000,\n y: 5000,\n color: 'blue',\n },\n {\n x: 3000,\n y: 3000,\n color: 'navy',\n },\n {\n x: 4000,\n y: 2000,\n color: 'blue',\n },\n];\n"],"names":["chartPoints2VSBC","chartPointsDC","chartPointsDCElevateMinimums","chartPointsHBCWA","chartPointsVBC","chartPointsVSBC","chartPointsWithAxisToolTipHBCWA","chartPointsWithStringYAxisHBCWA","emptychartPointsVSBC","pointsDC","pointsDCElevateMinimumsExample","pointsHBCWA","x","y","legend","color","xAxisCalloutData","yAxisCalloutData","firstChartPointsVSBC","data","secondChartPointsVSBC","chartData","xAxisPoint","lineData","chartTitle"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IA0EaA,gBAAAA;eAAAA;;IAkEAC,aAAAA;eAAAA;;IAKAC,4BAAAA;eAAAA;;IAKAC,gBAAAA;eAAAA;;IA9IAC,cAAAA;eAAAA;;IA6DAC,eAAAA;eAAAA;;IA4IAC,+BAAAA;eAAAA;;IAvBAC,+BAAAA;eAAAA;;IAnGAC,oBAAAA;eAAAA;;IAsCAC,QAAAA;eAAAA;;IAMAC,8BAAAA;eAAAA;;IA1CAC,WAAAA;eAAAA;;;AAjFN,MAAMP,iBAAiB;IAC5B;QACEQ,GAAG;QACHC,GAAG;QACHC,QAAQ;QACRC,OAAO;QACPC,kBAAkB;QAClBC,kBAAkB;IACpB;IACA;QACEL,GAAG;QACHC,GAAG;QACHC,QAAQ;QACRC,OAAO;QACPC,kBAAkB;QAClBC,kBAAkB;IACpB;IACA;QACEL,GAAG;QACHC,GAAG;QACHC,QAAQ;QACRC,OAAO;QACPC,kBAAkB;QAClBC,kBAAkB;IACpB;CACD;AAED,MAAMC,uBAA2C;IAC/C;QACEJ,QAAQ;QACRK,MAAM;QACNJ,OAAO;QACPC,kBAAkB;QAClBC,kBAAkB;IACpB;IACA;QACEH,QAAQ;QACRK,MAA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M,MAAMT,kCAAyE;IACpF;QACEM,GAAG;QACHC,GAAG;QACHE,OAAO;IACT;IACA;QACEH,GAAG;QACHC,GAAG;QACHE,OAAO;IACT;IACA;QACEH,GAAG;QACHC,GAAG;QACHE,OAAO;IACT;IACA;QACEH,GAAG;QACHC,GAAG;QACHE,OAAO;IACT;CACD"}
1
+ {"version":3,"sources":["test-data.ts"],"sourcesContent":["import {\n ChartDataPoint,\n ChartProps,\n HorizontalBarChartWithAxisDataPoint,\n VSChartDataPoint,\n VerticalStackedChartProps,\n VerticalBarChartDataPoint,\n DataVizPalette,\n} from '../index';\n\nexport const chartPointsVBC = [\n {\n x: 0,\n y: 10000,\n legend: 'First',\n color: 'aqua',\n xAxisCalloutData: '2020/04/30',\n yAxisCalloutData: '10%',\n },\n {\n x: 10000,\n y: 50000,\n legend: 'Second',\n color: 'blue',\n xAxisCalloutData: '2020/04/30',\n yAxisCalloutData: '20%',\n },\n {\n x: 25000,\n y: 30000,\n legend: 'Third',\n color: 'navy',\n xAxisCalloutData: '2020/04/30',\n yAxisCalloutData: '37%',\n },\n];\n\nconst firstChartPointsVSBC: VSChartDataPoint[] = [\n {\n legend: 'Metadata1',\n data: 40,\n color: 'aqua',\n xAxisCalloutData: '2020/04/30',\n yAxisCalloutData: '40%',\n },\n {\n legend: 'Metadata2',\n data: 5,\n color: 'navy',\n xAxisCalloutData: '2020/04/30',\n yAxisCalloutData: '5%',\n },\n];\n\nconst secondChartPointsVSBC: VSChartDataPoint[] = [\n {\n legend: 'Metadata1',\n data: 30,\n color: 'aqua',\n xAxisCalloutData: '2020/04/30',\n yAxisCalloutData: '30%',\n },\n {\n legend: 'Metadata2',\n data: 20,\n color: 'navy',\n xAxisCalloutData: '2020/04/30',\n yAxisCalloutData: '20%',\n },\n];\n\nexport const chartPointsVSBC: VerticalStackedChartProps[] = [\n { chartData: firstChartPointsVSBC, xAxisPoint: 0 },\n { chartData: secondChartPointsVSBC, xAxisPoint: 20 },\n];\n\nexport const chartPoints2VSBC: VerticalStackedChartProps[] = [\n {\n chartData: firstChartPointsVSBC,\n xAxisPoint: 0,\n lineData: [{ y: 15, legend: 'Line1', color: 'yellow' }],\n },\n {\n chartData: secondChartPointsVSBC,\n xAxisPoint: 20,\n lineData: [{ y: 30, legend: 'Line1', color: 'yellow' }],\n },\n];\n\nexport const emptychartPointsVSBC: VerticalStackedChartProps[] = [{ chartData: [], xAxisPoint: 0 }];\n\nexport const pointsHBCWA = [\n {\n x: 10000,\n y: 5000,\n legend: 'Oranges',\n color: 'aqua',\n xAxisCalloutData: '2020/04/30',\n yAxisCalloutData: '10%',\n },\n {\n x: 20000,\n y: 50000,\n legend: 'Dogs',\n color: 'blue',\n xAxisCalloutData: '2020/04/30',\n yAxisCalloutData: '20%',\n },\n {\n x: 25000,\n y: 30000,\n legend: 'Apples',\n color: 'navy',\n xAxisCalloutData: '2020/04/30',\n yAxisCalloutData: '37%',\n },\n\n {\n x: 40000,\n y: 13000,\n legend: 'Bananas',\n color: 'teal',\n xAxisCalloutData: '2020/04/30',\n yAxisCalloutData: '88%',\n },\n];\n\nexport const pointsDC: ChartDataPoint[] = [\n { legend: 'first', data: 20000, color: '#E5E5E5', xAxisCalloutData: '2020/04/30' },\n { legend: 'second', data: 39000, color: '#0078D4', xAxisCalloutData: '2020/04/20' },\n { legend: 'third', data: 45000, color: '#DADADA', xAxisCalloutData: '2020/04/25' },\n];\n\nexport const pointsDCElevateMinimumsExample: ChartDataPoint[] = [\n { legend: 'first', data: 39000, color: '#E5E5E5', xAxisCalloutData: '2020/04/30' },\n { legend: 'second', data: 20, color: '#0078D4', xAxisCalloutData: '2020/04/20' },\n { legend: 'third', data: 20, color: '#DADADA', xAxisCalloutData: '2020/04/25' },\n { legend: 'fourth', data: 20, color: '#DADADA', xAxisCalloutData: '2020/04/25' },\n { legend: 'fifth', data: 20, color: '#DADADA', xAxisCalloutData: '2020/04/25' },\n { legend: 'sixth', data: 20, color: '#DADADA', xAxisCalloutData: '2020/04/25' },\n];\n\nexport const chartPointsDC: ChartProps = {\n chartTitle: 'Donut chart example',\n chartData: pointsDC,\n};\n\nexport const chartPointsDCElevateMinimums: ChartProps = {\n chartTitle: 'Donut chart example',\n chartData: pointsDC,\n};\n\nexport const chartPointsHBCWA: HorizontalBarChartWithAxisDataPoint[] = [\n {\n x: 10000,\n y: 5000,\n legend: 'Oranges',\n color: 'aqua',\n yAxisCalloutData: '2020/04/30',\n xAxisCalloutData: '10%',\n },\n {\n x: 20000,\n y: 50000,\n legend: 'Grapes',\n color: 'blue',\n yAxisCalloutData: '2020/04/30',\n xAxisCalloutData: '20%',\n },\n {\n x: 25000,\n y: 30000,\n legend: 'Apples',\n color: 'navy',\n yAxisCalloutData: '2020/04/30',\n xAxisCalloutData: '37%',\n },\n\n {\n x: 40000,\n y: 13000,\n legend: 'Bananas',\n color: 'teal',\n yAxisCalloutData: '2020/04/30',\n xAxisCalloutData: '88%',\n },\n];\n\nexport const chartPointsWithStringYAxisHBCWA: HorizontalBarChartWithAxisDataPoint[] = [\n {\n y: 'String One',\n x: 1000,\n color: 'aqua',\n },\n {\n y: 'String Two',\n x: 5000,\n color: 'blue',\n },\n {\n y: 'String Three',\n x: 3000,\n color: 'navy',\n },\n {\n y: 'String Four',\n x: 2000,\n color: 'blue',\n },\n];\n\nexport const chartPointsWithAxisToolTipHBCWA: HorizontalBarChartWithAxisDataPoint[] = [\n {\n x: 1000,\n y: 1000,\n color: 'aqua',\n },\n {\n x: 2000,\n y: 5000,\n color: 'blue',\n },\n {\n x: 3000,\n y: 3000,\n color: 'navy',\n },\n {\n x: 4000,\n y: 2000,\n color: 'blue',\n },\n];\n\nexport const allNegativeChartPointsVBC: VerticalBarChartDataPoint[] = [\n {\n x: 0,\n y: -10000,\n legend: 'First',\n color: DataVizPalette.color1,\n xAxisCalloutData: '2020/04/30',\n yAxisCalloutData: '10%',\n },\n {\n x: 10000,\n y: -50000,\n legend: 'Second',\n color: DataVizPalette.color2,\n xAxisCalloutData: '2020/04/30',\n yAxisCalloutData: '20%',\n },\n {\n x: 25000,\n y: -30000,\n legend: 'Third',\n color: DataVizPalette.color3,\n xAxisCalloutData: '2020/04/30',\n yAxisCalloutData: '37%',\n },\n];\n\nexport const negativeChartPointsVBC: VerticalBarChartDataPoint[] = [\n {\n x: 0,\n y: 10000,\n legend: 'First',\n color: DataVizPalette.color1,\n xAxisCalloutData: '2020/04/30',\n yAxisCalloutData: '10%',\n },\n {\n x: 10000,\n y: -50000,\n legend: 'Second',\n color: DataVizPalette.color2,\n xAxisCalloutData: '2020/04/30',\n yAxisCalloutData: '20%',\n },\n {\n x: 25000,\n y: 30000,\n legend: 'Third',\n color: DataVizPalette.color3,\n xAxisCalloutData: '2020/04/30',\n yAxisCalloutData: '37%',\n },\n];\n"],"names":["allNegativeChartPointsVBC","chartPoints2VSBC","chartPointsDC","chartPointsDCElevateMinimums","chartPointsHBCWA","chartPointsVBC","chartPointsVSBC","chartPointsWithAxisToolTipHBCWA","chartPointsWithStringYAxisHBCWA","emptychartPointsVSBC","negativeChartPointsVBC","pointsDC","pointsDCElevateMinimumsExample","pointsHBCWA","x","y","legend","color","xAxisCalloutData","yAxisCalloutData","firstChartPointsVSBC","data","secondChartPointsVSBC","chartData","xAxisPoint","lineData","chartTitle","DataVizPalette","color1","color2","color3"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAQ;QACRC,OAAOU,qBAAAA,CAAeE,MAAM;QAC5BX,kBAAkB;QAClBC,kBAAkB;IACpB;IACA;QACEL,GAAG;QACHC,GAAG,CAAC;QACJC,QAAQ;QACRC,OAAOU,qBAAAA,CAAeG,MAAM;QAC5BZ,kBAAkB;QAClBC,kBAAkB;IACpB;CACD;AAEM,MAAMT,yBAAsD;IACjE;QACEI,GAAG;QACHC,GAAG;QACHC,QAAQ;QACRC,OAAOU,qBAAAA,CAAeC,MAAM;QAC5BV,kBAAkB;QAClBC,kBAAkB;IACpB;IACA;QACEL,GAAG;QACHC,GAAG,CAAC;QACJC,QAAQ;QACRC,OAAOU,qBAAAA,CAAeE,MAAM;QAC5BX,kBAAkB;QAClBC,kBAAkB;IACpB;IACA;QACEL,GAAG;QACHC,GAAG;QACHC,QAAQ;QACRC,OAAOU,qBAAAA,CAAeG,MAAM;QAC5BZ,kBAAkB;QAClBC,kBAAkB;IACpB;CACD"}
@@ -132,6 +132,9 @@ _export(exports, {
132
132
  getBarWidth: function() {
133
133
  return getBarWidth;
134
134
  },
135
+ getCurveFactory: function() {
136
+ return getCurveFactory;
137
+ },
135
138
  getDomainNRangeValues: function() {
136
139
  return getDomainNRangeValues;
137
140
  },
@@ -141,6 +144,9 @@ _export(exports, {
141
144
  getScalePadding: function() {
142
145
  return getScalePadding;
143
146
  },
147
+ getSecureProps: function() {
148
+ return getSecureProps;
149
+ },
144
150
  getTypeOfAxis: function() {
145
151
  return getTypeOfAxis;
146
152
  },
@@ -188,6 +194,7 @@ const _d3selection = require("d3-selection");
188
194
  const _d3format = require("d3-format");
189
195
  const _d3timeformat = require("d3-time-format");
190
196
  const _d3time = require("d3-time");
197
+ const _d3shape = require("d3-shape");
191
198
  const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
192
199
  var ChartTypes;
193
200
  (function(ChartTypes) {
@@ -369,23 +376,68 @@ function useRtl() {
369
376
  const { dir } = (0, _reactsharedcontexts.useFluent_unstable)(); // "dir" returns "ltr" or "rtl"
370
377
  return dir === 'rtl';
371
378
  }
372
- function prepareDatapoints(maxVal, minVal, splitInto, isIntegralDataset) {
379
+ function isPowerOf10(num) {
380
+ const roundedfinalYMax = handleFloatingPointPrecisionError(num);
381
+ return Math.log10(roundedfinalYMax) % 1 === 0;
382
+ }
383
+ //for reference, go through this 'https://docs.python.org/release/2.5.1/tut/node16.html'
384
+ function handleFloatingPointPrecisionError(num) {
385
+ const rounded = Math.round(num);
386
+ return Math.abs(num - rounded) < 1e-6 ? rounded : num;
387
+ }
388
+ /**
389
+ * This method is used to calculate the rounded tick values for the y-axis
390
+ * @param {number} minVal
391
+ * @param {number} maxVal
392
+ * @param {number} splitInto
393
+ * @returns {number[]}
394
+ */ function calculateRoundedTicks(minVal, maxVal, splitInto) {
395
+ const finalYmin = minVal >= 0 && minVal === maxVal ? 0 : minVal;
396
+ const finalYmax = minVal < 0 && minVal === maxVal ? 0 : maxVal;
397
+ const ticksInterval = (0, _d3array.nice)(finalYmin, finalYmax, splitInto);
398
+ const ticks = (0, _d3array.ticks)(ticksInterval[0], ticksInterval[ticksInterval.length - 1], splitInto);
399
+ if (ticks[ticks.length - 1] > finalYmax && isPowerOf10(finalYmax)) {
400
+ ticks.pop();
401
+ }
402
+ return ticks;
403
+ }
404
+ function prepareDatapoints(maxVal, minVal, splitInto, isIntegralDataset, roundedTicks) {
405
+ if (roundedTicks) {
406
+ return calculateRoundedTicks(minVal, maxVal, splitInto);
407
+ }
373
408
  const val = isIntegralDataset ? Math.ceil((maxVal - minVal) / splitInto) : (maxVal - minVal) / splitInto >= 1 ? Math.ceil((maxVal - minVal) / splitInto) : (maxVal - minVal) / splitInto;
374
- const dataPointsArray = [
375
- minVal,
376
- minVal + val
409
+ /*
410
+ For cases where we have negative and positive values
411
+ The dataPointsArray is filled from 0 to minVal by val difference
412
+ Then the array is reversed and values from 0(excluding 0) to maxVal are appended
413
+ This ensures presence of 0 to act as an anchor reference.
414
+ For simple cases where the scale may not encounter such a need for 0,
415
+ We simply fill from minVal to maxVal
416
+ */ const dataPointsArray = [
417
+ minVal < 0 && maxVal >= 0 ? 0 : minVal
377
418
  ];
419
+ /*For the case of all positive or all negative, we need to add another value
420
+ in array for atleast one interval, but in case of mix of positive and negative,
421
+ there will always be one more entry that will be added by the logic we have*/ if (dataPointsArray[0] === minVal) {
422
+ dataPointsArray.push(minVal + val);
423
+ }
424
+ if (minVal < 0 && maxVal >= 0) {
425
+ while(dataPointsArray[dataPointsArray.length - 1] > minVal){
426
+ dataPointsArray.push(dataPointsArray[dataPointsArray.length - 1] - val);
427
+ }
428
+ dataPointsArray.reverse();
429
+ }
378
430
  while(dataPointsArray[dataPointsArray.length - 1] < maxVal){
379
431
  dataPointsArray.push(dataPointsArray[dataPointsArray.length - 1] + val);
380
432
  }
381
433
  return dataPointsArray;
382
434
  }
383
- function createYAxis(yAxisParams, isRtl, axisData, chartType, barWidth, isIntegralDataset, useSecondaryYScale = false) {
435
+ function createYAxis(yAxisParams, isRtl, axisData, chartType, barWidth, isIntegralDataset, useSecondaryYScale = false, roundedTicks = false) {
384
436
  switch(chartType){
385
437
  case 6:
386
438
  return createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl, axisData, barWidth);
387
439
  default:
388
- return createYAxisForOtherCharts(yAxisParams, isRtl, axisData, isIntegralDataset, chartType, useSecondaryYScale);
440
+ return createYAxisForOtherCharts(yAxisParams, isRtl, axisData, isIntegralDataset, chartType, useSecondaryYScale, roundedTicks);
389
441
  }
390
442
  }
391
443
  function createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl, axisData, barWidth) {
@@ -407,10 +459,10 @@ function createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl, axisData,
407
459
  const axis = isRtl ? (0, _d3axis.axisRight)(yAxisScale) : (0, _d3axis.axisLeft)(yAxisScale);
408
460
  const yAxis = axis.tickPadding(tickPadding).ticks(yAxisTickCount);
409
461
  yAxisTickFormat ? yAxis.tickFormat(yAxisTickFormat) : yAxis.tickFormat((0, _d3format.format)('.2~s'));
410
- yAxisElement ? (0, _d3selection.select)(yAxisElement).call((g)=>yAxis).selectAll('text').attr('aria-hidden', 'true') : '';
462
+ yAxisElement ? (0, _d3selection.select)(yAxisElement).call(yAxis).selectAll('text').attr('aria-hidden', 'true') : '';
411
463
  return yAxisScale;
412
464
  }
413
- function createYAxisForOtherCharts(yAxisParams, isRtl, axisData, isIntegralDataset, chartType, useSecondaryYScale = false) {
465
+ function createYAxisForOtherCharts(yAxisParams, isRtl, axisData, isIntegralDataset, chartType, useSecondaryYScale = false, roundedTicks = false) {
414
466
  const { yMinMaxValues = {
415
467
  startValue: 0,
416
468
  endValue: 0
@@ -418,8 +470,8 @@ function createYAxisForOtherCharts(yAxisParams, isRtl, axisData, isIntegralDatas
418
470
  // maxOfYVal coming from only area chart and Grouped vertical bar chart(Calculation done at base file)
419
471
  const tempVal = maxOfYVal || yMinMaxValues.endValue;
420
472
  const finalYmax = tempVal > yMaxValue ? tempVal : yMaxValue;
421
- const finalYmin = yMinMaxValues.startValue < yMinValue ? 0 : yMinValue;
422
- const domainValues = prepareDatapoints(finalYmax, finalYmin, yAxisTickCount, isIntegralDataset);
473
+ const finalYmin = Math.min(yMinMaxValues.startValue, yMinValue || 0);
474
+ const domainValues = prepareDatapoints(finalYmax, finalYmin, yAxisTickCount, isIntegralDataset, roundedTicks);
423
475
  let yMin = finalYmin;
424
476
  let yMax = domainValues[domainValues.length - 1];
425
477
  if (chartType === 7) {
@@ -428,7 +480,7 @@ function createYAxisForOtherCharts(yAxisParams, isRtl, axisData, isIntegralDatas
428
480
  yMax = yMax + yPadding;
429
481
  }
430
482
  const yAxisScale = (0, _d3scale.scaleLinear)().domain([
431
- yMin,
483
+ domainValues[0],
432
484
  yMax
433
485
  ]).range([
434
486
  containerHeight - margins.bottom,
@@ -460,7 +512,7 @@ const createStringYAxisForHorizontalBarChartWithAxis = (yAxisParams, dataPoints,
460
512
  if (yAxisTickFormat) {
461
513
  yAxis.tickFormat(yAxisTickFormat);
462
514
  }
463
- yAxisElement ? (0, _d3selection.select)(yAxisElement).call((g)=>yAxis).selectAll('text') : '';
515
+ yAxisElement ? (0, _d3selection.select)(yAxisElement).call(yAxis).selectAll('text') : '';
464
516
  return yAxisScale;
465
517
  };
466
518
  const createStringYAxisForOtherCharts = (yAxisParams, dataPoints, isRtl)=>{
@@ -474,7 +526,7 @@ const createStringYAxisForOtherCharts = (yAxisParams, dataPoints, isRtl)=>{
474
526
  if (yAxisTickFormat) {
475
527
  yAxis.tickFormat(yAxisTickFormat);
476
528
  }
477
- yAxisElement ? (0, _d3selection.select)(yAxisElement).call((g)=>yAxis).selectAll('text') : '';
529
+ yAxisElement ? (0, _d3selection.select)(yAxisElement).call(yAxis).selectAll('text') : '';
478
530
  return yAxisScale;
479
531
  };
480
532
  function calloutData(values) {
@@ -549,7 +601,7 @@ function createWrapOfXLabels(wrapLabelProps) {
549
601
  if (node === null) {
550
602
  return;
551
603
  }
552
- const axisNode = (0, _d3selection.select)(node).call((g)=>xAxis);
604
+ const axisNode = (0, _d3selection.select)(node).call(xAxis);
553
605
  let removeVal = 0;
554
606
  const width = 10;
555
607
  const arr = [];
@@ -614,6 +666,7 @@ function createYAxisLabels(node, yAxis, noOfCharsToTruncate, truncateLabel, xVal
614
666
  if (node === null) {
615
667
  return;
616
668
  }
669
+ let tickIndex = 0;
617
670
  const axisNode = (0, _d3selection.select)(node).call(yAxis);
618
671
  axisNode.selectAll('.tick text').each(function() {
619
672
  const text = (0, _d3selection.select)(this);
@@ -625,11 +678,12 @@ function createYAxisLabels(node, yAxis, noOfCharsToTruncate, truncateLabel, xVal
625
678
  const x = text.attr('x');
626
679
  const dy = parseFloat(text.attr('dy'));
627
680
  const dx = 0;
628
- text.text(null).append('tspan').attr('x', x).attr('y', y).attr('id', 'BaseSpan').attr('dy', dy + 'em').attr('data-', totalWord);
681
+ const uid = tickIndex++;
682
+ text.text(null).append('tspan').attr('x', x).attr('y', y).attr('id', `BaseSpan-${uid}`).attr('dy', dy + 'em').attr('data-', totalWord);
629
683
  if (truncateLabel && totalWordLength > noOfCharsToTruncate) {
630
- text.append('tspan').attr('id', 'showDots').attr('x', isRtl ? 0 : x).attr('y', y).attr('dy', dy).attr('dx', padding + dx + 'em').text(truncatedWord);
684
+ text.append('tspan').attr('id', `showDots-${uid}`).attr('x', isRtl ? 0 : x).attr('y', y).attr('dy', dy).attr('dx', padding + dx + 'em').text(truncatedWord);
631
685
  } else {
632
- text.attr('text-align', 'start').append('tspan').attr('id', 'LessLength').attr('x', isRtl ? 0 : x).attr('y', y).attr('dx', padding + dx + 'em').text(totalWord);
686
+ text.attr('text-align', 'start').append('tspan').attr('id', `LessLength-${uid}`).attr('x', isRtl ? 0 : x).attr('y', y).attr('dx', padding + dx + 'em').text(totalWord);
633
687
  }
634
688
  });
635
689
  }
@@ -1292,3 +1346,26 @@ function resolveCSSVariables(chartContainer, styleRules) {
1292
1346
  return containerStyles.getPropertyValue(group1);
1293
1347
  });
1294
1348
  }
1349
+ function getSecureProps(props = {}) {
1350
+ const { dangerouslySetInnerHTML, ...result } = props;
1351
+ return result;
1352
+ }
1353
+ function getCurveFactory(curve, defaultFactory = _d3shape.curveLinear) {
1354
+ if (typeof curve === 'function') {
1355
+ return curve;
1356
+ }
1357
+ switch(curve){
1358
+ case 'linear':
1359
+ return _d3shape.curveLinear;
1360
+ case 'natural':
1361
+ return _d3shape.curveNatural;
1362
+ case 'step':
1363
+ return _d3shape.curveStep;
1364
+ case 'stepAfter':
1365
+ return _d3shape.curveStepAfter;
1366
+ case 'stepBefore':
1367
+ return _d3shape.curveStepBefore;
1368
+ default:
1369
+ return defaultFactory;
1370
+ }
1371
+ }