@milaboratories/graph-maker 1.1.138 → 1.1.139

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 (219) hide show
  1. package/dist/GraphMaker/components/LassoControls/index.vue.js +15 -13
  2. package/dist/GraphMaker/components/LassoControls/index.vue.js.map +1 -1
  3. package/dist/GraphMaker/utils/createChartSettingsForRender/composeBubbleSettings.d.ts +9 -3
  4. package/dist/GraphMaker/utils/createChartSettingsForRender/composeBubbleSettings.d.ts.map +1 -1
  5. package/dist/GraphMaker/utils/createChartSettingsForRender/composeDendroSettings.d.ts +17 -2
  6. package/dist/GraphMaker/utils/createChartSettingsForRender/composeDendroSettings.d.ts.map +1 -1
  7. package/dist/GraphMaker/utils/createChartSettingsForRender/composeDiscreteSettings.d.ts +13 -4
  8. package/dist/GraphMaker/utils/createChartSettingsForRender/composeDiscreteSettings.d.ts.map +1 -1
  9. package/dist/GraphMaker/utils/createChartSettingsForRender/composeHeatmapSettings.d.ts +28 -7
  10. package/dist/GraphMaker/utils/createChartSettingsForRender/composeHeatmapSettings.d.ts.map +1 -1
  11. package/dist/GraphMaker/utils/createChartSettingsForRender/composeHistogramSettings.d.ts +6 -2
  12. package/dist/GraphMaker/utils/createChartSettingsForRender/composeHistogramSettings.d.ts.map +1 -1
  13. package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.d.ts +16 -2
  14. package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.d.ts.map +1 -1
  15. package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.d.ts +14 -2
  16. package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.d.ts.map +1 -1
  17. package/dist/node_modules/@milaboratories/miplots4/dist/DataFrame.js +95 -72
  18. package/dist/node_modules/@milaboratories/miplots4/dist/DataFrame.js.map +1 -1
  19. package/dist/node_modules/@milaboratories/miplots4/dist/MiPlots.js +1 -1
  20. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/ChartRenderer.js +124 -122
  21. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/ChartRenderer.js.map +1 -1
  22. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/components/Chart.js +72 -91
  23. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/components/Chart.js.map +1 -1
  24. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/components/ChartsGroup.js +43 -41
  25. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/components/ChartsGroup.js.map +1 -1
  26. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/getCellTooltip.js +28 -0
  27. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/getCellTooltip.js.map +1 -0
  28. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/getGroupedCellsData.js +94 -0
  29. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/getGroupedCellsData.js.map +1 -0
  30. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/index.js +42 -38
  31. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/index.js.map +1 -1
  32. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/utils/calculateCaptionTails.js.map +1 -1
  33. package/dist/node_modules/@milaboratories/miplots4/dist/common/Legend.js.map +1 -1
  34. package/dist/node_modules/@milaboratories/miplots4/dist/common/Tooltip.js +11 -11
  35. package/dist/node_modules/@milaboratories/miplots4/dist/common/Tooltip.js.map +1 -1
  36. package/dist/node_modules/@milaboratories/miplots4/dist/common/useDataFrame.js +20 -0
  37. package/dist/node_modules/@milaboratories/miplots4/dist/common/useDataFrame.js.map +1 -0
  38. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/ChartRenderer.js +181 -181
  39. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/ChartRenderer.js.map +1 -1
  40. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/DendroSettingsImpl.js +2 -2
  41. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/DendroSettingsImpl.js.map +1 -1
  42. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/components/Chart.js +45 -45
  43. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/components/Chart.js.map +1 -1
  44. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/components/Heatmap.js +27 -27
  45. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/components/Heatmap.js.map +1 -1
  46. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/components/Legend.js.map +1 -1
  47. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/components/LinksGroup.js +18 -18
  48. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/components/LinksGroup.js.map +1 -1
  49. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/components/NodesGroup.js +36 -36
  50. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/components/NodesGroup.js.map +1 -1
  51. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/getHeatmapData.js +45 -41
  52. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/getHeatmapData.js.map +1 -1
  53. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/getHierarchyData.js +33 -33
  54. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/getHierarchyData.js.map +1 -1
  55. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/index.js +90 -93
  56. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/index.js.map +1 -1
  57. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/ChartRenderer.js +200 -199
  58. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/ChartRenderer.js.map +1 -1
  59. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/DiscreteSettingsImpl.js +17 -17
  60. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/DiscreteSettingsImpl.js.map +1 -1
  61. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/components/layers/BoxElement.js.map +1 -1
  62. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/index.js +102 -99
  63. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/index.js.map +1 -1
  64. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/bar.js +31 -36
  65. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/bar.js.map +1 -1
  66. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/binnedDots.js +62 -74
  67. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/binnedDots.js.map +1 -1
  68. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/boxes.js +52 -53
  69. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/boxes.js.map +1 -1
  70. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/dots.js +32 -32
  71. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/dots.js.map +1 -1
  72. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/lines.js +7 -6
  73. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/lines.js.map +1 -1
  74. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/logo.js +23 -23
  75. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/logo.js.map +1 -1
  76. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/pairedPoints.js +63 -63
  77. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/pairedPoints.js.map +1 -1
  78. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/sina.js +60 -64
  79. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/sina.js.map +1 -1
  80. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/stackedBar.js +23 -23
  81. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/stackedBar.js.map +1 -1
  82. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/utils/getOutliersBounds.js +5 -5
  83. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/utils/getOutliersBounds.js.map +1 -1
  84. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/utils/splitTextByWidth.js +13 -13
  85. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/utils/splitTextByWidth.js.map +1 -1
  86. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/ChartRenderer.js +258 -256
  87. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/ChartRenderer.js.map +1 -1
  88. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/HeatmapSettingsImpl.js +1 -1
  89. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/HeatmapSettingsImpl.js.map +1 -1
  90. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Annotations/Annotation.js +45 -44
  91. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Annotations/Annotation.js.map +1 -1
  92. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Chart.js +107 -106
  93. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Chart.js.map +1 -1
  94. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/ChartsGroup.js +18 -18
  95. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/ChartsGroup.js.map +1 -1
  96. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/getCells.js +99 -95
  97. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/getCells.js.map +1 -1
  98. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/index.js +30 -29
  99. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/index.js.map +1 -1
  100. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/utils/calculateAnnotationTitleSizes.js +1 -1
  101. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/utils/calculateAnnotationTitleSizes.js.map +1 -1
  102. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/utils/calculateCaptionTails.js.map +1 -1
  103. package/dist/node_modules/@milaboratories/miplots4/dist/histogram/ChartRenderer.js +143 -142
  104. package/dist/node_modules/@milaboratories/miplots4/dist/histogram/ChartRenderer.js.map +1 -1
  105. package/dist/node_modules/@milaboratories/miplots4/dist/histogram/HistogramSettingsImpl.js.map +1 -1
  106. package/dist/node_modules/@milaboratories/miplots4/dist/histogram/components/Chart.js +30 -30
  107. package/dist/node_modules/@milaboratories/miplots4/dist/histogram/components/Chart.js.map +1 -1
  108. package/dist/node_modules/@milaboratories/miplots4/dist/histogram/components/ChartsGroup.js +7 -7
  109. package/dist/node_modules/@milaboratories/miplots4/dist/histogram/getHistogramData.js +53 -54
  110. package/dist/node_modules/@milaboratories/miplots4/dist/histogram/getHistogramData.js.map +1 -1
  111. package/dist/node_modules/@milaboratories/miplots4/dist/histogram/index.js +59 -55
  112. package/dist/node_modules/@milaboratories/miplots4/dist/histogram/index.js.map +1 -1
  113. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/@d3fc/d3fc-axis/src/axisBase.js +7 -7
  114. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-array/src/min.js +6 -12
  115. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-array/src/min.js.map +1 -1
  116. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-shape/src/line.js.map +1 -1
  117. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/kdbush/index.js +148 -0
  118. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/kdbush/index.js.map +1 -0
  119. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/ChartRenderer.js +172 -168
  120. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/ChartRenderer.js.map +1 -1
  121. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/ScatterplotSettingsImpl.js +26 -26
  122. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/ScatterplotSettingsImpl.js.map +1 -1
  123. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/Chart.js +11 -11
  124. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartAxisTitles.js +30 -29
  125. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartAxisTitles.js.map +1 -1
  126. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartLayersData.js +135 -153
  127. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartLayersData.js.map +1 -1
  128. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartTooltip.js +35 -32
  129. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartTooltip.js.map +1 -1
  130. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartTrendsData.js +27 -27
  131. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartTrendsData.js.map +1 -1
  132. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartsGroup.js +14 -14
  133. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/constants.js.map +1 -1
  134. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/dots.js +24 -22
  135. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/dots.js.map +1 -1
  136. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/getLayersData.js +11 -14
  137. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/getLayersData.js.map +1 -1
  138. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/index.js +57 -58
  139. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/index.js.map +1 -1
  140. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/linearRegression.js +85 -83
  141. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/linearRegression.js.map +1 -1
  142. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/createAesGetter.js +20 -20
  143. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/createAesGetter.js.map +1 -1
  144. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/createLegendInfo.js +44 -37
  145. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/createLegendInfo.js.map +1 -1
  146. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/formatColumnValue.js +11 -0
  147. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/formatColumnValue.js.map +1 -0
  148. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/getVisibleLabels.js +46 -56
  149. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/getVisibleLabels.js.map +1 -1
  150. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/ChartRenderer.js +223 -205
  151. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/ChartRenderer.js.map +1 -1
  152. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/SettingsImpl.js +22 -22
  153. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/SettingsImpl.js.map +1 -1
  154. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/colors.js +42 -0
  155. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/colors.js.map +1 -0
  156. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/components/LowerSVG.js +84 -81
  157. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/components/LowerSVG.js.map +1 -1
  158. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/components/SVGLayer.js +11 -11
  159. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/components/UpperSVG.js +15 -14
  160. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/components/UpperSVG.js.map +1 -1
  161. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/index.js +89 -114
  162. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/index.js.map +1 -1
  163. package/dist/node_modules/@milaboratories/miplots4/dist/types/common.js +3 -1
  164. package/dist/node_modules/@milaboratories/miplots4/dist/types/common.js.map +1 -1
  165. package/dist/node_modules/@milaboratories/miplots4/dist/types/dendro.js +1 -1
  166. package/dist/node_modules/@milaboratories/miplots4/dist/types/dendro.js.map +1 -1
  167. package/dist/node_modules/@milaboratories/miplots4/dist/types/discrete.js +1 -1
  168. package/dist/node_modules/@milaboratories/miplots4/dist/types/discrete.js.map +1 -1
  169. package/dist/node_modules/@milaboratories/miplots4/dist/types/heatmap.js +1 -1
  170. package/dist/node_modules/@milaboratories/miplots4/dist/types/heatmap.js.map +1 -1
  171. package/dist/node_modules/@milaboratories/miplots4/dist/types/histogram.js +1 -1
  172. package/dist/node_modules/@milaboratories/miplots4/dist/types/histogram.js.map +1 -1
  173. package/dist/node_modules/@milaboratories/miplots4/dist/types/scatterplot-umap.js +1 -1
  174. package/dist/node_modules/@milaboratories/miplots4/dist/types/scatterplot-umap.js.map +1 -1
  175. package/dist/node_modules/@milaboratories/miplots4/dist/types/scatterplot.js +4 -4
  176. package/dist/node_modules/@milaboratories/miplots4/dist/types/scatterplot.js.map +1 -1
  177. package/dist/node_modules/@milaboratories/miplots4/dist/utils/TextMeasurer/TextMeasurer.js +39 -0
  178. package/dist/node_modules/@milaboratories/miplots4/dist/utils/TextMeasurer/TextMeasurer.js.map +1 -0
  179. package/dist/node_modules/@milaboratories/miplots4/dist/utils/TextMeasurer/charToWidth.json.js +101 -0
  180. package/dist/node_modules/@milaboratories/miplots4/dist/utils/TextMeasurer/charToWidth.json.js.map +1 -0
  181. package/dist/node_modules/@milaboratories/miplots4/dist/utils/arrangeLegendParts.js +4 -4
  182. package/dist/node_modules/@milaboratories/miplots4/dist/utils/arrangeLegendParts.js.map +1 -1
  183. package/dist/node_modules/@milaboratories/miplots4/dist/utils/getLegendWidth.js +3 -3
  184. package/dist/node_modules/@milaboratories/miplots4/dist/utils/getLegendWidth.js.map +1 -1
  185. package/dist/node_modules/@milaboratories/pf-plots/dist/index.js +1031 -1023
  186. package/dist/node_modules/@milaboratories/pf-plots/dist/index.js.map +1 -1
  187. package/package.json +3 -3
  188. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/getCells.js +0 -91
  189. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/getCells.js.map +0 -1
  190. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/add.js +0 -30
  191. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/add.js.map +0 -1
  192. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/cover.js +0 -29
  193. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/cover.js.map +0 -1
  194. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/data.js +0 -12
  195. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/data.js.map +0 -1
  196. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/extent.js +0 -7
  197. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/extent.js.map +0 -1
  198. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/find.js +0 -26
  199. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/find.js.map +0 -1
  200. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/quad.js +0 -7
  201. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/quad.js.map +0 -1
  202. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/quadtree.js +0 -51
  203. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/quadtree.js.map +0 -1
  204. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/remove.js +0 -21
  205. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/remove.js.map +0 -1
  206. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/root.js +0 -7
  207. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/root.js.map +0 -1
  208. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/size.js +0 -12
  209. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/size.js.map +0 -1
  210. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/visit.js +0 -14
  211. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/visit.js.map +0 -1
  212. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/visitAfter.js +0 -19
  213. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/visitAfter.js.map +0 -1
  214. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/x.js +0 -11
  215. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/x.js.map +0 -1
  216. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/y.js +0 -11
  217. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/y.js.map +0 -1
  218. package/dist/node_modules/@milaboratories/miplots4/dist/utils/TextMeasurer.js +0 -24
  219. package/dist/node_modules/@milaboratories/miplots4/dist/utils/TextMeasurer.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"calculateCaptionTails.js","sources":["../../../../../../../node_modules/@milaboratories/miplots4/src/heatmap/utils/calculateCaptionTails.ts"],"sourcesContent":["import type {ChartsScales} from '../components/types';\nimport type {LabelAngles} from '../components/types';\nimport {MIN_STEP_FOR_VISIBLE_LABELS} from '../constants';\nimport type {GroupedCellsData} from '../getCells';\nimport type {HeatmapSettingsImpl} from '../HeatmapSettingsImpl';\nimport type {TextMeasurer} from '../../utils/TextMeasurer';\n\nconst COS_PI_4 = Math.cos(Math.PI / 4);\nfunction getTailByFacetKey (\n facetKey: string,\n groupKeys: string[],\n groupLabels: Record<string, string>,\n valueLabels: Record<string, string>,\n getKeysInGroup: (facetKey:string, groupKey:string) => string[],\n steps: Record<string, number>,\n scale: (v:string) => number,\n groupTitleInclined: boolean,\n labelTitleInclined: boolean,\n textMeasurer: TextMeasurer\n): number {\n const step = steps[facetKey];\n const labelsVisible = step > MIN_STEP_FOR_VISIBLE_LABELS;\n\n let maxTail = 0;\n groupKeys.forEach((groupKey) => {\n const keysInGroup = getKeysInGroup(facetKey, groupKey);\n if (keysInGroup.length === 0) {\n return 0;\n }\n const groupHalfWidth = (keysInGroup.length * step) / 2;\n const groupTail = groupTitleInclined\n ? textMeasurer.getTextWidth(groupLabels[groupKey]) * COS_PI_4 - groupHalfWidth - scale(keysInGroup[0])\n : 0;\n const labelTail = labelTitleInclined && labelsVisible\n ? groupKeys.reduce((res, key) => {\n const label = valueLabels[key];\n return Math.max(res, textMeasurer.getTextWidth(label) * COS_PI_4 - step / 2 - scale(key));\n }, 0)\n : 0;\n maxTail = Math.max(maxTail, groupTail, labelTail);\n });\n return maxTail;\n}\nexport function calculateCaptionTails(\n labelAngles: LabelAngles,\n facetSettings: HeatmapSettingsImpl['facetSettings'],\n scales: ChartsScales,\n steps: {\n x: Record<string, number>;\n y: Record<string, number>;\n },\n groupedCells: GroupedCellsData,\n textMeasurer: TextMeasurer\n): {xCaptionTail: number; yCaptionTail: number} {\n const {facetKeys, xGroupKeys, yGroupKeys, xKeysByGroups, yKeysByGroups, xLabels, yLabels, xGroupLabels, yGroupLabels} = groupedCells.meta;\n let xCaptionTail = 0;\n let yCaptionTail = 0;\n // tails from 45deg inclined captions of groups titles/cells labels, that take place on adjacent padding\n const xGroupTitleInclined = labelAngles.xGroupLabels === 45;\n const xLabelsInclined = labelAngles.xAxisLabels === 45;\n if (xGroupTitleInclined || xLabelsInclined) {\n if (!facetSettings.sharedX) {\n facetKeys.forEach(facetKey => {\n xCaptionTail = Math.max(\n getTailByFacetKey(\n facetKey,\n xGroupKeys,\n xGroupLabels,\n xLabels,\n (facetKey:string, groupKey:string) => groupedCells.facets[facetKey].xKeysByGroups[groupKey],\n steps.x,\n scales.x[facetKey],\n xGroupTitleInclined,\n xLabelsInclined,\n textMeasurer\n ),\n xCaptionTail\n );\n });\n } else {\n const facetKey = facetKeys[0]; // there is no difference between facets in this case\n xCaptionTail = Math.max(\n getTailByFacetKey(\n facetKey,\n xGroupKeys,\n xGroupLabels,\n xLabels,\n (facetKey:string, groupKey:string) => xKeysByGroups[groupKey],\n steps.x,\n scales.x[facetKey],\n xGroupTitleInclined,\n xLabelsInclined,\n textMeasurer\n ),\n xCaptionTail\n );\n }\n }\n const yGroupTitleInclined = labelAngles.yGroupLabels === 45;\n const yLabelsInclined = labelAngles.yAxisLabels === 45;\n if (yGroupTitleInclined || yLabelsInclined) {\n if (!facetSettings.sharedY) {\n facetKeys.forEach(facetKey => {\n yCaptionTail = Math.max(\n getTailByFacetKey(\n facetKey,\n yGroupKeys,\n yGroupLabels,\n yLabels,\n (facetKey:string, groupKey:string) => groupedCells.facets[facetKey].yKeysByGroups[groupKey],\n steps.y,\n scales.y[facetKey],\n yGroupTitleInclined,\n yLabelsInclined,\n textMeasurer\n ),\n yCaptionTail\n );\n });\n } else {\n const facetKey = facetKeys[0]; // there is no difference between facets in this case\n yCaptionTail = Math.max(\n getTailByFacetKey(\n facetKey,\n yGroupKeys,\n yGroupLabels,\n yLabels,\n (facetKey:string, groupKey:string) => yKeysByGroups[groupKey],\n steps.y,\n scales.y[facetKey],\n yGroupTitleInclined,\n yLabelsInclined,\n textMeasurer\n ),\n yCaptionTail\n );\n }\n }\n return {xCaptionTail, yCaptionTail};\n}\n"],"names":["COS_PI_4","getTailByFacetKey","facetKey","groupKeys","groupLabels","valueLabels","getKeysInGroup","steps","scale","groupTitleInclined","labelTitleInclined","textMeasurer","step","labelsVisible","MIN_STEP_FOR_VISIBLE_LABELS","maxTail","groupKey","keysInGroup","groupHalfWidth","groupTail","labelTail","res","key","label","calculateCaptionTails","labelAngles","facetSettings","scales","groupedCells","facetKeys","xGroupKeys","yGroupKeys","xKeysByGroups","yKeysByGroups","xLabels","yLabels","xGroupLabels","yGroupLabels","xCaptionTail","yCaptionTail","xGroupTitleInclined","xLabels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AAAA,UACIC;AAAAA,UACA6B;AAAAA,UACAM;AAAAA,UACAF;AAAAA,UACA,CAACjC,GAAiBc,MAAoBiB,EAAcjB,CAAQ;AAAA,UAC5DT,EAAM;AAAA,UACNoB,EAAO,EAAEzB,CAAQ;AAAA,UACjBwC;AAAAA,UACAC;AAAAA,UACAhC;AAAAA,QAAA;AAAA,QAEJ4B;AAAAA,MAAA;AAAA,IAER;AAEJ,SAAO,EAAC,cAAAD,GAAc,cAAAC,EAAAA;AAC1B;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"calculateCaptionTails.js","sources":["../../../../../../../node_modules/@milaboratories/miplots4/src/heatmap/utils/calculateCaptionTails.ts"],"sourcesContent":["import type { TextMeasurer } from '../../utils/TextMeasurer/TextMeasurer';\nimport type { ChartsScales, LabelAngles } from '../components/types';\nimport { MIN_STEP_FOR_VISIBLE_LABELS } from '../constants';\nimport type { GroupedCellsData } from '../getCells';\nimport type { HeatmapSettingsImpl } from '../HeatmapSettingsImpl';\n\nconst COS_PI_4 = Math.cos(Math.PI / 4);\nfunction getTailByFacetKey (\n facetKey: string,\n groupKeys: string[],\n groupLabels: Record<string, string>,\n valueLabels: Record<string, string>,\n getKeysInGroup: (facetKey:string, groupKey:string) => string[],\n steps: Record<string, number>,\n scale: (v:string) => number,\n groupTitleInclined: boolean,\n labelTitleInclined: boolean,\n textMeasurer: TextMeasurer\n): number {\n const step = steps[facetKey];\n const labelsVisible = step > MIN_STEP_FOR_VISIBLE_LABELS;\n\n let maxTail = 0;\n groupKeys.forEach((groupKey) => {\n const keysInGroup = getKeysInGroup(facetKey, groupKey);\n if (keysInGroup.length === 0) {\n return 0;\n }\n const groupHalfWidth = (keysInGroup.length * step) / 2;\n const groupTail = groupTitleInclined\n ? textMeasurer.getTextWidth(groupLabels[groupKey]) * COS_PI_4 - groupHalfWidth - scale(keysInGroup[0])\n : 0;\n const labelTail = labelTitleInclined && labelsVisible\n ? groupKeys.reduce((res, key) => {\n const label = valueLabels[key];\n return Math.max(res, textMeasurer.getTextWidth(label) * COS_PI_4 - step / 2 - scale(key));\n }, 0)\n : 0;\n maxTail = Math.max(maxTail, groupTail, labelTail);\n });\n return maxTail;\n}\n\nexport function calculateCaptionTails(\n labelAngles: LabelAngles,\n facetSettings: HeatmapSettingsImpl['facetSettings'],\n scales: ChartsScales,\n steps: {\n x: Record<string, number>;\n y: Record<string, number>;\n },\n groupedCells: GroupedCellsData,\n textMeasurer: TextMeasurer\n): {xCaptionTail: number; yCaptionTail: number} {\n const {facetKeys, xGroupKeys, yGroupKeys, xKeysByGroups, yKeysByGroups, xLabels, yLabels, xGroupLabels, yGroupLabels} = groupedCells.meta;\n let xCaptionTail = 0;\n let yCaptionTail = 0;\n // tails from 45deg inclined captions of groups titles/cells labels, that take place on adjacent padding\n const xGroupTitleInclined = labelAngles.xGroupLabels === 45;\n const xLabelsInclined = labelAngles.xAxisLabels === 45;\n if (xGroupTitleInclined || xLabelsInclined) {\n if (!facetSettings.sharedX) {\n facetKeys.forEach(facetKey => {\n xCaptionTail = Math.max(\n getTailByFacetKey(\n facetKey,\n xGroupKeys,\n xGroupLabels,\n xLabels,\n (facetKey:string, groupKey:string) => groupedCells.facets[facetKey].xKeysByGroups[groupKey],\n steps.x,\n scales.x[facetKey],\n xGroupTitleInclined,\n xLabelsInclined,\n textMeasurer\n ),\n xCaptionTail\n );\n });\n } else {\n const facetKey = facetKeys[0]; // there is no difference between facets in this case\n xCaptionTail = Math.max(\n getTailByFacetKey(\n facetKey,\n xGroupKeys,\n xGroupLabels,\n xLabels,\n (facetKey:string, groupKey:string) => xKeysByGroups[groupKey],\n steps.x,\n scales.x[facetKey],\n xGroupTitleInclined,\n xLabelsInclined,\n textMeasurer\n ),\n xCaptionTail\n );\n }\n }\n const yGroupTitleInclined = labelAngles.yGroupLabels === 45;\n const yLabelsInclined = labelAngles.yAxisLabels === 45;\n if (yGroupTitleInclined || yLabelsInclined) {\n if (!facetSettings.sharedY) {\n facetKeys.forEach(facetKey => {\n yCaptionTail = Math.max(\n getTailByFacetKey(\n facetKey,\n yGroupKeys,\n yGroupLabels,\n yLabels,\n (facetKey:string, groupKey:string) => groupedCells.facets[facetKey].yKeysByGroups[groupKey],\n steps.y,\n scales.y[facetKey],\n yGroupTitleInclined,\n yLabelsInclined,\n textMeasurer\n ),\n yCaptionTail\n );\n });\n } else {\n const facetKey = facetKeys[0]; // there is no difference between facets in this case\n yCaptionTail = Math.max(\n getTailByFacetKey(\n facetKey,\n yGroupKeys,\n yGroupLabels,\n yLabels,\n (facetKey:string, groupKey:string) => yKeysByGroups[groupKey],\n steps.y,\n scales.y[facetKey],\n yGroupTitleInclined,\n yLabelsInclined,\n textMeasurer\n ),\n yCaptionTail\n );\n }\n }\n return {xCaptionTail, yCaptionTail};\n}\n"],"names":["COS_PI_4","getTailByFacetKey","facetKey","groupKeys","groupLabels","valueLabels","getKeysInGroup","steps","scale","groupTitleInclined","labelTitleInclined","textMeasurer","step","labelsVisible","MIN_STEP_FOR_VISIBLE_LABELS","maxTail","groupKey","keysInGroup","groupHalfWidth","groupTail","labelTail","res","key","label","calculateCaptionTails","labelAngles","facetSettings","scales","groupedCells","facetKeys","xGroupKeys","yGroupKeys","xKeysByGroups","yKeysByGroups","xLabels","yLabels","xGroupLabels","yGroupLabels","xCaptionTail","yCaptionTail","xGroupTitleInclined","xLabelsInclined","yGroupTitleInclined","yLabelsInclined"],"mappings":";AAMA,MAAMA,IAAW,KAAK,IAAI,KAAK,KAAK,CAAC;AACrC,SAASC,EACLC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACM;AACN,QAAMC,IAAOL,EAAML,CAAQ,GACrBW,IAAgBD,IAAOE;AAE7B,MAAIC,IAAU;AACd,SAAAZ,EAAU,QAAQ,CAACa,MAAa;AAC5B,UAAMC,IAAcX,EAAeJ,GAAUc,CAAQ;AACrD,QAAIC,EAAY,WAAW;AACvB,aAAO;AAEX,UAAMC,IAAkBD,EAAY,SAASL,IAAQ,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from "../common/Error.js";
3
- import { DEFAULT_HEIGHT as v, DEFAULT_WIDTH as b, TITLE_LINE_HEIGHT as $, TITLE_MARGIN as X } from "../constants.js";
4
- import { DEFAULT_TICKS_SIZE as L, TICK_OFFSET as A, MIN_PADDING as I, FACET_TITLE_OFFSET as R, FACET_TITLE_LINE as j, TITLE_LINE as G, MIN_MARGIN as w } from "./constants.js";
5
- import { splitTextByWidth as W } from "../discrete/utils/splitTextByWidth.js";
2
+ import { createRoot as $ } from "../node_modules/react-dom/client.js";
3
+ import { Error as X } from "../common/Error.js";
4
+ import { DataFrameProvider as j } from "../common/useDataFrame.js";
5
+ import { DEFAULT_HEIGHT as v, DEFAULT_WIDTH as b, TITLE_LINE_HEIGHT as R, TITLE_MARGIN as G } from "../constants.js";
6
+ import { splitTextByWidth as A } from "../discrete/utils/splitTextByWidth.js";
6
7
  import { LEGEND_OFFSET as O, DEFAULT_COMMON_AES as k } from "../scatterplot/constants.js";
7
- import { getTicksAndFormat as K } from "../scatterplot/utils/getTicksAndFormat.js";
8
- import { arrangeLegendParts as P } from "../utils/arrangeLegendParts.js";
9
- import { getContinuousColorScale as U } from "../utils/getContinuousColorScale.js";
10
- import { TextMeasurer as Y } from "../utils/TextMeasurer.js";
11
- import { createRoot as B } from "../node_modules/react-dom/client.js";
8
+ import { getTicksAndFormat as P } from "../scatterplot/utils/getTicksAndFormat.js";
9
+ import { arrangeLegendParts as U } from "../utils/arrangeLegendParts.js";
10
+ import { getContinuousColorScale as Y } from "../utils/getContinuousColorScale.js";
11
+ import { TextMeasurer as K } from "../utils/TextMeasurer/TextMeasurer.js";
12
12
  import { ChartsGroup as V } from "./components/ChartsGroup.js";
13
+ import { DEFAULT_TICKS_SIZE as F, TICK_OFFSET as W, MIN_PADDING as I, FACET_TITLE_OFFSET as B, FACET_TITLE_LINE as Z, TITLE_LINE as q, MIN_MARGIN as w } from "./constants.js";
13
14
  import N from "../node_modules/d3-scale/src/linear.js";
14
15
  import _ from "../node_modules/d3-scale/src/symlog.js";
15
- import Z from "../node_modules/d3-scale/src/ordinal.js";
16
- var q = Object.defineProperty, J = (a, i, t) => i in a ? q(a, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[i] = t, f = (a, i, t) => J(a, typeof i != "symbol" ? i + "" : i, t);
17
- function Q(a, i, t, s) {
18
- const e = [];
19
- return a % t === t - 1 && e.push("right"), a % t === 0 && e.push("left"), a < t && e.push("top"), (Math.ceil((a + 1) / t) === s || Math.ceil((a + 1) / t) === s - 1 && a % t > (i - 1) % t) && e.push("bottom"), e;
16
+ import J from "../node_modules/d3-scale/src/ordinal.js";
17
+ var Q = Object.defineProperty, tt = (e, t, i) => t in e ? Q(e, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[t] = i, f = (e, t, i) => tt(e, typeof t != "symbol" ? t + "" : t, i);
18
+ function it(e, t, i, a) {
19
+ const s = [];
20
+ return e % i === i - 1 && s.push("right"), e % i === 0 && s.push("left"), e < i && s.push("top"), (Math.ceil((e + 1) / i) === a || Math.ceil((e + 1) / i) === a - 1 && e % i > (t - 1) % i) && s.push("bottom"), s;
20
21
  }
21
- function tt(a, i, t, s, e, n, o, h) {
22
- const r = n.includes("left") || !(h != null && h.sharedY), C = n.includes("bottom") || !(h != null && h.sharedX), p = n.includes("bottom") && a.title !== "", l = t.yAxisCaptionsWidth, S = (i.showTicks ? L : 0) + (i.hiddenLabels ? 0 : A), d = t.xAxisCaptionsWidth, x = (a.showTicks ? L : 0) + (a.hiddenLabels ? 0 : A), u = p ? G : 0, c = l + S, m = x + d + u, g = Math.max(...s.map((T) => e[T].length));
22
+ function st(e, t, i, a, s, r, u, o) {
23
+ const h = r.includes("left") || !(o != null && o.sharedY), g = r.includes("bottom") || !(o != null && o.sharedX), S = r.includes("bottom") && e.title !== "", n = i.yAxisCaptionsWidth, C = (t.showTicks ? F : 0) + (t.hiddenLabels ? 0 : W), d = i.xAxisCaptionsWidth, x = (e.showTicks ? F : 0) + (e.hiddenLabels ? 0 : W), c = S ? q : 0, l = n + C, m = x + d + c, p = Math.max(...a.map((T) => s[T].length));
23
24
  return {
24
- left: r ? c : I,
25
- top: g === 0 ? 0 : R * 2 + g * j,
26
- bottom: C ? m : I,
27
- right: o ? 0 : I
25
+ left: h ? l : I,
26
+ top: p === 0 ? 0 : B * 2 + p * Z,
27
+ bottom: g ? m : I,
28
+ right: u ? 0 : I
28
29
  };
29
30
  }
30
- function it(a, i, t) {
31
- const s = [];
32
- for (let e = 0; e < i; e++)
33
- s.push(a.slice(e * t, e * t + t));
34
- return s;
31
+ function et(e, t, i) {
32
+ const a = [];
33
+ for (let s = 0; s < t; s++)
34
+ a.push(e.slice(s * i, s * i + i));
35
+ return a;
35
36
  }
36
- function et(a, i) {
37
- const t = Math.floor(a / i), s = a - t * i;
38
- return [t, s];
37
+ function at(e, t) {
38
+ const i = Math.floor(e / t), a = e - i * t;
39
+ return [i, a];
39
40
  }
40
- function F(a) {
41
- return typeof a == "object" && a !== null && "type" in a && "value" in a && a.type === "grouping";
41
+ function H(e) {
42
+ return typeof e == "object" && e !== null && "type" in e && "value" in e && e.type === "grouping";
42
43
  }
43
- function st(a) {
44
- return typeof a == "object" && a !== null && "range" in a;
44
+ function rt(e) {
45
+ return typeof e == "object" && e !== null && "range" in e;
45
46
  }
46
- function at(a, i, t) {
47
- return function(s, e, n) {
47
+ function ot(e, t, i, a) {
48
+ return function(s, r, u) {
48
49
  var o;
49
- if (st(s)) {
50
- const { domain: h = t, range: r, type: C = "linear" } = s, p = U(r, h, C);
51
- return p.clamp(!0), p(n);
50
+ if (rt(s)) {
51
+ const { domain: h = a, range: g, type: S = "linear" } = s, n = Y(g, h, S);
52
+ return n.clamp(!0), n(u);
52
53
  }
53
- if (F(s)) {
54
- const h = s.value, r = a[h];
55
- return (o = (r == null ? void 0 : r[String(e[h])]) ?? k) == null ? void 0 : o[i];
54
+ if (H(s)) {
55
+ const h = s.value, g = t[h];
56
+ return (o = (g == null ? void 0 : g[String(e.getColumnValue(h, r))]) ?? k) == null ? void 0 : o[i];
56
57
  }
57
58
  return s;
58
59
  };
59
60
  }
60
- class xt {
61
+ class Mt {
61
62
  constructor() {
62
63
  f(this, "reactRoot", null), f(this, "parentNode", null), f(this, "rootNode", null), f(this, "component", /* @__PURE__ */ M.jsx(M.Fragment, {})), f(this, "margins", {
63
64
  top: w,
@@ -90,135 +91,135 @@ class xt {
90
91
  });
91
92
  }
92
93
  clear() {
93
- var i;
94
- this.parentNode && this.rootNode && ((i = this.parentNode) == null || i.removeChild(this.rootNode), this.parentNode = null, this.rootNode = null), setTimeout(() => {
95
- var t;
96
- (t = this.reactRoot) == null || t.unmount(), this.reactRoot = null;
94
+ var t;
95
+ this.parentNode && this.rootNode && ((t = this.parentNode) == null || t.removeChild(this.rootNode), this.parentNode = null, this.rootNode = null), setTimeout(() => {
96
+ var i;
97
+ (i = this.reactRoot) == null || i.unmount(), this.reactRoot = null;
97
98
  });
98
99
  }
99
- init(i) {
100
- this.parentNode === null && (this.parentNode = i, this.rootNode = document.createElement("div"), this.parentNode.appendChild(this.rootNode), this.reactRoot = B(this.rootNode));
100
+ init(t) {
101
+ this.parentNode === null && (this.parentNode = t, this.rootNode = document.createElement("div"), this.parentNode.appendChild(this.rootNode), this.reactRoot = $(this.rootNode));
101
102
  }
102
- updateChartSizes(i) {
103
- this.chartSizes.chartWidth = i.width, this.chartSizes.chartHeight = i.height;
103
+ updateChartSizes(t) {
104
+ this.chartSizes.chartWidth = t.width, this.chartSizes.chartHeight = t.height;
104
105
  }
105
- updateChartDimensions(i, t, s, e) {
106
- const { chartWidth: n, chartHeight: o } = this.chartSizes;
107
- let h = 0, r = 0;
108
- this.chartsDimensions = i.reduce((l, S, d) => {
109
- const [x, u] = et(d, this.columnsCount), c = Q(d, i.length, this.columnsCount, this.rowsCount), m = tt(
106
+ updateChartDimensions(t, i, a, s) {
107
+ const { chartWidth: r, chartHeight: u } = this.chartSizes;
108
+ let o = 0, h = 0;
109
+ this.chartsDimensions = t.reduce((n, C, d) => {
110
+ const [x, c] = at(d, this.columnsCount), l = it(d, t.length, this.columnsCount, this.rowsCount), m = st(
111
+ a,
110
112
  s,
111
- e,
112
113
  this.captionsSizes,
113
- it(i, this.rowsCount, this.columnsCount)[x],
114
+ et(t, this.rowsCount, this.columnsCount)[x],
114
115
  this.facetTitles,
115
- c,
116
- u === this.columnsCount - 1,
117
- t
118
- ), g = n + m.left + m.right, T = o + m.top + m.bottom;
119
- return l[S] = {
120
- left: h,
121
- top: r,
122
- chartEdgeSides: c,
116
+ l,
117
+ c === this.columnsCount - 1,
118
+ i
119
+ ), p = r + m.left + m.right, T = u + m.top + m.bottom;
120
+ return n[C] = {
121
+ left: o,
122
+ top: h,
123
+ chartEdgeSides: l,
123
124
  padding: m,
124
- inner: { width: n, height: o },
125
- outer: { width: g, height: T }
126
- }, h += g, u === this.columnsCount - 1 && (h = 0, r += T), l;
125
+ inner: { width: r, height: u },
126
+ outer: { width: p, height: T }
127
+ }, o += p, c === this.columnsCount - 1 && (o = 0, h += T), n;
127
128
  }, {});
128
- const C = Math.max(
129
- ...i.map((l) => this.chartsDimensions[l].outer.width + this.chartsDimensions[l].left)
130
- ), p = Math.max(
131
- ...i.map((l) => this.chartsDimensions[l].outer.height + this.chartsDimensions[l].top)
129
+ const g = Math.max(
130
+ ...t.map((n) => this.chartsDimensions[n].outer.width + this.chartsDimensions[n].left)
131
+ ), S = Math.max(
132
+ ...t.map((n) => this.chartsDimensions[n].outer.height + this.chartsDimensions[n].top)
132
133
  );
133
- this.chartSizes.chartsWidth = C, this.chartSizes.chartsHeight = p;
134
+ this.chartSizes.chartsWidth = g, this.chartSizes.chartsHeight = S;
134
135
  }
135
- updateViewport(i, t, s, e, n, o, h) {
136
- const r = i.length, C = Math.min(t.nRows ?? r, r), p = Math.min(t.nCols ?? r, r);
137
- this.columnsCount = t.nRows ? Math.ceil(r / C) : p, this.rowsCount = Math.ceil(r / this.columnsCount);
138
- let [l, S] = [1 / 0, -1 / 0], d = -1 / 0;
139
- const x = i.reduce((u, c) => {
140
- const m = n[c], { minX: g, maxX: T, maxCount: E, maxCountFromGroups: z } = m;
141
- return l = Math.min(l, g), S = Math.max(S, T), d = Math.max(d, h === "vertical" ? E : z), u[c] = { minX: g, maxX: T, maxY: h === "vertical" ? E : z }, u;
136
+ updateViewport(t, i, a, s, r, u, o) {
137
+ const h = t.length, g = Math.min(i.nRows ?? h, h), S = Math.min(i.nCols ?? h, h);
138
+ this.columnsCount = i.nRows ? Math.ceil(h / g) : S, this.rowsCount = Math.ceil(h / this.columnsCount);
139
+ let [n, C] = [1 / 0, -1 / 0], d = -1 / 0;
140
+ const x = t.reduce((c, l) => {
141
+ const m = r[l], { minX: p, maxX: T, maxCount: z, maxCountFromGroups: E } = m;
142
+ return n = Math.min(n, p), C = Math.max(C, T), d = Math.max(d, o === "vertical" ? z : E), c[l] = { minX: p, maxX: T, maxY: o === "vertical" ? z : E }, c;
142
143
  }, {});
143
- i.forEach((u) => {
144
- const c = s.scale === "log" ? _() : N(), m = x[u], g = t.sharedX ? l : m.minX, T = t.sharedX ? S : m.maxX;
145
- c.domain([g, T]).range([0, this.chartSizes.chartWidth]), this.scales.x[u] = c;
146
- }), i.forEach((u) => {
147
- const c = e.scale === "log" ? _() : N(), m = x[u], g = 0, T = t.sharedY ? d : m.maxY, E = [this.chartSizes.chartHeight, 0], z = c.copy().domain([g, T]).range([
144
+ t.forEach((c) => {
145
+ const l = a.scale === "log" ? _() : N(), m = x[c], p = i.sharedX ? n : m.minX, T = i.sharedX ? C : m.maxX;
146
+ l.domain([p, T]).range([0, this.chartSizes.chartWidth]), this.scales.x[c] = l;
147
+ }), t.forEach((c) => {
148
+ const l = s.scale === "log" ? _() : N(), m = x[c], p = 0, T = i.sharedY ? d : m.maxY, z = [this.chartSizes.chartHeight, 0], E = l.copy().domain([p, T]).range([
148
149
  this.chartSizes.chartHeight,
149
- o.innerOffset
150
+ u.innerOffset
150
151
  ]);
151
- c.domain([z.invert(this.chartSizes.chartHeight), z.invert(0)]).range(
152
- E
153
- ), this.scales.y[u] = c;
152
+ l.domain([E.invert(this.chartSizes.chartHeight), E.invert(0)]).range(
153
+ z
154
+ ), this.scales.y[c] = l;
154
155
  });
155
156
  }
156
- updateCaptionsSize(i, t) {
157
- const s = new Y("600 14px Arial");
158
- let e = 0;
159
- function n(o) {
160
- return Math.max(...o.map((h) => s.getTextWidth(h)));
157
+ updateCaptionsSize(t, i) {
158
+ const a = new K("600 14px Arial");
159
+ let s = 0;
160
+ function r(u) {
161
+ return Math.max(...u.map((o) => a.getTextWidth(o)));
161
162
  }
162
- t.hiddenLabels || Object.values(this.scales.y).forEach((o) => {
163
- const { ticks: h, format: r } = K(o, !1);
164
- e = Math.max(e, n(h.map(r)));
163
+ i.hiddenLabels || Object.values(this.scales.y).forEach((u) => {
164
+ const { ticks: o, format: h } = P(u, !1);
165
+ s = Math.max(s, r(o.map(h)));
165
166
  }), this.captionsSizes = {
166
- xAxisCaptionsWidth: i.hiddenLabels ? 0 : 20,
167
- yAxisCaptionsWidth: e
167
+ xAxisCaptionsWidth: t.hiddenLabels ? 0 : 20,
168
+ yAxisCaptionsWidth: s
168
169
  };
169
170
  }
170
- createMainTitle(i, t) {
171
- const s = this.chartsDimensions[i[0]], e = this.chartsDimensions[i[i.length - 1]];
172
- this.mainTitle = W(
173
- t.name,
174
- this.chartSizes.chartsWidth - s.padding.left - e.padding.right,
171
+ createMainTitle(t, i) {
172
+ const a = this.chartsDimensions[t[0]], s = this.chartsDimensions[t[t.length - 1]];
173
+ this.mainTitle = A(
174
+ i.name,
175
+ this.chartSizes.chartsWidth - a.padding.left - s.padding.right,
175
176
  20
176
177
  );
177
178
  }
178
- createFacetTitles(i, t) {
179
- this.facetTitles = i.reduce((s, e, n) => (t[n].length === 1 && t[n][0] === "null" ? s[e] = [] : s[e] = W(t[n].join(", "), this.chartSizes.chartWidth, 14), s), {});
179
+ createFacetTitles(t, i) {
180
+ this.facetTitles = t.reduce((a, s, r) => (i[r].length === 1 && i[r][0] === "null" ? a[s] = [] : a[s] = A(i[r].join(", "), this.chartSizes.chartWidth, 14), a), {});
180
181
  }
181
- updateLegendSize(i, t, s, e) {
182
- if (!i.show) {
182
+ updateLegendSize(t, i, a, s) {
183
+ if (!t.show) {
183
184
  this.legend = { width: 0, height: 0, items: [] };
184
185
  return;
185
186
  }
186
- const n = [], o = { width: 0, height: 0, left: 0, top: 0 };
187
- if (e.forEach((l) => {
188
- if (F(l.aes.fillColor) && s) {
189
- const S = l.aes.fillColor.value, d = t[s.value], x = s.label ?? s.value, u = Z().domain(d.values).range(d.values.map((c) => d.aesMap[c].fillColor));
190
- n.push({ ...o, id: S, type: "discreteColor", title: x, scale: u, values: d.values, labels: d.labels });
187
+ const r = [], u = { width: 0, height: 0, left: 0, top: 0 };
188
+ if (s.forEach((n) => {
189
+ if (H(n.aes.fillColor) && a) {
190
+ const C = n.aes.fillColor.value, d = i[a.value], x = a.label ?? a.value, c = J().domain(d.values).range(d.values.map((l) => d.aesMap[l].fillColor));
191
+ r.push({ ...u, id: C, type: "discreteColor", title: x, scale: c, values: d.values, labels: d.labels });
191
192
  }
192
- }), !n.length) {
193
+ }), !r.length) {
193
194
  this.legend = { width: 0, height: 0, items: [] };
194
195
  return;
195
196
  }
196
- const h = P(n, this.chartSizes.chartHeight), r = h[h.length - 1], C = r.left + r.width + O, p = this.chartSizes.chartHeight;
197
+ const o = U(r, this.chartSizes.chartHeight), h = o[o.length - 1], g = h.left + h.width + O, S = this.chartSizes.chartHeight;
197
198
  this.legend = {
198
- width: C,
199
- height: p,
200
- items: h
199
+ width: g,
200
+ height: S,
201
+ items: o
201
202
  };
202
203
  }
203
- updateMargins(i) {
204
- const t = $ * this.mainTitle.length, s = t > 0 ? t + X * 2 : 0, e = i.outerOffset;
204
+ updateMargins(t) {
205
+ const i = R * this.mainTitle.length, a = i > 0 ? i + G * 2 : 0, s = t.outerOffset;
205
206
  this.margins = {
206
- top: Math.max(s, e),
207
- bottom: e,
208
- left: e,
209
- right: this.legend.width + e
207
+ top: Math.max(a, s),
208
+ bottom: s,
209
+ left: s,
210
+ right: this.legend.width + s
210
211
  }, this.chartSizes.totalWidth = this.margins.left + this.chartSizes.chartsWidth + this.margins.right, this.chartSizes.totalHeight = this.margins.top + this.chartSizes.chartsHeight + this.margins.bottom;
211
212
  }
212
- render(i, t, s, e, n, o, h, r, C, p, l, S, d) {
213
- var x;
214
- const { xAxis: u, yAxis: c, size: m, title: g } = t;
215
- this.updateChartSizes(m), this.updateViewport(e, s, u, c, o, m, l), this.updateCaptionsSize(u, c), this.createFacetTitles(e, n), this.updateChartDimensions(e, s, u, c), this.createMainTitle(e, g), this.updateLegendSize(t.legend, h, p, r), this.updateMargins(m);
216
- const T = e.reduce((D, y) => Math.min(D, o[y].minX), 1 / 0), E = e.reduce((D, y) => Math.max(D, o[y].maxX), -1 / 0), z = /* @__PURE__ */ M.jsx(
213
+ render(t, i, a, s, r, u, o, h, g, S, n, C, d, x) {
214
+ var c;
215
+ const { xAxis: l, yAxis: m, size: p, title: T } = a;
216
+ this.updateChartSizes(p), this.updateViewport(r, s, l, m, o, p, C), this.updateCaptionsSize(l, m), this.createFacetTitles(r, u), this.updateChartDimensions(r, s, l, m), this.createMainTitle(r, T), this.updateLegendSize(a.legend, h, n, g), this.updateMargins(p);
217
+ const z = r.reduce((D, y) => Math.min(D, o[y].minX), 1 / 0), E = r.reduce((D, y) => Math.max(D, o[y].maxX), -1 / 0), L = /* @__PURE__ */ M.jsx(j, { dataFrame: t, children: /* @__PURE__ */ M.jsx(
217
218
  V,
218
219
  {
219
220
  settingsId: i,
220
- chartSettings: t,
221
- facetKeys: e,
221
+ chartSettings: a,
222
+ facetKeys: r,
222
223
  facetSettings: s,
223
224
  chartSizes: this.chartSizes,
224
225
  chartsDimensions: this.chartsDimensions,
@@ -229,23 +230,23 @@ class xt {
229
230
  facetTitles: this.facetTitles,
230
231
  captionsSizes: this.captionsSizes,
231
232
  histogramDataByFacets: o,
232
- layers: r,
233
- aesColorGetter: at(C, "fillColor", [T, E]),
234
- groupingDirection: S,
235
- groupingStack: l,
236
- groupingLabels: p ? h[p.value].labels : {},
233
+ layers: g,
234
+ aesColorGetter: ot(t, S, "fillColor", [z, E]),
235
+ groupingDirection: d,
236
+ groupingStack: C,
237
+ groupingLabels: n ? h[n.value].labels : {},
237
238
  legend: this.legend,
238
- onTooltipHintSwitch: d
239
+ onTooltipHintSwitch: x
239
240
  }
240
- );
241
- this.component = z, (x = this.reactRoot) == null || x.render(z);
241
+ ) });
242
+ this.component = L, (c = this.reactRoot) == null || c.render(L);
242
243
  }
243
- renderError(i) {
244
- var t;
245
- (t = this.reactRoot) == null || t.render(/* @__PURE__ */ M.jsx(H, { message: i }));
244
+ renderError(t) {
245
+ var i;
246
+ (i = this.reactRoot) == null || i.render(/* @__PURE__ */ M.jsx(X, { message: t }));
246
247
  }
247
248
  }
248
249
  export {
249
- xt as default
250
+ Mt as default
250
251
  };
251
252
  //# sourceMappingURL=ChartRenderer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChartRenderer.js","sources":["../../../../../../node_modules/@milaboratories/miplots4/src/histogram/ChartRenderer.tsx"],"sourcesContent":["import {Error} from '../common/Error';\nimport type {LegendData, LegendItem} from '../common/types';\nimport {DEFAULT_HEIGHT, DEFAULT_WIDTH, TITLE_LINE_HEIGHT, TITLE_MARGIN} from '../constants';\nimport {FACET_TITLE_LINE} from './constants';\nimport {splitTextByWidth} from '../discrete/utils';\nimport type {HistogramLegendInfo, Margins} from './components/types';\nimport type {CaptionsSizes} from './components/types';\nimport {\n FACET_TITLE_OFFSET,\n MIN_MARGIN,\n MIN_PADDING,\n TICK_OFFSET,\n TITLE_LINE,\n} from './constants';\nimport type {GroupedHistogramData} from './getHistogramData';\nimport type {HistogramLayer, HistogramSettingsImpl} from './HistogramSettingsImpl';\nimport {DEFAULT_COMMON_AES, LEGEND_OFFSET} from '../scatterplot/constants';\nimport {getTicksAndFormat} from '../scatterplot/utils/getTicksAndFormat';\nimport type {ColumnName, ContinuousAesHistogram} from '../types';\nimport type {AesItem, InheritAesHistogram, Row} from '../types';\nimport {arrangeLegendParts} from '../utils/arrangeLegendParts';\nimport {getContinuousColorScale} from '../utils/getContinuousColorScale';\nimport {TextMeasurer} from '../utils/TextMeasurer';\nimport type {ScaleLogarithmic, ScaleOrdinal} from 'd3-scale';\nimport {scaleLinear, scaleOrdinal, scaleSymlog} from 'd3-scale';\nimport {DEFAULT_TICKS_SIZE} from './constants';\nimport type {ReactElement} from 'react';\nimport React from 'react';\nimport type {Root} from 'react-dom/client';\nimport {createRoot} from 'react-dom/client';\nimport {ChartsGroup} from './components/ChartsGroup';\nimport type {ChartDimensionsData, ChartScales, ChartSizes, ChartsScales} from './components/types';\n\nfunction getChartEdgeSides(index: number, facetsCount: number, columnsCount: number, rowsCount: number) {\n const chartSides: ('left' | 'right' | 'top' | 'bottom')[] = [];\n if (index % columnsCount === columnsCount - 1) {\n chartSides.push('right');\n }\n if (index % columnsCount === 0) {\n chartSides.push('left');\n }\n if (index < columnsCount) {\n chartSides.push('top');\n }\n if (\n Math.ceil((index + 1) / columnsCount) === rowsCount ||\n (Math.ceil((index + 1) / columnsCount) === rowsCount - 1 &&\n index % columnsCount > (facetsCount - 1) % columnsCount)\n ) {\n chartSides.push('bottom');\n }\n return chartSides;\n}\n\nfunction calculatePaddings(\n xAxis: HistogramSettingsImpl['chartSettings']['xAxis'],\n yAxis: HistogramSettingsImpl['chartSettings']['yAxis'],\n captionsSizes: CaptionsSizes,\n currentRowFacetKeys: string[],\n facetTitles: Record<string, string[]>,\n chartEdgeSides: ('left' | 'right' | 'top' | 'bottom')[],\n lastInRow: boolean,\n facetSettings?: HistogramSettingsImpl['facetSettings']\n) {\n const needLeftAxis = chartEdgeSides.includes('left') || !facetSettings?.sharedY;\n const needBottomAxis = chartEdgeSides.includes('bottom') || !facetSettings?.sharedX;\n const needBottomAxisTitle = chartEdgeSides.includes('bottom') && xAxis.title !== '';\n\n const yCaptions = captionsSizes.yAxisCaptionsWidth;\n const yTicks = (yAxis.showTicks ? DEFAULT_TICKS_SIZE : 0) + (yAxis.hiddenLabels ? 0 : TICK_OFFSET);\n\n const xCaptions = captionsSizes.xAxisCaptionsWidth;\n const xTicks = (xAxis.showTicks ? DEFAULT_TICKS_SIZE : 0) + (xAxis.hiddenLabels ? 0 : TICK_OFFSET);\n const xAxisTitle = needBottomAxisTitle ? TITLE_LINE : 0;\n\n const leftAxisElements = yCaptions + yTicks;\n const bottomAxisElements = xTicks + xCaptions + xAxisTitle;\n\n const facetTitlesLinesCount = Math.max(...currentRowFacetKeys.map(key => facetTitles[key].length));\n return {\n left: needLeftAxis ? leftAxisElements : MIN_PADDING,\n top: facetTitlesLinesCount === 0 ? 0 : FACET_TITLE_OFFSET * 2 + facetTitlesLinesCount * FACET_TITLE_LINE,\n bottom: needBottomAxis ? bottomAxisElements : MIN_PADDING,\n right: lastInRow ? 0 : MIN_PADDING,\n };\n}\n\n// facet keys grouped by rows\nfunction getFacetRows(facetKeys: string[], nRows: number, nColumns: number): string[][] {\n const result: string[][] = [];\n for (let i = 0; i < nRows; i++) {\n result.push(facetKeys.slice(i * nColumns, i * nColumns + nColumns));\n }\n return result;\n}\n\nfunction getRowColumn(idx: number, columnsCount: number) {\n const row = Math.floor(idx / columnsCount);\n const column = idx - row * columnsCount;\n return [row, column];\n}\n\nfunction isInheritedAes(v: InheritAesHistogram | unknown): v is InheritAesHistogram {\n return typeof v === 'object' && v !== null && 'type' in v && 'value' in v && v.type === 'grouping';\n}\nfunction isContinuousAes(v: ContinuousAesHistogram | unknown): v is ContinuousAesHistogram {\n return typeof v === 'object' && v !== null && 'range' in v;\n}\nfunction createAesGetter(aesData: HistogramSettingsImpl['inheritedAes'], field: keyof AesItem, defaultDomain:number[]) {\n return function (aesItem: string | InheritAesHistogram | ContinuousAesHistogram, row: Row, height:number) {\n if (isContinuousAes(aesItem)) {\n const {domain = defaultDomain, range, type = 'linear'} = aesItem;\n const scale = getContinuousColorScale(range as string[], domain, type);\n scale.clamp(true);\n return scale(height);\n }\n if (isInheritedAes(aesItem)) {\n const columnId = aesItem.value;\n const mapping = aesData[columnId];\n return (mapping?.[String(row[columnId])] ?? DEFAULT_COMMON_AES)?.[field] as string;\n }\n return aesItem;\n };\n}\n\nclass ChartRenderer {\n reactRoot: Root | null = null;\n parentNode: HTMLElement | null = null;\n rootNode: HTMLElement | null = null;\n component: ReactElement = (<></>);\n margins: Margins = {\n top: MIN_MARGIN,\n bottom: MIN_MARGIN,\n left: MIN_MARGIN,\n right: MIN_MARGIN,\n };\n chartsDimensions: Record<string, ChartDimensionsData> = {};\n chartSizes: ChartSizes = {\n chartWidth: DEFAULT_WIDTH, // width of single chart\n chartHeight: DEFAULT_HEIGHT, // height of single chart\n chartsWidth: DEFAULT_WIDTH, // width of all charts in charts row\n chartsHeight: DEFAULT_HEIGHT, // width of all charts in charts column, without axes\n totalWidth: DEFAULT_WIDTH, // width of all charts in charts row, plus left axis, plus legend\n totalHeight: DEFAULT_HEIGHT, // width of all charts in charts height, plus bottom axis, plus top title\n };\n columnsCount = 1;\n rowsCount = 1;\n scales: ChartsScales = {\n x: {null: scaleLinear().domain([0, 10]).range([0, DEFAULT_WIDTH])},\n y: {null: scaleLinear().domain([0, 10]).range([DEFAULT_HEIGHT, 0])},\n };\n captionsSizes: CaptionsSizes = {\n xAxisCaptionsWidth: 30,\n yAxisCaptionsWidth: 100,\n };\n facetTitles: Record<string, string[]> = {}; // can be multiline\n mainTitle: string[] = []; // can be multiline\n legend: LegendData = {\n width: 0,\n height: 0,\n items: [],\n };\n\n clear() {\n if (this.parentNode && this.rootNode) {\n this.parentNode?.removeChild(this.rootNode);\n this.parentNode = null;\n this.rootNode = null;\n }\n // timeout to avoid trying to unmount during rendering\n setTimeout(() => {\n this.reactRoot?.unmount();\n this.reactRoot = null;\n });\n }\n\n init(node: HTMLElement) {\n if (this.parentNode === null) {\n this.parentNode = node;\n this.rootNode = document.createElement('div');\n this.parentNode.appendChild(this.rootNode);\n this.reactRoot = createRoot(this.rootNode);\n }\n }\n\n updateChartSizes(size: HistogramSettingsImpl['chartSettings']['size']) {\n this.chartSizes.chartWidth = size.width;\n this.chartSizes.chartHeight = size.height;\n }\n\n updateChartDimensions(\n facetKeys: string[],\n facetSettings: HistogramSettingsImpl['facetSettings'],\n xAxis: HistogramSettingsImpl['chartSettings']['xAxis'],\n yAxis: HistogramSettingsImpl['chartSettings']['yAxis']\n ) {\n const {chartWidth, chartHeight} = this.chartSizes;\n let currentLeft = 0;\n let currentTop = 0;\n this.chartsDimensions = facetKeys.reduce((res: Record<string, ChartDimensionsData>, key: string, index) => {\n const [currentRow, currentColumn] = getRowColumn(index, this.columnsCount);\n const chartEdgeSides = getChartEdgeSides(index, facetKeys.length, this.columnsCount, this.rowsCount);\n const padding = calculatePaddings(\n xAxis,\n yAxis,\n this.captionsSizes,\n getFacetRows(facetKeys, this.rowsCount, this.columnsCount)[currentRow],\n this.facetTitles,\n chartEdgeSides,\n currentColumn === this.columnsCount - 1,\n facetSettings\n );\n const outerWidth = chartWidth + padding.left + padding.right;\n const outerHeight = chartHeight + padding.top + padding.bottom;\n res[key] = {\n left: currentLeft,\n top: currentTop,\n chartEdgeSides,\n padding,\n inner: {width: chartWidth, height: chartHeight},\n outer: {width: outerWidth, height: outerHeight},\n };\n currentLeft += outerWidth;\n if (currentColumn === this.columnsCount - 1) {\n currentLeft = 0;\n currentTop += outerHeight;\n }\n return res;\n }, {});\n\n const chartsWidth = Math.max(\n ...facetKeys.map(key => this.chartsDimensions[key].outer.width + this.chartsDimensions[key].left)\n );\n const chartsHeight = Math.max(\n ...facetKeys.map(key => this.chartsDimensions[key].outer.height + this.chartsDimensions[key].top)\n );\n this.chartSizes.chartsWidth = chartsWidth;\n this.chartSizes.chartsHeight = chartsHeight;\n }\n\n updateViewport(\n facetKeys: string[],\n facetSettings: HistogramSettingsImpl['facetSettings'],\n xAxis: HistogramSettingsImpl['chartSettings']['xAxis'],\n yAxis: HistogramSettingsImpl['chartSettings']['yAxis'],\n histogramDataByFacets: Record<string, GroupedHistogramData>,\n size: HistogramSettingsImpl['chartSettings']['size'],\n groupingStack: HistogramSettingsImpl['groupingStack'],\n ) {\n const facetCount = facetKeys.length;\n const maxNRows = Math.min(facetSettings.nRows ?? facetCount, facetCount);\n const maxNCols = Math.min(facetSettings.nCols ?? facetCount, facetCount);\n // Use columns/rows count from settings if some of them defined, else make 1 column\n this.columnsCount = facetSettings.nRows ? Math.ceil(facetCount / maxNRows) : maxNCols;\n this.rowsCount = Math.ceil(facetCount / this.columnsCount);\n\n let [minXAll, maxXAll] = [Infinity, -Infinity];\n let maxYAll = -Infinity;\n const histogramExtentsByKeys = facetKeys.reduce((res: Record<string, Record<string, number>>, key) => {\n const histogramData = histogramDataByFacets[key];\n const {minX, maxX, maxCount, maxCountFromGroups} = histogramData;\n minXAll = Math.min(minXAll, minX);\n maxXAll = Math.max(maxXAll, maxX);\n maxYAll = Math.max(maxYAll, groupingStack === 'vertical' ? maxCount : maxCountFromGroups);\n res[key] = {minX, maxX, maxY: groupingStack === 'vertical' ? maxCount : maxCountFromGroups};\n return res;\n }, {});\n\n facetKeys.forEach(key => {\n const scaleX: ChartScales['x'] = xAxis.scale === 'log' ? scaleSymlog() : scaleLinear();\n\n const extents = histogramExtentsByKeys[key];\n const minX = facetSettings.sharedX ? minXAll : extents.minX;\n const maxX = facetSettings.sharedX ? maxXAll : extents.maxX;\n\n (scaleX.domain([minX, maxX]) as ChartScales['x']).range([0, this.chartSizes.chartWidth]);\n this.scales.x[key] = scaleX;\n });\n facetKeys.forEach(key => {\n const scaleY = yAxis.scale === 'log' ? scaleSymlog() : scaleLinear();\n const extents = histogramExtentsByKeys[key];\n\n const minY = 0;\n const maxY = facetSettings.sharedY ? maxYAll : extents.maxY;\n\n const rangeV = [this.chartSizes.chartHeight, 0];\n // supporting scale, it needs to add offsets of fixed size in pixels to general scale Y\n const tempY: ChartScales['y'] = (scaleY.copy().domain([minY, maxY]) as ChartScales['y']).range([\n this.chartSizes.chartHeight,\n size.innerOffset,\n ]) as ChartScales['y'];\n (scaleY.domain([tempY.invert(this.chartSizes.chartHeight), tempY.invert(0)]) as ChartScales['y']).range(\n rangeV\n );\n this.scales.y[key] = scaleY;\n });\n }\n\n updateCaptionsSize(\n xAxis: HistogramSettingsImpl['chartSettings']['xAxis'],\n yAxis: HistogramSettingsImpl['chartSettings']['yAxis']\n ) {\n const textMeasurer = new TextMeasurer('600 14px Arial');\n\n let maxYTick = 0;\n\n function getMaxTickWidth(ticks: string[]) {\n return Math.max(...ticks.map(key => textMeasurer.getTextWidth(key)));\n }\n\n if (!yAxis.hiddenLabels) {\n Object.values(this.scales.y).forEach(scale => {\n const {ticks, format} = getTicksAndFormat(scale as ScaleLogarithmic<number, number>, false);\n maxYTick = Math.max(maxYTick, getMaxTickWidth(ticks.map(format)));\n });\n }\n this.captionsSizes = {\n xAxisCaptionsWidth: xAxis.hiddenLabels ? 0 : 20,\n yAxisCaptionsWidth: maxYTick,\n };\n }\n\n createMainTitle(facetKeys: string[], title: HistogramSettingsImpl['chartSettings']['title']) {\n const firstChart = this.chartsDimensions[facetKeys[0]];\n const lastChart = this.chartsDimensions[facetKeys[facetKeys.length - 1]];\n\n this.mainTitle = splitTextByWidth(\n title.name,\n this.chartSizes.chartsWidth - firstChart.padding.left - lastChart.padding.right,\n 20\n );\n }\n\n createFacetTitles(facetKeys: string[], facetLabels: string[][]) {\n this.facetTitles = facetKeys.reduce((res: Record<string, string[]>, key, idx) => {\n if (facetLabels[idx].length === 1 && facetLabels[idx][0] === 'null') {\n res[key] = [];\n } else {\n res[key] = splitTextByWidth(facetLabels[idx].join(', '), this.chartSizes.chartWidth, 14);\n }\n return res;\n }, {});\n }\n\n updateLegendSize(\n legend: HistogramSettingsImpl['chartSettings']['legend'],\n legendInfo: HistogramLegendInfo,\n grouping: ColumnName | null,\n layers: HistogramLayer[]\n ) {\n if (!legend.show) {\n this.legend = {width: 0, height: 0, items: []};\n return;\n }\n\n const legendItems: LegendItem[] = [];\n const emptySizes = {width:0, height:0, left:0, top: 0};\n\n layers.forEach(layer => {\n if (isInheritedAes(layer.aes.fillColor) && grouping) {\n const columnId = layer.aes.fillColor.value;\n const info = legendInfo[grouping.value];\n const title = grouping.label ?? grouping.value;\n const scale:ScaleOrdinal<string, string> = scaleOrdinal<string, string>()\n .domain(info.values)\n .range(info.values.map(value => info.aesMap[value].fillColor as string));\n legendItems.push({...emptySizes, id: columnId, type: 'discreteColor', title, scale, values: info.values, labels: info.labels});\n }\n });\n\n if (!legendItems.length) {\n this.legend = {width: 0, height: 0, items: []};\n return;\n }\n\n const items = arrangeLegendParts(legendItems, this.chartSizes.chartHeight);\n\n const lastItem = items[items.length - 1];\n const legendWidth = lastItem.left + lastItem.width + LEGEND_OFFSET;\n const legendHeight = this.chartSizes.chartHeight;\n\n this.legend = {\n width: legendWidth,\n height: legendHeight,\n items,\n };\n }\n\n updateMargins(size:HistogramSettingsImpl['chartSettings']['size']) {\n const titleTextHeight = TITLE_LINE_HEIGHT * this.mainTitle.length;\n const titleHeight = titleTextHeight > 0 ? titleTextHeight + TITLE_MARGIN * 2 : 0;\n\n const minMargin = size.outerOffset;\n\n this.margins = {\n top: Math.max(titleHeight, minMargin),\n bottom: minMargin,\n left: minMargin,\n right: this.legend.width + minMargin,\n };\n this.chartSizes.totalWidth = this.margins.left + this.chartSizes.chartsWidth + this.margins.right;\n this.chartSizes.totalHeight = this.margins.top + this.chartSizes.chartsHeight + this.margins.bottom;\n }\n\n render(\n settingsId: string,\n chartSettings: HistogramSettingsImpl['chartSettings'],\n facetSettings: HistogramSettingsImpl['facetSettings'],\n facetKeys: string[],\n facetLabels: string[][],\n histogramDataByFacets: Record<string, GroupedHistogramData>,\n legendInfo: HistogramLegendInfo,\n layers: HistogramLayer[],\n inheritedAes: HistogramSettingsImpl['inheritedAes'],\n grouping: ColumnName | null,\n groupingStack: HistogramSettingsImpl['groupingStack'],\n groupingDirection: HistogramSettingsImpl['groupingDirection'],\n onTooltipHintSwitch: (v:boolean) => void,\n ) {\n const {xAxis, yAxis, size, title} = chartSettings;\n this.updateChartSizes(size);\n this.updateViewport(facetKeys, facetSettings, xAxis, yAxis, histogramDataByFacets, size, groupingStack);\n this.updateCaptionsSize(xAxis, yAxis);\n this.createFacetTitles(facetKeys, facetLabels);\n this.updateChartDimensions(facetKeys, facetSettings, xAxis, yAxis);\n this.createMainTitle(facetKeys, title);\n this.updateLegendSize(chartSettings.legend, legendInfo, grouping, layers);\n this.updateMargins(size);\n const minHeight = facetKeys.reduce((v, key) => {\n return Math.min(v, histogramDataByFacets[key].minX);\n }, Infinity);\n const maxHeight = facetKeys.reduce((v, key) => {\n return Math.max(v, histogramDataByFacets[key].maxX);\n }, -Infinity);\n const component = (\n <ChartsGroup\n settingsId={settingsId}\n chartSettings={chartSettings}\n facetKeys={facetKeys}\n facetSettings={facetSettings}\n chartSizes={this.chartSizes}\n chartsDimensions={this.chartsDimensions}\n scales={this.scales}\n columnsCount={this.columnsCount}\n margins={this.margins}\n mainTitle={this.mainTitle}\n facetTitles={this.facetTitles}\n captionsSizes={this.captionsSizes}\n histogramDataByFacets={histogramDataByFacets}\n layers={layers}\n aesColorGetter={createAesGetter(inheritedAes, 'fillColor', [minHeight, maxHeight])}\n groupingDirection={groupingDirection}\n groupingStack={groupingStack}\n groupingLabels={grouping ? legendInfo[grouping.value].labels : {}}\n legend={this.legend}\n onTooltipHintSwitch={onTooltipHintSwitch}\n />\n );\n this.component = component;\n this.reactRoot?.render(component);\n }\n\n renderError(message: string) {\n this.reactRoot?.render(<Error message={message} />);\n }\n}\n\nexport default ChartRenderer;\n"],"names":["getChartEdgeSides","index","facetsCount","columnsCount","rowsCount","chartSides","calculatePaddings","xAxis","yAxis","captionsSizes","currentRowFacetKeys","facetTitles","chartEdgeSides","lastInRow","facetSettings","needLeftAxis","needBottomAxis","needBottomAxisTitle","yCaptions","yTicks","DEFAULT_TICKS_SIZE","TICK_OFFSET","xCaptions","xTicks","xAxisTitle","TITLE_LINE","leftAxisElements","bottomAxisElements","facetTitlesLinesCount","key","MIN_PADDING","FACET_TITLE_OFFSET","FACET_TITLE_LINE","getFacetRows","facetKeys","nRows","nColumns","result","i","getRowColumn","idx","row","column","isInheritedAes","v","isContinuousAes","createAesGetter","aesData","field","defaultDomain","aesItem","height","domain","range","type","scale","getContinuousColorScale","columnId","mapping","_a","DEFAULT_COMMON_AES","ChartRenderer","__publicField","jsx","Fragment","MIN_MARGIN","DEFAULT_WIDTH","DEFAULT_HEIGHT","scaleLinear","node","createRoot","size","chartWidth","chartHeight","currentLeft","currentTop","res","currentRow","currentColumn","padding","outerWidth","outerHeight","chartsWidth","chartsHeight","histogramDataByFacets","groupingStack","facetCount","maxNRows","maxNCols","minXAll","maxXAll","maxYAll","histogramExtentsByKeys","histogramData","minX","maxX","maxCount","maxCountFromGroups","scaleX","scaleSymlog","extents","scaleY","minY","maxY","rangeV","tempY","textMeasurer","TextMeasurer","maxYTick","getMaxTickWidth","ticks","format","getTicksAndFormat","title","firstChart","lastChart","splitTextByWidth","facetLabels","legend","legendInfo","grouping","layers","legendItems","emptySizes","layer","info","scaleOrdinal","value","items","arrangeLegendParts","lastItem","legendWidth","LEGEND_OFFSET","legendHeight","titleTextHeight","TITLE_LINE_HEIGHT","titleHeight","TITLE_MARGIN","minMargin","settingsId","chartSettings","inheritedAes","groupingDirection","onTooltipHintSwitch","minHeight","maxHeight","component","ChartsGroup","message","Error"],"mappings":";;;;;;;;;;;;;;;;AAiCA,SAASA,EAAkBC,GAAeC,GAAqBC,GAAsBC,GAAmB;AACpG,QAAMC,IAAsD,CAAA;AAC5D,SAAIJ,IAAQE,MAAiBA,IAAe,KACxCE,EAAW,KAAK,OAAO,GAEvBJ,IAAQE,MAAiB,KACzBE,EAAW,KAAK,MAAM,GAEtBJ,IAAQE,KACRE,EAAW,KAAK,KAAK,IAGrB,KAAK,MAAMJ,IAAQ,KAAKE,CAAY,MAAMC,KACzC,KAAK,MAAMH,IAAQ,KAA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AuB;AAAAA,MAAA;AAAA,IAAA;AAGR,SAAK,YAAYG,IACjBvF,IAAA,KAAK,cAAL,QAAAA,EAAgB,OAAOuF,CAAAA;AAAAA,EAC3B;AAAA,EAEA,YAAYE,GAAiB;;AACzB,KAAAzF,IAAA,KAAK,cAAL,QAAAA,EAAgB,OAAOI,gBAAAA,EAAAA,IAACsF,GAAA,EAAM,SAAAD,EAAAA,CAAkB,CAAA;AAAA,EACpD;AACJ;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"ChartRenderer.js","sources":["../../../../../../node_modules/@milaboratories/miplots4/src/histogram/ChartRenderer.tsx"],"sourcesContent":["import type { ScaleLogarithmic, ScaleOrdinal } from 'd3-scale';\nimport { scaleLinear, scaleOrdinal, scaleSymlog } from 'd3-scale';\nimport type { ReactElement } from 'react';\nimport type { Root } from 'react-dom/client';\nimport { createRoot } from 'react-dom/client';\nimport { Error } from '../common/Error';\nimport type { LegendData, LegendItem } from '../common/types';\nimport { DataFrameProvider } from '../common/useDataFrame';\nimport { DEFAULT_HEIGHT, DEFAULT_WIDTH, TITLE_LINE_HEIGHT, TITLE_MARGIN } from '../constants';\nimport type { DataFrame, RowIndex } from '../DataFrame';\nimport { splitTextByWidth } from '../discrete/utils';\nimport { DEFAULT_COMMON_AES, LEGEND_OFFSET } from '../scatterplot/constants';\nimport { getTicksAndFormat } from '../scatterplot/utils/getTicksAndFormat';\nimport type { AesItem, ColumnName, ContinuousAesHistogram, InheritAesHistogram } from '../types';\nimport { arrangeLegendParts } from '../utils/arrangeLegendParts';\nimport { getContinuousColorScale } from '../utils/getContinuousColorScale';\nimport { TextMeasurer } from '../utils/TextMeasurer/TextMeasurer';\nimport { ChartsGroup } from './components/ChartsGroup';\nimport type { CaptionsSizes, ChartDimensionsData, ChartScales, ChartSizes, ChartsScales, HistogramLegendInfo, Margins } from './components/types';\nimport {\n DEFAULT_TICKS_SIZE, FACET_TITLE_LINE, FACET_TITLE_OFFSET,\n MIN_MARGIN,\n MIN_PADDING,\n TICK_OFFSET,\n TITLE_LINE\n} from './constants';\nimport type { GroupedHistogramData } from './getHistogramData';\nimport type { HistogramLayer, HistogramSettingsImpl } from './HistogramSettingsImpl';\n\nfunction getChartEdgeSides(index: number, facetsCount: number, columnsCount: number, rowsCount: number) {\n const chartSides: ('left' | 'right' | 'top' | 'bottom')[] = [];\n if (index % columnsCount === columnsCount - 1) {\n chartSides.push('right');\n }\n if (index % columnsCount === 0) {\n chartSides.push('left');\n }\n if (index < columnsCount) {\n chartSides.push('top');\n }\n if (\n Math.ceil((index + 1) / columnsCount) === rowsCount ||\n (Math.ceil((index + 1) / columnsCount) === rowsCount - 1 &&\n index % columnsCount > (facetsCount - 1) % columnsCount)\n ) {\n chartSides.push('bottom');\n }\n return chartSides;\n}\n\nfunction calculatePaddings(\n xAxis: HistogramSettingsImpl['chartSettings']['xAxis'],\n yAxis: HistogramSettingsImpl['chartSettings']['yAxis'],\n captionsSizes: CaptionsSizes,\n currentRowFacetKeys: string[],\n facetTitles: Record<string, string[]>,\n chartEdgeSides: ('left' | 'right' | 'top' | 'bottom')[],\n lastInRow: boolean,\n facetSettings?: HistogramSettingsImpl['facetSettings']\n) {\n const needLeftAxis = chartEdgeSides.includes('left') || !facetSettings?.sharedY;\n const needBottomAxis = chartEdgeSides.includes('bottom') || !facetSettings?.sharedX;\n const needBottomAxisTitle = chartEdgeSides.includes('bottom') && xAxis.title !== '';\n\n const yCaptions = captionsSizes.yAxisCaptionsWidth;\n const yTicks = (yAxis.showTicks ? DEFAULT_TICKS_SIZE : 0) + (yAxis.hiddenLabels ? 0 : TICK_OFFSET);\n\n const xCaptions = captionsSizes.xAxisCaptionsWidth;\n const xTicks = (xAxis.showTicks ? DEFAULT_TICKS_SIZE : 0) + (xAxis.hiddenLabels ? 0 : TICK_OFFSET);\n const xAxisTitle = needBottomAxisTitle ? TITLE_LINE : 0;\n\n const leftAxisElements = yCaptions + yTicks;\n const bottomAxisElements = xTicks + xCaptions + xAxisTitle;\n\n const facetTitlesLinesCount = Math.max(...currentRowFacetKeys.map(key => facetTitles[key].length));\n return {\n left: needLeftAxis ? leftAxisElements : MIN_PADDING,\n top: facetTitlesLinesCount === 0 ? 0 : FACET_TITLE_OFFSET * 2 + facetTitlesLinesCount * FACET_TITLE_LINE,\n bottom: needBottomAxis ? bottomAxisElements : MIN_PADDING,\n right: lastInRow ? 0 : MIN_PADDING,\n };\n}\n\n// facet keys grouped by rows\nfunction getFacetRows(facetKeys: string[], nRows: number, nColumns: number): string[][] {\n const result: string[][] = [];\n for (let i = 0; i < nRows; i++) {\n result.push(facetKeys.slice(i * nColumns, i * nColumns + nColumns));\n }\n return result;\n}\n\nfunction getRowColumn(idx: number, columnsCount: number) {\n const row = Math.floor(idx / columnsCount);\n const column = idx - row * columnsCount;\n return [row, column];\n}\n\nfunction isInheritedAes(v: InheritAesHistogram | unknown): v is InheritAesHistogram {\n return typeof v === 'object' && v !== null && 'type' in v && 'value' in v && v.type === 'grouping';\n}\nfunction isContinuousAes(v: ContinuousAesHistogram | unknown): v is ContinuousAesHistogram {\n return typeof v === 'object' && v !== null && 'range' in v;\n}\nfunction createAesGetter(dataFrame: DataFrame, aesData: HistogramSettingsImpl['inheritedAes'], field: keyof AesItem, defaultDomain:number[]) {\n return function (aesItem: string | InheritAesHistogram | ContinuousAesHistogram, idx: RowIndex, height:number) {\n if (isContinuousAes(aesItem)) {\n const {domain = defaultDomain, range, type = 'linear'} = aesItem;\n const scale = getContinuousColorScale(range as string[], domain, type);\n scale.clamp(true);\n return scale(height);\n }\n if (isInheritedAes(aesItem)) {\n const columnId = aesItem.value;\n const mapping = aesData[columnId];\n return (mapping?.[String(dataFrame.getColumnValue(columnId, idx))] ?? DEFAULT_COMMON_AES)?.[field] as string;\n }\n return aesItem;\n };\n}\n\nclass ChartRenderer {\n reactRoot: Root | null = null;\n parentNode: HTMLElement | null = null;\n rootNode: HTMLElement | null = null;\n component: ReactElement = (<></>);\n margins: Margins = {\n top: MIN_MARGIN,\n bottom: MIN_MARGIN,\n left: MIN_MARGIN,\n right: MIN_MARGIN,\n };\n chartsDimensions: Record<string, ChartDimensionsData> = {};\n chartSizes: ChartSizes = {\n chartWidth: DEFAULT_WIDTH, // width of single chart\n chartHeight: DEFAULT_HEIGHT, // height of single chart\n chartsWidth: DEFAULT_WIDTH, // width of all charts in charts row\n chartsHeight: DEFAULT_HEIGHT, // width of all charts in charts column, without axes\n totalWidth: DEFAULT_WIDTH, // width of all charts in charts row, plus left axis, plus legend\n totalHeight: DEFAULT_HEIGHT, // width of all charts in charts height, plus bottom axis, plus top title\n };\n columnsCount = 1;\n rowsCount = 1;\n scales: ChartsScales = {\n x: {null: scaleLinear().domain([0, 10]).range([0, DEFAULT_WIDTH])},\n y: {null: scaleLinear().domain([0, 10]).range([DEFAULT_HEIGHT, 0])},\n };\n captionsSizes: CaptionsSizes = {\n xAxisCaptionsWidth: 30,\n yAxisCaptionsWidth: 100,\n };\n facetTitles: Record<string, string[]> = {}; // can be multiline\n mainTitle: string[] = []; // can be multiline\n legend: LegendData = {\n width: 0,\n height: 0,\n items: [],\n };\n\n clear() {\n if (this.parentNode && this.rootNode) {\n this.parentNode?.removeChild(this.rootNode);\n this.parentNode = null;\n this.rootNode = null;\n }\n // timeout to avoid trying to unmount during rendering\n setTimeout(() => {\n this.reactRoot?.unmount();\n this.reactRoot = null;\n });\n }\n\n init(node: HTMLElement) {\n if (this.parentNode === null) {\n this.parentNode = node;\n this.rootNode = document.createElement('div');\n this.parentNode.appendChild(this.rootNode);\n this.reactRoot = createRoot(this.rootNode);\n }\n }\n\n updateChartSizes(size: HistogramSettingsImpl['chartSettings']['size']) {\n this.chartSizes.chartWidth = size.width;\n this.chartSizes.chartHeight = size.height;\n }\n\n updateChartDimensions(\n facetKeys: string[],\n facetSettings: HistogramSettingsImpl['facetSettings'],\n xAxis: HistogramSettingsImpl['chartSettings']['xAxis'],\n yAxis: HistogramSettingsImpl['chartSettings']['yAxis']\n ) {\n const {chartWidth, chartHeight} = this.chartSizes;\n let currentLeft = 0;\n let currentTop = 0;\n this.chartsDimensions = facetKeys.reduce((res: Record<string, ChartDimensionsData>, key: string, index) => {\n const [currentRow, currentColumn] = getRowColumn(index, this.columnsCount);\n const chartEdgeSides = getChartEdgeSides(index, facetKeys.length, this.columnsCount, this.rowsCount);\n const padding = calculatePaddings(\n xAxis,\n yAxis,\n this.captionsSizes,\n getFacetRows(facetKeys, this.rowsCount, this.columnsCount)[currentRow],\n this.facetTitles,\n chartEdgeSides,\n currentColumn === this.columnsCount - 1,\n facetSettings\n );\n const outerWidth = chartWidth + padding.left + padding.right;\n const outerHeight = chartHeight + padding.top + padding.bottom;\n res[key] = {\n left: currentLeft,\n top: currentTop,\n chartEdgeSides,\n padding,\n inner: {width: chartWidth, height: chartHeight},\n outer: {width: outerWidth, height: outerHeight},\n };\n currentLeft += outerWidth;\n if (currentColumn === this.columnsCount - 1) {\n currentLeft = 0;\n currentTop += outerHeight;\n }\n return res;\n }, {});\n\n const chartsWidth = Math.max(\n ...facetKeys.map(key => this.chartsDimensions[key].outer.width + this.chartsDimensions[key].left)\n );\n const chartsHeight = Math.max(\n ...facetKeys.map(key => this.chartsDimensions[key].outer.height + this.chartsDimensions[key].top)\n );\n this.chartSizes.chartsWidth = chartsWidth;\n this.chartSizes.chartsHeight = chartsHeight;\n }\n\n updateViewport(\n facetKeys: string[],\n facetSettings: HistogramSettingsImpl['facetSettings'],\n xAxis: HistogramSettingsImpl['chartSettings']['xAxis'],\n yAxis: HistogramSettingsImpl['chartSettings']['yAxis'],\n histogramDataByFacets: Record<string, GroupedHistogramData>,\n size: HistogramSettingsImpl['chartSettings']['size'],\n groupingStack: HistogramSettingsImpl['groupingStack'],\n ) {\n const facetCount = facetKeys.length;\n const maxNRows = Math.min(facetSettings.nRows ?? facetCount, facetCount);\n const maxNCols = Math.min(facetSettings.nCols ?? facetCount, facetCount);\n // Use columns/rows count from settings if some of them defined, else make 1 column\n this.columnsCount = facetSettings.nRows ? Math.ceil(facetCount / maxNRows) : maxNCols;\n this.rowsCount = Math.ceil(facetCount / this.columnsCount);\n\n let [minXAll, maxXAll] = [Infinity, -Infinity];\n let maxYAll = -Infinity;\n const histogramExtentsByKeys = facetKeys.reduce((res: Record<string, Record<string, number>>, key) => {\n const histogramData = histogramDataByFacets[key];\n const {minX, maxX, maxCount, maxCountFromGroups} = histogramData;\n minXAll = Math.min(minXAll, minX);\n maxXAll = Math.max(maxXAll, maxX);\n maxYAll = Math.max(maxYAll, groupingStack === 'vertical' ? maxCount : maxCountFromGroups);\n res[key] = {minX, maxX, maxY: groupingStack === 'vertical' ? maxCount : maxCountFromGroups};\n return res;\n }, {});\n\n facetKeys.forEach(key => {\n const scaleX: ChartScales['x'] = xAxis.scale === 'log' ? scaleSymlog() : scaleLinear();\n\n const extents = histogramExtentsByKeys[key];\n const minX = facetSettings.sharedX ? minXAll : extents.minX;\n const maxX = facetSettings.sharedX ? maxXAll : extents.maxX;\n\n (scaleX.domain([minX, maxX]) as ChartScales['x']).range([0, this.chartSizes.chartWidth]);\n this.scales.x[key] = scaleX;\n });\n facetKeys.forEach(key => {\n const scaleY = yAxis.scale === 'log' ? scaleSymlog() : scaleLinear();\n const extents = histogramExtentsByKeys[key];\n\n const minY = 0;\n const maxY = facetSettings.sharedY ? maxYAll : extents.maxY;\n\n const rangeV = [this.chartSizes.chartHeight, 0];\n // supporting scale, it needs to add offsets of fixed size in pixels to general scale Y\n const tempY: ChartScales['y'] = (scaleY.copy().domain([minY, maxY]) as ChartScales['y']).range([\n this.chartSizes.chartHeight,\n size.innerOffset,\n ]) as ChartScales['y'];\n (scaleY.domain([tempY.invert(this.chartSizes.chartHeight), tempY.invert(0)]) as ChartScales['y']).range(\n rangeV\n );\n this.scales.y[key] = scaleY;\n });\n }\n\n updateCaptionsSize(\n xAxis: HistogramSettingsImpl['chartSettings']['xAxis'],\n yAxis: HistogramSettingsImpl['chartSettings']['yAxis']\n ) {\n const textMeasurer = new TextMeasurer('600 14px Arial');\n\n let maxYTick = 0;\n\n function getMaxTickWidth(ticks: string[]) {\n return Math.max(...ticks.map(key => textMeasurer.getTextWidth(key)));\n }\n\n if (!yAxis.hiddenLabels) {\n Object.values(this.scales.y).forEach(scale => {\n const {ticks, format} = getTicksAndFormat(scale as ScaleLogarithmic<number, number>, false);\n maxYTick = Math.max(maxYTick, getMaxTickWidth(ticks.map(format)));\n });\n }\n this.captionsSizes = {\n xAxisCaptionsWidth: xAxis.hiddenLabels ? 0 : 20,\n yAxisCaptionsWidth: maxYTick,\n };\n }\n\n createMainTitle(facetKeys: string[], title: HistogramSettingsImpl['chartSettings']['title']) {\n const firstChart = this.chartsDimensions[facetKeys[0]];\n const lastChart = this.chartsDimensions[facetKeys[facetKeys.length - 1]];\n\n this.mainTitle = splitTextByWidth(\n title.name,\n this.chartSizes.chartsWidth - firstChart.padding.left - lastChart.padding.right,\n 20\n );\n }\n\n createFacetTitles(facetKeys: string[], facetLabels: string[][]) {\n this.facetTitles = facetKeys.reduce((res: Record<string, string[]>, key, idx) => {\n if (facetLabels[idx].length === 1 && facetLabels[idx][0] === 'null') {\n res[key] = [];\n } else {\n res[key] = splitTextByWidth(facetLabels[idx].join(', '), this.chartSizes.chartWidth, 14);\n }\n return res;\n }, {});\n }\n\n updateLegendSize(\n legend: HistogramSettingsImpl['chartSettings']['legend'],\n legendInfo: HistogramLegendInfo,\n grouping: ColumnName | null,\n layers: HistogramLayer[]\n ) {\n if (!legend.show) {\n this.legend = {width: 0, height: 0, items: []};\n return;\n }\n\n const legendItems: LegendItem[] = [];\n const emptySizes = {width:0, height:0, left:0, top: 0};\n\n layers.forEach(layer => {\n if (isInheritedAes(layer.aes.fillColor) && grouping) {\n const columnId = layer.aes.fillColor.value;\n const info = legendInfo[grouping.value];\n const title = grouping.label ?? grouping.value;\n const scale:ScaleOrdinal<string, string> = scaleOrdinal<string, string>()\n .domain(info.values)\n .range(info.values.map(value => info.aesMap[value].fillColor as string));\n legendItems.push({...emptySizes, id: columnId, type: 'discreteColor', title, scale, values: info.values, labels: info.labels});\n }\n });\n\n if (!legendItems.length) {\n this.legend = {width: 0, height: 0, items: []};\n return;\n }\n\n const items = arrangeLegendParts(legendItems, this.chartSizes.chartHeight);\n\n const lastItem = items[items.length - 1];\n const legendWidth = lastItem.left + lastItem.width + LEGEND_OFFSET;\n const legendHeight = this.chartSizes.chartHeight;\n\n this.legend = {\n width: legendWidth,\n height: legendHeight,\n items,\n };\n }\n\n updateMargins(size:HistogramSettingsImpl['chartSettings']['size']) {\n const titleTextHeight = TITLE_LINE_HEIGHT * this.mainTitle.length;\n const titleHeight = titleTextHeight > 0 ? titleTextHeight + TITLE_MARGIN * 2 : 0;\n\n const minMargin = size.outerOffset;\n\n this.margins = {\n top: Math.max(titleHeight, minMargin),\n bottom: minMargin,\n left: minMargin,\n right: this.legend.width + minMargin,\n };\n this.chartSizes.totalWidth = this.margins.left + this.chartSizes.chartsWidth + this.margins.right;\n this.chartSizes.totalHeight = this.margins.top + this.chartSizes.chartsHeight + this.margins.bottom;\n }\n\n render(\n dataFrame: DataFrame,\n settingsId: string,\n chartSettings: HistogramSettingsImpl['chartSettings'],\n facetSettings: HistogramSettingsImpl['facetSettings'],\n facetKeys: string[],\n facetLabels: string[][],\n histogramDataByFacets: Record<string, GroupedHistogramData>,\n legendInfo: HistogramLegendInfo,\n layers: HistogramLayer[],\n inheritedAes: HistogramSettingsImpl['inheritedAes'],\n grouping: ColumnName | null,\n groupingStack: HistogramSettingsImpl['groupingStack'],\n groupingDirection: HistogramSettingsImpl['groupingDirection'],\n onTooltipHintSwitch: (v:boolean) => void,\n ) {\n const {xAxis, yAxis, size, title} = chartSettings;\n this.updateChartSizes(size);\n this.updateViewport(facetKeys, facetSettings, xAxis, yAxis, histogramDataByFacets, size, groupingStack);\n this.updateCaptionsSize(xAxis, yAxis);\n this.createFacetTitles(facetKeys, facetLabels);\n this.updateChartDimensions(facetKeys, facetSettings, xAxis, yAxis);\n this.createMainTitle(facetKeys, title);\n this.updateLegendSize(chartSettings.legend, legendInfo, grouping, layers);\n this.updateMargins(size);\n const minHeight = facetKeys.reduce((v, key) => {\n return Math.min(v, histogramDataByFacets[key].minX);\n }, Infinity);\n const maxHeight = facetKeys.reduce((v, key) => {\n return Math.max(v, histogramDataByFacets[key].maxX);\n }, -Infinity);\n const component = (\n <DataFrameProvider dataFrame={dataFrame}>\n <ChartsGroup\n settingsId={settingsId}\n chartSettings={chartSettings}\n facetKeys={facetKeys}\n facetSettings={facetSettings}\n chartSizes={this.chartSizes}\n chartsDimensions={this.chartsDimensions}\n scales={this.scales}\n columnsCount={this.columnsCount}\n margins={this.margins}\n mainTitle={this.mainTitle}\n facetTitles={this.facetTitles}\n captionsSizes={this.captionsSizes}\n histogramDataByFacets={histogramDataByFacets}\n layers={layers}\n aesColorGetter={createAesGetter(dataFrame, inheritedAes, 'fillColor', [minHeight, maxHeight])}\n groupingDirection={groupingDirection}\n groupingStack={groupingStack}\n groupingLabels={grouping ? legendInfo[grouping.value].labels : {}}\n legend={this.legend}\n onTooltipHintSwitch={onTooltipHintSwitch}\n />\n </DataFrameProvider>\n );\n this.component = component;\n this.reactRoot?.render(component);\n }\n\n renderError(message: string) {\n this.reactRoot?.render(<Error message={message} />);\n }\n}\n\nexport default ChartRenderer;\n"],"names":["getChartEdgeSides","index","facetsCount","columnsCount","rowsCount","chartSides","calculatePaddings","xAxis","yAxis","captionsSizes","currentRowFacetKeys","facetTitles","chartEdgeSides","lastInRow","facetSettings","needLeftAxis","needBottomAxis","needBottomAxisTitle","yCaptions","yTicks","DEFAULT_TICKS_SIZE","TICK_OFFSET","xCaptions","xTicks","xAxisTitle","TITLE_LINE","leftAxisElements","bottomAxisElements","facetTitlesLinesCount","key","MIN_PADDING","FACET_TITLE_OFFSET","FACET_TITLE_LINE","getFacetRows","facetKeys","nRows","nColumns","result","i","getRowColumn","idx","row","column","isInheritedAes","v","isContinuousAes","createAesGetter","dataFrame","aesData","field","defaultDomain","aesItem","height","domain","range","type","scale","getContinuousColorScale","columnId","mapping","_a","DEFAULT_COMMON_AES","ChartRenderer","__publicField","jsx","Fragment","MIN_MARGIN","DEFAULT_WIDTH","DEFAULT_HEIGHT","scaleLinear","node","createRoot","size","chartWidth","chartHeight","currentLeft","currentTop","res","currentRow","currentColumn","padding","outerWidth","outerHeight","chartsWidth","chartsHeight","histogramDataByFacets","groupingStack","facetCount","maxNRows","maxNCols","minXAll","maxXAll","maxYAll","histogramExtentsByKeys","histogramData","minX","maxX","maxCount","maxCountFromGroups","scaleX","scaleSymlog","extents","scaleY","minY","maxY","rangeV","tempY","textMeasurer","TextMeasurer","maxYTick","getMaxTickWidth","ticks","format","getTicksAndFormat","title","firstChart","lastChart","splitTextByWidth","facetLabels","legend","legendInfo","grouping","layers","legendItems","emptySizes","layer","info","scaleOrdinal","value","items","arrangeLegendParts","lastItem","legendWidth","LEGEND_OFFSET","legendHeight","titleTextHeight","TITLE_LINE_HEIGHT","titleHeight","TITLE_MARGIN","minMargin","settingsId","chartSettings","inheritedAes","groupingDirection","onTooltipHintSwitch","minHeight","maxHeight","component","DataFrameProvider","ChartsGroup","message","Error"],"mappings":";;;;;;;;;;;;;;;;;AA6BA,SAASA,GAAkBC,GAAeC,GAAqBC,GAAsBC,GAAmB;AACpG,QAAMC,IAAsD,CAAA;AAC5D,SAAIJ,IAAQE,MAAiBA,IAAe,KACxCE,EAAW,KAAK,OAAO,GAEvBJ,IAAQE,MAAiB,KACzBE,EAAW,KAAK,MAAM,GAEtBJ,IAAQE,KACRE,EAAW,KAAK,KAAK,IAGrB,KAAK,MAAMJ,IAAQ,KAAKE,CAAY,MAAMC,KACzC,KAAK,MAAMH,IAAQ,KAAKE,CAAY,MAAMC,IAAY,KACnDH,IAAQE,KAAgBD,IAAc,KAAKC,MAE/CE,EAAW,KAAK,QAAQ,GAErBA;AACX;AAEA,SAASC,GACLC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACF;AACE,QAAMC,IAAeH,EAAe,SAAS,MAAM,KAAK,EAACE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