@semcore/d3-chart 16.5.0 → 17.0.0-prerelease.8

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 (439) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/lib/cjs/AnimatedClipPath.js +28 -41
  3. package/lib/cjs/AnimatedClipPath.js.map +1 -1
  4. package/lib/cjs/Area.js +187 -223
  5. package/lib/cjs/Area.js.map +1 -1
  6. package/lib/cjs/Axis.js +248 -327
  7. package/lib/cjs/Axis.js.map +1 -1
  8. package/lib/cjs/Bar.js +162 -185
  9. package/lib/cjs/Bar.js.map +1 -1
  10. package/lib/cjs/Bubble.js +219 -248
  11. package/lib/cjs/Bubble.js.map +1 -1
  12. package/lib/cjs/CompactHorizontalBar.js +448 -482
  13. package/lib/cjs/CompactHorizontalBar.js.map +1 -1
  14. package/lib/cjs/Donut.js +349 -396
  15. package/lib/cjs/Donut.js.map +1 -1
  16. package/lib/cjs/Dots.js +67 -86
  17. package/lib/cjs/Dots.js.map +1 -1
  18. package/lib/cjs/GroupBar.js +78 -93
  19. package/lib/cjs/GroupBar.js.map +1 -1
  20. package/lib/cjs/HorizontalBar.js +149 -167
  21. package/lib/cjs/HorizontalBar.js.map +1 -1
  22. package/lib/cjs/Hover.js +178 -207
  23. package/lib/cjs/Hover.js.map +1 -1
  24. package/lib/cjs/Line.js +182 -222
  25. package/lib/cjs/Line.js.map +1 -1
  26. package/lib/cjs/Pattern.js +124 -126
  27. package/lib/cjs/Pattern.js.map +1 -1
  28. package/lib/cjs/Plot.js +100 -126
  29. package/lib/cjs/Plot.js.map +1 -1
  30. package/lib/cjs/Radar.js +576 -681
  31. package/lib/cjs/Radar.js.map +1 -1
  32. package/lib/cjs/RadialTree.js +518 -571
  33. package/lib/cjs/RadialTree.js.map +1 -1
  34. package/lib/cjs/Reference.js +147 -178
  35. package/lib/cjs/Reference.js.map +1 -1
  36. package/lib/cjs/ResponsiveContainer.js +64 -82
  37. package/lib/cjs/ResponsiveContainer.js.map +1 -1
  38. package/lib/cjs/ScatterPlot.js +169 -199
  39. package/lib/cjs/ScatterPlot.js.map +1 -1
  40. package/lib/cjs/StackBar.js +135 -177
  41. package/lib/cjs/StackBar.js.map +1 -1
  42. package/lib/cjs/StackedArea.js +60 -73
  43. package/lib/cjs/StackedArea.js.map +1 -1
  44. package/lib/cjs/Tooltip.js +193 -208
  45. package/lib/cjs/Tooltip.js.map +1 -1
  46. package/lib/cjs/Venn.js +182 -217
  47. package/lib/cjs/Venn.js.map +1 -1
  48. package/lib/cjs/a11y/DataAccessibilityTable.js +45 -83
  49. package/lib/cjs/a11y/DataAccessibilityTable.js.map +1 -1
  50. package/lib/cjs/a11y/PlotA11yModule.js +37 -97
  51. package/lib/cjs/a11y/PlotA11yModule.js.map +1 -1
  52. package/lib/cjs/a11y/PlotA11yView.js +97 -91
  53. package/lib/cjs/a11y/PlotA11yView.js.map +1 -1
  54. package/lib/cjs/a11y/bezier.js +17 -23
  55. package/lib/cjs/a11y/bezier.js.map +1 -1
  56. package/lib/cjs/a11y/focus.js +16 -16
  57. package/lib/cjs/a11y/focus.js.map +1 -1
  58. package/lib/cjs/a11y/hints.js +72 -75
  59. package/lib/cjs/a11y/hints.js.map +1 -1
  60. package/lib/cjs/a11y/insights.js +354 -525
  61. package/lib/cjs/a11y/insights.js.map +1 -1
  62. package/lib/cjs/a11y/intl.js +5 -5
  63. package/lib/cjs/a11y/intl.js.map +1 -1
  64. package/lib/cjs/a11y/locale.js +12 -19
  65. package/lib/cjs/a11y/locale.js.map +1 -1
  66. package/lib/cjs/a11y/serialize.js +164 -203
  67. package/lib/cjs/a11y/serialize.js.map +1 -1
  68. package/lib/cjs/a11y/summarize.js +7 -6
  69. package/lib/cjs/a11y/summarize.js.map +1 -1
  70. package/lib/cjs/a11y/translations/module/__intergalactic-dynamic-locales.js +16 -16
  71. package/lib/cjs/a11y/translations/module/__intergalactic-dynamic-locales.js.map +1 -1
  72. package/lib/cjs/a11y/translations/module/de.json +2 -2
  73. package/lib/cjs/a11y/translations/module/en.json +2 -2
  74. package/lib/cjs/a11y/translations/module/es.json +2 -2
  75. package/lib/cjs/a11y/translations/module/fr.json +2 -2
  76. package/lib/cjs/a11y/translations/module/it.json +2 -2
  77. package/lib/cjs/a11y/translations/module/ja.json +2 -2
  78. package/lib/cjs/a11y/translations/module/ko.json +2 -2
  79. package/lib/cjs/a11y/translations/module/nl.json +2 -2
  80. package/lib/cjs/a11y/translations/module/pl.json +2 -2
  81. package/lib/cjs/a11y/translations/module/pt.json +2 -2
  82. package/lib/cjs/a11y/translations/module/sv.json +2 -2
  83. package/lib/cjs/a11y/translations/module/tr.json +2 -2
  84. package/lib/cjs/a11y/translations/module/vi.json +2 -2
  85. package/lib/cjs/a11y/translations/module/zh.json +2 -2
  86. package/lib/cjs/a11y/translations/view/__intergalactic-dynamic-locales.js +16 -16
  87. package/lib/cjs/a11y/translations/view/__intergalactic-dynamic-locales.js.map +1 -1
  88. package/lib/cjs/color.js +1 -1
  89. package/lib/cjs/color.js.map +1 -1
  90. package/lib/cjs/component/Chart/AbstractChart.js +421 -466
  91. package/lib/cjs/component/Chart/AbstractChart.js.map +1 -1
  92. package/lib/cjs/component/Chart/AbstractChart.type.js.map +1 -1
  93. package/lib/cjs/component/Chart/AreaChart.js +97 -115
  94. package/lib/cjs/component/Chart/AreaChart.js.map +1 -1
  95. package/lib/cjs/component/Chart/AreaChart.type.js.map +1 -1
  96. package/lib/cjs/component/Chart/BarChart.js +229 -216
  97. package/lib/cjs/component/Chart/BarChart.js.map +1 -1
  98. package/lib/cjs/component/Chart/BarChart.type.js.map +1 -1
  99. package/lib/cjs/component/Chart/BubbleChart.js +114 -136
  100. package/lib/cjs/component/Chart/BubbleChart.js.map +1 -1
  101. package/lib/cjs/component/Chart/BubbleChart.type.js.map +1 -1
  102. package/lib/cjs/component/Chart/CigaretteChart.js +280 -305
  103. package/lib/cjs/component/Chart/CigaretteChart.js.map +1 -1
  104. package/lib/cjs/component/Chart/CompactHorizontalBarChart.js +76 -108
  105. package/lib/cjs/component/Chart/CompactHorizontalBarChart.js.map +1 -1
  106. package/lib/cjs/component/Chart/CompactHorizontalBarChart.type.js.map +1 -1
  107. package/lib/cjs/component/Chart/DonutChart.js +80 -95
  108. package/lib/cjs/component/Chart/DonutChart.js.map +1 -1
  109. package/lib/cjs/component/Chart/DonutChart.type.js.map +1 -1
  110. package/lib/cjs/component/Chart/HistogramChart.js +126 -148
  111. package/lib/cjs/component/Chart/HistogramChart.js.map +1 -1
  112. package/lib/cjs/component/Chart/HistogramChart.type.js.map +1 -1
  113. package/lib/cjs/component/Chart/LineChart.js +95 -113
  114. package/lib/cjs/component/Chart/LineChart.js.map +1 -1
  115. package/lib/cjs/component/Chart/LineChart.type.js.map +1 -1
  116. package/lib/cjs/component/Chart/RadarChart.js +84 -110
  117. package/lib/cjs/component/Chart/RadarChart.js.map +1 -1
  118. package/lib/cjs/component/Chart/RadarChart.type.js.map +1 -1
  119. package/lib/cjs/component/Chart/ScatterPlotChart.js +119 -143
  120. package/lib/cjs/component/Chart/ScatterPlotChart.js.map +1 -1
  121. package/lib/cjs/component/Chart/ScatterPlotChart.type.js.map +1 -1
  122. package/lib/cjs/component/Chart/VennChart.js +103 -122
  123. package/lib/cjs/component/Chart/VennChart.js.map +1 -1
  124. package/lib/cjs/component/Chart/VennChart.type.js.map +1 -1
  125. package/lib/cjs/component/Chart/index.js +2 -2
  126. package/lib/cjs/component/Chart/index.js.map +1 -1
  127. package/lib/cjs/component/ChartLegend/BaseLegend.js +72 -105
  128. package/lib/cjs/component/ChartLegend/BaseLegend.js.map +1 -1
  129. package/lib/cjs/component/ChartLegend/BaseLegend.type.js.map +1 -1
  130. package/lib/cjs/component/ChartLegend/LegendFlex/LegendFlex.js +58 -70
  131. package/lib/cjs/component/ChartLegend/LegendFlex/LegendFlex.js.map +1 -1
  132. package/lib/cjs/component/ChartLegend/LegendFlex/LegendFlex.type.js.map +1 -1
  133. package/lib/cjs/component/ChartLegend/LegendItem/LegendItem.js +208 -221
  134. package/lib/cjs/component/ChartLegend/LegendItem/LegendItem.js.map +1 -1
  135. package/lib/cjs/component/ChartLegend/LegendItem/LegendItem.type.js +1 -1
  136. package/lib/cjs/component/ChartLegend/LegendItem/LegendItem.type.js.map +1 -1
  137. package/lib/cjs/component/ChartLegend/LegendTable/LegendTable.js +63 -73
  138. package/lib/cjs/component/ChartLegend/LegendTable/LegendTable.js.map +1 -1
  139. package/lib/cjs/component/ChartLegend/LegendTable/LegendTable.type.js.map +1 -1
  140. package/lib/cjs/component/ChartLegend/index.js +4 -4
  141. package/lib/cjs/component/ChartLegend/index.js.map +1 -1
  142. package/lib/cjs/component/Cigarette/Cigarette.js +115 -129
  143. package/lib/cjs/component/Cigarette/Cigarette.js.map +1 -1
  144. package/lib/cjs/component/StackGroupBar/StackGroupBar.js +107 -137
  145. package/lib/cjs/component/StackGroupBar/StackGroupBar.js.map +1 -1
  146. package/lib/cjs/component/SvgElement.js +7 -7
  147. package/lib/cjs/component/SvgElement.js.map +1 -1
  148. package/lib/cjs/createElement.js +66 -65
  149. package/lib/cjs/createElement.js.map +1 -1
  150. package/lib/cjs/index.js +62 -62
  151. package/lib/cjs/style/axis.shadow.css +3 -0
  152. package/lib/cjs/style/plot.shadow.css +1 -3
  153. package/lib/cjs/style/plotA11yModule.shadow.css +10 -11
  154. package/lib/cjs/style/plotA11yView.shadow.css +13 -26
  155. package/lib/cjs/translations/__intergalactic-dynamic-locales.js +15 -15
  156. package/lib/cjs/translations/__intergalactic-dynamic-locales.js.map +1 -1
  157. package/lib/cjs/types/Axis.d.js.map +1 -1
  158. package/lib/cjs/types/CompactHorizontalBar.d.js.map +1 -1
  159. package/lib/cjs/types/Hover.d.js.map +1 -1
  160. package/lib/cjs/types/Line.d.js.map +1 -1
  161. package/lib/cjs/types/Plot.d.js.map +1 -1
  162. package/lib/cjs/types/Radar.d.js.map +1 -1
  163. package/lib/cjs/types/ResponsiveContainer.d.js.map +1 -1
  164. package/lib/cjs/types/Tooltip.d.js.map +1 -1
  165. package/lib/cjs/types/Venn.d.js.map +1 -1
  166. package/lib/cjs/types/index.d.js +80 -80
  167. package/lib/cjs/types/index.d.js.map +1 -1
  168. package/lib/cjs/utils.js +122 -145
  169. package/lib/cjs/utils.js.map +1 -1
  170. package/lib/es6/AnimatedClipPath.js +24 -37
  171. package/lib/es6/AnimatedClipPath.js.map +1 -1
  172. package/lib/es6/Area.js +179 -215
  173. package/lib/es6/Area.js.map +1 -1
  174. package/lib/es6/Axis.js +242 -321
  175. package/lib/es6/Axis.js.map +1 -1
  176. package/lib/es6/Bar.js +154 -177
  177. package/lib/es6/Bar.js.map +1 -1
  178. package/lib/es6/Bubble.js +206 -235
  179. package/lib/es6/Bubble.js.map +1 -1
  180. package/lib/es6/CompactHorizontalBar.js +433 -467
  181. package/lib/es6/CompactHorizontalBar.js.map +1 -1
  182. package/lib/es6/Donut.js +337 -384
  183. package/lib/es6/Donut.js.map +1 -1
  184. package/lib/es6/Dots.js +60 -79
  185. package/lib/es6/Dots.js.map +1 -1
  186. package/lib/es6/GroupBar.js +74 -89
  187. package/lib/es6/GroupBar.js.map +1 -1
  188. package/lib/es6/HorizontalBar.js +141 -159
  189. package/lib/es6/HorizontalBar.js.map +1 -1
  190. package/lib/es6/Hover.js +174 -203
  191. package/lib/es6/Hover.js.map +1 -1
  192. package/lib/es6/Line.js +173 -213
  193. package/lib/es6/Line.js.map +1 -1
  194. package/lib/es6/Pattern.js +68 -74
  195. package/lib/es6/Pattern.js.map +1 -1
  196. package/lib/es6/Plot.js +95 -121
  197. package/lib/es6/Plot.js.map +1 -1
  198. package/lib/es6/Radar.js +554 -659
  199. package/lib/es6/Radar.js.map +1 -1
  200. package/lib/es6/RadialTree.js +500 -553
  201. package/lib/es6/RadialTree.js.map +1 -1
  202. package/lib/es6/Reference.js +140 -171
  203. package/lib/es6/Reference.js.map +1 -1
  204. package/lib/es6/ResponsiveContainer.js +58 -76
  205. package/lib/es6/ResponsiveContainer.js.map +1 -1
  206. package/lib/es6/ScatterPlot.js +161 -191
  207. package/lib/es6/ScatterPlot.js.map +1 -1
  208. package/lib/es6/StackBar.js +130 -172
  209. package/lib/es6/StackBar.js.map +1 -1
  210. package/lib/es6/StackedArea.js +56 -69
  211. package/lib/es6/StackedArea.js.map +1 -1
  212. package/lib/es6/Tooltip.js +183 -198
  213. package/lib/es6/Tooltip.js.map +1 -1
  214. package/lib/es6/Venn.js +169 -204
  215. package/lib/es6/Venn.js.map +1 -1
  216. package/lib/es6/a11y/DataAccessibilityTable.js +41 -80
  217. package/lib/es6/a11y/DataAccessibilityTable.js.map +1 -1
  218. package/lib/es6/a11y/PlotA11yModule.js +35 -95
  219. package/lib/es6/a11y/PlotA11yModule.js.map +1 -1
  220. package/lib/es6/a11y/PlotA11yView.js +89 -84
  221. package/lib/es6/a11y/PlotA11yView.js.map +1 -1
  222. package/lib/es6/a11y/bezier.js +16 -23
  223. package/lib/es6/a11y/bezier.js.map +1 -1
  224. package/lib/es6/a11y/focus.js +15 -16
  225. package/lib/es6/a11y/focus.js.map +1 -1
  226. package/lib/es6/a11y/hints.js +67 -73
  227. package/lib/es6/a11y/hints.js.map +1 -1
  228. package/lib/es6/a11y/insights.js +353 -524
  229. package/lib/es6/a11y/insights.js.map +1 -1
  230. package/lib/es6/a11y/intl.js +4 -5
  231. package/lib/es6/a11y/intl.js.map +1 -1
  232. package/lib/es6/a11y/locale.js +11 -18
  233. package/lib/es6/a11y/locale.js.map +1 -1
  234. package/lib/es6/a11y/serialize.js +162 -203
  235. package/lib/es6/a11y/serialize.js.map +1 -1
  236. package/lib/es6/a11y/summarize.js +6 -6
  237. package/lib/es6/a11y/summarize.js.map +1 -1
  238. package/lib/es6/a11y/translations/module/__intergalactic-dynamic-locales.js +15 -15
  239. package/lib/es6/a11y/translations/module/__intergalactic-dynamic-locales.js.map +1 -1
  240. package/lib/es6/a11y/translations/module/de.json +2 -2
  241. package/lib/es6/a11y/translations/module/en.json +2 -2
  242. package/lib/es6/a11y/translations/module/es.json +2 -2
  243. package/lib/es6/a11y/translations/module/fr.json +2 -2
  244. package/lib/es6/a11y/translations/module/it.json +2 -2
  245. package/lib/es6/a11y/translations/module/ja.json +2 -2
  246. package/lib/es6/a11y/translations/module/ko.json +2 -2
  247. package/lib/es6/a11y/translations/module/nl.json +2 -2
  248. package/lib/es6/a11y/translations/module/pl.json +2 -2
  249. package/lib/es6/a11y/translations/module/pt.json +2 -2
  250. package/lib/es6/a11y/translations/module/sv.json +2 -2
  251. package/lib/es6/a11y/translations/module/tr.json +2 -2
  252. package/lib/es6/a11y/translations/module/vi.json +2 -2
  253. package/lib/es6/a11y/translations/module/zh.json +2 -2
  254. package/lib/es6/a11y/translations/view/__intergalactic-dynamic-locales.js +15 -15
  255. package/lib/es6/a11y/translations/view/__intergalactic-dynamic-locales.js.map +1 -1
  256. package/lib/es6/color.js +1 -1
  257. package/lib/es6/color.js.map +1 -1
  258. package/lib/es6/component/Chart/AbstractChart.js +416 -462
  259. package/lib/es6/component/Chart/AbstractChart.js.map +1 -1
  260. package/lib/es6/component/Chart/AbstractChart.type.js.map +1 -1
  261. package/lib/es6/component/Chart/AreaChart.js +92 -111
  262. package/lib/es6/component/Chart/AreaChart.js.map +1 -1
  263. package/lib/es6/component/Chart/AreaChart.type.js.map +1 -1
  264. package/lib/es6/component/Chart/BarChart.js +225 -213
  265. package/lib/es6/component/Chart/BarChart.js.map +1 -1
  266. package/lib/es6/component/Chart/BarChart.type.js.map +1 -1
  267. package/lib/es6/component/Chart/BubbleChart.js +109 -132
  268. package/lib/es6/component/Chart/BubbleChart.js.map +1 -1
  269. package/lib/es6/component/Chart/BubbleChart.type.js.map +1 -1
  270. package/lib/es6/component/Chart/CigaretteChart.js +276 -301
  271. package/lib/es6/component/Chart/CigaretteChart.js.map +1 -1
  272. package/lib/es6/component/Chart/CompactHorizontalBarChart.js +70 -103
  273. package/lib/es6/component/Chart/CompactHorizontalBarChart.js.map +1 -1
  274. package/lib/es6/component/Chart/CompactHorizontalBarChart.type.js.map +1 -1
  275. package/lib/es6/component/Chart/DonutChart.js +74 -90
  276. package/lib/es6/component/Chart/DonutChart.js.map +1 -1
  277. package/lib/es6/component/Chart/DonutChart.type.js.map +1 -1
  278. package/lib/es6/component/Chart/HistogramChart.js +121 -144
  279. package/lib/es6/component/Chart/HistogramChart.js.map +1 -1
  280. package/lib/es6/component/Chart/HistogramChart.type.js.map +1 -1
  281. package/lib/es6/component/Chart/LineChart.js +90 -109
  282. package/lib/es6/component/Chart/LineChart.js.map +1 -1
  283. package/lib/es6/component/Chart/LineChart.type.js.map +1 -1
  284. package/lib/es6/component/Chart/RadarChart.js +80 -107
  285. package/lib/es6/component/Chart/RadarChart.js.map +1 -1
  286. package/lib/es6/component/Chart/RadarChart.type.js.map +1 -1
  287. package/lib/es6/component/Chart/ScatterPlotChart.js +113 -138
  288. package/lib/es6/component/Chart/ScatterPlotChart.js.map +1 -1
  289. package/lib/es6/component/Chart/ScatterPlotChart.type.js.map +1 -1
  290. package/lib/es6/component/Chart/VennChart.js +97 -117
  291. package/lib/es6/component/Chart/VennChart.js.map +1 -1
  292. package/lib/es6/component/Chart/VennChart.type.js.map +1 -1
  293. package/lib/es6/component/ChartLegend/BaseLegend.js +70 -104
  294. package/lib/es6/component/ChartLegend/BaseLegend.js.map +1 -1
  295. package/lib/es6/component/ChartLegend/BaseLegend.type.js.map +1 -1
  296. package/lib/es6/component/ChartLegend/LegendFlex/LegendFlex.js +53 -65
  297. package/lib/es6/component/ChartLegend/LegendFlex/LegendFlex.js.map +1 -1
  298. package/lib/es6/component/ChartLegend/LegendFlex/LegendFlex.type.js.map +1 -1
  299. package/lib/es6/component/ChartLegend/LegendItem/LegendItem.js +198 -211
  300. package/lib/es6/component/ChartLegend/LegendItem/LegendItem.js.map +1 -1
  301. package/lib/es6/component/ChartLegend/LegendItem/LegendItem.type.js +1 -1
  302. package/lib/es6/component/ChartLegend/LegendItem/LegendItem.type.js.map +1 -1
  303. package/lib/es6/component/ChartLegend/LegendTable/LegendTable.js +58 -68
  304. package/lib/es6/component/ChartLegend/LegendTable/LegendTable.js.map +1 -1
  305. package/lib/es6/component/ChartLegend/LegendTable/LegendTable.type.js.map +1 -1
  306. package/lib/es6/component/Cigarette/Cigarette.js +108 -122
  307. package/lib/es6/component/Cigarette/Cigarette.js.map +1 -1
  308. package/lib/es6/component/StackGroupBar/StackGroupBar.js +100 -130
  309. package/lib/es6/component/StackGroupBar/StackGroupBar.js.map +1 -1
  310. package/lib/es6/component/SvgElement.js +4 -5
  311. package/lib/es6/component/SvgElement.js.map +1 -1
  312. package/lib/es6/createElement.js +55 -54
  313. package/lib/es6/createElement.js.map +1 -1
  314. package/lib/es6/style/axis.shadow.css +3 -0
  315. package/lib/es6/style/plot.shadow.css +1 -3
  316. package/lib/es6/style/plotA11yModule.shadow.css +10 -11
  317. package/lib/es6/style/plotA11yView.shadow.css +13 -26
  318. package/lib/es6/translations/__intergalactic-dynamic-locales.js +14 -14
  319. package/lib/es6/translations/__intergalactic-dynamic-locales.js.map +1 -1
  320. package/lib/es6/types/Axis.d.js.map +1 -1
  321. package/lib/es6/types/CompactHorizontalBar.d.js.map +1 -1
  322. package/lib/es6/types/Hover.d.js.map +1 -1
  323. package/lib/es6/types/Line.d.js.map +1 -1
  324. package/lib/es6/types/Plot.d.js.map +1 -1
  325. package/lib/es6/types/Radar.d.js.map +1 -1
  326. package/lib/es6/types/ResponsiveContainer.d.js.map +1 -1
  327. package/lib/es6/types/Tooltip.d.js.map +1 -1
  328. package/lib/es6/types/Venn.d.js.map +1 -1
  329. package/lib/es6/utils.js +105 -144
  330. package/lib/es6/utils.js.map +1 -1
  331. package/lib/esm/AnimatedClipPath.mjs +24 -36
  332. package/lib/esm/Area.mjs +178 -149
  333. package/lib/esm/Axis.mjs +241 -242
  334. package/lib/esm/Bar.mjs +155 -137
  335. package/lib/esm/Bubble.mjs +205 -171
  336. package/lib/esm/CompactHorizontalBar.mjs +428 -383
  337. package/lib/esm/Donut.mjs +315 -266
  338. package/lib/esm/Dots.mjs +60 -49
  339. package/lib/esm/GroupBar.mjs +71 -75
  340. package/lib/esm/HorizontalBar.mjs +142 -120
  341. package/lib/esm/Hover.mjs +173 -163
  342. package/lib/esm/Line.mjs +174 -145
  343. package/lib/esm/Pattern.mjs +67 -63
  344. package/lib/esm/Plot.mjs +98 -95
  345. package/lib/esm/Radar.mjs +550 -498
  346. package/lib/esm/RadialTree.mjs +512 -416
  347. package/lib/esm/Reference.mjs +137 -122
  348. package/lib/esm/ResponsiveContainer.mjs +58 -69
  349. package/lib/esm/ScatterPlot.mjs +163 -162
  350. package/lib/esm/StackBar.mjs +126 -147
  351. package/lib/esm/StackedArea.mjs +53 -61
  352. package/lib/esm/Tooltip.mjs +185 -175
  353. package/lib/esm/Venn.mjs +170 -170
  354. package/lib/esm/a11y/DataAccessibilityTable.mjs +46 -73
  355. package/lib/esm/a11y/PlotA11yModule.mjs +37 -80
  356. package/lib/esm/a11y/PlotA11yView.mjs +99 -74
  357. package/lib/esm/a11y/bezier.mjs +16 -23
  358. package/lib/esm/a11y/focus.mjs +15 -16
  359. package/lib/esm/a11y/hints.mjs +65 -71
  360. package/lib/esm/a11y/insights.mjs +347 -495
  361. package/lib/esm/a11y/intl.mjs +4 -5
  362. package/lib/esm/a11y/locale.mjs +12 -14
  363. package/lib/esm/a11y/serialize.mjs +139 -152
  364. package/lib/esm/a11y/summarize.mjs +3 -3
  365. package/lib/esm/a11y/translations/module/__intergalactic-dynamic-locales.mjs +1 -1
  366. package/lib/esm/a11y/translations/module/de.json.mjs +2 -4
  367. package/lib/esm/a11y/translations/module/en.json.mjs +2 -4
  368. package/lib/esm/a11y/translations/module/es.json.mjs +2 -4
  369. package/lib/esm/a11y/translations/module/fr.json.mjs +2 -4
  370. package/lib/esm/a11y/translations/module/it.json.mjs +2 -4
  371. package/lib/esm/a11y/translations/module/ja.json.mjs +2 -4
  372. package/lib/esm/a11y/translations/module/ko.json.mjs +2 -4
  373. package/lib/esm/a11y/translations/module/nl.json.mjs +2 -4
  374. package/lib/esm/a11y/translations/module/pl.json.mjs +2 -4
  375. package/lib/esm/a11y/translations/module/pt.json.mjs +2 -4
  376. package/lib/esm/a11y/translations/module/sv.json.mjs +2 -4
  377. package/lib/esm/a11y/translations/module/tr.json.mjs +2 -4
  378. package/lib/esm/a11y/translations/module/vi.json.mjs +2 -4
  379. package/lib/esm/a11y/translations/module/zh.json.mjs +2 -4
  380. package/lib/esm/a11y/translations/view/__intergalactic-dynamic-locales.mjs +1 -1
  381. package/lib/esm/color.mjs +1 -1
  382. package/lib/esm/component/Chart/AbstractChart.mjs +422 -415
  383. package/lib/esm/component/Chart/AreaChart.mjs +92 -91
  384. package/lib/esm/component/Chart/BarChart.mjs +225 -177
  385. package/lib/esm/component/Chart/BubbleChart.mjs +110 -118
  386. package/lib/esm/component/Chart/CigaretteChart.mjs +277 -268
  387. package/lib/esm/component/Chart/CompactHorizontalBarChart.mjs +70 -87
  388. package/lib/esm/component/Chart/DonutChart.mjs +74 -84
  389. package/lib/esm/component/Chart/HistogramChart.mjs +121 -117
  390. package/lib/esm/component/Chart/LineChart.mjs +90 -89
  391. package/lib/esm/component/Chart/RadarChart.mjs +81 -97
  392. package/lib/esm/component/Chart/ScatterPlotChart.mjs +113 -111
  393. package/lib/esm/component/Chart/VennChart.mjs +98 -111
  394. package/lib/esm/component/ChartLegend/BaseLegend.mjs +75 -97
  395. package/lib/esm/component/ChartLegend/LegendFlex/LegendFlex.mjs +54 -55
  396. package/lib/esm/component/ChartLegend/LegendItem/LegendItem.mjs +194 -165
  397. package/lib/esm/component/ChartLegend/LegendItem/LegendItem.type.mjs +1 -1
  398. package/lib/esm/component/ChartLegend/LegendTable/LegendTable.mjs +60 -58
  399. package/lib/esm/component/Cigarette/Cigarette.mjs +109 -99
  400. package/lib/esm/component/StackGroupBar/StackGroupBar.mjs +97 -111
  401. package/lib/esm/component/SvgElement.mjs +4 -4
  402. package/lib/esm/createElement.mjs +54 -37
  403. package/lib/esm/style/axis.shadow.css +3 -0
  404. package/lib/esm/style/plot.shadow.css +1 -3
  405. package/lib/esm/style/plotA11yModule.shadow.css +10 -11
  406. package/lib/esm/style/plotA11yView.shadow.css +13 -26
  407. package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +1 -1
  408. package/lib/esm/utils.mjs +103 -138
  409. package/lib/types/Axis.d.ts +4 -0
  410. package/lib/types/CompactHorizontalBar.d.ts +1 -1
  411. package/lib/types/Hover.d.ts +1 -1
  412. package/lib/types/Line.d.ts +1 -1
  413. package/lib/types/Plot.d.ts +1 -1
  414. package/lib/types/Radar.d.ts +1 -1
  415. package/lib/types/ResponsiveContainer.d.ts +1 -1
  416. package/lib/types/Tooltip.d.ts +1 -3
  417. package/lib/types/Venn.d.ts +1 -1
  418. package/lib/types/a11y/PlotA11yModule.d.ts +4 -11
  419. package/lib/types/a11y/PlotA11yView.d.ts +12 -1
  420. package/lib/types/a11y/translations/module/__intergalactic-dynamic-locales.d.ts +14 -14
  421. package/lib/types/component/Chart/AbstractChart.d.ts +1 -1
  422. package/lib/types/component/Chart/AbstractChart.type.d.ts +1 -1
  423. package/lib/types/component/Chart/AreaChart.type.d.ts +1 -1
  424. package/lib/types/component/Chart/BarChart.type.d.ts +1 -1
  425. package/lib/types/component/Chart/BubbleChart.type.d.ts +1 -1
  426. package/lib/types/component/Chart/CompactHorizontalBarChart.type.d.ts +1 -1
  427. package/lib/types/component/Chart/DonutChart.type.d.ts +1 -1
  428. package/lib/types/component/Chart/HistogramChart.type.d.ts +1 -1
  429. package/lib/types/component/Chart/LineChart.type.d.ts +1 -1
  430. package/lib/types/component/Chart/RadarChart.type.d.ts +1 -1
  431. package/lib/types/component/Chart/ScatterPlotChart.type.d.ts +1 -1
  432. package/lib/types/component/Chart/VennChart.type.d.ts +1 -1
  433. package/lib/types/component/ChartLegend/BaseLegend.d.ts +1 -1
  434. package/lib/types/component/ChartLegend/BaseLegend.type.d.ts +1 -1
  435. package/lib/types/component/ChartLegend/LegendFlex/LegendFlex.type.d.ts +1 -1
  436. package/lib/types/component/ChartLegend/LegendItem/LegendItem.type.d.ts +1 -1
  437. package/lib/types/component/ChartLegend/LegendTable/LegendTable.type.d.ts +1 -1
  438. package/lib/types/utils.d.ts +10 -10
  439. package/package.json +11 -14
@@ -1,58 +1,45 @@
1
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
- import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
4
- import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
5
- import _typeof from "@babel/runtime/helpers/esm/typeof";
6
1
  import { makeBezier } from "./bezier.mjs";
7
- var getPropByPath = function getPropByPath2(obj, path) {
2
+ const getPropByPath = (obj, path) => {
8
3
  if (typeof path === "number") path = String(path);
9
4
  if (typeof path === "string") path = path.split(".");
10
- for (var i = 0; i < path.length; i++) {
11
- if (_typeof(obj) !== "object" || obj === null) return obj;
5
+ for (let i = 0; i < path.length; i++) {
6
+ if (typeof obj !== "object" || obj === null) return obj;
12
7
  obj = obj[path[i]];
13
8
  }
14
9
  return obj;
15
10
  };
16
- var movingAverage = function movingAverage2(data, frame) {
17
- var result = [];
11
+ const movingAverage = (data, frame) => {
12
+ const result = [];
18
13
  frame = Math.floor(frame) % 2 === data.length % 2 ? Math.floor(frame) : Math.ceil(frame);
19
- for (var i = 0; i < data.length; i++) {
20
- var startIndex = Math.max(0, i - Math.floor(frame / 2));
21
- var endIndex = Math.min(data.length, i + Math.ceil(frame / 2));
14
+ for (let i = 0; i < data.length; i++) {
15
+ let startIndex = Math.max(0, i - Math.floor(frame / 2));
16
+ let endIndex = Math.min(data.length, i + Math.ceil(frame / 2));
22
17
  startIndex = Math.min(startIndex, Math.max(0, endIndex - frame));
23
18
  endIndex = Math.max(endIndex, Math.min(data.length, startIndex + frame));
24
- var part = data.slice(startIndex, endIndex);
25
- var sum = part.reduce(function(sum2, item) {
26
- return sum2 + item;
27
- }, 0);
28
- var value = sum / part.length;
19
+ const part = data.slice(startIndex, endIndex);
20
+ const sum = part.reduce((sum2, item) => sum2 + item, 0);
21
+ const value = sum / part.length;
29
22
  result.push(value);
30
23
  }
31
24
  return result;
32
25
  };
33
- var extractDataInsights = function extractDataInsights2(data, hints, config) {
34
- var _config$dataType, _hints$axesTitle$vert, _ref;
35
- var insights = [];
36
- var dataType = (_config$dataType = config.dataType) !== null && _config$dataType !== void 0 ? _config$dataType : hints.dataType;
37
- var dataRange = [];
38
- var groupKeys = _toConsumableArray(hints.groups);
39
- var dataTitle = (_hints$axesTitle$vert = hints.axesTitle.vertical) !== null && _hints$axesTitle$vert !== void 0 ? _hints$axesTitle$vert : hints.axesTitle.horizontal;
40
- var entitiesCount = 0;
41
- var keysMap = Object.fromEntries(Object.keys((_ref = Array.isArray(data) ? data[0] : data) !== null && _ref !== void 0 ? _ref : {}).map(function(key2) {
42
- return [key2, true];
43
- }));
26
+ const extractDataInsights = (data, hints, config) => {
27
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
28
+ let insights = [];
29
+ let dataType = config.dataType ?? hints.dataType;
30
+ const dataRange = [];
31
+ let groupKeys = [...hints.groups];
32
+ const dataTitle = hints.axesTitle.vertical ?? hints.axesTitle.horizontal;
33
+ let entitiesCount = 0;
34
+ const keysMap = Object.fromEntries(Object.keys((Array.isArray(data) ? data[0] : data) ?? {}).map((key) => [key, true]));
44
35
  if (!dataType) {
45
36
  if ((keysMap["y"] || keysMap["y1"] || keysMap["y2"]) && keysMap["x"] && (keysMap["value"] || keysMap["label"]) || hints.fields.horizontalAxes.size > 0 && hints.fields.verticalAxes.size > 0 && hints.fields.valueAxes.size > 0) {
46
37
  dataType = "points-cloud";
47
38
  } else if (Array.isArray(data) && data.length > 6) {
48
39
  dataType = "time-series";
49
40
  } else if (Array.isArray(data) && Object.keys(keysMap).length >= 3) {
50
- var possibleGroupKeys = Object.keys(keysMap).filter(function(key2) {
51
- return typeof data[0][key2] === "string";
52
- }).filter(function(key2) {
53
- var allData = data.map(function(row2) {
54
- return row2[key2];
55
- });
41
+ const possibleGroupKeys = Object.keys(keysMap).filter((key) => typeof data[0][key] === "string").filter((key) => {
42
+ const allData = data.map((row) => row[key]);
56
43
  return new Set(allData).size === allData.length;
57
44
  });
58
45
  if (possibleGroupKeys.length === 1) {
@@ -70,250 +57,195 @@ var extractDataInsights = function extractDataInsights2(data, hints, config) {
70
57
  }
71
58
  if (Array.isArray(data)) {
72
59
  if (dataType === "time-series") {
73
- var _ref2, _hints$titles$getHori, _hints$titles$getHori2, _hints$titles, _ref3, _hints$titles$getHori3, _hints$titles$getHori4, _hints$titles2;
74
- var firstRow = data[0];
75
- var lastRow = data[data.length - 1];
76
- var possibleValueKeys = ["y", "value"].concat(_toConsumableArray(hints.fields.verticalAxes));
77
- var valuesKeys = possibleValueKeys.filter(function(key2) {
78
- return keysMap[key2];
79
- });
80
- var possibleLabelKeys = ["label", "x"].concat(_toConsumableArray(hints.fields.horizontalAxes));
81
- var labelsKey = possibleLabelKeys.filter(function(key2) {
82
- return keysMap[key2];
83
- })[0];
60
+ const firstRow = data[0];
61
+ const lastRow = data[data.length - 1];
62
+ const possibleValueKeys = ["y", "value", ...hints.fields.verticalAxes];
63
+ const valuesKeys = possibleValueKeys.filter((key) => keysMap[key]);
64
+ const possibleLabelKeys = ["label", "x", ...hints.fields.horizontalAxes];
65
+ const labelsKey = possibleLabelKeys.filter((key) => keysMap[key])[0];
84
66
  entitiesCount = Object.keys(valuesKeys).length;
85
- var fromKey = firstRow[labelsKey];
86
- var toKey = lastRow[labelsKey];
87
- var from = (_ref2 = (_hints$titles$getHori = (_hints$titles$getHori2 = (_hints$titles = hints.titles).getHorizontalAxesTitle) === null || _hints$titles$getHori2 === void 0 ? void 0 : _hints$titles$getHori2.call(_hints$titles, fromKey)) !== null && _hints$titles$getHori !== void 0 ? _hints$titles$getHori : hints.titles.horizontalAxes[fromKey]) !== null && _ref2 !== void 0 ? _ref2 : fromKey;
88
- var to = (_ref3 = (_hints$titles$getHori3 = (_hints$titles$getHori4 = (_hints$titles2 = hints.titles).getHorizontalAxesTitle) === null || _hints$titles$getHori4 === void 0 ? void 0 : _hints$titles$getHori4.call(_hints$titles2, toKey)) !== null && _hints$titles$getHori3 !== void 0 ? _hints$titles$getHori3 : hints.titles.horizontalAxes[toKey]) !== null && _ref3 !== void 0 ? _ref3 : toKey;
67
+ const fromKey = firstRow[labelsKey];
68
+ const toKey = lastRow[labelsKey];
69
+ const from = ((_b = (_a = hints.titles).getHorizontalAxesTitle) == null ? void 0 : _b.call(_a, fromKey)) ?? hints.titles.horizontalAxes[fromKey] ?? fromKey;
70
+ const to = ((_d = (_c = hints.titles).getHorizontalAxesTitle) == null ? void 0 : _d.call(_c, toKey)) ?? hints.titles.horizontalAxes[toKey] ?? toKey;
89
71
  if (entitiesCount > 0) {
90
- var _hints$axesTitle$vert2;
91
72
  dataRange.push({
92
73
  from,
93
74
  to,
94
- label: (_hints$axesTitle$vert2 = hints.axesTitle.vertical) !== null && _hints$axesTitle$vert2 !== void 0 ? _hints$axesTitle$vert2 : labelsKey
75
+ label: hints.axesTitle.vertical ?? labelsKey
95
76
  });
96
77
  }
97
- var _iterator = _createForOfIteratorHelper(valuesKeys), _step;
98
- try {
99
- var _loop = function _loop2() {
100
- var _config$movingAverage, _config$movingAverage2, _insights;
101
- var valueKey = _step.value;
102
- var values2 = data.map(function(row2) {
103
- return row2[valueKey];
104
- }).filter(function(value) {
105
- return _typeof(value) !== "symbol";
78
+ for (const valueKey of valuesKeys) {
79
+ const values = data.map((row) => row[valueKey]).filter((value) => typeof value !== "symbol");
80
+ const sum = values.reduce((sum2, value) => sum2 + value, 0);
81
+ const average = sum / values.length;
82
+ const variance = 1 / values.length * values.map((value) => (value - average) ** 2).reduce((sum2, item) => sum2 + item, 0);
83
+ const standardDeviation = Math.sqrt(variance);
84
+ const trendStrengths = ["static", "weak", "medium", "strong"];
85
+ const frameSize = Math.sqrt(values.length);
86
+ const longMovingAverageSize = config.movingAverage.longSize ?? frameSize;
87
+ const shortMovingAverageSize = config.movingAverage.shortSize ?? Math.sqrt(frameSize);
88
+ const longMovingAverage = movingAverage(values, longMovingAverageSize);
89
+ const shortMovingAverage = values.length < 8 ? values : movingAverage(values, shortMovingAverageSize);
90
+ const table = [];
91
+ for (const i in values) {
92
+ table.push({
93
+ value: (values[i] ?? Number.NaN).toFixed(2),
94
+ long: (longMovingAverage[i] ?? Number.NaN).toFixed(2),
95
+ short: (shortMovingAverage[i] ?? Number.NaN).toFixed(2)
106
96
  });
107
- var sum = values2.reduce(function(sum2, value) {
108
- return sum2 + value;
109
- }, 0);
110
- var average = sum / values2.length;
111
- var variance = 1 / values2.length * values2.map(function(value) {
112
- return Math.pow(value - average, 2);
113
- }).reduce(function(sum2, item) {
114
- return sum2 + item;
115
- }, 0);
116
- var standardDeviation = Math.sqrt(variance);
117
- var trendStrengths = ["static", "weak", "medium", "strong"];
118
- var frameSize = Math.sqrt(values2.length);
119
- var longMovingAverageSize = (_config$movingAverage = config.movingAverage.longSize) !== null && _config$movingAverage !== void 0 ? _config$movingAverage : frameSize;
120
- var shortMovingAverageSize = (_config$movingAverage2 = config.movingAverage.shortSize) !== null && _config$movingAverage2 !== void 0 ? _config$movingAverage2 : Math.sqrt(frameSize);
121
- var longMovingAverage = movingAverage(values2, longMovingAverageSize);
122
- var shortMovingAverage = values2.length < 8 ? values2 : movingAverage(values2, shortMovingAverageSize);
123
- var table = [];
124
- for (var i2 in values2) {
125
- var _values$i, _longMovingAverage$i, _shortMovingAverage$i;
126
- table.push({
127
- value: ((_values$i = values2[i2]) !== null && _values$i !== void 0 ? _values$i : Number.NaN).toFixed(2),
128
- "long": ((_longMovingAverage$i = longMovingAverage[i2]) !== null && _longMovingAverage$i !== void 0 ? _longMovingAverage$i : Number.NaN).toFixed(2),
129
- "short": ((_shortMovingAverage$i = shortMovingAverage[i2]) !== null && _shortMovingAverage$i !== void 0 ? _shortMovingAverage$i : Number.NaN).toFixed(2)
130
- });
97
+ }
98
+ const strengthsMap = {
99
+ growth: {
100
+ static: "static",
101
+ weak: "weak-growth",
102
+ medium: "growth",
103
+ strong: "strong-growth"
104
+ },
105
+ reduction: {
106
+ static: "static",
107
+ weak: "weak-reduction",
108
+ medium: "reduction",
109
+ strong: "strong-reduction"
131
110
  }
132
- var strengthsMap = {
133
- growth: {
134
- "static": "static",
135
- weak: "weak-growth",
136
- medium: "growth",
137
- strong: "strong-growth"
138
- },
139
- reduction: {
140
- "static": "static",
141
- weak: "weak-reduction",
142
- medium: "reduction",
143
- strong: "strong-reduction"
111
+ };
112
+ const recordTrend = ({
113
+ value,
114
+ width,
115
+ label,
116
+ type
117
+ }) => {
118
+ var _a2, _b2;
119
+ for (let i = 0; i < trendStrengths.length; i++) {
120
+ const normalizedHeight = Math.abs(value.from - value.to) / (((_a2 = hints.pointsDensity) == null ? void 0 : _a2.verticalAxes) ?? 1);
121
+ const normalizedWidth = width / (((_b2 = hints.pointsDensity) == null ? void 0 : _b2.horizontalAxes) ?? 1);
122
+ const tang = normalizedHeight / normalizedWidth;
123
+ const trendStrength = trendStrengths[i];
124
+ if (tang <= config.trendTangens[trendStrength] || i === trendStrengths.length - 1) {
125
+ const strength = value.to > value.from ? strengthsMap.growth[trendStrength] : strengthsMap.reduction[trendStrength];
126
+ return {
127
+ type,
128
+ priority: i,
129
+ change: {
130
+ from: value.from,
131
+ to: value.to,
132
+ strength
133
+ },
134
+ from: label.from,
135
+ to: label.to,
136
+ dataKey: label.dataKey,
137
+ label: label.displayValue
138
+ };
144
139
  }
145
- };
146
- var recordTrend = function recordTrend2(_ref4) {
147
- var value = _ref4.value, width = _ref4.width, label = _ref4.label, type = _ref4.type;
148
- for (var _i = 0; _i < trendStrengths.length; _i++) {
149
- var _hints$pointsDensity$, _hints$pointsDensity, _hints$pointsDensity$2, _hints$pointsDensity2;
150
- var normalizedHeight = Math.abs(value.from - value.to) / ((_hints$pointsDensity$ = (_hints$pointsDensity = hints.pointsDensity) === null || _hints$pointsDensity === void 0 ? void 0 : _hints$pointsDensity.verticalAxes) !== null && _hints$pointsDensity$ !== void 0 ? _hints$pointsDensity$ : 1);
151
- var normalizedWidth = width / ((_hints$pointsDensity$2 = (_hints$pointsDensity2 = hints.pointsDensity) === null || _hints$pointsDensity2 === void 0 ? void 0 : _hints$pointsDensity2.horizontalAxes) !== null && _hints$pointsDensity$2 !== void 0 ? _hints$pointsDensity$2 : 1);
152
- var tang = normalizedHeight / normalizedWidth;
153
- var trendStrength = trendStrengths[_i];
154
- if (tang <= config.trendTangens[trendStrength] || _i === trendStrengths.length - 1) {
155
- var strength = value.to > value.from ? strengthsMap.growth[trendStrength] : strengthsMap.reduction[trendStrength];
156
- return {
157
- type,
158
- priority: _i,
159
- change: {
160
- from: value.from,
161
- to: value.to,
162
- strength
163
- },
164
- from: label.from,
165
- to: label.to,
166
- dataKey: label.dataKey,
167
- label: label.displayValue
168
- };
140
+ }
141
+ };
142
+ const generalTrend = recordTrend({
143
+ type: "general-trend",
144
+ value: {
145
+ from: shortMovingAverage[0],
146
+ to: shortMovingAverage[shortMovingAverage.length - 1]
147
+ },
148
+ width: data.length,
149
+ label: {
150
+ from,
151
+ to,
152
+ dataKey: valueKey,
153
+ displayValue: hints.titles.valuesAxes[valueKey]
154
+ }
155
+ });
156
+ const localTrends = [];
157
+ {
158
+ const notableDiff = config.movingAverage.notableDiff ?? standardDeviation / 10;
159
+ let lastSwitch = 0;
160
+ let lastSwitchValue = shortMovingAverage[lastSwitch];
161
+ let shortWasAbove = shortMovingAverage[0] > longMovingAverage[0];
162
+ for (let i = 1; i < data.length; i++) {
163
+ const shortIsAbove = shortMovingAverage[i] > longMovingAverage[i];
164
+ const diff = Math.abs(shortMovingAverage[i] - longMovingAverage[i]);
165
+ if (shortIsAbove === shortWasAbove) continue;
166
+ if (diff < notableDiff) continue;
167
+ if (i === 0 && lastSwitch === data.length - 1) continue;
168
+ if (i === data.length - 1 && lastSwitch === 0) continue;
169
+ i = Math.min(i, data.length - 1);
170
+ const fromKey2 = data[lastSwitch][labelsKey];
171
+ const toKey2 = data[i][labelsKey];
172
+ const from2 = ((_f = (_e = hints.titles).getHorizontalAxesTitle) == null ? void 0 : _f.call(_e, fromKey2)) ?? hints.titles.horizontalAxes[fromKey2] ?? fromKey2;
173
+ const to2 = ((_h = (_g = hints.titles).getHorizontalAxesTitle) == null ? void 0 : _h.call(_g, toKey2)) ?? hints.titles.horizontalAxes[toKey2] ?? toKey2;
174
+ localTrends.push(recordTrend({
175
+ type: "trend",
176
+ value: {
177
+ from: lastSwitchValue,
178
+ to: shortMovingAverage[i]
179
+ },
180
+ width: i - lastSwitch,
181
+ label: {
182
+ from: from2,
183
+ to: to2,
184
+ dataKey: valueKey,
185
+ displayValue: hints.titles.valuesAxes[valueKey]
169
186
  }
170
- }
171
- };
172
- var generalTrend = recordTrend({
173
- type: "general-trend",
174
- value: {
175
- from: shortMovingAverage[0],
176
- to: shortMovingAverage[shortMovingAverage.length - 1]
177
- },
178
- width: data.length,
179
- label: {
180
- from,
181
- to,
182
- dataKey: valueKey,
183
- displayValue: hints.titles.valuesAxes[valueKey]
184
- }
185
- });
186
- var localTrends = [];
187
- {
188
- var _config$movingAverage3;
189
- var notableDiff = (_config$movingAverage3 = config.movingAverage.notableDiff) !== null && _config$movingAverage3 !== void 0 ? _config$movingAverage3 : standardDeviation / 10;
190
- var lastSwitch = 0;
191
- var lastSwitchValue = shortMovingAverage[lastSwitch];
192
- var shortWasAbove = shortMovingAverage[0] > longMovingAverage[0];
193
- for (var _i2 = 1; _i2 < data.length; _i2++) {
194
- var _ref5, _hints$titles$getHori5, _hints$titles$getHori6, _hints$titles3, _ref6, _hints$titles$getHori7, _hints$titles$getHori8, _hints$titles4;
195
- var shortIsAbove = shortMovingAverage[_i2] > longMovingAverage[_i2];
196
- var diff = Math.abs(shortMovingAverage[_i2] - longMovingAverage[_i2]);
197
- if (shortIsAbove === shortWasAbove) continue;
198
- if (diff < notableDiff) continue;
199
- if (_i2 === 0 && lastSwitch === data.length - 1) continue;
200
- if (_i2 === data.length - 1 && lastSwitch === 0) continue;
201
- _i2 = Math.min(_i2, data.length - 1);
202
- var _fromKey = data[lastSwitch][labelsKey];
203
- var _toKey = data[_i2][labelsKey];
204
- var _from = (_ref5 = (_hints$titles$getHori5 = (_hints$titles$getHori6 = (_hints$titles3 = hints.titles).getHorizontalAxesTitle) === null || _hints$titles$getHori6 === void 0 ? void 0 : _hints$titles$getHori6.call(_hints$titles3, _fromKey)) !== null && _hints$titles$getHori5 !== void 0 ? _hints$titles$getHori5 : hints.titles.horizontalAxes[_fromKey]) !== null && _ref5 !== void 0 ? _ref5 : _fromKey;
205
- var _to = (_ref6 = (_hints$titles$getHori7 = (_hints$titles$getHori8 = (_hints$titles4 = hints.titles).getHorizontalAxesTitle) === null || _hints$titles$getHori8 === void 0 ? void 0 : _hints$titles$getHori8.call(_hints$titles4, _toKey)) !== null && _hints$titles$getHori7 !== void 0 ? _hints$titles$getHori7 : hints.titles.horizontalAxes[_toKey]) !== null && _ref6 !== void 0 ? _ref6 : _toKey;
187
+ }));
188
+ lastSwitch = i;
189
+ lastSwitchValue = shortMovingAverage[lastSwitch];
190
+ shortWasAbove = shortIsAbove;
191
+ }
192
+ if (lastSwitch !== 0) {
193
+ const lastIndex = shortMovingAverage.length - 1;
194
+ const lastValue = shortMovingAverage[lastIndex];
195
+ if (Math.abs(lastSwitchValue - lastValue) > notableDiff) {
206
196
  localTrends.push(recordTrend({
207
197
  type: "trend",
208
198
  value: {
209
199
  from: lastSwitchValue,
210
- to: shortMovingAverage[_i2]
200
+ to: lastValue
211
201
  },
212
- width: _i2 - lastSwitch,
202
+ width: lastIndex - lastSwitch,
213
203
  label: {
214
- from: _from,
215
- to: _to,
204
+ from: data[lastSwitch][labelsKey],
205
+ to: data[lastIndex][labelsKey],
216
206
  dataKey: valueKey,
217
207
  displayValue: hints.titles.valuesAxes[valueKey]
218
208
  }
219
209
  }));
220
- lastSwitch = _i2;
221
- lastSwitchValue = shortMovingAverage[lastSwitch];
222
- shortWasAbove = shortIsAbove;
223
- }
224
- if (lastSwitch !== 0) {
225
- var lastIndex = shortMovingAverage.length - 1;
226
- var lastValue = shortMovingAverage[lastIndex];
227
- if (Math.abs(lastSwitchValue - lastValue) > notableDiff) {
228
- localTrends.push(recordTrend({
229
- type: "trend",
230
- value: {
231
- from: lastSwitchValue,
232
- to: lastValue
233
- },
234
- width: lastIndex - lastSwitch,
235
- label: {
236
- from: data[lastSwitch][labelsKey],
237
- to: data[lastIndex][labelsKey],
238
- dataKey: valueKey,
239
- displayValue: hints.titles.valuesAxes[valueKey]
240
- }
241
- }));
242
- }
243
210
  }
244
211
  }
245
- insights.push(generalTrend);
246
- (_insights = insights).push.apply(_insights, localTrends);
247
- };
248
- for (_iterator.s(); !(_step = _iterator.n()).done; ) {
249
- _loop();
250
212
  }
251
- } catch (err) {
252
- _iterator.e(err);
253
- } finally {
254
- _iterator.f();
213
+ insights.push(generalTrend);
214
+ insights.push(...localTrends);
255
215
  }
256
216
  } else if (dataType === "points-cloud") {
257
- var _ref7, _config$clustersGridS, _insights2;
258
- var guessedXKey = [].concat(_toConsumableArray(hints.fields.horizontalAxes.values()), ["x"])[0];
259
- var guessedYKey = [].concat(_toConsumableArray(hints.fields.verticalAxes.values()), ["y"])[0];
260
- var guessedValueKey = [].concat(_toConsumableArray(hints.fields.valueAxes.values()), ["value"])[0];
261
- var guessedLabelKey = keysMap["label"] ? "label" : guessedValueKey;
262
- var normalized = data.map(function(row2) {
263
- return {
264
- x: row2[guessedXKey],
265
- y: row2[guessedYKey],
266
- label: row2[guessedLabelKey],
267
- value: row2[guessedValueKey]
268
- };
269
- });
270
- var gridSize = (_ref7 = (_config$clustersGridS = config.clustersGridSize) !== null && _config$clustersGridS !== void 0 ? _config$clustersGridS : hints.grid.verticalAxes) !== null && _ref7 !== void 0 ? _ref7 : hints.grid.horizontalAxes;
217
+ const guessedXKey = [...hints.fields.horizontalAxes.values(), "x"][0];
218
+ const guessedYKey = [...hints.fields.verticalAxes.values(), "y"][0];
219
+ const guessedValueKey = [...hints.fields.valueAxes.values(), "value"][0];
220
+ const guessedLabelKey = keysMap["label"] ? "label" : guessedValueKey;
221
+ const normalized = data.map((row) => ({
222
+ x: row[guessedXKey],
223
+ y: row[guessedYKey],
224
+ label: row[guessedLabelKey],
225
+ value: row[guessedValueKey]
226
+ }));
227
+ let gridSize = config.clustersGridSize ?? hints.grid.verticalAxes ?? hints.grid.horizontalAxes;
271
228
  if (!gridSize) {
272
- var usedX = /* @__PURE__ */ new Set();
273
- var usedY = /* @__PURE__ */ new Set();
274
- var _iterator2 = _createForOfIteratorHelper(normalized), _step2;
275
- try {
276
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) {
277
- var _step2$value = _step2.value, x = _step2$value.x, y = _step2$value.y;
278
- usedX.add(x);
279
- usedY.add(y);
280
- }
281
- } catch (err) {
282
- _iterator2.e(err);
283
- } finally {
284
- _iterator2.f();
229
+ const usedX = /* @__PURE__ */ new Set();
230
+ const usedY = /* @__PURE__ */ new Set();
231
+ for (const {
232
+ x,
233
+ y
234
+ } of normalized) {
235
+ usedX.add(x);
236
+ usedY.add(y);
285
237
  }
286
- var orderedX = _toConsumableArray(usedX).sort(function(a, b) {
287
- return a - b;
288
- });
289
- var orderedY = _toConsumableArray(usedY).sort(function(a, b) {
290
- return a - b;
291
- });
292
- var distancesX = orderedX.slice(0, -1).map(function(x2, index) {
293
- return orderedX[index + 1] - x2;
294
- });
295
- var distancesY = orderedY.slice(0, -1).map(function(y2, index) {
296
- return orderedY[index + 1] - y2;
297
- });
298
- var avgDistanceX = distancesX.reduce(function(sum, x2) {
299
- return sum + x2;
300
- }, 0) / distancesX.length;
301
- var avgDistanceY = distancesY.reduce(function(sum, y2) {
302
- return sum + y2;
303
- }, 0) / distancesY.length;
304
- var belowAvgDistancesX = distancesX.filter(function(x2) {
305
- return x2 < avgDistanceX;
306
- });
307
- var belowAvgDistancesY = distancesY.filter(function(y2) {
308
- return y2 < avgDistanceY;
309
- });
310
- var betweenDistanceX = belowAvgDistancesX.reduce(function(sum, x2) {
311
- return sum + x2;
312
- }, 0) / belowAvgDistancesX.length;
313
- var betweenDistanceY = belowAvgDistancesY.reduce(function(sum, y2) {
314
- return sum + y2;
315
- }, 0) / belowAvgDistancesY.length;
316
- var avgDistance = 0;
238
+ const orderedX = [...usedX].sort((a, b) => a - b);
239
+ const orderedY = [...usedY].sort((a, b) => a - b);
240
+ const distancesX = orderedX.slice(0, -1).map((x, index) => orderedX[index + 1] - x);
241
+ const distancesY = orderedY.slice(0, -1).map((y, index) => orderedY[index + 1] - y);
242
+ const avgDistanceX = distancesX.reduce((sum, x) => sum + x, 0) / distancesX.length;
243
+ const avgDistanceY = distancesY.reduce((sum, y) => sum + y, 0) / distancesY.length;
244
+ const belowAvgDistancesX = distancesX.filter((x) => x < avgDistanceX);
245
+ const belowAvgDistancesY = distancesY.filter((y) => y < avgDistanceY);
246
+ const betweenDistanceX = belowAvgDistancesX.reduce((sum, x) => sum + x, 0) / belowAvgDistancesX.length;
247
+ const betweenDistanceY = belowAvgDistancesY.reduce((sum, y) => sum + y, 0) / belowAvgDistancesY.length;
248
+ let avgDistance = 0;
317
249
  if (!Number.isNaN(betweenDistanceX) && !Number.isNaN(betweenDistanceY)) {
318
250
  avgDistance = (betweenDistanceX + betweenDistanceY) / 2;
319
251
  } else if (!Number.isNaN(betweenDistanceX)) {
@@ -325,90 +257,59 @@ var extractDataInsights = function extractDataInsights2(data, hints, config) {
325
257
  }
326
258
  gridSize = Math.sqrt(Math.sqrt(avgDistance));
327
259
  }
328
- var grid = {};
329
- var takenY = /* @__PURE__ */ new Set();
330
- var takenX = /* @__PURE__ */ new Set();
331
- for (var i = 0; i < normalized.length; i++) {
332
- var _grid$gridX, _grid$gridX$gridY;
333
- var _normalized$i = normalized[i], _x = _normalized$i.x, _y = _normalized$i.y;
334
- var gridX = Math.round(_x / gridSize);
335
- var gridY = Math.round(_y / gridSize);
336
- takenY.add(_y);
337
- takenX.add(_x);
338
- grid[gridX] = (_grid$gridX = grid[gridX]) !== null && _grid$gridX !== void 0 ? _grid$gridX : {};
339
- grid[gridX][gridY] = (_grid$gridX$gridY = grid[gridX][gridY]) !== null && _grid$gridX$gridY !== void 0 ? _grid$gridX$gridY : {
340
- clusterId: "".concat(gridX, "_").concat(gridY),
260
+ const grid = {};
261
+ const takenY = /* @__PURE__ */ new Set();
262
+ const takenX = /* @__PURE__ */ new Set();
263
+ for (let i = 0; i < normalized.length; i++) {
264
+ const {
265
+ x,
266
+ y
267
+ } = normalized[i];
268
+ const gridX = Math.round(x / gridSize);
269
+ const gridY = Math.round(y / gridSize);
270
+ takenY.add(y);
271
+ takenX.add(x);
272
+ grid[gridX] = grid[gridX] ?? {};
273
+ grid[gridX][gridY] = grid[gridX][gridY] ?? {
274
+ clusterId: `${gridX}_${gridY}`,
341
275
  members: []
342
276
  };
343
277
  grid[gridX][gridY].members.push(normalized[i]);
344
278
  }
345
- var clusters = {};
346
- var _iterator3 = _createForOfIteratorHelper(Object.keys(grid).map(function(x2) {
347
- return Number.parseInt(x2, 10);
348
- })), _step3;
349
- try {
350
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done; ) {
351
- var _x3 = _step3.value;
352
- var _iterator4 = _createForOfIteratorHelper(Object.keys(grid[_x3]).map(function(y2) {
353
- return Number.parseInt(y2, 10);
354
- })), _step4;
355
- try {
356
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done; ) {
357
- var _clusters$grid$_x3$_y, _clusters$grid$_x3$_y2;
358
- var _y3 = _step4.value;
359
- var pointHandled = false;
360
- for (var _i4 = 0, _arr = [_x3 - 1, _x3, _x3 + 1]; _i4 < _arr.length; _i4++) {
361
- var xNeighbour = _arr[_i4];
362
- for (var _i5 = 0, _arr2 = [_y3 - 1, _y3, _y3 + 1]; _i5 < _arr2.length; _i5++) {
363
- var _grid$xNeighbour;
364
- var yNeighbour = _arr2[_i5];
365
- if (xNeighbour === void 0 || yNeighbour === void 0) continue;
366
- if (xNeighbour === _x3 && yNeighbour === _y3) continue;
367
- if (!((_grid$xNeighbour = grid[xNeighbour]) !== null && _grid$xNeighbour !== void 0 && _grid$xNeighbour[yNeighbour])) continue;
368
- pointHandled = true;
369
- grid[_x3][_y3].clusterId = grid[xNeighbour][yNeighbour].clusterId;
370
- break;
371
- }
372
- if (pointHandled) break;
373
- }
374
- clusters[grid[_x3][_y3].clusterId] = (_clusters$grid$_x3$_y = clusters[grid[_x3][_y3].clusterId]) !== null && _clusters$grid$_x3$_y !== void 0 ? _clusters$grid$_x3$_y : [];
375
- (_clusters$grid$_x3$_y2 = clusters[grid[_x3][_y3].clusterId]).push.apply(_clusters$grid$_x3$_y2, _toConsumableArray(grid[_x3][_y3].members));
279
+ const clusters = {};
280
+ for (const x of Object.keys(grid).map((x2) => Number.parseInt(x2, 10))) {
281
+ for (const y of Object.keys(grid[x]).map((y2) => Number.parseInt(y2, 10))) {
282
+ let pointHandled = false;
283
+ for (const xNeighbour of [x - 1, x, x + 1]) {
284
+ for (const yNeighbour of [y - 1, y, y + 1]) {
285
+ if (xNeighbour === void 0 || yNeighbour === void 0) continue;
286
+ if (xNeighbour === x && yNeighbour === y) continue;
287
+ if (!((_i = grid[xNeighbour]) == null ? void 0 : _i[yNeighbour])) continue;
288
+ pointHandled = true;
289
+ grid[x][y].clusterId = grid[xNeighbour][yNeighbour].clusterId;
290
+ break;
376
291
  }
377
- } catch (err) {
378
- _iterator4.e(err);
379
- } finally {
380
- _iterator4.f();
292
+ if (pointHandled) break;
381
293
  }
294
+ clusters[grid[x][y].clusterId] = clusters[grid[x][y].clusterId] ?? [];
295
+ clusters[grid[x][y].clusterId].push(...grid[x][y].members);
382
296
  }
383
- } catch (err) {
384
- _iterator3.e(err);
385
- } finally {
386
- _iterator3.f();
387
297
  }
388
- var clustersInsights = [];
389
- for (var clusterId in clusters) {
390
- var _hints$axesTitle$hori, _hints$axesTitle$vert3;
391
- var size = clusters[clusterId].reduce(function(sum, _ref8) {
392
- var value = _ref8.value;
393
- return sum + (value !== null && value !== void 0 ? value : 1);
394
- }, 0);
395
- var labels = _toConsumableArray(clusters[clusterId]).sort(function(a, b) {
396
- return b.value - a.value;
397
- }).map(function(_ref9) {
398
- var label = _ref9.label;
399
- return label;
400
- }).filter(function(label) {
401
- return label !== void 0;
402
- });
403
- var uniqueLabels = _toConsumableArray(new Set(labels));
404
- var _x2 = clusters[clusterId].reduce(function(sum, _ref0) {
405
- var x2 = _ref0.x;
406
- return sum + x2;
407
- }, 0) / clusters[clusterId].length;
408
- var _y2 = clusters[clusterId].reduce(function(sum, _ref1) {
409
- var y2 = _ref1.y;
410
- return sum + y2;
411
- }, 0) / clusters[clusterId].length;
298
+ const clustersInsights = [];
299
+ for (const clusterId in clusters) {
300
+ const size = clusters[clusterId].reduce((sum, {
301
+ value
302
+ }) => sum + (value ?? 1), 0);
303
+ const labels = [...clusters[clusterId]].sort((a, b) => b.value - a.value).map(({
304
+ label
305
+ }) => label).filter((label) => label !== void 0);
306
+ const uniqueLabels = [...new Set(labels)];
307
+ const x = clusters[clusterId].reduce((sum, {
308
+ x: x2
309
+ }) => sum + x2, 0) / clusters[clusterId].length;
310
+ const y = clusters[clusterId].reduce((sum, {
311
+ y: y2
312
+ }) => sum + y2, 0) / clusters[clusterId].length;
412
313
  clustersInsights.push({
413
314
  type: "cluster",
414
315
  priority: 1,
@@ -416,62 +317,58 @@ var extractDataInsights = function extractDataInsights2(data, hints, config) {
416
317
  labels: uniqueLabels,
417
318
  relativeSize: "average",
418
319
  center: {
419
- x: _x2,
420
- y: _y2,
421
- xLabel: (_hints$axesTitle$hori = hints.axesTitle.horizontal) !== null && _hints$axesTitle$hori !== void 0 ? _hints$axesTitle$hori : guessedXKey,
422
- yLabel: (_hints$axesTitle$vert3 = hints.axesTitle.vertical) !== null && _hints$axesTitle$vert3 !== void 0 ? _hints$axesTitle$vert3 : guessedYKey
320
+ x,
321
+ y,
322
+ xLabel: hints.axesTitle.horizontal ?? guessedXKey,
323
+ yLabel: hints.axesTitle.vertical ?? guessedYKey
423
324
  }
424
325
  });
425
326
  }
426
327
  entitiesCount = Object.keys(clusters).length;
427
- clustersInsights.sort(function(a, b) {
428
- return b.size - a.size;
429
- });
430
- var relativeSizeDistrivution = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "significantly-bigger", {
431
- max: Number.POSITIVE_INFINITY,
432
- min: 0.85
433
- }), "bigger", {
434
- min: 0.7,
435
- max: 0.85
436
- }), "slightly-bigger", {
437
- min: 0.6,
438
- max: 0.7
439
- }), "average", {
440
- min: 0.4,
441
- max: 0.6
442
- }), "slightly-smaller", {
443
- max: 0.4,
444
- min: 0.3
445
- }), "smaller", {
446
- min: 0.15,
447
- max: 0.3
448
- }), "significantly-smaller", {
449
- min: Number.NEGATIVE_INFINITY,
450
- max: 0.15
451
- });
452
- var averageSize = clustersInsights.reduce(function(sum, cluster) {
453
- return sum + cluster.size;
454
- }, 0) / clustersInsights.length;
455
- var smallerClusters = clustersInsights.filter(function(cluster) {
456
- return cluster.size < averageSize;
457
- });
458
- var smallerSize = smallerClusters.reduce(function(sum, cluster) {
459
- return sum + cluster.size;
460
- }, 0) / smallerClusters.length;
461
- var biggerClusters = clustersInsights.filter(function(cluster) {
462
- return cluster.size > averageSize;
463
- });
464
- var biggerSize = biggerClusters.reduce(function(sum, cluster) {
465
- return sum + cluster.size;
466
- }, 0) / biggerClusters.length;
467
- var normalizingSize = averageSize * 2;
468
- var averageSizeNormalized = averageSize / normalizingSize;
469
- var smallerSizeNormalized = smallerSize / normalizingSize;
470
- var biggerSizeNormalized = biggerSize / normalizingSize;
328
+ clustersInsights.sort((a, b) => b.size - a.size);
329
+ const relativeSizeDistrivution = {
330
+ ["significantly-bigger"]: {
331
+ max: Number.POSITIVE_INFINITY,
332
+ min: 0.85
333
+ },
334
+ ["bigger"]: {
335
+ min: 0.7,
336
+ max: 0.85
337
+ },
338
+ ["slightly-bigger"]: {
339
+ min: 0.6,
340
+ max: 0.7
341
+ },
342
+ ["average"]: {
343
+ min: 0.4,
344
+ max: 0.6
345
+ },
346
+ ["slightly-smaller"]: {
347
+ max: 0.4,
348
+ min: 0.3
349
+ },
350
+ ["smaller"]: {
351
+ min: 0.15,
352
+ max: 0.3
353
+ },
354
+ ["significantly-smaller"]: {
355
+ min: Number.NEGATIVE_INFINITY,
356
+ max: 0.15
357
+ }
358
+ };
359
+ const averageSize = clustersInsights.reduce((sum, cluster) => sum + cluster.size, 0) / clustersInsights.length;
360
+ const smallerClusters = clustersInsights.filter((cluster) => cluster.size < averageSize);
361
+ const smallerSize = smallerClusters.reduce((sum, cluster) => sum + cluster.size, 0) / smallerClusters.length;
362
+ const biggerClusters = clustersInsights.filter((cluster) => cluster.size > averageSize);
363
+ const biggerSize = biggerClusters.reduce((sum, cluster) => sum + cluster.size, 0) / biggerClusters.length;
364
+ const normalizingSize = averageSize * 2;
365
+ let averageSizeNormalized = averageSize / normalizingSize;
366
+ let smallerSizeNormalized = smallerSize / normalizingSize;
367
+ let biggerSizeNormalized = biggerSize / normalizingSize;
471
368
  smallerSizeNormalized = !Number.isNaN(smallerSizeNormalized) ? smallerSizeNormalized : 0.25;
472
369
  averageSizeNormalized = !Number.isNaN(averageSizeNormalized) ? averageSizeNormalized : 0.5;
473
370
  biggerSizeNormalized = !Number.isNaN(biggerSizeNormalized) ? biggerSizeNormalized : 0.75;
474
- var sizeMapBezier = makeBezier([{
371
+ const sizeMapBezier = makeBezier([{
475
372
  x: 0,
476
373
  y: 0
477
374
  }, {
@@ -491,23 +388,25 @@ var extractDataInsights = function extractDataInsights2(data, hints, config) {
491
388
  }], {
492
389
  width: 1
493
390
  });
494
- for (var _i3 = 0, _clustersInsights = clustersInsights; _i3 < _clustersInsights.length; _i3++) {
495
- var clustersInsight = _clustersInsights[_i3];
496
- var _size = clustersInsight.size;
497
- var mappedSize = sizeMapBezier(_size / normalizingSize);
498
- for (var relativeSize in relativeSizeDistrivution) {
499
- var _relativeSizeDistrivu2 = relativeSizeDistrivution[relativeSize], min = _relativeSizeDistrivu2.min, max = _relativeSizeDistrivu2.max;
391
+ for (const clustersInsight of clustersInsights) {
392
+ const {
393
+ size
394
+ } = clustersInsight;
395
+ const mappedSize = sizeMapBezier(size / normalizingSize);
396
+ for (const relativeSize in relativeSizeDistrivution) {
397
+ const {
398
+ min,
399
+ max
400
+ } = relativeSizeDistrivution[relativeSize];
500
401
  if (mappedSize > min && mappedSize <= max) {
501
402
  clustersInsight.relativeSize = relativeSize;
502
403
  break;
503
404
  }
504
405
  }
505
406
  }
506
- (_insights2 = insights).push.apply(_insights2, clustersInsights);
407
+ insights.push(...clustersInsights);
507
408
  if (hints.axesTitle.horizontal) {
508
- var sortedX = _toConsumableArray(takenX).sort(function(a, b) {
509
- return a - b;
510
- });
409
+ const sortedX = [...takenX].sort((a, b) => a - b);
511
410
  dataRange.push({
512
411
  from: sortedX[0],
513
412
  to: sortedX[sortedX.length - 1],
@@ -515,9 +414,7 @@ var extractDataInsights = function extractDataInsights2(data, hints, config) {
515
414
  });
516
415
  }
517
416
  if (hints.axesTitle.vertical) {
518
- var sortedY = _toConsumableArray(takenY).sort(function(a, b) {
519
- return a - b;
520
- });
417
+ const sortedY = [...takenY].sort((a, b) => a - b);
521
418
  dataRange.push({
522
419
  from: sortedY[0],
523
420
  to: sortedY[sortedY.length - 1],
@@ -525,108 +422,76 @@ var extractDataInsights = function extractDataInsights2(data, hints, config) {
525
422
  });
526
423
  }
527
424
  } else if (dataType === "grouped-values") {
528
- var _insights3;
529
- var makeRowKey = function makeRowKey2(row2) {
530
- return groupKeys.map(function(key2, index) {
531
- return "".concat(index, "-").concat(getPropByPath(row2, key2));
532
- }).join("-");
533
- };
534
- var allRowsIds = data.map(makeRowKey);
535
- var groupedValues = {};
536
- for (var _i6 = 0; _i6 < data.length; _i6++) {
537
- var _groupedValues$key, _hints$titles$getHori9, _hints$titles$getHori0, _hints$titles5;
538
- var row = data[_i6];
539
- var key = allRowsIds[_i6];
540
- var groupKeyValue = getPropByPath(row, groupKeys[0]);
541
- groupedValues[key] = (_groupedValues$key = groupedValues[key]) !== null && _groupedValues$key !== void 0 ? _groupedValues$key : {
542
- groupName: (_hints$titles$getHori9 = (_hints$titles$getHori0 = (_hints$titles5 = hints.titles).getHorizontalAxesTitle) === null || _hints$titles$getHori0 === void 0 ? void 0 : _hints$titles$getHori0.call(_hints$titles5, groupKeyValue)) !== null && _hints$titles$getHori9 !== void 0 ? _hints$titles$getHori9 : groupKeyValue,
425
+ const makeRowKey = (row) => groupKeys.map((key, index) => `${index}-${getPropByPath(row, key)}`).join("-");
426
+ const allRowsIds = data.map(makeRowKey);
427
+ const groupedValues = {};
428
+ for (let i = 0; i < data.length; i++) {
429
+ const row = data[i];
430
+ const key = allRowsIds[i];
431
+ const groupKeyValue = getPropByPath(row, groupKeys[0]);
432
+ groupedValues[key] = groupedValues[key] ?? {
433
+ groupName: ((_k = (_j = hints.titles).getHorizontalAxesTitle) == null ? void 0 : _k.call(_j, groupKeyValue)) ?? groupKeyValue,
543
434
  rows: []
544
435
  };
545
436
  groupedValues[key].rows.push(row);
546
437
  }
547
- var fields = _toConsumableArray(hints.fields.values);
548
- var grouppingKeys = Object.fromEntries(groupKeys.map(function(key2) {
549
- return [key2, true];
550
- }));
438
+ let fields = [...hints.fields.values];
439
+ const grouppingKeys = Object.fromEntries(groupKeys.map((key) => [key, true]));
551
440
  if (fields.length === 0) {
552
- var _fields;
553
- (_fields = fields).push.apply(_fields, _toConsumableArray(Object.keys(keysMap)));
441
+ fields.push(...Object.keys(keysMap));
554
442
  }
555
- fields = fields.filter(function(key2) {
556
- return !grouppingKeys[key2];
557
- });
558
- var groups = Object.entries(groupedValues).map(function(_ref10) {
559
- var _group$groupName;
560
- var _ref11 = _slicedToArray(_ref10, 2), groupKey = _ref11[0], group = _ref11[1];
561
- var values2 = [];
562
- var _iterator5 = _createForOfIteratorHelper(group.rows), _step5;
563
- try {
564
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done; ) {
565
- var _row = _step5.value;
566
- var _iterator6 = _createForOfIteratorHelper(fields), _step6;
567
- try {
568
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done; ) {
569
- var _ref13, _hints$titles$valuesA, _hints$titles$getVert, _hints$titles6;
570
- var field = _step6.value;
571
- values2.push({
572
- label: (_ref13 = (_hints$titles$valuesA = hints.titles.valuesAxes[field]) !== null && _hints$titles$valuesA !== void 0 ? _hints$titles$valuesA : (_hints$titles$getVert = (_hints$titles6 = hints.titles).getVerticalAxesTitle) === null || _hints$titles$getVert === void 0 ? void 0 : _hints$titles$getVert.call(_hints$titles6, field)) !== null && _ref13 !== void 0 ? _ref13 : field,
573
- value: getPropByPath(_row, field)
574
- });
575
- }
576
- } catch (err) {
577
- _iterator6.e(err);
578
- } finally {
579
- _iterator6.f();
580
- }
443
+ fields = fields.filter((key) => !grouppingKeys[key]);
444
+ const groups = Object.entries(groupedValues).map(([groupKey, group]) => {
445
+ var _a2, _b2;
446
+ const values = [];
447
+ for (const row of group.rows) {
448
+ for (const field of fields) {
449
+ values.push({
450
+ label: hints.titles.valuesAxes[field] ?? ((_b2 = (_a2 = hints.titles).getVerticalAxesTitle) == null ? void 0 : _b2.call(_a2, field)) ?? field,
451
+ value: getPropByPath(row, field)
452
+ });
581
453
  }
582
- } catch (err) {
583
- _iterator5.e(err);
584
- } finally {
585
- _iterator5.f();
586
454
  }
587
- values2.sort(function(a, b) {
455
+ values.sort((a, b) => {
588
456
  if (typeof a.value !== "number" || typeof b.value !== "number") return 0;
589
457
  return b.value - a.value;
590
458
  });
591
- var averageValue = values2.reduce(function(sum, _ref12) {
592
- var value = _ref12.value;
593
- return sum + value;
594
- }, 0) / values2.length;
459
+ const averageValue = values.reduce((sum, {
460
+ value
461
+ }) => sum + value, 0) / values.length;
595
462
  return {
596
- label: (_group$groupName = group.groupName) !== null && _group$groupName !== void 0 ? _group$groupName : groupKey,
597
- values: values2,
463
+ label: group.groupName ?? groupKey,
464
+ values,
598
465
  averageValue: !Number.isNaN(averageValue) ? averageValue : void 0
599
466
  };
600
467
  });
601
- groups.sort(function(a, b) {
468
+ groups.sort((a, b) => {
602
469
  if (typeof a.averageValue !== "number" || typeof b.averageValue !== "number") return 0;
603
470
  return b.averageValue - a.averageValue;
604
471
  });
605
472
  entitiesCount = groups.length;
606
- (_insights3 = insights).push.apply(_insights3, _toConsumableArray(groups.map(function(group) {
607
- return {
608
- type: "comparison",
609
- label: group.label,
610
- values: group.values,
611
- priority: 1
612
- };
473
+ insights.push(...groups.map((group) => ({
474
+ type: "comparison",
475
+ label: group.label,
476
+ values: group.values,
477
+ priority: 1
613
478
  })));
614
479
  }
615
480
  }
616
481
  if (dataType === "values-set") {
617
- var _fields2 = _toConsumableArray(hints.fields.values);
618
- if (_fields2.length === 0) {
619
- _fields2.push.apply(_fields2, _toConsumableArray(Object.keys(keysMap)));
482
+ const fields = [...hints.fields.values];
483
+ if (fields.length === 0) {
484
+ fields.push(...Object.keys(keysMap));
620
485
  }
621
- var values = _fields2.map(function(field) {
622
- var _ref14, _hints$titles$valuesA2, _hints$titles$getValu, _hints$titles7;
486
+ const values = fields.map((field) => {
487
+ var _a2, _b2;
623
488
  return {
624
- label: (_ref14 = (_hints$titles$valuesA2 = hints.titles.valuesAxes[field]) !== null && _hints$titles$valuesA2 !== void 0 ? _hints$titles$valuesA2 : (_hints$titles$getValu = (_hints$titles7 = hints.titles).getValueAxesTitle) === null || _hints$titles$getValu === void 0 ? void 0 : _hints$titles$getValu.call(_hints$titles7, field)) !== null && _ref14 !== void 0 ? _ref14 : field,
489
+ label: hints.titles.valuesAxes[field] ?? ((_b2 = (_a2 = hints.titles).getValueAxesTitle) == null ? void 0 : _b2.call(_a2, field)) ?? field,
625
490
  value: getPropByPath(data, field)
626
491
  };
627
492
  });
628
493
  entitiesCount = values.length;
629
- values.sort(function(a, b) {
494
+ values.sort((a, b) => {
630
495
  if (typeof a.value !== "number" || typeof b.value !== "number") return 0;
631
496
  return b.value - a.value;
632
497
  });
@@ -637,52 +502,39 @@ var extractDataInsights = function extractDataInsights2(data, hints, config) {
637
502
  });
638
503
  }
639
504
  if (dataType === "indexed-groups") {
640
- var _insights4;
641
- var _groups = _toConsumableArray(hints.groups).map(function(groupKey) {
642
- var _getPropByPath;
643
- var values2 = _toConsumableArray(hints.fields.values).filter(function(fieldPath) {
644
- return String(fieldPath).startsWith("".concat(groupKey, "."));
645
- }).map(function(fieldPath) {
646
- return {
647
- label: getPropByPath(hints.titles.valuesAxes, String(fieldPath).substring(String(groupKey).length + 1)),
648
- value: getPropByPath(data, String(fieldPath))
649
- };
650
- });
651
- values2.sort(function(a, b) {
505
+ const groups = [...hints.groups].map((groupKey) => {
506
+ const values = [...hints.fields.values].filter((fieldPath) => String(fieldPath).startsWith(`${groupKey}.`)).map((fieldPath) => ({
507
+ label: getPropByPath(hints.titles.valuesAxes, String(fieldPath).substring(String(groupKey).length + 1)),
508
+ value: getPropByPath(data, String(fieldPath))
509
+ }));
510
+ values.sort((a, b) => {
652
511
  if (typeof a.value !== "number" || typeof b.value !== "number") return 0;
653
512
  return b.value - a.value;
654
513
  });
655
- var averageValue = values2.reduce(function(sum, _ref15) {
656
- var value = _ref15.value;
657
- return sum + value;
658
- }, 0) / values2.length;
514
+ const averageValue = values.reduce((sum, {
515
+ value
516
+ }) => sum + value, 0) / values.length;
659
517
  return {
660
- label: (_getPropByPath = getPropByPath(hints.titles.valuesAxes, String(groupKey))) !== null && _getPropByPath !== void 0 ? _getPropByPath : groupKey,
661
- values: values2,
518
+ label: getPropByPath(hints.titles.valuesAxes, String(groupKey)) ?? groupKey,
519
+ values,
662
520
  averageValue: !Number.isNaN(averageValue) ? averageValue : void 0
663
521
  };
664
522
  });
665
- _groups.sort(function(a, b) {
523
+ groups.sort((a, b) => {
666
524
  if (typeof a.averageValue !== "number" || typeof b.averageValue !== "number") return 0;
667
525
  return b.averageValue - a.averageValue;
668
526
  });
669
- entitiesCount = _groups.length;
670
- (_insights4 = insights).push.apply(_insights4, _toConsumableArray(_groups.map(function(group) {
671
- return {
672
- type: "comparison",
673
- label: group.label,
674
- values: group.values,
675
- priority: 1
676
- };
527
+ entitiesCount = groups.length;
528
+ insights.push(...groups.map((group) => ({
529
+ type: "comparison",
530
+ label: group.label,
531
+ values: group.values,
532
+ priority: 1
677
533
  })));
678
534
  }
679
- var hasHighPriorityInsights = insights.some(function(insight) {
680
- return insight.priority > 0;
681
- });
535
+ const hasHighPriorityInsights = insights.some((insight) => insight.priority > 0);
682
536
  if (hasHighPriorityInsights) {
683
- insights = insights.filter(function(insight) {
684
- return insight.priority > 0;
685
- });
537
+ insights = insights.filter((insight) => insight.priority > 0);
686
538
  } else {
687
539
  insights = insights.slice(0, 1);
688
540
  }