@fluentui/react-charts 9.3.5 → 9.3.6

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 (266) hide show
  1. package/CHANGELOG.md +23 -2
  2. package/dist/index.d.ts +223 -44
  3. package/lib/AnnotationOnlyChart.js +1 -0
  4. package/lib/AnnotationOnlyChart.js.map +1 -0
  5. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js +208 -0
  6. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -0
  7. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js +1 -0
  8. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js.map +1 -0
  9. package/lib/components/AnnotationOnlyChart/index.js +2 -0
  10. package/lib/components/AnnotationOnlyChart/index.js.map +1 -0
  11. package/lib/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.js +31 -0
  12. package/lib/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.js.map +1 -0
  13. package/lib/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.raw.js +23 -0
  14. package/lib/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.raw.js.map +1 -0
  15. package/lib/components/AreaChart/useAreaChartStyles.styles.js +11 -6
  16. package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
  17. package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js +3 -1
  18. package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
  19. package/lib/components/ChartTable/useChartTableStyles.styles.js +59 -39
  20. package/lib/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
  21. package/lib/components/ChartTable/useChartTableStyles.styles.raw.js +5 -5
  22. package/lib/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
  23. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js +617 -0
  24. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -0
  25. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js +1 -0
  26. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -0
  27. package/lib/components/CommonComponents/Annotations/index.js +2 -0
  28. package/lib/components/CommonComponents/Annotations/index.js.map +1 -0
  29. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +173 -0
  30. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -0
  31. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +126 -0
  32. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -0
  33. package/lib/components/CommonComponents/CartesianChart.js +157 -132
  34. package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
  35. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  36. package/lib/components/CommonComponents/index.js +2 -0
  37. package/lib/components/CommonComponents/index.js.map +1 -1
  38. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +29 -13
  39. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  40. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +14 -1
  41. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  42. package/lib/components/CommonComponents/useChartPopoverStyles.styles.js +2 -6
  43. package/lib/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
  44. package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js +3 -2
  45. package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +1 -1
  46. package/lib/components/DeclarativeChart/DeclarativeChart.js +39 -19
  47. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  48. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +4 -8
  49. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  50. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +644 -72
  51. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  52. package/lib/components/DonutChart/Arc/useArcStyles.styles.js +23 -8
  53. package/lib/components/DonutChart/Arc/useArcStyles.styles.js.map +1 -1
  54. package/lib/components/DonutChart/Arc/useArcStyles.styles.raw.js +2 -2
  55. package/lib/components/DonutChart/Arc/useArcStyles.styles.raw.js.map +1 -1
  56. package/lib/components/DonutChart/useDonutChartStyles.styles.js +2 -2
  57. package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
  58. package/lib/components/GanttChart/GanttChart.js +3 -3
  59. package/lib/components/GanttChart/GanttChart.js.map +1 -1
  60. package/lib/components/GanttChart/GanttChart.types.js.map +1 -1
  61. package/lib/components/GanttChart/useGanttChartStyles.styles.js +3 -1
  62. package/lib/components/GanttChart/useGanttChartStyles.styles.js.map +1 -1
  63. package/lib/components/GanttChart/useGanttChartStyles.styles.raw.js +3 -1
  64. package/lib/components/GanttChart/useGanttChartStyles.styles.raw.js.map +1 -1
  65. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +1 -1
  66. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  67. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +11 -6
  68. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
  69. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +3 -1
  70. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
  71. package/lib/components/HeatMapChart/HeatMapChart.js +1 -1
  72. package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
  73. package/lib/components/HeatMapChart/HeatMapChart.types.js.map +1 -1
  74. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js +3 -1
  75. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -1
  76. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js +3 -1
  77. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js.map +1 -1
  78. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +25 -12
  79. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -1
  80. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js +4 -4
  81. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js.map +1 -1
  82. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +2 -2
  83. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  84. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
  85. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +3 -1
  86. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
  87. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +3 -1
  88. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -1
  89. package/lib/components/Legends/useLegendsStyles.styles.js +97 -37
  90. package/lib/components/Legends/useLegendsStyles.styles.js.map +1 -1
  91. package/lib/components/Legends/useLegendsStyles.styles.raw.js +10 -11
  92. package/lib/components/Legends/useLegendsStyles.styles.raw.js.map +1 -1
  93. package/lib/components/LineChart/LineChart.js +1 -1
  94. package/lib/components/LineChart/LineChart.js.map +1 -1
  95. package/lib/components/LineChart/useLineChartStyles.styles.js +15 -10
  96. package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -1
  97. package/lib/components/LineChart/useLineChartStyles.styles.raw.js +3 -1
  98. package/lib/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
  99. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +13 -10
  100. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  101. package/lib/components/ScatterChart/ScatterChart.js +1 -1
  102. package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
  103. package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
  104. package/lib/components/ScatterChart/useScatterChartStyles.styles.js +13 -8
  105. package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
  106. package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js +3 -1
  107. package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
  108. package/lib/components/VerticalBarChart/VerticalBarChart.js +1 -1
  109. package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  110. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +13 -8
  111. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
  112. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +3 -1
  113. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
  114. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +1 -1
  115. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  116. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
  117. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +11 -6
  118. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
  119. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +3 -1
  120. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
  121. package/lib/index.js +1 -0
  122. package/lib/index.js.map +1 -1
  123. package/lib/types/ChartAnnotation.js +1 -0
  124. package/lib/types/ChartAnnotation.js.map +1 -0
  125. package/lib/types/index.js +1 -0
  126. package/lib/types/index.js.map +1 -1
  127. package/lib/utilities/Common.styles.js +1 -2
  128. package/lib/utilities/Common.styles.js.map +1 -1
  129. package/lib/utilities/Common.styles.raw.js +1 -2
  130. package/lib/utilities/Common.styles.raw.js.map +1 -1
  131. package/lib/utilities/image-export-utils.js +108 -0
  132. package/lib/utilities/image-export-utils.js.map +1 -1
  133. package/lib/utilities/utilities.js +16 -13
  134. package/lib/utilities/utilities.js.map +1 -1
  135. package/lib-commonjs/AnnotationOnlyChart.js +6 -0
  136. package/lib-commonjs/AnnotationOnlyChart.js.map +1 -0
  137. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js +219 -0
  138. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -0
  139. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js +6 -0
  140. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js.map +1 -0
  141. package/lib-commonjs/components/AnnotationOnlyChart/index.js +7 -0
  142. package/lib-commonjs/components/AnnotationOnlyChart/index.js.map +1 -0
  143. package/lib-commonjs/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.js +56 -0
  144. package/lib-commonjs/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.js.map +1 -0
  145. package/lib-commonjs/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.raw.js +33 -0
  146. package/lib-commonjs/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.raw.js.map +1 -0
  147. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +14 -15
  148. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
  149. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js +3 -1
  150. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
  151. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js +74 -102
  152. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
  153. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js +4 -4
  154. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
  155. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js +628 -0
  156. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -0
  157. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js +4 -0
  158. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -0
  159. package/lib-commonjs/components/CommonComponents/Annotations/index.js +7 -0
  160. package/lib-commonjs/components/CommonComponents/Annotations/index.js.map +1 -0
  161. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +265 -0
  162. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -0
  163. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +161 -0
  164. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -0
  165. package/lib-commonjs/components/CommonComponents/CartesianChart.js +157 -131
  166. package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
  167. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  168. package/lib-commonjs/components/CommonComponents/index.js +2 -0
  169. package/lib-commonjs/components/CommonComponents/index.js.map +1 -1
  170. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +32 -21
  171. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  172. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +14 -1
  173. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  174. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js +0 -14
  175. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
  176. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js +2 -1
  177. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +1 -1
  178. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +38 -18
  179. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  180. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  181. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +630 -38
  182. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  183. package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.js +25 -16
  184. package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.js.map +1 -1
  185. package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.raw.js +1 -1
  186. package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.raw.js.map +1 -1
  187. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js +2 -2
  188. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
  189. package/lib-commonjs/components/GanttChart/GanttChart.js +3 -3
  190. package/lib-commonjs/components/GanttChart/GanttChart.js.map +1 -1
  191. package/lib-commonjs/components/GanttChart/GanttChart.types.js.map +1 -1
  192. package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.js +3 -1
  193. package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.js.map +1 -1
  194. package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.raw.js +3 -1
  195. package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.raw.js.map +1 -1
  196. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +1 -1
  197. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  198. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +14 -15
  199. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
  200. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +3 -1
  201. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
  202. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +1 -1
  203. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
  204. package/lib-commonjs/components/HeatMapChart/HeatMapChart.types.js.map +1 -1
  205. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js +3 -1
  206. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -1
  207. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js +3 -1
  208. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js.map +1 -1
  209. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +47 -34
  210. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -1
  211. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js +3 -3
  212. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js.map +1 -1
  213. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +2 -2
  214. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  215. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
  216. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +3 -1
  217. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
  218. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +3 -1
  219. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -1
  220. package/lib-commonjs/components/Legends/useLegendsStyles.styles.js +144 -86
  221. package/lib-commonjs/components/Legends/useLegendsStyles.styles.js.map +1 -1
  222. package/lib-commonjs/components/Legends/useLegendsStyles.styles.raw.js +9 -10
  223. package/lib-commonjs/components/Legends/useLegendsStyles.styles.raw.js.map +1 -1
  224. package/lib-commonjs/components/LineChart/LineChart.js +1 -1
  225. package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
  226. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +18 -19
  227. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -1
  228. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js +3 -1
  229. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
  230. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +16 -19
  231. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  232. package/lib-commonjs/components/ScatterChart/ScatterChart.js +1 -1
  233. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
  234. package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
  235. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +16 -17
  236. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
  237. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js +3 -1
  238. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
  239. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +1 -1
  240. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  241. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +16 -17
  242. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
  243. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +3 -1
  244. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
  245. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +1 -1
  246. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  247. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
  248. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +14 -15
  249. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
  250. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +3 -1
  251. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
  252. package/lib-commonjs/index.js +1 -0
  253. package/lib-commonjs/index.js.map +1 -1
  254. package/lib-commonjs/types/ChartAnnotation.js +6 -0
  255. package/lib-commonjs/types/ChartAnnotation.js.map +1 -0
  256. package/lib-commonjs/types/index.js +1 -0
  257. package/lib-commonjs/types/index.js.map +1 -1
  258. package/lib-commonjs/utilities/Common.styles.js +1 -2
  259. package/lib-commonjs/utilities/Common.styles.js.map +1 -1
  260. package/lib-commonjs/utilities/Common.styles.raw.js +1 -2
  261. package/lib-commonjs/utilities/Common.styles.raw.js.map +1 -1
  262. package/lib-commonjs/utilities/image-export-utils.js +108 -0
  263. package/lib-commonjs/utilities/image-export-utils.js.map +1 -1
  264. package/lib-commonjs/utilities/utilities.js +16 -13
  265. package/lib-commonjs/utilities/utilities.js.map +1 -1
  266. package/package.json +11 -11
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/DeclarativeChart/PlotlyColorAdapter.ts"],"sourcesContent":["import * as React from 'react';\nimport { color as d3Color } from 'd3-color';\nimport type { PieColors, Color, PlotData, Layout } from '@fluentui/chart-utilities';\nimport { isArrayOrTypedArray } from '@fluentui/chart-utilities';\nimport { areArraysEqual } from '../../utilities/utilities';\nimport { DataVizPalette, getColorFromToken, getNextColor } from '../../utilities/colors';\nimport { scaleLinear as d3ScaleLinear } from 'd3-scale';\n\ntype PlotlyColorway = 'plotly' | 'd3' | 'others';\n\n// The color sequences in plotly express are defined here:\n// https://plotly.com/python/discrete-color/#:~:text=Join%20now.-,Color%20Sequences%20in%20Plotly%20Express,-By%20default%2C%20Plotly\nexport type ColorwayType = 'default' | 'builtin' | 'others' | undefined;\n\nconst DEFAULT_PLOTLY_COLORWAY = [\n '#636efa', //1\n '#ef553b', //2\n '#00cc96', //3\n '#ab63fa', //4\n '#ffa15a', //5\n '#19d3f3', //6\n '#ff6692', //7\n '#b6e880', //8\n '#ff97ff', //9\n '#fecb52', //10\n];\n\n// Default D3 qualitative colorway (Category10), matching Plotly Express px.colors.qualitative.D3\n// Source: https://plotly.com/python/discrete-color/#:~:text=Join%20now.-,Color%20Sequences%20in%20Plotly%20Express,-By%20default%2C%20Plotly\nexport const DEFAULT_D3_COLORWAY = [\n '#1f77b4', //1\n '#ff7f0e', //2\n '#2ca02c', //3\n '#d62728', //4\n '#9467bd', //5\n '#8c564b', //6\n '#e377c2', //7\n '#7f7f7f', //8\n '#bcbd22', //9\n '#17becf', //10\n];\n\nconst PLOTLY_FLUENTVIZ_COLORWAY_MAPPING = [\n DataVizPalette.color1, //1\n DataVizPalette.warning, //2\n DataVizPalette.color8, //3\n DataVizPalette.color4, //4\n DataVizPalette.color7, //5\n DataVizPalette.color6, //6\n DataVizPalette.color2, //7\n DataVizPalette.color5, //8\n DataVizPalette.color9, //9\n DataVizPalette.color10, //10\n];\n\n// Mapping from D3 Category10 order to Fluent DataViz tokens (light/dark handled via getColorFromToken)\n// D3: [blue, orange, green, red, purple, brown, pink, gray, olive, cyan]\nexport const D3_FLUENTVIZ_COLORWAY_MAPPING: string[] = [\n DataVizPalette.color26, // blue -> lightBlue.shade10\n DataVizPalette.warning, // orange -> semantic warning\n DataVizPalette.color5, // green -> lightGreen.primary\n DataVizPalette.error, // red -> semantic error\n DataVizPalette.color4, // purple -> orchid.tint10\n DataVizPalette.color17, // brown -> pumpkin.shade20\n DataVizPalette.color22, // pink -> hotPink.tint20\n DataVizPalette.disabled, // gray -> semantic disabled\n DataVizPalette.color10, // olive/yellow-green -> gold.shade10\n DataVizPalette.color3, // cyan/teal -> teal.tint20\n];\n\nfunction getPlotlyColorway(colorway: string[] | undefined, isDonut: boolean = false): PlotlyColorway {\n if (!colorway || !isArrayOrTypedArray(colorway)) {\n return 'others';\n }\n const lower = colorway.map(c => c.toLowerCase());\n if (isDonut && areArraysEqual(lower, D3_FLUENTVIZ_COLORWAY_MAPPING)) {\n return 'd3';\n }\n if (areArraysEqual(lower, DEFAULT_PLOTLY_COLORWAY)) {\n return 'plotly';\n }\n return 'others';\n}\n\nfunction tryMapFluentDataViz(\n hexColor: string,\n templateColorway: PlotlyColorway,\n isDarkTheme?: boolean,\n isDonut?: boolean,\n): string {\n if (templateColorway !== 'plotly') {\n return hexColor;\n }\n let defaultColorway: string[] = DEFAULT_PLOTLY_COLORWAY;\n let defaultMapping: string[] = PLOTLY_FLUENTVIZ_COLORWAY_MAPPING;\n if (isDonut) {\n defaultColorway = templateColorway === 'plotly' ? DEFAULT_PLOTLY_COLORWAY : DEFAULT_D3_COLORWAY;\n defaultMapping = templateColorway === 'plotly' ? PLOTLY_FLUENTVIZ_COLORWAY_MAPPING : D3_FLUENTVIZ_COLORWAY_MAPPING;\n }\n const idx = defaultColorway.indexOf(hexColor.toLowerCase());\n if (idx !== -1) {\n return getColorFromToken(defaultMapping[idx], !!isDarkTheme);\n }\n return hexColor;\n}\n\nexport const getColor = (\n legendLabel: string,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n colorMap: React.MutableRefObject<Map<string, string>>,\n templateColorway: PlotlyColorway,\n isDarkTheme?: boolean,\n isDonut?: boolean,\n): string => {\n if (!colorMap.current.has(legendLabel)) {\n let nextColor: string;\n const defaultColorMapping = isDonut\n ? templateColorway === 'plotly'\n ? PLOTLY_FLUENTVIZ_COLORWAY_MAPPING\n : D3_FLUENTVIZ_COLORWAY_MAPPING\n : PLOTLY_FLUENTVIZ_COLORWAY_MAPPING;\n if (colorMap.current.size < defaultColorMapping.length) {\n // Get first 10 colors from plotly-fluentviz colorway mapping\n nextColor = getColorFromToken(defaultColorMapping[colorMap.current.size], isDarkTheme);\n } else {\n nextColor = getNextColor(colorMap.current.size, 0, isDarkTheme);\n }\n colorMap.current.set(legendLabel, nextColor);\n return nextColor;\n }\n\n return colorMap.current.get(legendLabel) as string;\n};\n\nexport const getSchemaColors = (\n colorway: string[] | undefined,\n colors: PieColors | Color | Color[] | string | null | undefined,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n isDonut?: boolean,\n): string[] | string | undefined => {\n const hexColors: string[] = [];\n if (!colors) {\n return undefined;\n }\n const templateColorway = getPlotlyColorway(colorway, isDonut);\n if (isArrayOrTypedArray(colors)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (colors as any[]).forEach((element, index) => {\n const colorString = element?.toString().trim();\n const nextFluentColor = getColor(`Label_${index}`, colorMap, templateColorway, isDarkTheme, isDonut);\n if (colorString) {\n const parsedColor = d3Color(colorString);\n hexColors.push(\n parsedColor ? tryMapFluentDataViz(parsedColor.formatHex(), templateColorway, isDarkTheme) : nextFluentColor,\n );\n } else {\n hexColors.push(nextFluentColor);\n }\n });\n } else if (typeof colors === 'string') {\n const parsedColor = d3Color(colors);\n return parsedColor\n ? tryMapFluentDataViz(parsedColor.formatHex(), templateColorway, isDarkTheme)\n : getColor('Label_0', colorMap, templateColorway, isDarkTheme, isDonut);\n }\n return hexColors;\n};\n\nexport const extractColor = (\n colorway: string[] | undefined,\n colorwayType: ColorwayType,\n colors: PieColors | Color | Color[] | string | null | undefined,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n isDonut?: boolean,\n): string | string[] | undefined => {\n return colorwayType === 'default' && colors\n ? getSchemaColors(colorway, colors, colorMap, isDarkTheme, isDonut)\n : undefined;\n};\n\nexport const resolveColor = (\n extractedColors: string[] | string | null | undefined,\n index: number,\n legend: string,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n colorMap: React.MutableRefObject<Map<string, string>>,\n colorway: string[] | undefined,\n isDarkTheme?: boolean,\n isDonut?: boolean,\n): string => {\n let color = '';\n const templateColorway = getPlotlyColorway(colorway, isDonut);\n if (extractedColors && isArrayOrTypedArray(extractedColors) && extractedColors.length > 0) {\n color = extractedColors[index % extractedColors.length];\n } else if (typeof extractedColors === 'string') {\n color = extractedColors;\n } else {\n color = getColor(legend, colorMap, templateColorway, isDarkTheme, isDonut);\n }\n return color;\n};\n\nexport const getOpacity = (series: Partial<PlotData>, index: number): number => {\n return series.marker?.opacity\n ? isArrayOrTypedArray(series.marker?.opacity)\n ? (series.marker?.opacity as number[])[index % (series.marker?.opacity as number[]).length]\n : (series.marker?.opacity as number)\n : series.opacity ?? 1;\n};\n\nexport const createColorScale = (\n layout: Partial<Layout> | undefined,\n series: Partial<PlotData>,\n currentColorScale: ((value: number) => string) | undefined,\n): ((value: number) => string) | undefined => {\n if (\n layout?.coloraxis?.colorscale?.length &&\n isArrayOrTypedArray(series.marker?.color) &&\n (series.marker?.color as Color[]).length > 0 &&\n typeof (series.marker?.color as Color[])?.[0] === 'number'\n ) {\n const scale = layout?.coloraxis?.colorscale as Array<[number, string]>;\n const colorValues = series.marker?.color as number[];\n const [dMin, dMax] = [\n layout?.coloraxis?.cmin ?? Math.min(...colorValues),\n layout?.coloraxis?.cmax ?? Math.max(...colorValues),\n ];\n\n // Normalize colorscale domain to actual data domain\n const scaleDomain = scale.map(([pos]) => dMin + pos * (dMax - dMin));\n const scaleColors = scale.map(item => item[1]);\n\n return d3ScaleLinear<string>().domain(scaleDomain).range(scaleColors);\n }\n return currentColorScale;\n};\n"],"names":["React","color","d3Color","isArrayOrTypedArray","areArraysEqual","DataVizPalette","getColorFromToken","getNextColor","scaleLinear","d3ScaleLinear","DEFAULT_PLOTLY_COLORWAY","DEFAULT_D3_COLORWAY","PLOTLY_FLUENTVIZ_COLORWAY_MAPPING","color1","warning","color8","color4","color7","color6","color2","color5","color9","color10","D3_FLUENTVIZ_COLORWAY_MAPPING","color26","error","color17","color22","disabled","color3","getPlotlyColorway","colorway","isDonut","lower","map","c","toLowerCase","tryMapFluentDataViz","hexColor","templateColorway","isDarkTheme","defaultColorway","defaultMapping","idx","indexOf","getColor","legendLabel","colorMap","current","has","nextColor","defaultColorMapping","size","length","set","get","getSchemaColors","colors","hexColors","undefined","forEach","element","index","colorString","toString","trim","nextFluentColor","parsedColor","push","formatHex","extractColor","colorwayType","resolveColor","extractedColors","legend","getOpacity","series","marker","opacity","createColorScale","layout","currentColorScale","coloraxis","colorscale","scale","colorValues","dMin","dMax","cmin","Math","min","cmax","max","scaleDomain","pos","scaleColors","item","domain","range"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,SAASC,OAAO,QAAQ,WAAW;AAE5C,SAASC,mBAAmB,QAAQ,4BAA4B;AAChE,SAASC,cAAc,QAAQ,4BAA4B;AAC3D,SAASC,cAAc,EAAEC,iBAAiB,EAAEC,YAAY,QAAQ,yBAAyB;AACzF,SAASC,eAAeC,aAAa,QAAQ,WAAW;AAQxD,MAAMC,0BAA0B;IAC9B;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAED,iGAAiG;AACjG,6IAA6I;AAC7I,OAAO,MAAMC,sBAAsB;IACjC;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,CAAC;AAEF,MAAMC,oCAAoC;IACxCP,eAAeQ,MAAM;IACrBR,eAAeS,OAAO;IACtBT,eAAeU,MAAM;IACrBV,eAAeW,MAAM;IACrBX,eAAeY,MAAM;IACrBZ,eAAea,MAAM;IACrBb,eAAec,MAAM;IACrBd,eAAee,MAAM;IACrBf,eAAegB,MAAM;IACrBhB,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3D;IACA,OAAOd;AACT,EAAE"}
1
+ {"version":3,"sources":["../src/components/DeclarativeChart/PlotlyColorAdapter.ts"],"sourcesContent":["import * as React from 'react';\nimport { color as d3Color } from 'd3-color';\nimport type { PieColors, Color, PlotData, Layout } from '@fluentui/chart-utilities';\nimport { isArrayOrTypedArray } from '@fluentui/chart-utilities';\nimport { areArraysEqual } from '../../utilities/utilities';\nimport { DataVizPalette, getColorFromToken, getNextColor } from '../../utilities/colors';\nimport { scaleLinear as d3ScaleLinear } from 'd3-scale';\n\ntype PlotlyColorway = 'plotly' | 'd3' | 'others';\n\n// The color sequences in plotly express are defined here:\n// https://plotly.com/python/discrete-color/#:~:text=Join%20now.-,Color%20Sequences%20in%20Plotly%20Express,-By%20default%2C%20Plotly\nexport type ColorwayType = 'default' | 'builtin' | 'others' | undefined;\n\nconst DEFAULT_PLOTLY_COLORWAY = [\n '#636efa', //1\n '#ef553b', //2\n '#00cc96', //3\n '#ab63fa', //4\n '#ffa15a', //5\n '#19d3f3', //6\n '#ff6692', //7\n '#b6e880', //8\n '#ff97ff', //9\n '#fecb52', //10\n];\n\n// Default D3 qualitative colorway (Category10), matching Plotly Express px.colors.qualitative.D3\n// Source: https://plotly.com/python/discrete-color/#:~:text=Join%20now.-,Color%20Sequences%20in%20Plotly%20Express,-By%20default%2C%20Plotly\nexport const DEFAULT_D3_COLORWAY = [\n '#1f77b4', //1\n '#ff7f0e', //2\n '#2ca02c', //3\n '#d62728', //4\n '#9467bd', //5\n '#8c564b', //6\n '#e377c2', //7\n '#7f7f7f', //8\n '#bcbd22', //9\n '#17becf', //10\n];\n\nconst PLOTLY_FLUENTVIZ_COLORWAY_MAPPING = [\n DataVizPalette.color1, //1\n DataVizPalette.warning, //2\n DataVizPalette.color8, //3\n DataVizPalette.color4, //4\n DataVizPalette.color7, //5\n DataVizPalette.color6, //6\n DataVizPalette.color2, //7\n DataVizPalette.color5, //8\n DataVizPalette.color9, //9\n DataVizPalette.color10, //10\n];\n\n// Mapping from D3 Category10 order to Fluent DataViz tokens (light/dark handled via getColorFromToken)\n// D3: [blue, orange, green, red, purple, brown, pink, gray, olive, cyan]\nexport const D3_FLUENTVIZ_COLORWAY_MAPPING: string[] = [\n DataVizPalette.color26, // blue -> lightBlue.shade10\n DataVizPalette.warning, // orange -> semantic warning\n DataVizPalette.color5, // green -> lightGreen.primary\n DataVizPalette.error, // red -> semantic error\n DataVizPalette.color4, // purple -> orchid.tint10\n DataVizPalette.color17, // brown -> pumpkin.shade20\n DataVizPalette.color22, // pink -> hotPink.tint20\n DataVizPalette.disabled, // gray -> semantic disabled\n DataVizPalette.color10, // olive/yellow-green -> gold.shade10\n DataVizPalette.color3, // cyan/teal -> teal.tint20\n];\n\nfunction getPlotlyColorway(colorway: string[] | undefined, isDonut: boolean = false): PlotlyColorway {\n if (!colorway || !isArrayOrTypedArray(colorway)) {\n return 'others';\n }\n const lower = colorway.map(c => c.toLowerCase());\n if (isDonut && areArraysEqual(lower, D3_FLUENTVIZ_COLORWAY_MAPPING)) {\n return 'd3';\n }\n if (areArraysEqual(lower, DEFAULT_PLOTLY_COLORWAY)) {\n return 'plotly';\n }\n return 'others';\n}\n\nfunction tryMapFluentDataViz(\n hexColor: string,\n templateColorway: PlotlyColorway,\n isDarkTheme?: boolean,\n isDonut?: boolean,\n): string {\n if (templateColorway !== 'plotly') {\n return hexColor;\n }\n let defaultColorway: string[] = DEFAULT_PLOTLY_COLORWAY;\n let defaultMapping: string[] = PLOTLY_FLUENTVIZ_COLORWAY_MAPPING;\n if (isDonut) {\n defaultColorway = templateColorway === 'plotly' ? DEFAULT_PLOTLY_COLORWAY : DEFAULT_D3_COLORWAY;\n defaultMapping = templateColorway === 'plotly' ? PLOTLY_FLUENTVIZ_COLORWAY_MAPPING : D3_FLUENTVIZ_COLORWAY_MAPPING;\n }\n const idx = defaultColorway.indexOf(hexColor.toLowerCase());\n if (idx !== -1) {\n return getColorFromToken(defaultMapping[idx], !!isDarkTheme);\n }\n return hexColor;\n}\n\nexport const getColor = (\n legendLabel: string,\n colorMap: React.RefObject<Map<string, string>>,\n templateColorway: PlotlyColorway,\n isDarkTheme?: boolean,\n isDonut?: boolean,\n): string => {\n if (!colorMap.current!.has(legendLabel)) {\n let nextColor: string;\n const defaultColorMapping = isDonut\n ? templateColorway === 'plotly'\n ? PLOTLY_FLUENTVIZ_COLORWAY_MAPPING\n : D3_FLUENTVIZ_COLORWAY_MAPPING\n : PLOTLY_FLUENTVIZ_COLORWAY_MAPPING;\n if (colorMap.current!.size < defaultColorMapping.length) {\n // Get first 10 colors from plotly-fluentviz colorway mapping\n nextColor = getColorFromToken(defaultColorMapping[colorMap.current!.size], isDarkTheme);\n } else {\n nextColor = getNextColor(colorMap.current!.size, 0, isDarkTheme);\n }\n colorMap.current!.set(legendLabel, nextColor);\n return nextColor;\n }\n\n return colorMap.current!.get(legendLabel) as string;\n};\n\nexport const getSchemaColors = (\n colorway: string[] | undefined,\n colors: PieColors | Color | Color[] | string | null | undefined,\n colorMap: React.RefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n isDonut?: boolean,\n): string[] | string | undefined => {\n const hexColors: string[] = [];\n if (!colors) {\n return undefined;\n }\n const templateColorway = getPlotlyColorway(colorway, isDonut);\n if (isArrayOrTypedArray(colors)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (colors as any[]).forEach((element, index) => {\n const colorString = element?.toString().trim();\n const nextFluentColor = getColor(`Label_${index}`, colorMap, templateColorway, isDarkTheme, isDonut);\n if (colorString) {\n const parsedColor = d3Color(colorString);\n hexColors.push(\n parsedColor ? tryMapFluentDataViz(parsedColor.formatHex(), templateColorway, isDarkTheme) : nextFluentColor,\n );\n } else {\n hexColors.push(nextFluentColor);\n }\n });\n } else if (typeof colors === 'string') {\n const parsedColor = d3Color(colors);\n return parsedColor\n ? tryMapFluentDataViz(parsedColor.formatHex(), templateColorway, isDarkTheme)\n : getColor('Label_0', colorMap, templateColorway, isDarkTheme, isDonut);\n }\n return hexColors;\n};\n\nexport const extractColor = (\n colorway: string[] | undefined,\n colorwayType: ColorwayType,\n colors: PieColors | Color | Color[] | string | null | undefined,\n colorMap: React.RefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n isDonut?: boolean,\n): string | string[] | undefined => {\n return colorwayType === 'default' && colors\n ? getSchemaColors(colorway, colors, colorMap, isDarkTheme, isDonut)\n : undefined;\n};\n\nexport const resolveColor = (\n extractedColors: string[] | string | null | undefined,\n index: number,\n legend: string,\n colorMap: React.RefObject<Map<string, string>>,\n colorway: string[] | undefined,\n isDarkTheme?: boolean,\n isDonut?: boolean,\n): string => {\n let color = '';\n const templateColorway = getPlotlyColorway(colorway, isDonut);\n if (extractedColors && isArrayOrTypedArray(extractedColors) && extractedColors.length > 0) {\n color = extractedColors[index % extractedColors.length];\n } else if (typeof extractedColors === 'string') {\n color = extractedColors;\n } else {\n color = getColor(legend, colorMap, templateColorway, isDarkTheme, isDonut);\n }\n return color;\n};\n\nexport const getOpacity = (series: Partial<PlotData>, index: number): number => {\n return series.marker?.opacity\n ? isArrayOrTypedArray(series.marker?.opacity)\n ? (series.marker?.opacity as number[])[index % (series.marker?.opacity as number[]).length]\n : (series.marker?.opacity as number)\n : series.opacity ?? 1;\n};\n\nexport const createColorScale = (\n layout: Partial<Layout> | undefined,\n series: Partial<PlotData>,\n currentColorScale: ((value: number) => string) | undefined,\n): ((value: number) => string) | undefined => {\n if (\n layout?.coloraxis?.colorscale?.length &&\n isArrayOrTypedArray(series.marker?.color) &&\n (series.marker?.color as Color[]).length > 0 &&\n typeof (series.marker?.color as Color[])?.[0] === 'number'\n ) {\n const scale = layout?.coloraxis?.colorscale as Array<[number, string]>;\n const colorValues = series.marker?.color as number[];\n const [dMin, dMax] = [\n layout?.coloraxis?.cmin ?? Math.min(...colorValues),\n layout?.coloraxis?.cmax ?? Math.max(...colorValues),\n ];\n\n // Normalize colorscale domain to actual data domain\n const scaleDomain = scale.map(([pos]) => dMin + pos * (dMax - dMin));\n const scaleColors = scale.map(item => item[1]);\n\n return d3ScaleLinear<string>().domain(scaleDomain).range(scaleColors);\n }\n return currentColorScale;\n};\n"],"names":["React","color","d3Color","isArrayOrTypedArray","areArraysEqual","DataVizPalette","getColorFromToken","getNextColor","scaleLinear","d3ScaleLinear","DEFAULT_PLOTLY_COLORWAY","DEFAULT_D3_COLORWAY","PLOTLY_FLUENTVIZ_COLORWAY_MAPPING","color1","warning","color8","color4","color7","color6","color2","color5","color9","color10","D3_FLUENTVIZ_COLORWAY_MAPPING","color26","error","color17","color22","disabled","color3","getPlotlyColorway","colorway","isDonut","lower","map","c","toLowerCase","tryMapFluentDataViz","hexColor","templateColorway","isDarkTheme","defaultColorway","defaultMapping","idx","indexOf","getColor","legendLabel","colorMap","current","has","nextColor","defaultColorMapping","size","length","set","get","getSchemaColors","colors","hexColors","undefined","forEach","element","index","colorString","toString","trim","nextFluentColor","parsedColor","push","formatHex","extractColor","colorwayType","resolveColor","extractedColors","legend","getOpacity","series","marker","opacity","createColorScale","layout","currentColorScale","coloraxis","colorscale","scale","colorValues","dMin","dMax","cmin","Math","min","cmax","max","scaleDomain","pos","scaleColors","item","domain","range"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,SAASC,OAAO,QAAQ,WAAW;AAE5C,SAASC,mBAAmB,QAAQ,4BAA4B;AAChE,SAASC,cAAc,QAAQ,4BAA4B;AAC3D,SAASC,cAAc,EAAEC,iBAAiB,EAAEC,YAAY,QAAQ,yBAAyB;AACzF,SAASC,eAAeC,aAAa,QAAQ,WAAW;AAQxD,MAAMC,0BAA0B;IAC9B;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAED,iGAAiG;AACjG,6IAA6I;AAC7I,OAAO,MAAMC,sBAAsB;IACjC;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,CAAC;AAEF,MAAMC,oCAAoC;IACxCP,eAAeQ,MAAM;IACrBR,eAAeS,OAAO;IACtBT,eAAeU,MAAM;IACrB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