@milaboratories/miplots4 1.0.129 → 1.0.131

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 (351) hide show
  1. package/dist/DataFrame.d.ts +15 -9
  2. package/dist/DataFrame.d.ts.map +1 -1
  3. package/dist/DataFrame.js +105 -81
  4. package/dist/DataFrame.js.map +1 -1
  5. package/dist/bubble/ChartRenderer.d.ts +6 -5
  6. package/dist/bubble/ChartRenderer.d.ts.map +1 -1
  7. package/dist/bubble/ChartRenderer.js +123 -121
  8. package/dist/bubble/ChartRenderer.js.map +1 -1
  9. package/dist/bubble/components/Chart.d.ts +3 -2
  10. package/dist/bubble/components/Chart.d.ts.map +1 -1
  11. package/dist/bubble/components/Chart.js +78 -97
  12. package/dist/bubble/components/Chart.js.map +1 -1
  13. package/dist/bubble/components/ChartsGroup.d.ts +6 -5
  14. package/dist/bubble/components/ChartsGroup.d.ts.map +1 -1
  15. package/dist/bubble/components/ChartsGroup.js +39 -37
  16. package/dist/bubble/components/ChartsGroup.js.map +1 -1
  17. package/dist/bubble/getCellTooltip.d.ts +5 -0
  18. package/dist/bubble/getCellTooltip.d.ts.map +1 -0
  19. package/dist/bubble/getCellTooltip.js +28 -0
  20. package/dist/bubble/getCellTooltip.js.map +1 -0
  21. package/dist/bubble/{getCells.d.ts → getGroupedCellsData.d.ts} +4 -4
  22. package/dist/bubble/getGroupedCellsData.d.ts.map +1 -0
  23. package/dist/bubble/getGroupedCellsData.js +94 -0
  24. package/dist/bubble/getGroupedCellsData.js.map +1 -0
  25. package/dist/bubble/index.d.ts +4 -4
  26. package/dist/bubble/index.d.ts.map +1 -1
  27. package/dist/bubble/index.js +47 -42
  28. package/dist/bubble/index.js.map +1 -1
  29. package/dist/bubble/utils/calculateCaptionTails.d.ts +2 -2
  30. package/dist/bubble/utils/calculateCaptionTails.d.ts.map +1 -1
  31. package/dist/bubble/utils/calculateCaptionTails.js.map +1 -1
  32. package/dist/common/Legend.d.ts.map +1 -1
  33. package/dist/common/Legend.js.map +1 -1
  34. package/dist/common/Tooltip.js +1 -1
  35. package/dist/common/Tooltip.js.map +1 -1
  36. package/dist/common/types.d.ts +1 -1
  37. package/dist/common/types.d.ts.map +1 -1
  38. package/dist/common/useDataFrame.d.ts +11 -0
  39. package/dist/common/useDataFrame.d.ts.map +1 -0
  40. package/dist/common/useDataFrame.js +20 -0
  41. package/dist/common/useDataFrame.js.map +1 -0
  42. package/dist/dendro/ChartRenderer.d.ts +9 -8
  43. package/dist/dendro/ChartRenderer.d.ts.map +1 -1
  44. package/dist/dendro/ChartRenderer.js +187 -187
  45. package/dist/dendro/ChartRenderer.js.map +1 -1
  46. package/dist/dendro/components/Chart.d.ts +8 -8
  47. package/dist/dendro/components/Chart.d.ts.map +1 -1
  48. package/dist/dendro/components/Chart.js +35 -35
  49. package/dist/dendro/components/Chart.js.map +1 -1
  50. package/dist/dendro/components/Heatmap.d.ts +3 -3
  51. package/dist/dendro/components/Heatmap.d.ts.map +1 -1
  52. package/dist/dendro/components/Heatmap.js +23 -23
  53. package/dist/dendro/components/Heatmap.js.map +1 -1
  54. package/dist/dendro/components/Legend.d.ts.map +1 -1
  55. package/dist/dendro/components/Legend.js.map +1 -1
  56. package/dist/dendro/components/LinksGroup.d.ts +6 -6
  57. package/dist/dendro/components/LinksGroup.d.ts.map +1 -1
  58. package/dist/dendro/components/LinksGroup.js +17 -17
  59. package/dist/dendro/components/LinksGroup.js.map +1 -1
  60. package/dist/dendro/components/NodesGroup.d.ts +7 -7
  61. package/dist/dendro/components/NodesGroup.d.ts.map +1 -1
  62. package/dist/dendro/components/NodesGroup.js +29 -29
  63. package/dist/dendro/components/NodesGroup.js.map +1 -1
  64. package/dist/dendro/components/types.d.ts +2 -2
  65. package/dist/dendro/components/types.d.ts.map +1 -1
  66. package/dist/dendro/getHeatmapData.d.ts +2 -2
  67. package/dist/dendro/getHeatmapData.d.ts.map +1 -1
  68. package/dist/dendro/getHeatmapData.js +48 -44
  69. package/dist/dendro/getHeatmapData.js.map +1 -1
  70. package/dist/dendro/getHierarchyData.d.ts +3 -3
  71. package/dist/dendro/getHierarchyData.d.ts.map +1 -1
  72. package/dist/dendro/getHierarchyData.js +31 -31
  73. package/dist/dendro/getHierarchyData.js.map +1 -1
  74. package/dist/dendro/index.d.ts +5 -5
  75. package/dist/dendro/index.d.ts.map +1 -1
  76. package/dist/dendro/index.js +86 -89
  77. package/dist/dendro/index.js.map +1 -1
  78. package/dist/discrete/ChartRenderer.d.ts +6 -6
  79. package/dist/discrete/ChartRenderer.d.ts.map +1 -1
  80. package/dist/discrete/ChartRenderer.js +197 -196
  81. package/dist/discrete/ChartRenderer.js.map +1 -1
  82. package/dist/discrete/DiscreteSettingsImpl.d.ts +3 -3
  83. package/dist/discrete/DiscreteSettingsImpl.d.ts.map +1 -1
  84. package/dist/discrete/DiscreteSettingsImpl.js +8 -8
  85. package/dist/discrete/DiscreteSettingsImpl.js.map +1 -1
  86. package/dist/discrete/components/layers/BoxElement.js.map +1 -1
  87. package/dist/discrete/index.d.ts +1 -1
  88. package/dist/discrete/index.d.ts.map +1 -1
  89. package/dist/discrete/index.js +109 -106
  90. package/dist/discrete/index.js.map +1 -1
  91. package/dist/discrete/layers/bar.d.ts +2 -2
  92. package/dist/discrete/layers/bar.d.ts.map +1 -1
  93. package/dist/discrete/layers/bar.js +32 -37
  94. package/dist/discrete/layers/bar.js.map +1 -1
  95. package/dist/discrete/layers/binnedDots.d.ts +3 -3
  96. package/dist/discrete/layers/binnedDots.d.ts.map +1 -1
  97. package/dist/discrete/layers/binnedDots.js +66 -78
  98. package/dist/discrete/layers/binnedDots.js.map +1 -1
  99. package/dist/discrete/layers/boxes.d.ts +3 -4
  100. package/dist/discrete/layers/boxes.d.ts.map +1 -1
  101. package/dist/discrete/layers/boxes.js +59 -60
  102. package/dist/discrete/layers/boxes.js.map +1 -1
  103. package/dist/discrete/layers/dots.d.ts +2 -3
  104. package/dist/discrete/layers/dots.d.ts.map +1 -1
  105. package/dist/discrete/layers/dots.js +30 -30
  106. package/dist/discrete/layers/dots.js.map +1 -1
  107. package/dist/discrete/layers/lines.js +11 -10
  108. package/dist/discrete/layers/lines.js.map +1 -1
  109. package/dist/discrete/layers/logo.d.ts +2 -2
  110. package/dist/discrete/layers/logo.d.ts.map +1 -1
  111. package/dist/discrete/layers/logo.js +21 -21
  112. package/dist/discrete/layers/logo.js.map +1 -1
  113. package/dist/discrete/layers/pairedPoints.d.ts +2 -2
  114. package/dist/discrete/layers/pairedPoints.d.ts.map +1 -1
  115. package/dist/discrete/layers/pairedPoints.js +62 -62
  116. package/dist/discrete/layers/pairedPoints.js.map +1 -1
  117. package/dist/discrete/layers/sina.d.ts +3 -4
  118. package/dist/discrete/layers/sina.d.ts.map +1 -1
  119. package/dist/discrete/layers/sina.js +67 -71
  120. package/dist/discrete/layers/sina.js.map +1 -1
  121. package/dist/discrete/layers/stackedBar.d.ts +1 -1
  122. package/dist/discrete/layers/stackedBar.d.ts.map +1 -1
  123. package/dist/discrete/layers/stackedBar.js +25 -25
  124. package/dist/discrete/layers/stackedBar.js.map +1 -1
  125. package/dist/discrete/layers/violins.js +13 -13
  126. package/dist/discrete/utils/getOutliersBounds.d.ts +1 -1
  127. package/dist/discrete/utils/getOutliersBounds.d.ts.map +1 -1
  128. package/dist/discrete/utils/getOutliersBounds.js +5 -5
  129. package/dist/discrete/utils/getOutliersBounds.js.map +1 -1
  130. package/dist/discrete/utils/splitTextByWidth.js +1 -1
  131. package/dist/discrete/utils/splitTextByWidth.js.map +1 -1
  132. package/dist/heatmap/ChartRenderer.d.ts +7 -6
  133. package/dist/heatmap/ChartRenderer.d.ts.map +1 -1
  134. package/dist/heatmap/ChartRenderer.js +232 -230
  135. package/dist/heatmap/ChartRenderer.js.map +1 -1
  136. package/dist/heatmap/HeatmapSettingsImpl.d.ts +2 -2
  137. package/dist/heatmap/HeatmapSettingsImpl.d.ts.map +1 -1
  138. package/dist/heatmap/HeatmapSettingsImpl.js +1 -1
  139. package/dist/heatmap/HeatmapSettingsImpl.js.map +1 -1
  140. package/dist/heatmap/components/Annotations/Annotation.d.ts.map +1 -1
  141. package/dist/heatmap/components/Annotations/Annotation.js +40 -39
  142. package/dist/heatmap/components/Annotations/Annotation.js.map +1 -1
  143. package/dist/heatmap/components/Chart.d.ts.map +1 -1
  144. package/dist/heatmap/components/Chart.js +90 -89
  145. package/dist/heatmap/components/Chart.js.map +1 -1
  146. package/dist/heatmap/components/ChartsGroup.d.ts +2 -2
  147. package/dist/heatmap/components/ChartsGroup.d.ts.map +1 -1
  148. package/dist/heatmap/components/ChartsGroup.js +14 -14
  149. package/dist/heatmap/components/ChartsGroup.js.map +1 -1
  150. package/dist/heatmap/components/types.d.ts +3 -2
  151. package/dist/heatmap/components/types.d.ts.map +1 -1
  152. package/dist/heatmap/getCells.d.ts +3 -2
  153. package/dist/heatmap/getCells.d.ts.map +1 -1
  154. package/dist/heatmap/getCells.js +97 -93
  155. package/dist/heatmap/getCells.js.map +1 -1
  156. package/dist/heatmap/index.d.ts +3 -3
  157. package/dist/heatmap/index.d.ts.map +1 -1
  158. package/dist/heatmap/index.js +13 -12
  159. package/dist/heatmap/index.js.map +1 -1
  160. package/dist/heatmap/utils/calculateAnnotationTitleSizes.d.ts.map +1 -1
  161. package/dist/heatmap/utils/calculateAnnotationTitleSizes.js +1 -1
  162. package/dist/heatmap/utils/calculateAnnotationTitleSizes.js.map +1 -1
  163. package/dist/heatmap/utils/calculateCaptionTails.d.ts +1 -1
  164. package/dist/heatmap/utils/calculateCaptionTails.d.ts.map +1 -1
  165. package/dist/heatmap/utils/calculateCaptionTails.js.map +1 -1
  166. package/dist/histogram/ChartRenderer.d.ts +6 -5
  167. package/dist/histogram/ChartRenderer.d.ts.map +1 -1
  168. package/dist/histogram/ChartRenderer.js +154 -153
  169. package/dist/histogram/ChartRenderer.js.map +1 -1
  170. package/dist/histogram/HistogramSettingsImpl.d.ts +2 -2
  171. package/dist/histogram/HistogramSettingsImpl.d.ts.map +1 -1
  172. package/dist/histogram/HistogramSettingsImpl.js.map +1 -1
  173. package/dist/histogram/components/Chart.js +48 -48
  174. package/dist/histogram/components/Chart.js.map +1 -1
  175. package/dist/histogram/components/types.d.ts +4 -3
  176. package/dist/histogram/components/types.d.ts.map +1 -1
  177. package/dist/histogram/getHistogramData.d.ts +7 -7
  178. package/dist/histogram/getHistogramData.d.ts.map +1 -1
  179. package/dist/histogram/getHistogramData.js +52 -53
  180. package/dist/histogram/getHistogramData.js.map +1 -1
  181. package/dist/histogram/index.d.ts +3 -3
  182. package/dist/histogram/index.d.ts.map +1 -1
  183. package/dist/histogram/index.js +49 -45
  184. package/dist/histogram/index.js.map +1 -1
  185. package/dist/node_modules/@d3fc/d3fc-axis/src/axisBase.js +10 -10
  186. package/dist/node_modules/d3-array/src/min.js +5 -11
  187. package/dist/node_modules/d3-array/src/min.js.map +1 -1
  188. package/dist/node_modules/d3-shape/src/area.js +30 -30
  189. package/dist/node_modules/d3-shape/src/line.js +6 -6
  190. package/dist/node_modules/d3-shape/src/line.js.map +1 -1
  191. package/dist/node_modules/kdbush/index.js +148 -0
  192. package/dist/node_modules/kdbush/index.js.map +1 -0
  193. package/dist/scatterplot/ChartRenderer.d.ts +7 -6
  194. package/dist/scatterplot/ChartRenderer.d.ts.map +1 -1
  195. package/dist/scatterplot/ChartRenderer.js +213 -209
  196. package/dist/scatterplot/ChartRenderer.js.map +1 -1
  197. package/dist/scatterplot/ScatterplotSettingsImpl.d.ts +2 -2
  198. package/dist/scatterplot/ScatterplotSettingsImpl.d.ts.map +1 -1
  199. package/dist/scatterplot/ScatterplotSettingsImpl.js +28 -28
  200. package/dist/scatterplot/ScatterplotSettingsImpl.js.map +1 -1
  201. package/dist/scatterplot/components/ChartAxisTitles.d.ts.map +1 -1
  202. package/dist/scatterplot/components/ChartAxisTitles.js +31 -30
  203. package/dist/scatterplot/components/ChartAxisTitles.js.map +1 -1
  204. package/dist/scatterplot/components/ChartLayersData.d.ts.map +1 -1
  205. package/dist/scatterplot/components/ChartLayersData.js +138 -156
  206. package/dist/scatterplot/components/ChartLayersData.js.map +1 -1
  207. package/dist/scatterplot/components/ChartTooltip.d.ts.map +1 -1
  208. package/dist/scatterplot/components/ChartTooltip.js +41 -38
  209. package/dist/scatterplot/components/ChartTooltip.js.map +1 -1
  210. package/dist/scatterplot/components/ChartTrendsData.js +21 -21
  211. package/dist/scatterplot/components/ChartTrendsData.js.map +1 -1
  212. package/dist/scatterplot/components/types.d.ts +7 -7
  213. package/dist/scatterplot/components/types.d.ts.map +1 -1
  214. package/dist/scatterplot/constants.d.ts +1 -1
  215. package/dist/scatterplot/constants.d.ts.map +1 -1
  216. package/dist/scatterplot/constants.js.map +1 -1
  217. package/dist/scatterplot/dots.d.ts +2 -2
  218. package/dist/scatterplot/dots.d.ts.map +1 -1
  219. package/dist/scatterplot/dots.js +27 -25
  220. package/dist/scatterplot/dots.js.map +1 -1
  221. package/dist/scatterplot/getLayersData.d.ts +3 -3
  222. package/dist/scatterplot/getLayersData.d.ts.map +1 -1
  223. package/dist/scatterplot/getLayersData.js +12 -15
  224. package/dist/scatterplot/getLayersData.js.map +1 -1
  225. package/dist/scatterplot/index.d.ts +4 -4
  226. package/dist/scatterplot/index.d.ts.map +1 -1
  227. package/dist/scatterplot/index.js +71 -72
  228. package/dist/scatterplot/index.js.map +1 -1
  229. package/dist/scatterplot/linearRegression.d.ts +5 -4
  230. package/dist/scatterplot/linearRegression.d.ts.map +1 -1
  231. package/dist/scatterplot/linearRegression.js +88 -86
  232. package/dist/scatterplot/linearRegression.js.map +1 -1
  233. package/dist/scatterplot/utils/createAesGetter.d.ts +3 -2
  234. package/dist/scatterplot/utils/createAesGetter.d.ts.map +1 -1
  235. package/dist/scatterplot/utils/createAesGetter.js +21 -21
  236. package/dist/scatterplot/utils/createAesGetter.js.map +1 -1
  237. package/dist/scatterplot/utils/createLegendInfo.d.ts +2 -10
  238. package/dist/scatterplot/utils/createLegendInfo.d.ts.map +1 -1
  239. package/dist/scatterplot/utils/createLegendInfo.js +44 -37
  240. package/dist/scatterplot/utils/createLegendInfo.js.map +1 -1
  241. package/dist/scatterplot/utils/formatColumnValue.d.ts +5 -0
  242. package/dist/scatterplot/utils/formatColumnValue.d.ts.map +1 -0
  243. package/dist/scatterplot/utils/formatColumnValue.js +11 -0
  244. package/dist/scatterplot/utils/formatColumnValue.js.map +1 -0
  245. package/dist/scatterplot/utils/getVisibleLabels.d.ts +6 -9
  246. package/dist/scatterplot/utils/getVisibleLabels.d.ts.map +1 -1
  247. package/dist/scatterplot/utils/getVisibleLabels.js +46 -56
  248. package/dist/scatterplot/utils/getVisibleLabels.js.map +1 -1
  249. package/dist/scatterplot-umap/ChartRenderer.d.ts +18 -15
  250. package/dist/scatterplot-umap/ChartRenderer.d.ts.map +1 -1
  251. package/dist/scatterplot-umap/ChartRenderer.js +231 -214
  252. package/dist/scatterplot-umap/ChartRenderer.js.map +1 -1
  253. package/dist/scatterplot-umap/SettingsImpl.d.ts +2 -2
  254. package/dist/scatterplot-umap/SettingsImpl.d.ts.map +1 -1
  255. package/dist/scatterplot-umap/SettingsImpl.js +25 -25
  256. package/dist/scatterplot-umap/SettingsImpl.js.map +1 -1
  257. package/dist/scatterplot-umap/colors.d.ts +6 -0
  258. package/dist/scatterplot-umap/colors.d.ts.map +1 -0
  259. package/dist/scatterplot-umap/colors.js +42 -0
  260. package/dist/scatterplot-umap/colors.js.map +1 -0
  261. package/dist/scatterplot-umap/components/LowerSVG.d.ts +2 -2
  262. package/dist/scatterplot-umap/components/LowerSVG.d.ts.map +1 -1
  263. package/dist/scatterplot-umap/components/LowerSVG.js +97 -94
  264. package/dist/scatterplot-umap/components/LowerSVG.js.map +1 -1
  265. package/dist/scatterplot-umap/components/UpperSVG.d.ts.map +1 -1
  266. package/dist/scatterplot-umap/components/UpperSVG.js +20 -19
  267. package/dist/scatterplot-umap/components/UpperSVG.js.map +1 -1
  268. package/dist/scatterplot-umap/index.d.ts +0 -2
  269. package/dist/scatterplot-umap/index.d.ts.map +1 -1
  270. package/dist/scatterplot-umap/index.js +77 -102
  271. package/dist/scatterplot-umap/index.js.map +1 -1
  272. package/dist/scatterplot-umap/types.d.ts +7 -10
  273. package/dist/scatterplot-umap/types.d.ts.map +1 -1
  274. package/dist/types/bubble.d.ts +44 -12
  275. package/dist/types/bubble.d.ts.map +1 -1
  276. package/dist/types/common.d.ts +22 -3
  277. package/dist/types/common.d.ts.map +1 -1
  278. package/dist/types/common.js +3 -1
  279. package/dist/types/common.js.map +1 -1
  280. package/dist/types/dendro.d.ts +113 -10
  281. package/dist/types/dendro.d.ts.map +1 -1
  282. package/dist/types/dendro.js +1 -1
  283. package/dist/types/dendro.js.map +1 -1
  284. package/dist/types/discrete.d.ts +99 -22
  285. package/dist/types/discrete.d.ts.map +1 -1
  286. package/dist/types/discrete.js +3 -3
  287. package/dist/types/discrete.js.map +1 -1
  288. package/dist/types/heatmap.d.ts +187 -28
  289. package/dist/types/heatmap.d.ts.map +1 -1
  290. package/dist/types/heatmap.js +1 -1
  291. package/dist/types/heatmap.js.map +1 -1
  292. package/dist/types/histogram.d.ts +30 -8
  293. package/dist/types/histogram.d.ts.map +1 -1
  294. package/dist/types/histogram.js +1 -1
  295. package/dist/types/histogram.js.map +1 -1
  296. package/dist/types/scatterplot-umap.d.ts +149 -15
  297. package/dist/types/scatterplot-umap.d.ts.map +1 -1
  298. package/dist/types/scatterplot-umap.js +9 -9
  299. package/dist/types/scatterplot-umap.js.map +1 -1
  300. package/dist/types/scatterplot.d.ts +164 -12
  301. package/dist/types/scatterplot.d.ts.map +1 -1
  302. package/dist/types/scatterplot.js +1 -1
  303. package/dist/types/scatterplot.js.map +1 -1
  304. package/dist/utils/TextMeasurer/TextMeasurer.d.ts +7 -0
  305. package/dist/utils/TextMeasurer/TextMeasurer.d.ts.map +1 -0
  306. package/dist/utils/TextMeasurer/TextMeasurer.js +42 -0
  307. package/dist/utils/TextMeasurer/TextMeasurer.js.map +1 -0
  308. package/dist/utils/TextMeasurer/charToWidth.json.js +155 -0
  309. package/dist/utils/TextMeasurer/charToWidth.json.js.map +1 -0
  310. package/dist/utils/arrangeLegendParts.js +1 -1
  311. package/dist/utils/arrangeLegendParts.js.map +1 -1
  312. package/dist/utils/getChartEdgeSides.d.ts +1 -1
  313. package/dist/utils/getLegendWidth.d.ts.map +1 -1
  314. package/dist/utils/getLegendWidth.js +1 -1
  315. package/dist/utils/getLegendWidth.js.map +1 -1
  316. package/package.json +5 -3
  317. package/dist/bubble/getCells.d.ts.map +0 -1
  318. package/dist/bubble/getCells.js +0 -91
  319. package/dist/bubble/getCells.js.map +0 -1
  320. package/dist/node_modules/d3-quadtree/src/add.js +0 -30
  321. package/dist/node_modules/d3-quadtree/src/add.js.map +0 -1
  322. package/dist/node_modules/d3-quadtree/src/cover.js +0 -29
  323. package/dist/node_modules/d3-quadtree/src/cover.js.map +0 -1
  324. package/dist/node_modules/d3-quadtree/src/data.js +0 -12
  325. package/dist/node_modules/d3-quadtree/src/data.js.map +0 -1
  326. package/dist/node_modules/d3-quadtree/src/extent.js +0 -7
  327. package/dist/node_modules/d3-quadtree/src/extent.js.map +0 -1
  328. package/dist/node_modules/d3-quadtree/src/find.js +0 -26
  329. package/dist/node_modules/d3-quadtree/src/find.js.map +0 -1
  330. package/dist/node_modules/d3-quadtree/src/quad.js +0 -7
  331. package/dist/node_modules/d3-quadtree/src/quad.js.map +0 -1
  332. package/dist/node_modules/d3-quadtree/src/quadtree.js +0 -51
  333. package/dist/node_modules/d3-quadtree/src/quadtree.js.map +0 -1
  334. package/dist/node_modules/d3-quadtree/src/remove.js +0 -21
  335. package/dist/node_modules/d3-quadtree/src/remove.js.map +0 -1
  336. package/dist/node_modules/d3-quadtree/src/root.js +0 -7
  337. package/dist/node_modules/d3-quadtree/src/root.js.map +0 -1
  338. package/dist/node_modules/d3-quadtree/src/size.js +0 -12
  339. package/dist/node_modules/d3-quadtree/src/size.js.map +0 -1
  340. package/dist/node_modules/d3-quadtree/src/visit.js +0 -14
  341. package/dist/node_modules/d3-quadtree/src/visit.js.map +0 -1
  342. package/dist/node_modules/d3-quadtree/src/visitAfter.js +0 -19
  343. package/dist/node_modules/d3-quadtree/src/visitAfter.js.map +0 -1
  344. package/dist/node_modules/d3-quadtree/src/x.js +0 -11
  345. package/dist/node_modules/d3-quadtree/src/x.js.map +0 -1
  346. package/dist/node_modules/d3-quadtree/src/y.js +0 -11
  347. package/dist/node_modules/d3-quadtree/src/y.js.map +0 -1
  348. package/dist/utils/TextMeasurer.d.ts +0 -8
  349. package/dist/utils/TextMeasurer.d.ts.map +0 -1
  350. package/dist/utils/TextMeasurer.js +0 -27
  351. package/dist/utils/TextMeasurer.js.map +0 -1
@@ -1,131 +1,120 @@
1
- var Q = Object.defineProperty;
2
- var $ = (h, t, e) => t in h ? Q(h, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[t] = e;
3
- var l = (h, t, e) => $(h, typeof t != "symbol" ? t + "" : t, e);
4
- import { j as N } from "../node_modules/react/jsx-runtime.js";
1
+ var _ = Object.defineProperty;
2
+ var k = (y, t, e) => t in y ? _(y, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : y[t] = e;
3
+ var c = (y, t, e) => k(y, typeof t != "symbol" ? t + "" : t, e);
4
+ import { j as b } from "../node_modules/react/jsx-runtime.js";
5
+ import K from "../node_modules/@d3fc/d3fc-chart/src/cartesian.js";
6
+ import "../node_modules/@d3fc/d3fc-webgl/src/scale/scaleMapper.js";
7
+ import Y from "../node_modules/@d3fc/d3fc-webgl/src/style/fillColor.js";
8
+ import X from "../node_modules/@d3fc/d3fc-series/src/webgl/point.js";
9
+ import j from "../node_modules/@d3fc/d3fc-series/src/svg/multi.js";
10
+ import q from "../node_modules/@d3fc/d3fc-series/src/webgl/multi.js";
11
+ import $ from "../node_modules/d3-zoom/src/zoom.js";
12
+ import "../node_modules/d3-zoom/src/transform.js";
13
+ import { createRoot as Q } from "../node_modules/react-dom/client.js";
5
14
  import { Error as J } from "../common/Error.js";
6
- import { BLACK as E, DEFAULT_HEIGHT as W, DEFAULT_WIDTH as H, TITLE_LINE_HEIGHT as Z, MAX_SHOWN_UNIQUE_VALUES_IN_LABELS as tt, TITLE_MARGIN as et } from "../constants.js";
7
- import { splitTextByWidth as st } from "../discrete/utils/splitTextByWidth.js";
8
- import { SVGLayer as it } from "./components/SVGLayer.js";
9
- import { MIN_MARGIN as L, DEFAULT_DOT_AES as O } from "../scatterplot/constants.js";
10
- import { PADDINGS as w, TITLE_LINE as _, LEGEND_OFFSET as ot } from "./constants.js";
11
- import { createAesGetter as M } from "../scatterplot/utils/createAesGetter.js";
12
- import { getTicksAndFormat as at } from "../scatterplot/utils/getTicksAndFormat.js";
13
- import { getFilteredLabels as I, updateLabelsBBoxes as rt } from "../scatterplot/utils/getVisibleLabels.js";
14
- import { isContinuousAes as U } from "../types/common.js";
15
+ import { BLACK as R, DEFAULT_HEIGHT as w, DEFAULT_WIDTH as D, TITLE_LINE_HEIGHT as Z, TITLE_MARGIN as tt } from "../constants.js";
16
+ import { splitTextByWidth as et } from "../discrete/utils/splitTextByWidth.js";
17
+ import { MIN_MARGIN as L, DEFAULT_DOT_AES as G } from "../scatterplot/constants.js";
18
+ import { createAesGetter as H } from "../scatterplot/utils/createAesGetter.js";
19
+ import { getTicksAndFormat as it } from "../scatterplot/utils/getTicksAndFormat.js";
20
+ import { createLabelPositioner as st } from "../scatterplot/utils/getVisibleLabels.js";
21
+ import { isContinuousAes as A } from "../types/common.js";
15
22
  import "../types/discrete.js";
16
23
  import "../types/scatterplot.js";
17
24
  import "../types/heatmap.js";
18
25
  import "../types/dendro.js";
19
26
  import "../types/histogram.js";
20
27
  import "../types/bubble.js";
21
- import { getContinuousColorScale as lt } from "../utils/getContinuousColorScale.js";
22
- import { getContinuousLegendTicks as nt } from "../utils/getContinuousLegendTicks.js";
23
- import { TextMeasurer as ht } from "../utils/TextMeasurer.js";
24
- import { createRoot as ct } from "../node_modules/react-dom/client.js";
25
- import dt from "../node_modules/d3-zoom/src/zoom.js";
26
- import "../node_modules/d3-zoom/src/transform.js";
27
- import mt from "../node_modules/@d3fc/d3fc-chart/src/cartesian.js";
28
- import "../node_modules/@d3fc/d3fc-webgl/src/scale/scaleMapper.js";
29
- import pt from "../node_modules/@d3fc/d3fc-webgl/src/style/fillColor.js";
30
- import gt from "../node_modules/@d3fc/d3fc-series/src/webgl/point.js";
31
- import ut from "../node_modules/@d3fc/d3fc-series/src/svg/multi.js";
32
- import ft from "../node_modules/@d3fc/d3fc-series/src/webgl/multi.js";
33
- import yt from "../node_modules/@d3fc/d3fc-pointer/src/pointer.js";
34
- import { arrangeLegendParts as St } from "../utils/arrangeLegendParts.js";
35
- import C from "../node_modules/d3-scale/src/linear.js";
36
- import B from "../node_modules/d3-scale/src/log.js";
37
- import T from "../node_modules/d3-selection/src/select.js";
38
- import vt from "../node_modules/d3-scale/src/ordinal.js";
39
- import zt from "../node_modules/d3-scale/src/symlog.js";
40
- import { sqrt as xt } from "../node_modules/d3-scale/src/pow.js";
41
- import { rgb as D } from "../node_modules/d3-color/src/color.js";
42
- import Lt from "../node_modules/d3-quadtree/src/quadtree.js";
43
- import bt from "../node_modules/d3-polygon/src/contains.js";
44
- function V(h) {
45
- return h / 2.35 * (h / 2.35) * 64;
46
- }
47
- function G(h, t) {
48
- return h + (1 - h) * (1 - t);
28
+ import { getContinuousColorScale as ot } from "../utils/getContinuousColorScale.js";
29
+ import { getContinuousLegendTicks as at } from "../utils/getContinuousLegendTicks.js";
30
+ import { TextMeasurer as F } from "../utils/TextMeasurer/TextMeasurer.js";
31
+ import { SVGLayer as nt } from "./components/SVGLayer.js";
32
+ import { PADDINGS as W, TITLE_LINE as I, LEGEND_OFFSET as rt } from "./constants.js";
33
+ import lt from "../node_modules/@d3fc/d3fc-pointer/src/pointer.js";
34
+ import ht from "../node_modules/kdbush/index.js";
35
+ import { DataFrameProvider as ct } from "../common/useDataFrame.js";
36
+ import { arrangeLegendParts as dt } from "../utils/arrangeLegendParts.js";
37
+ import { stringToNumberRgba as M, getColorWithFakeOpacity as P, GET_BLACK as O } from "./colors.js";
38
+ import T from "../node_modules/d3-scale/src/linear.js";
39
+ import V from "../node_modules/d3-scale/src/log.js";
40
+ import N from "../node_modules/d3-selection/src/select.js";
41
+ import mt from "../node_modules/d3-scale/src/ordinal.js";
42
+ import pt from "../node_modules/d3-scale/src/symlog.js";
43
+ import { sqrt as gt } from "../node_modules/d3-scale/src/pow.js";
44
+ import ut from "../node_modules/d3-polygon/src/contains.js";
45
+ function B(y) {
46
+ return y / 2.35 * (y / 2.35) * 64;
49
47
  }
50
- function F(h, t) {
51
- return [
52
- G(h.r / 255, t),
53
- G(h.g / 255, t),
54
- G(h.b / 255, t),
55
- 1
56
- ];
48
+ function E(y, t, e) {
49
+ return e.length === 0 ? !0 : e.some((i) => i.closed && i.points.length > 2 && ut(i.points, [y, t]));
57
50
  }
58
- function P(h, t, e) {
59
- return e.length === 0 ? !0 : e.some((i) => i.closed && i.points.length > 2 && bt(i.points, [h, t]));
60
- }
61
- function k(h, t) {
62
- const e = t.find((c) => c.type === "dots"), i = t.find((c) => c.type === "curve");
51
+ function U(y, t, e) {
52
+ const i = e.find((o) => o.type === "dots"), r = e.find((o) => o.type === "curve");
63
53
  return {
64
- dotFill: M(h, (e == null ? void 0 : e.aes.dotFill) ?? O.color, "dotFill"),
65
- dotSize: M(h, (e == null ? void 0 : e.aes.dotSize) ?? O.size, "dotSize"),
66
- lineType: M(h, (i == null ? void 0 : i.aes.lineShape) ?? "solid", "lineShape")
54
+ dotFill: H(y, t, (i == null ? void 0 : i.aes.dotFill) ?? G.color, "dotFill"),
55
+ dotSize: H(y, t, (i == null ? void 0 : i.aes.dotSize) ?? G.size, "dotSize"),
56
+ lineType: H(y, t, (r == null ? void 0 : r.aes.lineShape) ?? "solid", "lineShape")
67
57
  };
68
58
  }
69
- class de {
59
+ class oe {
70
60
  constructor() {
71
- l(this, "reactRoot", null);
72
- l(this, "parentNode", null);
73
- l(this, "rootNode", null);
74
- l(this, "canvasNode", null);
75
- l(this, "svgLayerElement", null);
76
- l(this, "svgLayerComponent", /* @__PURE__ */ N.jsx(N.Fragment, {}));
77
- l(this, "aesGetters", {
61
+ c(this, "reactRoot", null);
62
+ c(this, "parentNode", null);
63
+ c(this, "rootNode", null);
64
+ c(this, "canvasNode", null);
65
+ c(this, "svgLayerElement", null);
66
+ c(this, "svgLayerComponent", /* @__PURE__ */ b.jsx(b.Fragment, {}));
67
+ c(this, "aesGetters", {
78
68
  dotSize: () => 2,
79
- dotFill: () => E,
69
+ dotFill: () => R,
80
70
  lineType: () => "solid"
81
71
  });
82
- l(this, "tools", null);
83
- l(this, "margins", {
72
+ c(this, "tools", null);
73
+ c(this, "margins", {
84
74
  top: L,
85
75
  bottom: L,
86
76
  left: L,
87
77
  right: L
88
78
  });
89
- l(this, "chartSizes", {
90
- chartWidth: H,
79
+ c(this, "chartSizes", {
80
+ chartWidth: D,
91
81
  // width of single chart
92
- chartHeight: W,
82
+ chartHeight: w,
93
83
  // height of single chart
94
- totalWidth: H,
84
+ totalWidth: D,
95
85
  // width of all charts in charts row, plus left axis, plus legend
96
- totalHeight: W
86
+ totalHeight: w
97
87
  // width of all charts in charts height, plus bottom axis, plus top title
98
88
  });
99
- l(this, "scales", {
100
- x: C().domain([0, 10]).range([0, H]),
101
- y: C().domain([0, 10]).range([W, 0]),
102
- xOriginal: C().domain([0, 10]).range([0, H]),
103
- yOriginal: C().domain([0, 10]).range([W, 0])
89
+ c(this, "scales", {
90
+ x: T().domain([0, 10]).range([0, D]),
91
+ y: T().domain([0, 10]).range([w, 0]),
92
+ xOriginal: T().domain([0, 10]).range([0, D]),
93
+ yOriginal: T().domain([0, 10]).range([w, 0])
104
94
  });
105
- l(this, "polygons", []);
106
- l(this, "onPolygonUpdateOutside", () => {
95
+ c(this, "polygons", []);
96
+ c(this, "onPolygonUpdateOutside", () => {
107
97
  });
108
- l(this, "onTooltipHintSwitch", () => {
98
+ c(this, "onTooltipHintSwitch", () => {
109
99
  });
110
- l(this, "onLassoControlsStateUpdate", () => {
100
+ c(this, "onLassoControlsStateUpdate", () => {
111
101
  });
112
- l(this, "zoomTransform", null);
113
- l(this, "zoomStateKey", "");
114
- l(this, "selectedDot", null);
115
- l(this, "captionsSizes", {
102
+ c(this, "zoomTransform", null);
103
+ c(this, "zoomStateKey", "");
104
+ c(this, "selectedDot", null);
105
+ c(this, "captionsSizes", {
116
106
  xAxisCaptionsWidth: 30,
117
107
  yAxisCaptionsWidth: 100
118
108
  });
119
- l(this, "mainTitle", []);
109
+ c(this, "mainTitle", []);
120
110
  // can be multiline
121
- l(this, "legend", { width: 0, height: 0, items: [] });
122
- l(this, "notCalculatedProps", {});
123
- l(this, "allDots", []);
124
- l(this, "allPossibleLabels", []);
125
- l(this, "visibleLabels", []);
126
- l(this, "onPolygonUpdate", (t) => {
111
+ c(this, "legend", { width: 0, height: 0, items: [] });
112
+ c(this, "notCalculatedProps", {});
113
+ c(this, "allDots", []);
114
+ c(this, "visibleLabels", []);
115
+ c(this, "onPolygonUpdate", (t) => {
127
116
  this.polygons = t, this.updateByLasso();
128
- const e = this.allDots.filter((i) => P(i.x, i.y, this.polygons)).map((i) => i.idx);
117
+ const e = this.allDots.filter((i) => E(i.x, i.y, this.polygons)).map((i) => i.idx);
129
118
  this.onPolygonUpdateOutside(e, t);
130
119
  });
131
120
  }
@@ -137,201 +126,202 @@ class de {
137
126
  });
138
127
  }
139
128
  init(t) {
140
- this.parentNode === null && (this.parentNode = t, this.rootNode = document.createElement("div"), this.canvasNode = document.createElement("div"), this.parentNode.appendChild(this.rootNode), this.parentNode.appendChild(this.canvasNode), this.reactRoot = ct(this.rootNode));
129
+ this.parentNode === null && (this.parentNode = t, this.rootNode = document.createElement("div"), this.canvasNode = document.createElement("div"), this.parentNode.appendChild(this.rootNode), this.parentNode.appendChild(this.canvasNode), this.reactRoot = Q(this.rootNode));
141
130
  }
142
131
  updateChartSizes(t) {
143
132
  (t.width !== this.chartSizes.chartWidth || t.height !== this.chartSizes.chartHeight) && (this.chartSizes.chartWidth = t.width, this.chartSizes.chartHeight = t.height, this.scales.x.range([0, this.chartSizes.chartWidth]), this.scales.y.range([this.chartSizes.chartHeight, 0]));
144
133
  }
145
134
  updateViewport(t, e, i) {
146
- const c = t.scale === "log" ? B() : C();
147
- let { minX: n, minY: p, maxX: m, maxY: f } = i;
148
- if (t.lowerValue !== void 0 && (n = Math.max(n, t.lowerValue)), t.upperValue !== void 0 && (m = Math.min(m, t.upperValue)), e.lowerValue !== void 0 && (p = Math.max(p, e.lowerValue)), e.upperValue !== void 0 && (f = Math.min(f, e.upperValue)), t.symmetricRange !== void 0) {
135
+ const r = t.scale === "log" ? V() : T();
136
+ let { minX: o, minY: l, maxX: m, maxY: u } = i;
137
+ if (t.lowerValue !== void 0 && (o = Math.max(o, t.lowerValue)), t.upperValue !== void 0 && (m = Math.min(m, t.upperValue)), e.lowerValue !== void 0 && (l = Math.max(l, e.lowerValue)), e.upperValue !== void 0 && (u = Math.min(u, e.upperValue)), t.symmetricRange !== void 0) {
149
138
  const a = t.symmetricRange;
150
- if (a >= n && a <= m) {
151
- const y = Math.max(a - n, m - a);
152
- n = a - y, m = a + y;
139
+ if (a >= o && a <= m) {
140
+ const f = Math.max(a - o, m - a);
141
+ o = a - f, m = a + f;
153
142
  }
154
143
  }
155
144
  if (typeof e.symmetricRange < "u") {
156
145
  const a = e.symmetricRange;
157
- if (a >= p && a <= f) {
158
- const y = Math.max(a - p, f - a);
159
- p = a - y, f = a + y;
146
+ if (a >= l && a <= u) {
147
+ const f = Math.max(a - l, u - a);
148
+ l = a - f, u = a + f;
160
149
  }
161
150
  }
162
- const v = [0, this.chartSizes.chartWidth], z = c.copy().domain([n, m]).range([w.LEFT, this.chartSizes.chartWidth - w.RIGHT]);
163
- c.domain([z.invert(0), z.invert(this.chartSizes.chartWidth)]).range(v).nice(), this.scales.x = c, this.scales.xOriginal = c.copy();
164
- const d = e.scale === "log" ? B() : C(), r = [this.chartSizes.chartHeight, 0], u = d.copy().domain([p, f]).range([this.chartSizes.chartHeight - w.BOTTOM, w.TOP]);
165
- d.domain([u.invert(this.chartSizes.chartHeight), u.invert(0)]).range(r).nice(), this.scales.y = d, this.scales.yOriginal = d.copy();
151
+ const S = [0, this.chartSizes.chartWidth], x = r.copy().domain([o, m]).range([W.LEFT, this.chartSizes.chartWidth - W.RIGHT]);
152
+ r.domain([x.invert(0), x.invert(this.chartSizes.chartWidth)]).range(S).nice(), this.scales.x = r, this.scales.xOriginal = r.copy();
153
+ const d = e.scale === "log" ? V() : T(), h = [this.chartSizes.chartHeight, 0], g = d.copy().domain([l, u]).range([this.chartSizes.chartHeight - W.BOTTOM, W.TOP]);
154
+ d.domain([g.invert(this.chartSizes.chartHeight), g.invert(0)]).range(h).nice(), this.scales.y = d, this.scales.yOriginal = d.copy();
166
155
  }
167
156
  updateCaptionsSize() {
168
- const t = new ht("600 14px Arial");
169
- function e(p) {
170
- return Math.max(...p.map((m) => t.getTextWidth(m)));
157
+ const t = new F("600 14px Arial");
158
+ function e(l) {
159
+ return Math.max(...l.map((m) => t.getTextWidth(m)));
171
160
  }
172
- const { ticks: i, format: c } = at(this.scales.y, !1), n = e(i.map(c));
161
+ const { ticks: i, format: r } = it(this.scales.y, !1), o = e(i.map(r));
173
162
  this.captionsSizes = {
174
163
  xAxisCaptionsWidth: 20,
175
- yAxisCaptionsWidth: n
164
+ yAxisCaptionsWidth: o
176
165
  };
177
166
  }
178
167
  createMainTitle(t) {
179
- this.mainTitle = st(
168
+ this.mainTitle = et(
180
169
  t.name,
181
170
  this.chartSizes.totalWidth - this.margins.left - this.margins.right,
182
171
  20
183
172
  );
184
173
  }
185
174
  updateMargins() {
186
- const t = Z * this.mainTitle.length, e = t > 0 ? t + et * 2 : 0;
175
+ const t = Z * this.mainTitle.length, e = t > 0 ? t + tt * 2 : 0;
187
176
  this.margins = {
188
177
  top: Math.max(e, L),
189
- bottom: L + this.captionsSizes.xAxisCaptionsWidth + _,
190
- left: L + this.captionsSizes.yAxisCaptionsWidth + _,
178
+ bottom: L + this.captionsSizes.xAxisCaptionsWidth + I,
179
+ left: L + this.captionsSizes.yAxisCaptionsWidth + I,
191
180
  right: this.legend.width + L
192
- }, this.chartSizes.totalWidth = this.margins.left + this.chartSizes.chartWidth + this.margins.right, this.chartSizes.totalHeight = this.margins.top + Math.max(this.chartSizes.chartHeight, this.legend.height) + this.margins.bottom, T(this.canvasNode).style("width", this.chartSizes.chartWidth + "px").style("height", this.chartSizes.chartHeight + "px").style("top", this.margins.top + "px").style("left", this.margins.left + "px");
181
+ }, this.chartSizes.totalWidth = this.margins.left + this.chartSizes.chartWidth + this.margins.right, this.chartSizes.totalHeight = this.margins.top + Math.max(this.chartSizes.chartHeight, this.legend.height) + this.margins.bottom, N(this.canvasNode).style("width", this.chartSizes.chartWidth + "px").style("height", this.chartSizes.chartHeight + "px").style("top", this.margins.top + "px").style("left", this.margins.left + "px");
193
182
  }
194
- updateLegendSize(t, e, i, c) {
183
+ updateLegendSize(t, e, i, r) {
195
184
  if (!t.show) {
196
185
  this.legend = { width: 0, height: 0, items: [] };
197
186
  return;
198
187
  }
199
- const n = [], p = { width: 0, height: 0, left: 0, top: 0 };
188
+ const o = [], l = { width: 0, height: 0, left: 0, top: 0 };
200
189
  if (i.forEach((d) => {
201
- const r = e[d.value];
202
- if (r.usedAes.length === 0 || !r.aesMap)
203
- return;
204
- if (r.values.length > tt) {
205
- console.warn(`Too many values for discrete legend (${r.values.length})`);
190
+ const h = e[d.value];
191
+ if (h.usedAes.length === 0 || !h.aesMap)
206
192
  return;
207
- }
208
- const u = {};
209
- r.values.forEach((g) => {
210
- u[g] || (u[g] = { ...O }), r.usedAes.forEach((S) => {
211
- var s, o;
212
- S === "dotFill" && (u[g].color = ((s = r.aesMap[g]) == null ? void 0 : s[S]) ?? E), S === "dotSize" && (u[g].size = ((o = r.aesMap[g]) == null ? void 0 : o[S]) ?? 3);
193
+ const g = {};
194
+ h.values.forEach((p) => {
195
+ g[p] || (g[p] = { ...G }), h.usedAes.forEach((v) => {
196
+ v === "dotFill" && (g[p].color = h.aesMap(p, v) ?? R), v === "dotSize" && (g[p].size = Number(h.aesMap(p, v) ?? 3));
213
197
  });
214
198
  });
215
- const a = d.label ?? d.value, y = vt().domain(r.values).range(r.values.map((g) => u[g]));
216
- n.push({ ...p, id: d.value, type: "dots", title: a, scale: y, values: r.values, labels: r.labels });
217
- }), c.forEach((d) => {
218
- if (d.type === "dots" && U(d.aes.dotFill)) {
219
- const { domain: r, range: u, columnName: a, type: y = "linear" } = d.aes.dotFill, g = a.label ?? a.value, S = lt(u, r, "linear"), s = (y === "log" ? zt() : C()).domain(r).range([this.chartSizes.chartHeight, 0]), o = nt(s, r);
220
- n.push({ ...p, id: "dotFill", type: "continuous", title: g, scale: S, tickPositionScale: s, values: o });
199
+ const a = d.label ?? d.value, f = mt().domain(h.values).range(h.values.map((p) => g[p]));
200
+ o.push({ ...l, id: d.value, type: "dots", title: a, scale: f, values: h.values, labels: h.labels });
201
+ }), r.forEach((d) => {
202
+ if (d.type === "dots" && A(d.aes.dotFill)) {
203
+ const { domain: h, range: g, columnName: a, type: f = "linear" } = d.aes.dotFill, p = a.label ?? a.value, v = ot(g, h, "linear"), s = (f === "log" ? pt() : T()).domain(h).range([this.chartSizes.chartHeight, 0]), n = at(s, h);
204
+ o.push({ ...l, id: "dotFill", type: "continuous", title: p, scale: v, tickPositionScale: s, values: n });
221
205
  }
222
- if (d.type === "dots" && U(d.aes.dotSize)) {
223
- const { columnName: r, domain: u, range: a } = d.aes.dotSize, y = r.label ?? r.value, g = xt(u, a), S = g.ticks(3), s = g.tickFormat(3), o = S.reduce((x, b) => (x[String(b)] = s(b), x), {});
224
- n.push({ ...p, id: r.value, type: "size", title: y, scale: g, values: S, labels: o });
206
+ if (d.type === "dots" && A(d.aes.dotSize)) {
207
+ const { columnName: h, domain: g, range: a } = d.aes.dotSize, f = h.label ?? h.value, p = gt(g, a), v = p.ticks(3), s = p.tickFormat(3), n = v.reduce((C, z) => (C[String(z)] = s(z), C), {});
208
+ o.push({ ...l, id: h.value, type: "size", title: f, scale: p, values: v, labels: n });
225
209
  }
226
- }), !n.length) {
210
+ }), !o.length) {
227
211
  this.legend = { width: 0, height: 0, items: [] };
228
212
  return;
229
213
  }
230
- const m = St(n, this.chartSizes.chartHeight), f = m[m.length - 1], v = f.left + f.width + ot, z = this.chartSizes.chartHeight;
214
+ const m = dt(o, this.chartSizes.chartHeight), u = m[m.length - 1], S = u.left + u.width + rt, x = this.chartSizes.chartHeight;
231
215
  this.legend = {
232
- width: v,
233
- height: z,
216
+ width: S,
217
+ height: x,
234
218
  items: m
235
219
  };
236
220
  }
237
- initSettings(t, e, i, c, n, p) {
238
- const { xAxis: m, yAxis: f, size: v, title: z, legend: d } = e;
239
- this.updateChartSizes(v), this.updateViewport(m, f, i), this.updateCaptionsSize(), this.updateLegendSize(d, c, p, n), this.createMainTitle(z), this.updateMargins(), this.aesGetters = k(c, n);
240
- const r = pt().data(t).value((s) => {
241
- const o = D(this.aesGetters.dotFill(s.data)), x = !s.dimmed && P(s.x, s.y, this.polygons) ? 1 : 0.4;
242
- return F(o, x);
243
- }), u = gt().equals((s, o) => s === o).size((s) => V(this.aesGetters.dotSize(s.data))).crossValue((s) => s.x).mainValue((s) => s.y).decorate((s) => r(s)), a = dt().scaleExtent([0.1, 1e3]).filter((s) => s.type === "wheel" || s.metaKey || s.ctrlKey).on("start", () => {
221
+ initSettings(t, e, i, r, o, l, m) {
222
+ const { xAxis: u, yAxis: S, size: x, title: d, legend: h } = i;
223
+ this.updateChartSizes(x), this.updateViewport(u, S, r), this.updateCaptionsSize(), this.updateLegendSize(h, o, m, l), this.createMainTitle(d), this.updateMargins(), this.aesGetters = U(t, o, l);
224
+ const g = Y().data(e).value((s) => {
225
+ const n = M(this.aesGetters.dotFill(s.idx));
226
+ return n[3] = !s.dimmed && E(s.x, s.y, this.polygons) ? 1 : 0.4, P(n, n);
227
+ }), a = X().equals((s, n) => s === n).size((s) => B(this.aesGetters.dotSize(s.idx))).crossValue((s) => s.x).mainValue((s) => s.y).decorate((s) => g(s)), f = $().scaleExtent([0.1, 1e3]).filter((s) => s.type === "wheel" || s.metaKey || s.ctrlKey).on("start", () => {
244
228
  this.selectedDot = null;
245
229
  }).on("zoom", (s) => {
246
- const o = s.transform, x = o.rescaleX(this.scales.xOriginal), b = o.rescaleY(this.scales.yOriginal);
247
- this.scales.x.domain(x.domain()), this.scales.y.domain(b.domain()), this.zoomTransform = o, this.zoomStateKey = `${o.x}_${o.y}_${o.k}`, this.renderSvgLayer(), this.renderWebglLayer();
230
+ const n = s.transform, C = n.rescaleX(this.scales.xOriginal), z = n.rescaleY(this.scales.yOriginal);
231
+ this.scales.x.domain(C.domain()), this.scales.y.domain(z.domain()), this.zoomTransform = n, this.zoomStateKey = `${n.x}_${n.y}_${n.k}`, this.updateLabelsPosition(this.visibleLabels), this.renderSvgLayer(t), this.renderWebglLayer();
248
232
  }).on("end", () => {
249
- this.allPossibleLabels.forEach((s) => {
250
- s.x = this.scales.x(s.dot.x), s.y = this.scales.y(s.dot.y);
251
- }), this.visibleLabels = I(this.allPossibleLabels, this.chartSizes.chartWidth, this.chartSizes.chartHeight), this.renderSvgLayer();
252
- }), y = this.createQuadtree(t), g = yt().on("point", ([s]) => {
253
- var b, A, R;
254
- let o;
255
- if (s) {
256
- const K = this.scales.x.invert(s.x), q = this.scales.y.invert(s.y), X = this.scales.xOriginal(K), Y = this.scales.yOriginal(q), j = 20 / (((b = this.zoomTransform) == null ? void 0 : b.k) || 1);
257
- o = (A = this.tools) == null ? void 0 : A.qt.find(X, Y, j);
258
- }
259
- const x = this.selectedDot && !o || !this.selectedDot && o || ((R = this.selectedDot) == null ? void 0 : R.id) !== (o == null ? void 0 : o.id);
260
- this.selectedDot = o ?? null, x && this.renderSvgLayer();
261
- }), S = mt({
233
+ this.visibleLabels = this.computeLabels(this.allDots), this.renderSvgLayer(t);
234
+ }), p = lt().on("point", ([s]) => {
235
+ var z;
236
+ let n;
237
+ s && (n = this.getClosestDot(s.x, s.y));
238
+ const C = this.selectedDot && !n || !this.selectedDot && n || ((z = this.selectedDot) == null ? void 0 : z.idx) !== (n == null ? void 0 : n.idx);
239
+ this.selectedDot = n ?? null, C && this.renderSvgLayer(t);
240
+ }), v = K({
262
241
  xScale: this.scales.x,
263
242
  yScale: this.scales.y
264
- }).xAxisHeight(() => "0").yAxisWidth(() => "0").svgPlotArea(ut()).webglPlotArea(
243
+ }).xAxisHeight(() => "0").yAxisWidth(() => "0").svgPlotArea(j()).webglPlotArea(
265
244
  // only render the point series on the WebGL layer
266
- ft().series([u]).mapping((s) => s)
245
+ q().series([a]).mapping((s) => s)
267
246
  ).decorate((s) => {
268
- const o = s.enter();
269
- o && !this.svgLayerElement && (o.style("grid-template-columns", "0 auto 1fr auto 0"), o.style("grid-template-rows", "0 auto 1fr auto 0"), this.svgLayerElement = o.select(".svg-plot-area.plot-area svg").node()), o.select(".svg-plot-area.plot-area").attr("class", "svg-plot-area plot-area miplots-scatterplot-plot-area").call(a).call(g);
247
+ const n = s.enter();
248
+ n && !this.svgLayerElement && (n.style("grid-template-columns", "0 auto 1fr auto 0"), n.style("grid-template-rows", "0 auto 1fr auto 0"), this.svgLayerElement = n.select(".svg-plot-area.plot-area svg").node()), n.select(".svg-plot-area.plot-area").attr("class", "svg-plot-area plot-area miplots-scatterplot-plot-area").call(f).call(p);
270
249
  });
271
250
  this.tools = {
272
- webglChart: S,
273
- zoom: a,
274
- qt: y,
275
- fillColor: r,
276
- pointSeries: u
277
- }, T(this.canvasNode).datum(t).style("position", "absolute").style("width", this.chartSizes.chartWidth + "px").style("height", this.chartSizes.chartHeight + "px").style("top", this.margins.top + "px").style("left", this.margins.left + "px");
251
+ webglChart: v,
252
+ zoom: f,
253
+ fillColor: g,
254
+ pointSeries: a
255
+ }, N(this.canvasNode).datum(e).style("position", "absolute").style("width", this.chartSizes.chartWidth + "px").style("height", this.chartSizes.chartHeight + "px").style("top", this.margins.top + "px").style("left", this.margins.left + "px");
278
256
  }
279
- updateAes(t, e) {
280
- this.tools !== null && (this.aesGetters = k(t, e), this.tools.fillColor.value((i) => {
281
- const c = this.aesGetters.dotFill ?? (() => E), n = D(c(i.data)), p = !i.dimmed && P(i.x, i.y, this.polygons) ? 1 : 0.4;
282
- return F(n, p);
257
+ updateAes(t, e, i) {
258
+ this.tools !== null && (this.aesGetters = U(t, e, i), this.tools.fillColor.value((r) => {
259
+ const o = this.aesGetters.dotFill ?? O, l = M(o(r.idx));
260
+ return l[3] = !r.dimmed && E(r.x, r.y, this.polygons) ? 1 : 0.4, P(l, l);
283
261
  }));
284
262
  }
285
263
  updatePointSize() {
286
- this.tools !== null && (T(this.canvasNode).datum([...this.allDots]), this.tools.pointSeries.size((t) => V(this.aesGetters.dotSize(t.data))));
264
+ this.tools !== null && (N(this.canvasNode).datum([...this.allDots]), this.tools.pointSeries.size((t) => B(this.aesGetters.dotSize(t.data))));
287
265
  }
288
266
  updateByLasso() {
289
267
  var t;
290
268
  this.tools !== null && ((t = this.tools) == null || t.fillColor.value((e) => {
291
- const i = this.aesGetters.dotFill ?? (() => E), c = D(i(e.data)), n = !e.dimmed && P(e.x, e.y, this.polygons) ? 1 : 0.4;
292
- return F(c, n);
269
+ const i = this.aesGetters.dotFill ?? O, r = M(i(e.idx));
270
+ return r[3] = !e.dimmed && E(e.x, e.y, this.polygons) ? 1 : 0.4, P(r, r);
293
271
  }), this.renderWebglLayer());
294
272
  }
295
273
  createQuadtree(t) {
296
- return Lt().x((e) => this.scales.xOriginal(e.x)).y((e) => this.scales.yOriginal(e.y)).addAll(t);
274
+ const e = new ht(t.length, 512);
275
+ for (let i = 0; i < t.length; i++)
276
+ e.add(t[i].x, t[i].y);
277
+ return e.finish();
297
278
  }
298
- updateData(t) {
299
- this.tools !== null && (T(this.canvasNode).datum(t), this.tools.fillColor.data(t), this.tools.qt = this.createQuadtree(t));
279
+ getClosestDot(t, e) {
280
+ var a, f;
281
+ const i = (a = this.tools) == null ? void 0 : a.qt;
282
+ if (!i) return null;
283
+ const r = this.allDots, o = this.scales.x.invert(t), l = this.scales.y.invert(e), m = 1 / (((f = this.zoomTransform) == null ? void 0 : f.k) || 1), u = o - m, S = o + m, x = l - m, d = l + m, h = i.range(u, x, S, d), g = h.reduce((p, v) => {
284
+ const s = r[v], n = this.scales.x(s.x) - t, C = this.scales.y(s.y) - e, z = Math.hypot(n, C);
285
+ return (p === null || z < p.distance) && (p.index = v, p.distance = z), p;
286
+ }, {
287
+ index: -1,
288
+ distance: 1 / 0
289
+ });
290
+ return h.length === 0 || g.index === -1 ? null : r[g.index];
300
291
  }
301
- render(t, e, i, c, n, p, m, f, v, z, d, r, u) {
292
+ updateDots(t) {
293
+ this.tools !== null && (N(this.canvasNode).datum(t), this.tools.fillColor.data(t), this.tools.qt = this.createQuadtree(t), this.allDots = t);
294
+ }
295
+ render(t, e, i, r, o, l, m, u, S, x, d, h, g) {
302
296
  if (this.tools === null)
303
297
  this.initSettings(
304
- c,
305
- e,
306
- n,
307
- f,
308
- m,
309
- v
310
- ), this.onPolygonUpdateOutside = d, this.onTooltipHintSwitch = r, this.onLassoControlsStateUpdate = u;
298
+ t,
299
+ o,
300
+ i,
301
+ l,
302
+ S,
303
+ u,
304
+ x
305
+ );
311
306
  else {
312
- const { title: a, legend: y, size: g } = e;
313
- this.updateChartSizes(g), this.updateLegendSize(y, f, v, m), this.createMainTitle(a), this.updateMargins(), this.updateAes(f, m);
307
+ const { title: a, legend: f, size: p } = i;
308
+ this.updateChartSizes(p), this.updateLegendSize(f, S, x, u), this.createMainTitle(a), this.updateMargins(), this.updateAes(t, S, u);
314
309
  }
315
- this.allDots = c, this.allPossibleLabels = z, this.allPossibleLabels.forEach((a) => {
316
- a.x = this.scales.x(a.dot.x), a.y = this.scales.y(a.dot.y);
317
- }), this.visibleLabels = I(this.allPossibleLabels, this.chartSizes.chartWidth, this.chartSizes.chartHeight), this.notCalculatedProps = {
318
- settingsId: t,
319
- chartSettings: e,
320
- keyColumn: i,
321
- dotsByGrouping: p,
322
- layers: m
323
- }, this.renderWebglLayer(), this.renderSvgLayer();
310
+ this.onPolygonUpdateOutside = d, this.onTooltipHintSwitch = h, this.onLassoControlsStateUpdate = g, this.allDots !== o && (this.updateDots(o), this.visibleLabels = this.computeLabels(o)), this.notCalculatedProps = {
311
+ settingsId: e,
312
+ chartSettings: i,
313
+ keyColumn: r,
314
+ dotsByGrouping: m,
315
+ layers: u
316
+ }, this.renderWebglLayer(), this.renderSvgLayer(t);
324
317
  }
325
318
  renderWebglLayer() {
326
319
  var t, e;
327
- (t = this.tools) != null && t.webglChart && T(this.canvasNode).call((e = this.tools) == null ? void 0 : e.webglChart);
320
+ (t = this.tools) != null && t.webglChart && N(this.canvasNode).call((e = this.tools) == null ? void 0 : e.webglChart);
328
321
  }
329
- renderSvgLayer() {
330
- var e;
331
- this.visibleLabels.forEach((i) => {
332
- i.x = this.scales.x(i.dot.x), i.y = this.scales.y(i.dot.y);
333
- }), rt(this.visibleLabels);
334
- const t = {
322
+ renderSvgLayer(t) {
323
+ var i;
324
+ const e = {
335
325
  settingsId: this.notCalculatedProps.settingsId,
336
326
  chartSettings: this.notCalculatedProps.chartSettings,
337
327
  keyColumn: this.notCalculatedProps.keyColumn,
@@ -353,14 +343,41 @@ class de {
353
343
  onTooltipHintSwitch: this.onTooltipHintSwitch,
354
344
  onLassoControlsStateUpdate: this.onLassoControlsStateUpdate
355
345
  };
356
- this.svgLayerComponent = /* @__PURE__ */ N.jsx(it, { ...t }), (e = this.reactRoot) == null || e.render(this.svgLayerComponent);
346
+ this.svgLayerComponent = /* @__PURE__ */ b.jsx(ct, { dataFrame: t, children: /* @__PURE__ */ b.jsx(nt, { ...e }) }), (i = this.reactRoot) == null || i.render(this.svgLayerComponent);
357
347
  }
358
348
  renderError(t) {
359
349
  var e;
360
- (e = this.reactRoot) == null || e.render(/* @__PURE__ */ N.jsx(J, { message: t }));
350
+ (e = this.reactRoot) == null || e.render(/* @__PURE__ */ b.jsx(J, { message: t }));
351
+ }
352
+ computeLabels(t) {
353
+ const e = new F("16px Manrope"), i = st(this.chartSizes.chartWidth, this.chartSizes.chartHeight), r = [];
354
+ for (let o = 0; o < t.length; o++) {
355
+ const l = t[o];
356
+ if (l.label == null)
357
+ continue;
358
+ const m = String(l.label), u = e.getTextMetrics(m), S = this.scales.x(l.x), x = this.scales.y(l.y), d = u.width, h = u.actualBoundingBoxAscent + u.actualBoundingBoxDescent, g = 10, a = i(S, x, d, h, g);
359
+ a && r.push({
360
+ x: S,
361
+ y: x,
362
+ dot: l,
363
+ name: m,
364
+ width: d,
365
+ height: h,
366
+ padding: g,
367
+ xPosition: a[0],
368
+ yPosition: a[1]
369
+ });
370
+ }
371
+ return r;
372
+ }
373
+ updateLabelsPosition(t) {
374
+ for (let e = 0; e < t.length; e++) {
375
+ const i = t[e];
376
+ i.x = this.scales.x(i.dot.x), i.y = this.scales.y(i.dot.y);
377
+ }
361
378
  }
362
379
  }
363
380
  export {
364
- de as default
381
+ oe as default
365
382
  };
366
383
  //# sourceMappingURL=ChartRenderer.js.map