@milaboratories/graph-maker 1.1.138 → 1.1.140

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 (253) hide show
  1. package/dist/GraphMaker/components/Chart.vue.d.ts.map +1 -1
  2. package/dist/GraphMaker/components/Chart.vue.js +1 -0
  3. package/dist/GraphMaker/components/Chart.vue.js.map +1 -1
  4. package/dist/GraphMaker/components/LassoControls/index.vue.js +15 -13
  5. package/dist/GraphMaker/components/LassoControls/index.vue.js.map +1 -1
  6. package/dist/GraphMaker/dataBindAes.d.ts +5 -5
  7. package/dist/GraphMaker/dataBindAes.d.ts.map +1 -1
  8. package/dist/GraphMaker/dataBindAes.js +52 -49
  9. package/dist/GraphMaker/dataBindAes.js.map +1 -1
  10. package/dist/GraphMaker/forms/LayersForm/AesSelector.vue.js +14 -14
  11. package/dist/GraphMaker/forms/LayersForm/AesSelector.vue.js.map +1 -1
  12. package/dist/GraphMaker/index.vue.d.ts.map +1 -1
  13. package/dist/GraphMaker/index.vue.js +125 -124
  14. package/dist/GraphMaker/index.vue.js.map +1 -1
  15. package/dist/GraphMaker/types.d.ts +1 -1
  16. package/dist/GraphMaker/types.d.ts.map +1 -1
  17. package/dist/GraphMaker/utils/createChartSettingsForRender/composeBubbleSettings.d.ts +6 -0
  18. package/dist/GraphMaker/utils/createChartSettingsForRender/composeBubbleSettings.d.ts.map +1 -1
  19. package/dist/GraphMaker/utils/createChartSettingsForRender/composeChartSettings.d.ts +4 -8
  20. package/dist/GraphMaker/utils/createChartSettingsForRender/composeChartSettings.d.ts.map +1 -1
  21. package/dist/GraphMaker/utils/createChartSettingsForRender/composeChartSettings.js.map +1 -1
  22. package/dist/GraphMaker/utils/createChartSettingsForRender/composeDendroSettings.d.ts +15 -0
  23. package/dist/GraphMaker/utils/createChartSettingsForRender/composeDendroSettings.d.ts.map +1 -1
  24. package/dist/GraphMaker/utils/createChartSettingsForRender/composeDiscreteSettings.d.ts +12 -3
  25. package/dist/GraphMaker/utils/createChartSettingsForRender/composeDiscreteSettings.d.ts.map +1 -1
  26. package/dist/GraphMaker/utils/createChartSettingsForRender/composeHeatmapSettings.d.ts +21 -0
  27. package/dist/GraphMaker/utils/createChartSettingsForRender/composeHeatmapSettings.d.ts.map +1 -1
  28. package/dist/GraphMaker/utils/createChartSettingsForRender/composeHistogramSettings.d.ts +10 -6
  29. package/dist/GraphMaker/utils/createChartSettingsForRender/composeHistogramSettings.d.ts.map +1 -1
  30. package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.d.ts +31 -13
  31. package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.d.ts.map +1 -1
  32. package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.js +56 -62
  33. package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.js.map +1 -1
  34. package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.d.ts +29 -13
  35. package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.d.ts.map +1 -1
  36. package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.js +20 -19
  37. package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.js.map +1 -1
  38. package/dist/GraphMaker/utils/loadUniqueValuesToSave.d.ts.map +1 -1
  39. package/dist/GraphMaker/utils/loadUniqueValuesToSave.js +57 -54
  40. package/dist/GraphMaker/utils/loadUniqueValuesToSave.js.map +1 -1
  41. package/dist/lib.js +1 -1
  42. package/dist/node_modules/@milaboratories/miplots4/dist/AbstractChart.js +5 -5
  43. package/dist/node_modules/@milaboratories/miplots4/dist/AbstractChart.js.map +1 -1
  44. package/dist/node_modules/@milaboratories/miplots4/dist/DataFrame.js +95 -72
  45. package/dist/node_modules/@milaboratories/miplots4/dist/DataFrame.js.map +1 -1
  46. package/dist/node_modules/@milaboratories/miplots4/dist/MiPlots.js +8 -5
  47. package/dist/node_modules/@milaboratories/miplots4/dist/MiPlots.js.map +1 -1
  48. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/ChartRenderer.js +124 -122
  49. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/ChartRenderer.js.map +1 -1
  50. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/components/Chart.js +72 -91
  51. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/components/Chart.js.map +1 -1
  52. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/components/ChartsGroup.js +43 -41
  53. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/components/ChartsGroup.js.map +1 -1
  54. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/getCellTooltip.js +28 -0
  55. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/getCellTooltip.js.map +1 -0
  56. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/getGroupedCellsData.js +94 -0
  57. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/getGroupedCellsData.js.map +1 -0
  58. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/index.js +38 -34
  59. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/index.js.map +1 -1
  60. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/utils/calculateCaptionTails.js.map +1 -1
  61. package/dist/node_modules/@milaboratories/miplots4/dist/common/Error.js +4 -22
  62. package/dist/node_modules/@milaboratories/miplots4/dist/common/Error.js.map +1 -1
  63. package/dist/node_modules/@milaboratories/miplots4/dist/common/Legend.js.map +1 -1
  64. package/dist/node_modules/@milaboratories/miplots4/dist/common/Tooltip.js +11 -11
  65. package/dist/node_modules/@milaboratories/miplots4/dist/common/Tooltip.js.map +1 -1
  66. package/dist/node_modules/@milaboratories/miplots4/dist/common/useDataFrame.js +20 -0
  67. package/dist/node_modules/@milaboratories/miplots4/dist/common/useDataFrame.js.map +1 -0
  68. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/ChartRenderer.js +181 -181
  69. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/ChartRenderer.js.map +1 -1
  70. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/DendroSettingsImpl.js +2 -2
  71. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/DendroSettingsImpl.js.map +1 -1
  72. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/components/Chart.js +45 -45
  73. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/components/Chart.js.map +1 -1
  74. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/components/Heatmap.js +27 -27
  75. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/components/Heatmap.js.map +1 -1
  76. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/components/Legend.js.map +1 -1
  77. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/components/LinksGroup.js +18 -18
  78. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/components/LinksGroup.js.map +1 -1
  79. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/components/NodesGroup.js +36 -36
  80. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/components/NodesGroup.js.map +1 -1
  81. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/getHeatmapData.js +45 -41
  82. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/getHeatmapData.js.map +1 -1
  83. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/getHierarchyData.js +33 -33
  84. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/getHierarchyData.js.map +1 -1
  85. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/index.js +90 -93
  86. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/index.js.map +1 -1
  87. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/ChartRenderer.js +199 -198
  88. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/ChartRenderer.js.map +1 -1
  89. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/DiscreteSettingsImpl.js +17 -17
  90. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/DiscreteSettingsImpl.js.map +1 -1
  91. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/components/layers/BoxElement.js.map +1 -1
  92. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/index.js +102 -99
  93. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/index.js.map +1 -1
  94. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/bar.js +31 -36
  95. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/bar.js.map +1 -1
  96. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/binnedDots.js +62 -74
  97. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/binnedDots.js.map +1 -1
  98. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/boxes.js +52 -53
  99. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/boxes.js.map +1 -1
  100. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/dots.js +32 -32
  101. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/dots.js.map +1 -1
  102. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/lines.js +7 -6
  103. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/lines.js.map +1 -1
  104. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/logo.js +23 -23
  105. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/logo.js.map +1 -1
  106. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/pairedPoints.js +63 -63
  107. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/pairedPoints.js.map +1 -1
  108. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/sina.js +60 -64
  109. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/sina.js.map +1 -1
  110. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/stackedBar.js +23 -23
  111. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/stackedBar.js.map +1 -1
  112. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/utils/getOutliersBounds.js +5 -5
  113. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/utils/getOutliersBounds.js.map +1 -1
  114. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/utils/splitTextByWidth.js +13 -13
  115. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/utils/splitTextByWidth.js.map +1 -1
  116. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/ChartRenderer.js +258 -256
  117. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/ChartRenderer.js.map +1 -1
  118. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/HeatmapSettingsImpl.js +1 -1
  119. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/HeatmapSettingsImpl.js.map +1 -1
  120. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Annotations/Annotation.js +81 -79
  121. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Annotations/Annotation.js.map +1 -1
  122. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Chart.js +140 -134
  123. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Chart.js.map +1 -1
  124. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/ChartsGroup.js +17 -17
  125. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/ChartsGroup.js.map +1 -1
  126. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/getCells.js +99 -95
  127. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/getCells.js.map +1 -1
  128. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/index.js +32 -31
  129. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/index.js.map +1 -1
  130. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/utils/calculateAnnotationTitleSizes.js +1 -1
  131. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/utils/calculateAnnotationTitleSizes.js.map +1 -1
  132. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/utils/calculateCaptionTails.js.map +1 -1
  133. package/dist/node_modules/@milaboratories/miplots4/dist/histogram/ChartRenderer.js +143 -142
  134. package/dist/node_modules/@milaboratories/miplots4/dist/histogram/ChartRenderer.js.map +1 -1
  135. package/dist/node_modules/@milaboratories/miplots4/dist/histogram/HistogramSettingsImpl.js.map +1 -1
  136. package/dist/node_modules/@milaboratories/miplots4/dist/histogram/components/Chart.js +30 -30
  137. package/dist/node_modules/@milaboratories/miplots4/dist/histogram/components/Chart.js.map +1 -1
  138. package/dist/node_modules/@milaboratories/miplots4/dist/histogram/components/ChartsGroup.js +7 -7
  139. package/dist/node_modules/@milaboratories/miplots4/dist/histogram/getHistogramData.js +53 -54
  140. package/dist/node_modules/@milaboratories/miplots4/dist/histogram/getHistogramData.js.map +1 -1
  141. package/dist/node_modules/@milaboratories/miplots4/dist/histogram/index.js +62 -58
  142. package/dist/node_modules/@milaboratories/miplots4/dist/histogram/index.js.map +1 -1
  143. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/@d3fc/d3fc-axis/src/axisBase.js +7 -7
  144. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-array/src/min.js +6 -12
  145. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-array/src/min.js.map +1 -1
  146. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-shape/src/line.js.map +1 -1
  147. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/kdbush/index.js +148 -0
  148. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/kdbush/index.js.map +1 -0
  149. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/ChartRenderer.js +172 -168
  150. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/ChartRenderer.js.map +1 -1
  151. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/ScatterplotSettingsImpl.js +28 -28
  152. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/ScatterplotSettingsImpl.js.map +1 -1
  153. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/Chart.js +11 -11
  154. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartAxisTitles.js +30 -29
  155. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartAxisTitles.js.map +1 -1
  156. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartLayersData.js +135 -153
  157. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartLayersData.js.map +1 -1
  158. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartTooltip.js +35 -32
  159. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartTooltip.js.map +1 -1
  160. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartTrendsData.js +27 -27
  161. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartTrendsData.js.map +1 -1
  162. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartsGroup.js +14 -14
  163. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/constants.js.map +1 -1
  164. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/dots.js +24 -25
  165. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/dots.js.map +1 -1
  166. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/getLayersData.js +13 -13
  167. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/getLayersData.js.map +1 -1
  168. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/index.js +69 -76
  169. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/index.js.map +1 -1
  170. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/linearRegression.js +85 -83
  171. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/linearRegression.js.map +1 -1
  172. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/createAesGetter.js +20 -20
  173. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/createAesGetter.js.map +1 -1
  174. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/createLegendInfo.js +50 -38
  175. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/createLegendInfo.js.map +1 -1
  176. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/formatColumnValue.js +11 -0
  177. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/formatColumnValue.js.map +1 -0
  178. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/getVisibleLabels.js +46 -56
  179. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/getVisibleLabels.js.map +1 -1
  180. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/sortDotsByGrouping.js +18 -0
  181. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/sortDotsByGrouping.js.map +1 -0
  182. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/ChartRenderer.js +223 -205
  183. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/ChartRenderer.js.map +1 -1
  184. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/SettingsImpl.js +26 -26
  185. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/SettingsImpl.js.map +1 -1
  186. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/colors.js +42 -0
  187. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/colors.js.map +1 -0
  188. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/components/LowerSVG.js +84 -81
  189. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/components/LowerSVG.js.map +1 -1
  190. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/components/SVGLayer.js +11 -11
  191. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/components/UpperSVG.js +15 -14
  192. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/components/UpperSVG.js.map +1 -1
  193. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/index.js +97 -118
  194. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/index.js.map +1 -1
  195. package/dist/node_modules/@milaboratories/miplots4/dist/types/common.js +3 -1
  196. package/dist/node_modules/@milaboratories/miplots4/dist/types/common.js.map +1 -1
  197. package/dist/node_modules/@milaboratories/miplots4/dist/types/dendro.js +1 -1
  198. package/dist/node_modules/@milaboratories/miplots4/dist/types/dendro.js.map +1 -1
  199. package/dist/node_modules/@milaboratories/miplots4/dist/types/discrete.js +1 -1
  200. package/dist/node_modules/@milaboratories/miplots4/dist/types/discrete.js.map +1 -1
  201. package/dist/node_modules/@milaboratories/miplots4/dist/types/heatmap.js +1 -1
  202. package/dist/node_modules/@milaboratories/miplots4/dist/types/heatmap.js.map +1 -1
  203. package/dist/node_modules/@milaboratories/miplots4/dist/types/histogram.js +1 -1
  204. package/dist/node_modules/@milaboratories/miplots4/dist/types/histogram.js.map +1 -1
  205. package/dist/node_modules/@milaboratories/miplots4/dist/types/scatterplot-umap.js +23 -17
  206. package/dist/node_modules/@milaboratories/miplots4/dist/types/scatterplot-umap.js.map +1 -1
  207. package/dist/node_modules/@milaboratories/miplots4/dist/types/scatterplot.js +25 -19
  208. package/dist/node_modules/@milaboratories/miplots4/dist/types/scatterplot.js.map +1 -1
  209. package/dist/node_modules/@milaboratories/miplots4/dist/utils/TextMeasurer/TextMeasurer.js +39 -0
  210. package/dist/node_modules/@milaboratories/miplots4/dist/utils/TextMeasurer/TextMeasurer.js.map +1 -0
  211. package/dist/node_modules/@milaboratories/miplots4/dist/utils/TextMeasurer/charToWidth.json.js +101 -0
  212. package/dist/node_modules/@milaboratories/miplots4/dist/utils/TextMeasurer/charToWidth.json.js.map +1 -0
  213. package/dist/node_modules/@milaboratories/miplots4/dist/utils/arrangeLegendParts.js +4 -4
  214. package/dist/node_modules/@milaboratories/miplots4/dist/utils/arrangeLegendParts.js.map +1 -1
  215. package/dist/node_modules/@milaboratories/miplots4/dist/utils/arraysAreDifferent.js +7 -0
  216. package/dist/node_modules/@milaboratories/miplots4/dist/utils/arraysAreDifferent.js.map +1 -0
  217. package/dist/node_modules/@milaboratories/miplots4/dist/utils/getLegendWidth.js +3 -3
  218. package/dist/node_modules/@milaboratories/miplots4/dist/utils/getLegendWidth.js.map +1 -1
  219. package/dist/node_modules/@milaboratories/pf-plots/dist/index.js +1111 -1097
  220. package/dist/node_modules/@milaboratories/pf-plots/dist/index.js.map +1 -1
  221. package/package.json +3 -3
  222. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/getCells.js +0 -91
  223. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/getCells.js.map +0 -1
  224. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/add.js +0 -30
  225. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/add.js.map +0 -1
  226. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/cover.js +0 -29
  227. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/cover.js.map +0 -1
  228. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/data.js +0 -12
  229. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/data.js.map +0 -1
  230. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/extent.js +0 -7
  231. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/extent.js.map +0 -1
  232. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/find.js +0 -26
  233. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/find.js.map +0 -1
  234. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/quad.js +0 -7
  235. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/quad.js.map +0 -1
  236. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/quadtree.js +0 -51
  237. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/quadtree.js.map +0 -1
  238. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/remove.js +0 -21
  239. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/remove.js.map +0 -1
  240. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/root.js +0 -7
  241. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/root.js.map +0 -1
  242. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/size.js +0 -12
  243. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/size.js.map +0 -1
  244. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/visit.js +0 -14
  245. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/visit.js.map +0 -1
  246. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/visitAfter.js +0 -19
  247. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/visitAfter.js.map +0 -1
  248. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/x.js +0 -11
  249. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/x.js.map +0 -1
  250. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/y.js +0 -11
  251. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/y.js.map +0 -1
  252. package/dist/node_modules/@milaboratories/miplots4/dist/utils/TextMeasurer.js +0 -24
  253. package/dist/node_modules/@milaboratories/miplots4/dist/utils/TextMeasurer.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ChartRenderer.js","sources":["../../../../../../node_modules/@milaboratories/miplots4/src/discrete/ChartRenderer.tsx"],"sourcesContent":["import {Error} from '../common/Error';\nimport {DEFAULT_HEIGHT, DEFAULT_WIDTH, TITLE_LINE_HEIGHT, TITLE_MARGIN} from '../constants';\nimport type {GroupKey} from '../DataFrame';\nimport type {Margins} from './components/types';\nimport type {DiscreteSettingsImpl} from './DiscreteSettingsImpl';\nimport type {StatsData} from './layers/types';\nimport type {LayerData} from './layers/types';\nimport type {CaptionsSizes, ChartDimensionsData, ChartSizes, ChartsScales} from './components/types';\nimport {CAPTION_LINE_HEIGHT, FACET_TITLE_LINE, FACET_TITLE_OFFSET, MIN_PADDING} from './constants';\nimport {LEGEND_OFFSET} from './constants';\nimport {DEFAULT_COMMON_AES, DEFAULT_TICKS_SIZE} from '../scatterplot/constants';\nimport type {InheritAesDiscrete} from '../types';\nimport type {GroupingData} from '../types';\nimport type {AesItem, ColumnName, Orientation} from '../types';\nimport {TextMeasurer} from '../utils/TextMeasurer';\nimport {scaleBand, scaleLinear, scaleLog, scaleOrdinal} from 'd3-scale';\nimport lodash from 'lodash';\nimport {DEFAULT_AES, TICK_OFFSET, TITLE_LINE} 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 {getChartStatsPadding, splitTextByWidth} from './utils';\nimport type {LegendData, LegendItemDiscreteMultiAes} from '../common/types';\nimport { arrangeLegendParts } from '../utils/arrangeLegendParts';\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 orientation: Orientation,\n xAxis: DiscreteSettingsImpl['chartSettings']['xAxis'],\n yAxis: DiscreteSettingsImpl['chartSettings']['yAxis'],\n captionsSizes: CaptionsSizes,\n currentRowFacetKeys: string[],\n facetTitles: Record<string, string[]>,\n chartEdgeSides: ('left' | 'right' | 'top' | 'bottom')[],\n facetSettings: DiscreteSettingsImpl['facetSettings'],\n currentRow: number,\n currentColumn: number,\n lastInRow: boolean\n) {\n const isVertical = orientation === 'vertical';\n const needLeftAxis =\n chartEdgeSides.includes('left') ||\n (isVertical && !facetSettings?.sharedY) ||\n (!isVertical && !facetSettings?.sharedX);\n const needLeftAxisTitle = chartEdgeSides.includes('left') && yAxis.title !== '';\n const needBottomAxis =\n chartEdgeSides.includes('bottom') ||\n (isVertical && !facetSettings?.sharedX) ||\n (!isVertical && !facetSettings?.sharedY);\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 const yAxisTitle = needLeftAxisTitle ? TITLE_LINE : 0;\n\n const xCaptions = captionsSizes.xAxisCaptionsWidthByRows[isVertical ? currentRow : currentColumn];\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 = isVertical ? yCaptions + yTicks + yAxisTitle : xCaptions + xTicks + xAxisTitle;\n const bottomAxisElements = isVertical ? xTicks + xCaptions + xAxisTitle : yTicks + 2 * TITLE_LINE;\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 columns\nfunction getFacetColumns(facetKeys: string[], nRows: number, nColumns: number): string[][] {\n const result: string[][] = new Array(nColumns).fill(null).map(() => []);\n for (let i = 0; i < nColumns; i++) {\n for (let j = 0; j < nRows; j++) {\n const facetIdx = j * nColumns + i;\n if (facetIdx < facetKeys.length) {\n result[i].push(facetKeys[j * nColumns + i]);\n }\n }\n }\n return result;\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 isInheritAes(v: InheritAesDiscrete | string | number | boolean): v is InheritAesDiscrete {\n return typeof v === 'object' && 'type' in v;\n}\n\nclass ChartRenderer {\n reactRoot: Root | null = null;\n parentNode: HTMLElement | null = null;\n rootNode: HTMLElement | null = null;\n component: ReactElement = (<></>);\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 // Scale from primary grouping categories to every category x coordinate\n xPrimary: {null: scaleBand().range([0, DEFAULT_WIDTH]).domain(['1'])},\n // Scale from secondary grouping categories to x shift inside corresponding primary group\n xSecondary: {null: scaleBand().range([0, DEFAULT_WIDTH]).domain(['1'])},\n // Scale from y value to y coordinate, by facet\n y: {null: scaleLinear().domain([0, 10]).range([DEFAULT_HEIGHT, 0]).nice()},\n // Scale for link primary grouping category and aesthetics\n xPrimaryAes: scaleOrdinal<string, AesItem, AesItem>().unknown(DEFAULT_AES),\n // Scale for link secondary grouping category and aesthetics\n xSecondaryAes: scaleOrdinal<string, AesItem, AesItem>().unknown(DEFAULT_AES),\n };\n facetTitles: Record<string, string[]> = {}; // can be multiline\n mainTitle: string[] = []; // can be multiline\n axisLabelsX: Record<string, Record<string, string[]>> = {}; // can be multiline\n captionsSizes: CaptionsSizes = {\n xAxisCaptionsWidthByRows: [],\n xCaptionsTail: 0,\n yAxisCaptionsWidth: 100,\n };\n legend: LegendData = {width: 0, height: 0, items: []};\n margins: Margins = {left: 0, right: 0, top: 0, bottom: 0};\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 updateChartSize(\n size: DiscreteSettingsImpl['chartSettings']['size'],\n facetKeys: string[],\n facetSettings: DiscreteSettingsImpl['facetSettings'],\n primaryKeys: GroupKey[],\n orientation: Orientation,\n statsData: StatsData[]\n ) {\n const paddingTop = size.innerOffset;\n const paddingBottom = size.innerOffset;\n // It may be necessary increase chart height/width for p-value\n const statsPadding = getChartStatsPadding(statsData, primaryKeys, size.innerOffset);\n // Use columns/rows count from settings if some of them defined, else make 1 column\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 {width, height} = size;\n // avoid situation when statistics fill all available chart area\n if (orientation === 'vertical' && statsPadding > paddingTop) {\n height += statsPadding;\n }\n if (orientation === 'horizontal' && statsPadding > paddingBottom) {\n width += statsPadding;\n }\n this.chartSizes.chartWidth = width;\n this.chartSizes.chartHeight = height;\n }\n\n updateChartDimensions(\n facetKeys: string[],\n facetSettings: DiscreteSettingsImpl['facetSettings'],\n orientation: Orientation,\n xAxis: DiscreteSettingsImpl['chartSettings']['xAxis'],\n yAxis: DiscreteSettingsImpl['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 orientation,\n xAxis,\n yAxis,\n this.captionsSizes,\n getFacetRows(facetKeys, this.rowsCount, this.columnsCount)[currentRow],\n this.facetTitles,\n chartEdgeSides,\n facetSettings,\n currentRow,\n currentColumn,\n currentColumn === this.columnsCount - 1\n );\n\n const outerWidth = chartWidth + padding.left + padding.right;\n const outerHeight = chartHeight + padding.top + padding.bottom;\n\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\n this.chartSizes.chartsWidth = chartsWidth;\n this.chartSizes.chartsHeight = chartsHeight;\n }\n\n updateViewport(\n orientation: Orientation,\n primaryKeys: string[],\n secondaryKeys: string[],\n facetKeys: string[],\n facetSettings: DiscreteSettingsImpl['facetSettings'],\n yAxis: DiscreteSettingsImpl['chartSettings']['yAxis'],\n layersData: LayerData[],\n statsData: StatsData[],\n size: DiscreteSettingsImpl['chartSettings']['size'],\n nonEmptyGroupsByFacets: Record<string, string[]>,\n ) {\n const paddingBottom = size.innerOffset;\n const isVertical = orientation === 'vertical';\n const statsPadding = getChartStatsPadding(statsData, primaryKeys, size.innerOffset);\n const sharedX = facetSettings === null || facetSettings.sharedX;\n const sharedY = facetSettings === null || facetSettings.sharedY;\n\n const {chartHeight, chartWidth} = this.chartSizes;\n facetKeys.forEach(key => {\n const scaleY = yAxis.scale === 'log' ? scaleLog() : scaleLinear();\n const min = sharedY\n ? Math.min(...layersData.map(({meta}) => meta.minY))\n : Math.min(...layersData.map(({geoms}) => Math.min(...geoms[key].map(({boundsY}) => boundsY.min))));\n const max = sharedY\n ? Math.max(...layersData.map(({meta}) => meta.maxY))\n : Math.max(...layersData.map(({geoms}) => Math.max(...geoms[key].map(({boundsY}) => boundsY.max))));\n\n // supporting scale, it needs to add offsets of fixed size in pixels to general scale Y\n const tempY = scaleY\n .copy()\n .domain([min, max])\n .range(\n isVertical\n ? [chartHeight - paddingBottom, statsPadding]\n : [paddingBottom, chartWidth - statsPadding]\n );\n scaleY\n .domain([tempY.invert(isVertical ? chartHeight : 0), tempY.invert(isVertical ? 0 : chartWidth)])\n .range(isVertical ? [chartHeight, 0] : [0, chartWidth]);\n this.scales.y[key] = scaleY;\n\n const facetPrimaryKeys = sharedX ? primaryKeys : nonEmptyGroupsByFacets[key];\n this.scales.xPrimary[key] = scaleBand()\n .domain(facetPrimaryKeys)\n .range(isVertical ? [0, chartWidth] : [chartHeight, 0]);\n this.scales.xSecondary[key] = scaleBand()\n .domain(secondaryKeys)\n .range([0, this.scales.xPrimary[key].bandwidth()]);\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 createMainTitle(facetKeys: string[], title: DiscreteSettingsImpl['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 createAxisLabels(\n facetKeys: string[],\n xAxis: DiscreteSettingsImpl['chartSettings']['xAxis'],\n primaryGrouping: GroupingData,\n orientation: Orientation\n ) {\n const DEFAULT_MAX_WIDTH = {\n center: 120,\n '45deg': 256,\n '90deg': 320,\n };\n const isVertical = orientation === 'vertical';\n\n function getMaxLinesCount(labelsPosition: 'center' | '45deg' | '90deg', bandwidth: number) {\n if (labelsPosition === 'center') {\n return Infinity;\n }\n if (labelsPosition === '45deg') {\n return Math.floor((bandwidth * Math.sin(Math.PI / 4)) / CAPTION_LINE_HEIGHT);\n }\n return Math.floor(bandwidth / CAPTION_LINE_HEIGHT);\n }\n\n this.axisLabelsX = facetKeys.reduce((res: Record<string, Record<string, string[]>>, facetKey) => {\n const scale = this.scales.xPrimary[facetKey];\n const bandwidth = scale.bandwidth();\n const defaultWidth = DEFAULT_MAX_WIDTH[xAxis.labelsPosition];\n const width = xAxis.labelsPosition === 'center' ? Math.min(defaultWidth, bandwidth) : defaultWidth;\n const labelsMap = primaryGrouping.valueLabels;\n res[facetKey] = scale.domain().reduce((res2: Record<string, string[]>, axisKey) => {\n if (xAxis.hiddenLabels) {\n res2[axisKey] = [];\n return res2;\n }\n const label = labelsMap[axisKey];\n if (!isVertical) {\n res2[axisKey] = [label];\n } else {\n const maxLinesCount = getMaxLinesCount(xAxis.labelsPosition, bandwidth);\n const multilineKey = splitTextByWidth(label, width, 14);\n res2[axisKey] = multilineKey.length > maxLinesCount ? [label] : multilineKey;\n }\n return res2;\n }, {});\n return res;\n }, {});\n }\n\n updateAesScales(primaryGrouping: GroupingData, secondaryGrouping: GroupingData) {\n if (primaryGrouping.inheritedAes) {\n const {inheritedAes, keys} = primaryGrouping;\n this.scales.xPrimaryAes.domain(keys).range(keys.map(key => inheritedAes[key] ?? DEFAULT_COMMON_AES));\n } else {\n this.scales.xPrimaryAes.domain([]).range([]);\n }\n if (secondaryGrouping.inheritedAes) {\n const {inheritedAes, keys} = secondaryGrouping;\n this.scales.xSecondaryAes.domain(keys).range(keys.map(key => inheritedAes[key] ?? DEFAULT_COMMON_AES));\n } else {\n this.scales.xSecondaryAes.domain([]).range([]);\n }\n }\n\n updateCaptionsSize(\n orientation: Orientation,\n facetKeys: string[],\n xAxis: DiscreteSettingsImpl['chartSettings']['xAxis'],\n yAxis: DiscreteSettingsImpl['chartSettings']['yAxis'],\n ) {\n const LABEL_FONT_SIZE = 14;\n const textMeasurer = new TextMeasurer(`600 ${LABEL_FONT_SIZE}px Manrope`);\n const isVertical = orientation === 'vertical';\n\n function getMaxStrWidth(strs: string[]) {\n if (!strs.length) {\n return 0;\n }\n return Math.max(...strs.map(str => textMeasurer.getTextWidth(str)));\n }\n\n function getMultilineMaxStrWidth(strs: string[][]) {\n if (!strs.length) {\n return 0;\n }\n return Math.max(...strs.map(getMaxStrWidth));\n }\n\n // x ticks are always strings and can have variable width in different facets, and can be rotated;\n // for x we consider the widest tick caption in row (column for horizontal orientation);\n // y ticks are always numbers, and we consider only the widest number of all facets\n // because numbers sizes are closer to each other, and it makes more equal facets grid without superwide empty offsets\n let xAxisCaptionsWidthByRows: number[] = [];\n let xTail = 0;\n\n const facetRows = getFacetRows(facetKeys, this.rowsCount, this.columnsCount);\n const facetColumns = getFacetColumns(facetKeys, this.rowsCount, this.columnsCount);\n if (!isVertical) {\n // with horizontal chart orientation X ticks are always in horizontal position\n xAxisCaptionsWidthByRows = facetColumns\n // max of ticks width in every facet's column\n .map(columnFacetKeys =>\n Math.max(\n ...columnFacetKeys.map(facetKey =>\n getMultilineMaxStrWidth(\n this.scales.xPrimary[facetKey]\n .domain()\n .map(axisKey => this.axisLabelsX[facetKey][axisKey])\n )\n )\n )\n );\n } else {\n if (xAxis.labelsPosition === 'center') {\n xAxisCaptionsWidthByRows = facetRows.map(rowFacetKeys =>\n Math.max(\n ...rowFacetKeys.map(facetKey =>\n Math.max(\n ...this.scales.xPrimary[facetKey]\n .domain()\n // do not consider empty ticks captions, for example - single group\n .map(axisKey =>\n axisKey ? this.axisLabelsX[facetKey][axisKey].length * CAPTION_LINE_HEIGHT : 0\n )\n )\n )\n )\n );\n }\n if (xAxis.labelsPosition === '45deg') {\n const sin45 = Math.sin(Math.PI / 4);\n xAxisCaptionsWidthByRows = facetRows.map(rowKeys => {\n return Math.max(\n ...rowKeys.map(key => {\n const labels = this.scales.xPrimary[key]\n .domain()\n .map(axisKey => this.axisLabelsX[key][axisKey]);\n const ticksWidth = getMultilineMaxStrWidth(labels);\n return ticksWidth > 0 ? ticksWidth * sin45 + LABEL_FONT_SIZE : 0;\n })\n );\n });\n xTail = Math.max(\n ...facetColumns[0].map(facetKey => {\n const ticks = this.scales.xPrimary[facetKey].domain();\n const sideTick = this.axisLabelsX[facetKey][ticks[0]];\n return Math.max(\n getMaxStrWidth(sideTick) * sin45 -\n this.scales.xPrimary[facetKey].bandwidth() / 2 +\n LABEL_FONT_SIZE,\n 0\n );\n })\n );\n }\n if (xAxis.labelsPosition === '90deg') {\n xAxisCaptionsWidthByRows = facetRows\n // max of ticks width in every facet's row\n .map(rowKeys =>\n Math.max(\n ...rowKeys.map(facetKey =>\n getMultilineMaxStrWidth(\n this.scales.xPrimary[facetKey]\n .domain()\n .map(axisKey => this.axisLabelsX[facetKey][axisKey])\n )\n )\n )\n );\n }\n }\n\n const yTicks = lodash.flatten(\n facetKeys.map(facetKey => {\n if (yAxis.hiddenLabels) {\n return [];\n }\n const scaleY = this.scales.y[facetKey];\n const ticks = scaleY.ticks();\n const specifier = ticks.some(tick => (Math.abs(tick) < 0.0001 && tick !== 0) || tick > 10000)\n ? ',e'\n : ',f';\n const format = scaleY.tickFormat(10, specifier);\n return ticks.map(format);\n })\n );\n const yAxisCaptionsWidth = getMaxStrWidth(yTicks);\n\n this.captionsSizes = {\n xCaptionsTail: xTail,\n xAxisCaptionsWidthByRows,\n yAxisCaptionsWidth,\n };\n }\n\n updateMargins(orientation: Orientation, facetKeys: string[], size:DiscreteSettingsImpl['chartSettings']['size']) {\n const firstChart = this.chartsDimensions[facetKeys[0]];\n const lastChart = this.chartsDimensions[facetKeys[facetKeys.length - 1]];\n const isVertical = orientation === 'vertical';\n\n const mainTitleHeight = this.mainTitle.length ? TITLE_LINE_HEIGHT * this.mainTitle.length + TITLE_MARGIN * 2 : 0;\n const minMargin = size.outerOffset;\n this.margins = {\n left: Math.max(minMargin, isVertical ? this.captionsSizes.xCaptionsTail - firstChart.padding.left : 0),\n right: this.legend.width + minMargin,\n top: Math.max(mainTitleHeight, minMargin),\n bottom: Math.max(minMargin, isVertical ? 0 : this.captionsSizes.xCaptionsTail - lastChart.padding.bottom),\n };\n this.chartSizes.totalWidth = this.margins.left + this.chartSizes.chartsWidth + this.margins.right;\n this.chartSizes.totalHeight =\n this.margins.top + Math.max(this.chartSizes.chartsHeight, this.legend.height) + this.margins.bottom;\n }\n\n updateLegendSize(\n legend: DiscreteSettingsImpl['chartSettings']['legend'],\n primaryGrouping: GroupingData,\n secondaryGrouping: GroupingData,\n layersData: LayerData[]\n ) {\n if (!legend.show) {\n this.legend = {width: 0, height: 0, items: []};\n return;\n }\n const legendHeight = this.chartSizes.chartHeight;\n const emptySizes = {width:0, height:0, left:0, top: 0};\n const legendItems: LegendItemDiscreteMultiAes[] = [];\n\n function layersHasInheritedAesByField(\n type: 'primaryGrouping' | 'secondaryGrouping',\n field: keyof LegendItemDiscreteMultiAes['usedAes']\n ) {\n return layersData.some(l => {\n const value = l.aes[field as keyof typeof l.aes];\n return value && isInheritAes(value) && value.type === type;\n });\n }\n function getUsedAes(type: 'primaryGrouping' | 'secondaryGrouping'): LegendItemDiscreteMultiAes['usedAes'] {\n return {\n dotFill: layersHasInheritedAesByField(type, 'dotFill'),\n fillColor: layersHasInheritedAesByField(type, 'fillColor'),\n lineColor: layersHasInheritedAesByField(type, 'lineColor'),\n dotShape: layersHasInheritedAesByField(type, 'dotShape'),\n lineShape: layersHasInheritedAesByField(type, 'lineShape'),\n };\n }\n const primaryUsedAes = getUsedAes('primaryGrouping');\n const secondaryUsedAes = getUsedAes('secondaryGrouping');\n if (Object.values(primaryUsedAes).some(v => v) && primaryGrouping.inheritedAes) {\n legendItems.push({\n type: 'discreteMulti',\n id: 'primary',\n title: primaryGrouping.label,\n scale: this.scales.xPrimaryAes,\n values: primaryGrouping.keys,\n labels: primaryGrouping.valueLabels,\n usedAes: primaryUsedAes,\n ...emptySizes,\n });\n }\n if (Object.values(secondaryUsedAes).some(v => v) && secondaryGrouping.inheritedAes) {\n legendItems.push({\n type: 'discreteMulti',\n id: 'secondary',\n title: secondaryGrouping.label,\n scale: this.scales.xSecondaryAes,\n values: secondaryGrouping.keys,\n labels: secondaryGrouping.valueLabels,\n usedAes: secondaryUsedAes,\n ...emptySizes\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 const lastItem = items[items.length - 1];\n const legendWidth = lastItem.left + lastItem.width + LEGEND_OFFSET;\n\n this.legend = {\n width: legendWidth,\n height: legendHeight,\n items\n };\n }\n\n render(\n settingsId: string,\n chartSettings: DiscreteSettingsImpl['chartSettings'],\n primaryGrouping: GroupingData,\n secondaryGrouping: GroupingData,\n facetSettings: DiscreteSettingsImpl['facetSettings'],\n facetKeys: string[],\n facetLabels: string[][],\n layersData: LayerData[],\n statsData: StatsData[],\n keyColumn: ColumnName | null,\n nonEmptyGroupsByFacets: Record<string, string[]>,\n onlyPositive: boolean,\n onTooltipHintSwitch: (v:boolean) => void\n ) {\n const {orientation, xAxis, yAxis, size} = chartSettings;\n this.updateChartSize(size, facetKeys, facetSettings, primaryGrouping.keys, orientation, statsData);\n this.updateViewport(\n orientation,\n primaryGrouping.keys,\n secondaryGrouping.keys,\n facetKeys,\n facetSettings,\n yAxis,\n layersData,\n statsData,\n size,\n nonEmptyGroupsByFacets\n );\n this.createAxisLabels(facetKeys, xAxis, primaryGrouping, orientation);\n this.createFacetTitles(facetKeys, facetLabels);\n this.updateCaptionsSize(orientation, facetKeys, xAxis, yAxis);\n this.updateChartDimensions(facetKeys, facetSettings, orientation, xAxis, yAxis);\n this.updateLegendSize(chartSettings.legend, primaryGrouping, secondaryGrouping, layersData);\n this.createMainTitle(facetKeys, chartSettings.title);\n this.updateMargins(orientation, facetKeys, size);\n this.updateAesScales(primaryGrouping, secondaryGrouping);\n\n const component = (\n <ChartsGroup\n settingsId={settingsId}\n chartSettings={chartSettings}\n facetKeys={facetKeys}\n facetSettings={facetSettings}\n facetTitles={this.facetTitles}\n chartSizes={this.chartSizes}\n chartsDimensions={this.chartsDimensions}\n scales={this.scales}\n layersData={layersData}\n statsData={statsData}\n legendData={this.legend}\n margins={this.margins}\n columnsCount={this.columnsCount}\n keyColumn={keyColumn}\n xLabels={this.axisLabelsX}\n chartTitle={this.mainTitle}\n onlyPositive={onlyPositive}\n secondaryGrouping={secondaryGrouping}\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","orientation","xAxis","yAxis","captionsSizes","currentRowFacetKeys","facetTitles","chartEdgeSides","facetSettings","currentRow","currentColumn","lastInRow","isVertical","needLeftAxis","needLeftAxisTitle","needBottomAxis","needBottomAxisTitle","yCaptions","yTicks","DEFAULT_TICKS_SIZE","TICK_OFFSET","yAxisTitle","TITLE_LINE","xCaptions","xTicks","xAxisTitle","leftAxisElements","bottomAxisElements","facetTitlesLinesCount","key","MIN_PADDING","FACET_TITLE_OFFSET","FACET_TITLE_LINE","getFacetColumns","facetKeys","nRows","nColumns","result","i","j","getFacetRows","getRowColumn","idx","row","column","isInheritAes","v","ChartRenderer","__publicField","jsx","Fragment","DEFAULT_WIDTH","DEFAULT_HEIGHT","scaleBand","scaleLinear","scaleOrdinal","DEFAULT_AES","_a","node","createRoot","size","primaryKeys","statsData","paddingTop","paddingBottom","statsPadding","getChartStatsPadding","facetCount","maxNRows","maxNCols","width","height","chartWidth","chartHeight","currentLeft","currentTop","res","padding","outerWidth","outerHeight","chartsWidth","chartsHeight","secondaryKeys","layersData","nonEmptyGroupsByFacets","sharedX","sharedY","scaleY","scaleLog","min","meta","geoms","boundsY","max","tempY","facetPrimaryKeys","facetLabels","splitTextByWidth","title","firstChart","lastChart","primaryGrouping","DEFAULT_MAX_WIDTH","getMaxLinesCount","labelsPosition","bandwidth","CAPTION_LINE_HEIGHT","facetKey","scale","defaultWidth","labelsMap","res2","axisKey","label","maxLinesCount","multilineKey","secondaryGrouping","inheritedAes","keys","DEFAULT_COMMON_AES","textMeasurer","TextMeasurer","getMaxStrWidth","strs","o","str","getMultilineMaxStrWidth","xAxisCaptionsWidthByRows","xTail","facetRows","facetColumns","columnFacetKeys","rowFacetKeys","sin45","rowKeys","labels","ticksWidth","ticks","sideTick","lodash","specifier","tick","format","yAxisCaptionsWidth","mainTitleHeight","TITLE_LINE_HEIGHT","TITLE_MARGIN","minMargin","legend","legendHeight","emptySizes","legendItems","layersHasInheritedAesByField","type","field","l","value","getUsedAes","primaryUsedAes","secondaryUsedAes","items","arrangeLegendParts","lastItem","legendWidth","LEGEND_OFFSET","settingsId","chartSettings","keyColumn","onlyPositive","onTooltipHintSwitch","component","ChartsGroup","message","Error"],"mappings":";;;;;;;;;;;;;;;;;AA2BA,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,GACAC,GACAC,GACAC,GACF;AACE,QAAMC,IAAaX,MAAgB,YAC7BY,IACFN,EAAe,SAAS,MAAM,KAC7BK,KAAc,EAACJ,KAAA,QAAAA,EAAe,YAC9B,CAACI,KAAc,EAACJ,KAAA,QAAAA,EAAe,UAC9BM,IAAoBP,EAAe,SAAS,MAAM,KAAKJ,EAAM,UAAU,IACvEY,IACFR,EAAe,SAAS,QAAQ,KAC/BK,KAAc,EAACJ,KAAA,QAAAA,EAAe,YAC9B,CAACI,KAAc,EAACJ,KAAA,QAAAA,EAAe,UAC9BQ,IAAsBT,EAAe,SAAS,QAAQ,KAAKL,EAAM,UAAU,IAE3Ee,IAAYb,EAAc,oBAC1Bc,KAAUf,EAAM,YAAYgB,IAAqB,MAAMhB,EAAM,eAAe,IAAIiB,IAChFC,IAAaP,IAAoBQ,IAAa,GAE9CC,IAAYnB,EAAc,yBAAyBQ,IAAaH,IAAaC,CAAa,GAC1Fc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A,YAAYE,GAAiB;;AACzB,KAAAnH,IAAA,KAAK,cAAL,QAAAA,EAAgB,OAAOR,gBAAAA,EAAAA,IAAC4H,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/discrete/ChartRenderer.tsx"],"sourcesContent":["import { scaleBand, scaleLinear, scaleLog, scaleOrdinal } from 'd3-scale';\nimport lodash from 'lodash';\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, LegendItemDiscreteMultiAes } from '../common/types';\nimport { DataFrameProvider } from '../common/useDataFrame';\nimport { DEFAULT_HEIGHT, DEFAULT_WIDTH, TITLE_LINE_HEIGHT, TITLE_MARGIN } from '../constants';\nimport type { DataFrame, GroupKey } from '../DataFrame';\nimport { DEFAULT_COMMON_AES, DEFAULT_TICKS_SIZE } from '../scatterplot/constants';\nimport type { AesItem, ColumnName, GroupingData, InheritAesDiscrete, Orientation } from '../types';\nimport { arrangeLegendParts } from '../utils/arrangeLegendParts';\nimport { TextMeasurer } from '../utils/TextMeasurer/TextMeasurer';\nimport { ChartsGroup } from './components/ChartsGroup';\nimport type { CaptionsSizes, ChartDimensionsData, ChartSizes, ChartsScales, Margins } from './components/types';\nimport { CAPTION_LINE_HEIGHT, DEFAULT_AES, FACET_TITLE_LINE, FACET_TITLE_OFFSET, LEGEND_OFFSET, MIN_PADDING, TICK_OFFSET, TITLE_LINE } from './constants';\nimport type { DiscreteSettingsImpl } from './DiscreteSettingsImpl';\nimport type { LayerData, StatsData } from './layers/types';\nimport { getChartStatsPadding, splitTextByWidth } from './utils';\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 orientation: Orientation,\n xAxis: DiscreteSettingsImpl['chartSettings']['xAxis'],\n yAxis: DiscreteSettingsImpl['chartSettings']['yAxis'],\n captionsSizes: CaptionsSizes,\n currentRowFacetKeys: string[],\n facetTitles: Record<string, string[]>,\n chartEdgeSides: ('left' | 'right' | 'top' | 'bottom')[],\n facetSettings: DiscreteSettingsImpl['facetSettings'],\n currentRow: number,\n currentColumn: number,\n lastInRow: boolean\n) {\n const isVertical = orientation === 'vertical';\n const needLeftAxis =\n chartEdgeSides.includes('left') ||\n (isVertical && !facetSettings?.sharedY) ||\n (!isVertical && !facetSettings?.sharedX);\n const needLeftAxisTitle = chartEdgeSides.includes('left') && yAxis.title !== '';\n const needBottomAxis =\n chartEdgeSides.includes('bottom') ||\n (isVertical && !facetSettings?.sharedX) ||\n (!isVertical && !facetSettings?.sharedY);\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 const yAxisTitle = needLeftAxisTitle ? TITLE_LINE : 0;\n\n const xCaptions = captionsSizes.xAxisCaptionsWidthByRows[isVertical ? currentRow : currentColumn];\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 = isVertical ? yCaptions + yTicks + yAxisTitle : xCaptions + xTicks + xAxisTitle;\n const bottomAxisElements = isVertical ? xTicks + xCaptions + xAxisTitle : yTicks + 2 * TITLE_LINE;\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 columns\nfunction getFacetColumns(facetKeys: string[], nRows: number, nColumns: number): string[][] {\n const result: string[][] = new Array(nColumns).fill(null).map(() => []);\n for (let i = 0; i < nColumns; i++) {\n for (let j = 0; j < nRows; j++) {\n const facetIdx = j * nColumns + i;\n if (facetIdx < facetKeys.length) {\n result[i].push(facetKeys[j * nColumns + i]);\n }\n }\n }\n return result;\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 isInheritAes(v: InheritAesDiscrete | string | number | boolean): v is InheritAesDiscrete {\n return typeof v === 'object' && 'type' in v;\n}\n\nclass ChartRenderer {\n reactRoot: Root | null = null;\n parentNode: HTMLElement | null = null;\n rootNode: HTMLElement | null = null;\n component: ReactElement = (<></>);\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 // Scale from primary grouping categories to every category x coordinate\n xPrimary: {null: scaleBand().range([0, DEFAULT_WIDTH]).domain(['1'])},\n // Scale from secondary grouping categories to x shift inside corresponding primary group\n xSecondary: {null: scaleBand().range([0, DEFAULT_WIDTH]).domain(['1'])},\n // Scale from y value to y coordinate, by facet\n y: {null: scaleLinear().domain([0, 10]).range([DEFAULT_HEIGHT, 0]).nice()},\n // Scale for link primary grouping category and aesthetics\n xPrimaryAes: scaleOrdinal<string, AesItem, AesItem>().unknown(DEFAULT_AES),\n // Scale for link secondary grouping category and aesthetics\n xSecondaryAes: scaleOrdinal<string, AesItem, AesItem>().unknown(DEFAULT_AES),\n };\n facetTitles: Record<string, string[]> = {}; // can be multiline\n mainTitle: string[] = []; // can be multiline\n axisLabelsX: Record<string, Record<string, string[]>> = {}; // can be multiline\n captionsSizes: CaptionsSizes = {\n xAxisCaptionsWidthByRows: [],\n xCaptionsTail: 0,\n yAxisCaptionsWidth: 100,\n };\n legend: LegendData = {width: 0, height: 0, items: []};\n margins: Margins = {left: 0, right: 0, top: 0, bottom: 0};\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 updateChartSize(\n size: DiscreteSettingsImpl['chartSettings']['size'],\n facetKeys: string[],\n facetSettings: DiscreteSettingsImpl['facetSettings'],\n primaryKeys: GroupKey[],\n orientation: Orientation,\n statsData: StatsData[]\n ) {\n const paddingTop = size.innerOffset;\n const paddingBottom = size.innerOffset;\n // It may be necessary increase chart height/width for p-value\n const statsPadding = getChartStatsPadding(statsData, primaryKeys, size.innerOffset);\n // Use columns/rows count from settings if some of them defined, else make 1 column\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 {width, height} = size;\n // avoid situation when statistics fill all available chart area\n if (orientation === 'vertical' && statsPadding > paddingTop) {\n height += statsPadding;\n }\n if (orientation === 'horizontal' && statsPadding > paddingBottom) {\n width += statsPadding;\n }\n this.chartSizes.chartWidth = width;\n this.chartSizes.chartHeight = height;\n }\n\n updateChartDimensions(\n facetKeys: string[],\n facetSettings: DiscreteSettingsImpl['facetSettings'],\n orientation: Orientation,\n xAxis: DiscreteSettingsImpl['chartSettings']['xAxis'],\n yAxis: DiscreteSettingsImpl['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 orientation,\n xAxis,\n yAxis,\n this.captionsSizes,\n getFacetRows(facetKeys, this.rowsCount, this.columnsCount)[currentRow],\n this.facetTitles,\n chartEdgeSides,\n facetSettings,\n currentRow,\n currentColumn,\n currentColumn === this.columnsCount - 1\n );\n\n const outerWidth = chartWidth + padding.left + padding.right;\n const outerHeight = chartHeight + padding.top + padding.bottom;\n\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\n this.chartSizes.chartsWidth = chartsWidth;\n this.chartSizes.chartsHeight = chartsHeight;\n }\n\n updateViewport(\n orientation: Orientation,\n primaryKeys: string[],\n secondaryKeys: string[],\n facetKeys: string[],\n facetSettings: DiscreteSettingsImpl['facetSettings'],\n yAxis: DiscreteSettingsImpl['chartSettings']['yAxis'],\n layersData: LayerData[],\n statsData: StatsData[],\n size: DiscreteSettingsImpl['chartSettings']['size'],\n nonEmptyGroupsByFacets: Record<string, string[]>,\n ) {\n const paddingBottom = size.innerOffset;\n const isVertical = orientation === 'vertical';\n const statsPadding = getChartStatsPadding(statsData, primaryKeys, size.innerOffset);\n const sharedX = facetSettings === null || facetSettings.sharedX;\n const sharedY = facetSettings === null || facetSettings.sharedY;\n\n const {chartHeight, chartWidth} = this.chartSizes;\n facetKeys.forEach(key => {\n const scaleY = yAxis.scale === 'log' ? scaleLog() : scaleLinear();\n const min = sharedY\n ? Math.min(...layersData.map(({meta}) => meta.minY))\n : Math.min(...layersData.map(({geoms}) => Math.min(...geoms[key].map(({boundsY}) => boundsY.min))));\n const max = sharedY\n ? Math.max(...layersData.map(({meta}) => meta.maxY))\n : Math.max(...layersData.map(({geoms}) => Math.max(...geoms[key].map(({boundsY}) => boundsY.max))));\n\n // supporting scale, it needs to add offsets of fixed size in pixels to general scale Y\n const tempY = scaleY\n .copy()\n .domain([min, max])\n .range(\n isVertical\n ? [chartHeight - paddingBottom, statsPadding]\n : [paddingBottom, chartWidth - statsPadding]\n );\n scaleY\n .domain([tempY.invert(isVertical ? chartHeight : 0), tempY.invert(isVertical ? 0 : chartWidth)])\n .range(isVertical ? [chartHeight, 0] : [0, chartWidth]);\n this.scales.y[key] = scaleY;\n\n const facetPrimaryKeys = sharedX ? primaryKeys : nonEmptyGroupsByFacets[key];\n this.scales.xPrimary[key] = scaleBand()\n .domain(facetPrimaryKeys)\n .range(isVertical ? [0, chartWidth] : [chartHeight, 0]);\n this.scales.xSecondary[key] = scaleBand()\n .domain(secondaryKeys)\n .range([0, this.scales.xPrimary[key].bandwidth()]);\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 createMainTitle(facetKeys: string[], title: DiscreteSettingsImpl['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 createAxisLabels(\n facetKeys: string[],\n xAxis: DiscreteSettingsImpl['chartSettings']['xAxis'],\n primaryGrouping: GroupingData,\n orientation: Orientation\n ) {\n const DEFAULT_MAX_WIDTH = {\n center: 120,\n '45deg': 256,\n '90deg': 320,\n };\n const isVertical = orientation === 'vertical';\n\n function getMaxLinesCount(labelsPosition: 'center' | '45deg' | '90deg', bandwidth: number) {\n if (labelsPosition === 'center') {\n return Infinity;\n }\n if (labelsPosition === '45deg') {\n return Math.floor((bandwidth * Math.sin(Math.PI / 4)) / CAPTION_LINE_HEIGHT);\n }\n return Math.floor(bandwidth / CAPTION_LINE_HEIGHT);\n }\n\n this.axisLabelsX = facetKeys.reduce((res: Record<string, Record<string, string[]>>, facetKey) => {\n const scale = this.scales.xPrimary[facetKey];\n const bandwidth = scale.bandwidth();\n const defaultWidth = DEFAULT_MAX_WIDTH[xAxis.labelsPosition];\n const width = xAxis.labelsPosition === 'center' ? Math.min(defaultWidth, bandwidth) : defaultWidth;\n const labelsMap = primaryGrouping.valueLabels;\n res[facetKey] = scale.domain().reduce((res2: Record<string, string[]>, axisKey) => {\n if (xAxis.hiddenLabels) {\n res2[axisKey] = [];\n return res2;\n }\n const label = labelsMap[axisKey];\n if (!isVertical) {\n res2[axisKey] = [label];\n } else {\n const maxLinesCount = getMaxLinesCount(xAxis.labelsPosition, bandwidth);\n const multilineKey = splitTextByWidth(label, width, 14);\n res2[axisKey] = multilineKey.length > maxLinesCount ? [label] : multilineKey;\n }\n return res2;\n }, {});\n return res;\n }, {});\n }\n\n updateAesScales(primaryGrouping: GroupingData, secondaryGrouping: GroupingData) {\n if (primaryGrouping.inheritedAes) {\n const {inheritedAes, keys} = primaryGrouping;\n this.scales.xPrimaryAes.domain(keys).range(keys.map(key => inheritedAes[key] ?? DEFAULT_COMMON_AES));\n } else {\n this.scales.xPrimaryAes.domain([]).range([]);\n }\n if (secondaryGrouping.inheritedAes) {\n const {inheritedAes, keys} = secondaryGrouping;\n this.scales.xSecondaryAes.domain(keys).range(keys.map(key => inheritedAes[key] ?? DEFAULT_COMMON_AES));\n } else {\n this.scales.xSecondaryAes.domain([]).range([]);\n }\n }\n\n updateCaptionsSize(\n orientation: Orientation,\n facetKeys: string[],\n xAxis: DiscreteSettingsImpl['chartSettings']['xAxis'],\n yAxis: DiscreteSettingsImpl['chartSettings']['yAxis'],\n ) {\n const LABEL_FONT_SIZE = 14;\n const textMeasurer = new TextMeasurer(`600 ${LABEL_FONT_SIZE}px Manrope`);\n const isVertical = orientation === 'vertical';\n\n function getMaxStrWidth(strs: string[]) {\n if (!strs.length) {\n return 0;\n }\n return Math.max(...strs.map(str => textMeasurer.getTextWidth(str)));\n }\n\n function getMultilineMaxStrWidth(strs: string[][]) {\n if (!strs.length) {\n return 0;\n }\n return Math.max(...strs.map(getMaxStrWidth));\n }\n\n // x ticks are always strings and can have variable width in different facets, and can be rotated;\n // for x we consider the widest tick caption in row (column for horizontal orientation);\n // y ticks are always numbers, and we consider only the widest number of all facets\n // because numbers sizes are closer to each other, and it makes more equal facets grid without superwide empty offsets\n let xAxisCaptionsWidthByRows: number[] = [];\n let xTail = 0;\n\n const facetRows = getFacetRows(facetKeys, this.rowsCount, this.columnsCount);\n const facetColumns = getFacetColumns(facetKeys, this.rowsCount, this.columnsCount);\n if (!isVertical) {\n // with horizontal chart orientation X ticks are always in horizontal position\n xAxisCaptionsWidthByRows = facetColumns\n // max of ticks width in every facet's column\n .map(columnFacetKeys =>\n Math.max(\n ...columnFacetKeys.map(facetKey =>\n getMultilineMaxStrWidth(\n this.scales.xPrimary[facetKey]\n .domain()\n .map(axisKey => this.axisLabelsX[facetKey][axisKey])\n )\n )\n )\n );\n } else {\n if (xAxis.labelsPosition === 'center') {\n xAxisCaptionsWidthByRows = facetRows.map(rowFacetKeys =>\n Math.max(\n ...rowFacetKeys.map(facetKey =>\n Math.max(\n ...this.scales.xPrimary[facetKey]\n .domain()\n // do not consider empty ticks captions, for example - single group\n .map(axisKey =>\n axisKey ? this.axisLabelsX[facetKey][axisKey].length * CAPTION_LINE_HEIGHT : 0\n )\n )\n )\n )\n );\n }\n if (xAxis.labelsPosition === '45deg') {\n const sin45 = Math.sin(Math.PI / 4);\n xAxisCaptionsWidthByRows = facetRows.map(rowKeys => {\n return Math.max(\n ...rowKeys.map(key => {\n const labels = this.scales.xPrimary[key]\n .domain()\n .map(axisKey => this.axisLabelsX[key][axisKey]);\n const ticksWidth = getMultilineMaxStrWidth(labels);\n return ticksWidth > 0 ? ticksWidth * sin45 + LABEL_FONT_SIZE : 0;\n })\n );\n });\n xTail = Math.max(\n ...facetColumns[0].map(facetKey => {\n const ticks = this.scales.xPrimary[facetKey].domain();\n const sideTick = this.axisLabelsX[facetKey][ticks[0]];\n return Math.max(\n getMaxStrWidth(sideTick) * sin45 -\n this.scales.xPrimary[facetKey].bandwidth() / 2 +\n LABEL_FONT_SIZE,\n 0\n );\n })\n );\n }\n if (xAxis.labelsPosition === '90deg') {\n xAxisCaptionsWidthByRows = facetRows\n // max of ticks width in every facet's row\n .map(rowKeys =>\n Math.max(\n ...rowKeys.map(facetKey =>\n getMultilineMaxStrWidth(\n this.scales.xPrimary[facetKey]\n .domain()\n .map(axisKey => this.axisLabelsX[facetKey][axisKey])\n )\n )\n )\n );\n }\n }\n\n const yTicks = lodash.flatten(\n facetKeys.map(facetKey => {\n if (yAxis.hiddenLabels) {\n return [];\n }\n const scaleY = this.scales.y[facetKey];\n const ticks = scaleY.ticks();\n const specifier = ticks.some(tick => (Math.abs(tick) < 0.0001 && tick !== 0) || tick > 10000)\n ? ',e'\n : ',f';\n const format = scaleY.tickFormat(10, specifier);\n return ticks.map(format);\n })\n );\n const yAxisCaptionsWidth = getMaxStrWidth(yTicks);\n\n this.captionsSizes = {\n xCaptionsTail: xTail,\n xAxisCaptionsWidthByRows,\n yAxisCaptionsWidth,\n };\n }\n\n updateMargins(orientation: Orientation, facetKeys: string[], size:DiscreteSettingsImpl['chartSettings']['size']) {\n const firstChart = this.chartsDimensions[facetKeys[0]];\n const lastChart = this.chartsDimensions[facetKeys[facetKeys.length - 1]];\n const isVertical = orientation === 'vertical';\n\n const mainTitleHeight = this.mainTitle.length ? TITLE_LINE_HEIGHT * this.mainTitle.length + TITLE_MARGIN * 2 : 0;\n const minMargin = size.outerOffset;\n this.margins = {\n left: Math.max(minMargin, isVertical ? this.captionsSizes.xCaptionsTail - firstChart.padding.left : 0),\n right: this.legend.width + minMargin,\n top: Math.max(mainTitleHeight, minMargin),\n bottom: Math.max(minMargin, isVertical ? 0 : this.captionsSizes.xCaptionsTail - lastChart.padding.bottom),\n };\n this.chartSizes.totalWidth = this.margins.left + this.chartSizes.chartsWidth + this.margins.right;\n this.chartSizes.totalHeight =\n this.margins.top + Math.max(this.chartSizes.chartsHeight, this.legend.height) + this.margins.bottom;\n }\n\n updateLegendSize(\n legend: DiscreteSettingsImpl['chartSettings']['legend'],\n primaryGrouping: GroupingData,\n secondaryGrouping: GroupingData,\n layersData: LayerData[]\n ) {\n if (!legend.show) {\n this.legend = {width: 0, height: 0, items: []};\n return;\n }\n const legendHeight = this.chartSizes.chartHeight;\n const emptySizes = {width:0, height:0, left:0, top: 0};\n const legendItems: LegendItemDiscreteMultiAes[] = [];\n\n function layersHasInheritedAesByField(\n type: 'primaryGrouping' | 'secondaryGrouping',\n field: keyof LegendItemDiscreteMultiAes['usedAes']\n ) {\n return layersData.some(l => {\n const value = l.aes[field as keyof typeof l.aes];\n return value && isInheritAes(value) && value.type === type;\n });\n }\n function getUsedAes(type: 'primaryGrouping' | 'secondaryGrouping'): LegendItemDiscreteMultiAes['usedAes'] {\n return {\n dotFill: layersHasInheritedAesByField(type, 'dotFill'),\n fillColor: layersHasInheritedAesByField(type, 'fillColor'),\n lineColor: layersHasInheritedAesByField(type, 'lineColor'),\n dotShape: layersHasInheritedAesByField(type, 'dotShape'),\n lineShape: layersHasInheritedAesByField(type, 'lineShape'),\n };\n }\n const primaryUsedAes = getUsedAes('primaryGrouping');\n const secondaryUsedAes = getUsedAes('secondaryGrouping');\n if (Object.values(primaryUsedAes).some(v => v) && primaryGrouping.inheritedAes) {\n legendItems.push({\n type: 'discreteMulti',\n id: 'primary',\n title: primaryGrouping.label,\n scale: this.scales.xPrimaryAes,\n values: primaryGrouping.keys,\n labels: primaryGrouping.valueLabels,\n usedAes: primaryUsedAes,\n ...emptySizes,\n });\n }\n if (Object.values(secondaryUsedAes).some(v => v) && secondaryGrouping.inheritedAes) {\n legendItems.push({\n type: 'discreteMulti',\n id: 'secondary',\n title: secondaryGrouping.label,\n scale: this.scales.xSecondaryAes,\n values: secondaryGrouping.keys,\n labels: secondaryGrouping.valueLabels,\n usedAes: secondaryUsedAes,\n ...emptySizes\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 const lastItem = items[items.length - 1];\n const legendWidth = lastItem.left + lastItem.width + LEGEND_OFFSET;\n\n this.legend = {\n width: legendWidth,\n height: legendHeight,\n items\n };\n }\n\n render(\n dataFrame: DataFrame,\n settingsId: string,\n chartSettings: DiscreteSettingsImpl['chartSettings'],\n primaryGrouping: GroupingData,\n secondaryGrouping: GroupingData,\n facetSettings: DiscreteSettingsImpl['facetSettings'],\n facetKeys: string[],\n facetLabels: string[][],\n layersData: LayerData[],\n statsData: StatsData[],\n keyColumn: ColumnName | null,\n nonEmptyGroupsByFacets: Record<string, string[]>,\n onlyPositive: boolean,\n onTooltipHintSwitch: (v:boolean) => void\n ) {\n const {orientation, xAxis, yAxis, size} = chartSettings;\n this.updateChartSize(size, facetKeys, facetSettings, primaryGrouping.keys, orientation, statsData);\n this.updateViewport(\n orientation,\n primaryGrouping.keys,\n secondaryGrouping.keys,\n facetKeys,\n facetSettings,\n yAxis,\n layersData,\n statsData,\n size,\n nonEmptyGroupsByFacets\n );\n this.createAxisLabels(facetKeys, xAxis, primaryGrouping, orientation);\n this.createFacetTitles(facetKeys, facetLabels);\n this.updateCaptionsSize(orientation, facetKeys, xAxis, yAxis);\n this.updateChartDimensions(facetKeys, facetSettings, orientation, xAxis, yAxis);\n this.updateLegendSize(chartSettings.legend, primaryGrouping, secondaryGrouping, layersData);\n this.createMainTitle(facetKeys, chartSettings.title);\n this.updateMargins(orientation, facetKeys, size);\n this.updateAesScales(primaryGrouping, secondaryGrouping);\n\n const component = (\n <DataFrameProvider dataFrame={dataFrame}>\n <ChartsGroup\n settingsId={settingsId}\n chartSettings={chartSettings}\n facetKeys={facetKeys}\n facetSettings={facetSettings}\n facetTitles={this.facetTitles}\n chartSizes={this.chartSizes}\n chartsDimensions={this.chartsDimensions}\n scales={this.scales}\n layersData={layersData}\n statsData={statsData}\n legendData={this.legend}\n margins={this.margins}\n columnsCount={this.columnsCount}\n keyColumn={keyColumn}\n xLabels={this.axisLabelsX}\n chartTitle={this.mainTitle}\n onlyPositive={onlyPositive}\n secondaryGrouping={secondaryGrouping}\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","orientation","xAxis","yAxis","captionsSizes","currentRowFacetKeys","facetTitles","chartEdgeSides","facetSettings","currentRow","currentColumn","lastInRow","isVertical","needLeftAxis","needLeftAxisTitle","needBottomAxis","needBottomAxisTitle","yCaptions","yTicks","DEFAULT_TICKS_SIZE","TICK_OFFSET","yAxisTitle","TITLE_LINE","xCaptions","xTicks","xAxisTitle","leftAxisElements","bottomAxisElements","facetTitlesLinesCount","key","MIN_PADDING","FACET_TITLE_OFFSET","FACET_TITLE_LINE","getFacetColumns","facetKeys","nRows","nColumns","result","i","j","getFacetRows","getRowColumn","idx","row","column","isInheritAes","v","ChartRenderer","__publicField","jsx","Fragment","DEFAULT_WIDTH","DEFAULT_HEIGHT","scaleBand","scaleLinear","scaleOrdinal","DEFAULT_AES","_a","node","createRoot","size","primaryKeys","statsData","paddingTop","paddingBottom","statsPadding","getChartStatsPadding","facetCount","maxNRows","maxNCols","width","height","chartWidth","chartHeight","currentLeft","currentTop","res","padding","outerWidth","outerHeight","chartsWidth","chartsHeight","secondaryKeys","layersData","nonEmptyGroupsByFacets","sharedX","sharedY","scaleY","scaleLog","min","meta","geoms","boundsY","max","tempY","facetPrimaryKeys","facetLabels","splitTextByWidth","title","firstChart","lastChart","primaryGrouping","DEFAULT_MAX_WIDTH","getMaxLinesCount","labelsPosition","bandwidth","CAPTION_LINE_HEIGHT","facetKey","scale","defaultWidth","labelsMap","res2","axisKey","label","maxLinesCount","multilineKey","secondaryGrouping","inheritedAes","keys","DEFAULT_COMMON_AES","textMeasurer","TextMeasurer","getMaxStrWidth","strs","str","getMultilineMaxStrWidth","xAxisCaptionsWidthByRows","xTail","facetRows","facetColumns","columnFacetKeys","rowFacetKeys","sin45","rowKeys","labels","ticksWidth","ticks","sideTick","lodash","specifier","tick","format","yAxisCaptionsWidth","mainTitleHeight","TITLE_LINE_HEIGHT","TITLE_MARGIN","minMargin","legend","legendHeight","emptySizes","legendItems","layersHasInheritedAesByField","type","field","l","value","getUsedAes","primaryUsedAes","secondaryUsedAes","items","arrangeLegendParts","lastItem","legendWidth","LEGEND_OFFSET","dataFrame","settingsId","chartSettings","keyColumn","onlyPositive","onTooltipHintSwitch","component","DataFrameProvider","ChartsGroup","message","Error"],"mappings":";;;;;;;;;;;;;;;;;;AAqBA,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,GACAC,GACAC,GACAC,GACF;AACE,QAAMC,IAAaX,MAAgB,YAC7BY,IACFN,EAAe,SAAS,MAAM,KAC7BK,KAAc,EAACJ,KAAA,QAAAA,EAAe,YAC9B,CAACI,KAAc,EAACJ,KAAA,QAAAA,EAAe,UAC9BM,IAAoBP,EAAe,SAAS,MAAM,KAAKJ,EAAM,UAAU,IACvEY,IACFR,EAAe,SAAS,QAAQ,KAC/BK,KA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YAAA2E;AAAAA,QACA,WAAArB;AAAAA,QACA,YAAY,KAAK;AAAA,QACjB,SAAS,KAAK;AAAA,QACd,cAAc,KAAK;AAAA,QACnB,WAAAyG;AAAAA,QACA,SAAS,KAAK;AAAA,QACd,YAAY,KAAK;AAAA,QACjB,cAAAC;AAAAA,QACA,mBAAApD;AAAAA,QACA,qBAAAqD;AAAAA,MAAA;AAAA,IAAA,GAER;AAEJ,SAAK,YAAYC,IACjBjH,IAAA,KAAK,cAAL,QAAAA,EAAgB,OAAOiH,CAAAA;AAAAA,EAC3B;AAAA,EAEA,YAAYG,GAAiB;;AACzB,KAAApH,IAAA,KAAK,cAAL,QAAAA,EAAgB,OAAOR,gBAAAA,EAAAA,IAAC6H,GAAA,EAAM,SAAAD,EAAAA,CAAkB,CAAA;AAAA,EACpD;AACJ;","x_google_ignoreList":[0]}
@@ -1,14 +1,14 @@
1
1
  import { DEFAULT_HEIGHT_SMALL as C, DEFAULT_HEIGHT as g, DEFAULT_WIDTH_SMALL as L, DEFAULT_WIDTH as S, BLACK as a } from "../constants.js";
2
- import { PADDINGS as b, MIN_MARGIN as x } from "./constants.js";
3
2
  import "../types/common.js";
4
- import { DiscreteSettingsSchema as k } from "../types/discrete.js";
3
+ import { DiscreteSettingsSchema as b } from "../types/discrete.js";
5
4
  import "../types/scatterplot.js";
6
5
  import "../types/heatmap.js";
7
6
  import "../types/dendro.js";
8
7
  import "../types/histogram.js";
9
8
  import "../types/bubble.js";
10
- import { exhaustive as z } from "../utils/index.js";
11
- import O from "../node_modules/lodash/lodash.js";
9
+ import { PADDINGS as x, MIN_MARGIN as k } from "./constants.js";
10
+ import z from "../node_modules/lodash/lodash.js";
11
+ import { exhaustive as O } from "../utils/index.js";
12
12
  var E = Object.defineProperty, F = (i, t, o) => t in i ? E(i, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : i[t] = o, e = (i, t, o) => F(i, typeof t != "symbol" ? t + "" : t, o);
13
13
  const p = "#3e9838", n = "21", h = 3;
14
14
  class r {
@@ -180,7 +180,7 @@ class V extends r {
180
180
  return t.type === "logo" && t.normalize === this.normalize;
181
181
  }
182
182
  }
183
- class W extends r {
183
+ class M extends r {
184
184
  constructor(t) {
185
185
  super(), e(this, "type", "binnedDots"), e(this, "method"), e(this, "position"), e(this, "keyColumn"), e(this, "aes", {
186
186
  showOutliers: !0,
@@ -199,7 +199,7 @@ class W extends r {
199
199
  return t.type === "binnedDots" && this.method === t.method && this.position === t.position && ((o = this.keyColumn) == null ? void 0 : o.value) === ((l = t.keyColumn) == null ? void 0 : l.value);
200
200
  }
201
201
  }
202
- class I extends r {
202
+ class W extends r {
203
203
  constructor(t) {
204
204
  super(), e(this, "type", "pairedPoints"), e(this, "linkColumn"), e(this, "aes", {
205
205
  showOutliers: !0,
@@ -219,7 +219,7 @@ class I extends r {
219
219
  return t.type === "pairedPoints" && this.aes.showOutliers === t.aes.showOutliers && this.linkColumn.value === t.linkColumn.value;
220
220
  }
221
221
  }
222
- class M extends r {
222
+ class I extends r {
223
223
  constructor(t) {
224
224
  super(), e(this, "type", "sina"), e(this, "aes", {
225
225
  showOutliers: !0,
@@ -254,7 +254,7 @@ class Z {
254
254
  constructor(t) {
255
255
  e(this, "id"), e(this, "type", "discrete"), e(this, "y"), e(this, "keyColumn"), e(this, "primaryGrouping"), e(this, "secondaryGrouping"), e(this, "facetSettings"), e(this, "facetBy"), e(this, "chartSettings"), e(this, "layers");
256
256
  var o, l, u, d, c, y, m, f, w, v;
257
- k.parse(t), this.id = O.uniqueId("settings"), this.y = t.y, this.keyColumn = t.keyColumn ?? null, this.primaryGrouping = t.primaryGrouping ?? null, this.secondaryGrouping = t.secondaryGrouping ?? null, this.facetSettings = {
257
+ b.parse(t), this.id = z.uniqueId("settings"), this.y = t.y, this.keyColumn = t.keyColumn ?? null, this.primaryGrouping = t.primaryGrouping ?? null, this.secondaryGrouping = t.secondaryGrouping ?? null, this.facetSettings = {
258
258
  sharedX: !0,
259
259
  sharedY: !0,
260
260
  titlePosition: "left",
@@ -263,8 +263,8 @@ class Z {
263
263
  size: {
264
264
  width: ((o = t == null ? void 0 : t.size) == null ? void 0 : o.width) ?? (this.facetBy.length ? L : S),
265
265
  height: ((l = t == null ? void 0 : t.size) == null ? void 0 : l.height) ?? (this.facetBy.length ? C : g),
266
- outerOffset: ((u = t == null ? void 0 : t.size) == null ? void 0 : u.outerOffset) ?? x,
267
- innerOffset: ((d = t == null ? void 0 : t.size) == null ? void 0 : d.innerOffset) ?? b.TOP
266
+ outerOffset: ((u = t == null ? void 0 : t.size) == null ? void 0 : u.outerOffset) ?? k,
267
+ innerOffset: ((d = t == null ? void 0 : t.size) == null ? void 0 : d.innerOffset) ?? x.TOP
268
268
  },
269
269
  title: {
270
270
  position: "center",
@@ -327,28 +327,28 @@ class Z {
327
327
  if (s.type === "stat")
328
328
  return new _(s);
329
329
  if (s.type === "binnedDots")
330
- return new W(s);
330
+ return new M(s);
331
331
  if (s.type === "pairedPoints")
332
- return new I(s);
332
+ return new W(s);
333
333
  if (s.type === "sina")
334
- return new M(s);
334
+ return new I(s);
335
335
  if (s.type === "logo")
336
336
  return new V(s);
337
- z(s, "Unknown layer type");
337
+ O(s, "Unknown layer type");
338
338
  }).filter(Boolean);
339
339
  }
340
340
  }
341
341
  export {
342
342
  A as BarLayer,
343
- W as BinnedDotsLayer,
343
+ M as BinnedDotsLayer,
344
344
  G as BoxLayer,
345
345
  Z as DiscreteSettingsImpl,
346
346
  T as DotLayer,
347
347
  q as ErrorBarLayer,
348
348
  D as LineLayer,
349
349
  V as LogoPlotLayer,
350
- I as PairedPointsLayer,
351
- M as SinaLayer,
350
+ W as PairedPointsLayer,
351
+ I as SinaLayer,
352
352
  P as StackedBarLayer,
353
353
  _ as StatLayer,
354
354
  B as ViolinLayer
@@ -1 +1 @@
1
- {"version":3,"file":"DiscreteSettingsImpl.js","sources":["../../../../../../node_modules/@milaboratories/miplots4/src/discrete/DiscreteSettingsImpl.ts"],"sourcesContent":["import {BLACK, DEFAULT_HEIGHT, DEFAULT_HEIGHT_SMALL, DEFAULT_WIDTH, DEFAULT_WIDTH_SMALL} from '../constants';\nimport {MIN_MARGIN, PADDINGS} from './constants';\nimport {DiscreteSettingsSchema} from '../types';\nimport type {\n AesMap,\n Color,\n ColumnName,\n DataValue,\n DiscreteSettings,\n FrameType,\n InheritAesDiscrete,\n LegendPosition,\n LineShape,\n Orientation,\n BarLayer as OuterBarLayer,\n BinnedDotsLayer as OuterBinnedDotsLayer,\n BoxLayer as OuterBoxLayer,\n DotLayer as OuterDotLayer,\n ErrorBarLayer as OuterErrorBarLayer,\n LineLayer as OuterLineLayer,\n LogoPlotLayer as OuterLogoPlotLayer,\n PairedPointsLayer as OuterPairedPointsLayer,\n SinaLayer as OuterSinaLayer,\n StackedBarLayer as OuterStackedBarLayer,\n StatLayer as OuterStatLayer,\n ViolinLayer as OuterViolinLayer,\n PointShape,\n PValueCorrectionMethod,\n SettingsInterface,\n SignificanceLevels,\n StatTestMethod,\n SummaryErrorValue,\n SummaryGroupValue,\n TitlePosition,\n} from '../types';\n\nimport {exhaustive} from '../utils';\nimport lodash from 'lodash';\n\nconst DEFAULT_FILL = '#3e9838';\nconst DEFAULT_DOT_SHAPE = '21';\nconst DEFAULT_DOT_SIZE = 3;\n\nabstract class BaseDiscreteLayer {\n abstract type: string;\n abstract isEqualForCalculation(otherLayer: DiscreteLayer): boolean;\n}\n\nexport class BoxLayer extends BaseDiscreteLayer {\n readonly type = 'box';\n readonly stat: {\n upper: number;\n medium: number;\n lower: number;\n k: number;\n } = {\n upper: 0.75,\n medium: 0.5,\n lower: 0.25,\n k: 1.5,\n };\n readonly aes: {\n showOutliers: boolean;\n boxWidth: 'auto' | number;\n dotShape: InheritAesDiscrete | PointShape;\n dotSize: InheritAesDiscrete | number;\n dotFill: InheritAesDiscrete | string;\n lineColor: InheritAesDiscrete | string;\n fillColor: InheritAesDiscrete | string;\n lineWidth: number;\n lineShape: LineShape;\n opacity: number;\n } = {\n showOutliers: true,\n boxWidth: 'auto',\n dotShape: DEFAULT_DOT_SHAPE,\n dotFill: BLACK,\n dotSize: DEFAULT_DOT_SIZE,\n lineColor: BLACK,\n fillColor: DEFAULT_FILL,\n lineWidth: 1,\n lineShape: 'solid',\n opacity: 1,\n };\n\n constructor(layer: OuterBoxLayer) {\n super();\n this.stat = {\n ...this.stat,\n ...layer.stat,\n };\n this.aes = {\n ...this.aes,\n ...layer.aes,\n };\n }\n\n isEqualForCalculation(otherLayer: DiscreteLayer) {\n return (\n otherLayer.type === 'box' &&\n (Object.keys(this.stat) as (keyof BoxLayer['stat'])[]).every(key => this.stat[key] === otherLayer.stat[key])\n );\n }\n}\n\nexport class ViolinLayer extends BaseDiscreteLayer {\n readonly type = 'violin';\n readonly stat: {\n bandwidth: 'auto' | number;\n stepsCount: 'auto' | number;\n trim: boolean;\n } = {\n bandwidth: 'auto',\n stepsCount: 40,\n trim: true,\n };\n readonly aes: {\n width: 'auto' | number;\n lineColor: InheritAesDiscrete | string;\n fillColor: InheritAesDiscrete | string;\n lineWidth: number;\n lineShape: LineShape;\n opacity: number;\n showQuartiles: boolean;\n medianLineStyle: LineShape;\n quartilesLineStyle: LineShape;\n } = {\n width: 'auto',\n lineColor: BLACK,\n fillColor: DEFAULT_FILL,\n lineWidth: 1,\n lineShape: 'solid',\n opacity: 1,\n showQuartiles: true,\n medianLineStyle: 'solid',\n quartilesLineStyle: 'dashed'\n };\n\n constructor(layer: OuterViolinLayer) {\n super();\n this.stat = {\n ...this.stat,\n ...layer.stat,\n };\n this.aes = {\n ...this.aes,\n ...layer.aes,\n };\n }\n\n isEqualForCalculation(otherLayer: DiscreteLayer) {\n return (\n otherLayer.type === 'violin' && (\n this.stat.bandwidth !== otherLayer.stat.bandwidth ||\n this.stat.trim !== otherLayer.stat.trim ||\n this.stat.stepsCount !== otherLayer.stat.stepsCount\n )\n );\n }\n}\n\nexport class DotLayer extends BaseDiscreteLayer {\n readonly type = 'dot';\n readonly aes: {\n showOutliers: boolean;\n jitter: number;\n dotFill: InheritAesDiscrete | string;\n lineColor: InheritAesDiscrete | string;\n dotShape: InheritAesDiscrete | PointShape;\n dotSize: number;\n opacity: number;\n } = {\n showOutliers: true,\n jitter: 0.8,\n lineColor: 'none',\n dotFill: BLACK,\n dotShape: DEFAULT_DOT_SHAPE,\n dotSize: DEFAULT_DOT_SIZE,\n opacity: 1,\n };\n\n constructor(layer: OuterDotLayer) {\n super();\n this.aes = {\n ...this.aes,\n ...layer.aes,\n };\n }\n\n isEqualForCalculation(otherLayer: DiscreteLayer) {\n return otherLayer.type === 'dot' && this.aes.showOutliers === otherLayer.aes.showOutliers;\n }\n}\n\nexport class LineLayer extends BaseDiscreteLayer {\n readonly type = 'line';\n readonly pointsValues: SummaryGroupValue;\n readonly aes: {\n showOutliers: boolean;\n lineWidth: number;\n lineColor: InheritAesDiscrete | string;\n fillColor: InheritAesDiscrete | string;\n lineShape: InheritAesDiscrete | LineShape;\n dotShape: InheritAesDiscrete | PointShape;\n dotSize: number;\n opacity: number;\n } = {\n showOutliers: true,\n lineWidth: 1,\n lineShape: 'solid',\n fillColor: 'none',\n lineColor: BLACK,\n dotShape: DEFAULT_DOT_SHAPE,\n dotSize: DEFAULT_DOT_SIZE,\n opacity: 1,\n };\n\n constructor(layer: OuterLineLayer) {\n super();\n this.pointsValues = layer.pointsValues;\n this.aes = {\n ...this.aes,\n ...layer.aes,\n };\n }\n\n isEqualForCalculation(otherLayer: DiscreteLayer) {\n return otherLayer.type === 'line' && this.pointsValues === otherLayer.pointsValues;\n }\n}\n\nexport class ErrorBarLayer extends BaseDiscreteLayer {\n readonly type = 'errorbar';\n readonly pointsValues: SummaryGroupValue;\n readonly interval: SummaryErrorValue;\n readonly aes: {\n showDots: boolean;\n width: number | 'auto';\n lineWidth: number;\n lineColor: InheritAesDiscrete | string;\n fillColor: InheritAesDiscrete | string;\n dotShape: InheritAesDiscrete | PointShape;\n dotSize: number;\n opacity: number;\n } = {\n showDots: true,\n width: 'auto',\n lineWidth: 1,\n fillColor: 'none',\n lineColor: BLACK,\n dotShape: DEFAULT_DOT_SHAPE,\n dotSize: DEFAULT_DOT_SIZE,\n opacity: 1,\n };\n\n constructor(layer: OuterErrorBarLayer) {\n super();\n this.pointsValues = layer.pointsValues;\n this.interval = layer.interval;\n this.aes = {\n ...this.aes,\n ...layer.aes,\n };\n }\n\n isEqualForCalculation(otherLayer: DiscreteLayer) {\n return (\n otherLayer.type === 'errorbar' &&\n this.pointsValues === otherLayer.pointsValues &&\n this.interval === otherLayer.interval\n );\n }\n}\n\nexport class BarLayer extends BaseDiscreteLayer {\n readonly type = 'bar';\n readonly height: 'min' | 'max' | 'median' | 'mean';\n readonly aes: {\n width: number | 'auto';\n lineColor: InheritAesDiscrete | Color;\n fillColor: InheritAesDiscrete | Color;\n lineWidth: number;\n opacity: number;\n } = {\n width: 'auto',\n lineWidth: 1,\n fillColor: 'none',\n lineColor: BLACK,\n opacity: 1,\n };\n\n constructor(layer: OuterBarLayer) {\n super();\n this.height = layer.height ?? 'max';\n this.aes = {\n ...this.aes,\n ...layer.aes,\n };\n }\n\n isEqualForCalculation(otherLayer: DiscreteLayer) {\n return otherLayer.type === 'bar' && this.height === otherLayer.height;\n }\n}\n\nexport class StackedBarLayer extends BaseDiscreteLayer {\n readonly type = 'stackedBar';\n readonly normalize: boolean = false;\n readonly aes: {\n width: number | 'auto';\n lineColor: InheritAesDiscrete | Color;\n fillColor: InheritAesDiscrete | Color;\n lineWidth: number;\n opacity: number;\n } = {\n width: 'auto',\n lineWidth: 1,\n fillColor: DEFAULT_FILL,\n lineColor: 'none',\n opacity: 1,\n };\n\n constructor(layer: OuterStackedBarLayer) {\n super();\n this.normalize = layer.normalize ?? false;\n this.aes = {\n ...this.aes,\n ...layer.aes,\n };\n }\n\n isEqualForCalculation(otherLayer: DiscreteLayer) {\n return otherLayer.type === 'stackedBar' && otherLayer.normalize === this.normalize;\n }\n}\n\nexport class LogoPlotLayer extends BaseDiscreteLayer {\n readonly type = 'logo';\n readonly normalize: boolean = false;\n readonly aes: {\n width: number | 'auto';\n fillColor: Record<string, string> | Color;\n lineColor: Color;\n opacity: number;\n } = {\n width: 'auto',\n fillColor: DEFAULT_FILL,\n lineColor: 'none',\n opacity: 1,\n };\n\n constructor(layer: OuterLogoPlotLayer) {\n super();\n this.normalize = layer.normalize ?? false;\n this.aes = {\n ...this.aes,\n ...layer.aes,\n };\n }\n\n isEqualForCalculation(otherLayer: DiscreteLayer) {\n return otherLayer.type === 'logo' && otherLayer.normalize === this.normalize;\n }\n}\n\nexport class BinnedDotsLayer extends BaseDiscreteLayer {\n readonly type = 'binnedDots';\n readonly method: 'dotdensity' | 'histodot';\n readonly position: 'stack' | 'jitter';\n readonly keyColumn: ColumnName | null;\n readonly aes: {\n showOutliers: boolean;\n width: number | 'auto';\n lineColor: InheritAesDiscrete | Color;\n fillColor: InheritAesDiscrete | Color;\n dotSize?: number;\n lineWidth: number;\n opacity: number;\n } = {\n showOutliers: true,\n width: 'auto',\n lineWidth: 1,\n fillColor: 'none',\n lineColor: BLACK,\n opacity: 1,\n };\n\n constructor(layer: OuterBinnedDotsLayer) {\n super();\n this.method = layer.method ?? 'dotdensity';\n this.position = layer.position ?? 'stack';\n this.keyColumn = layer.keyColumn ?? null;\n this.aes = {\n ...this.aes,\n ...layer.aes,\n };\n }\n\n isEqualForCalculation(otherLayer: DiscreteLayer) {\n return (\n otherLayer.type === 'binnedDots' &&\n this.method === otherLayer.method &&\n this.position === otherLayer.position &&\n this.keyColumn?.value === otherLayer.keyColumn?.value\n );\n }\n}\n\nexport class PairedPointsLayer extends BaseDiscreteLayer {\n readonly type = 'pairedPoints';\n readonly linkColumn: ColumnName;\n readonly aes: {\n showOutliers: boolean;\n lineColor: InheritAesDiscrete | Color;\n lineWidth: number;\n lineShape: LineShape;\n dotFill: InheritAesDiscrete | Color;\n dotSize: number;\n dotShape: PointShape;\n opacity: number;\n } = {\n showOutliers: true,\n lineWidth: 1,\n lineColor: BLACK,\n lineShape: 'solid',\n dotFill: BLACK,\n dotSize: DEFAULT_DOT_SIZE,\n dotShape: DEFAULT_DOT_SHAPE,\n opacity: 1,\n };\n\n constructor(layer: OuterPairedPointsLayer) {\n super();\n this.linkColumn = layer.linkColumn;\n this.aes = {\n ...this.aes,\n ...layer.aes,\n };\n }\n\n isEqualForCalculation(otherLayer: DiscreteLayer) {\n return (\n otherLayer.type === 'pairedPoints' &&\n this.aes.showOutliers === otherLayer.aes.showOutliers &&\n this.linkColumn.value === otherLayer.linkColumn.value\n );\n }\n}\n\nexport class SinaLayer extends BaseDiscreteLayer {\n readonly type = 'sina';\n readonly aes: {\n showOutliers: boolean;\n width: number | 'auto';\n dotFill: InheritAesDiscrete | Color;\n dotSize: number;\n dotShape: InheritAesDiscrete | PointShape;\n opacity: number;\n } = {\n showOutliers: true,\n width: 'auto',\n dotFill: DEFAULT_FILL,\n dotSize: DEFAULT_DOT_SIZE,\n dotShape: DEFAULT_DOT_SHAPE,\n opacity: 1,\n };\n\n constructor(layer: OuterSinaLayer) {\n super();\n this.aes = {\n ...this.aes,\n ...layer.aes,\n };\n }\n\n isEqualForCalculation(otherLayer: DiscreteLayer) {\n return otherLayer.type === 'sina' && this.aes.showOutliers === otherLayer.aes.showOutliers;\n }\n}\n\nexport class StatLayer extends BaseDiscreteLayer {\n readonly type = 'stat';\n readonly statType: 'overall' | 'referenceGroup' | 'pairwise';\n readonly testMethod: StatTestMethod;\n readonly paired: boolean;\n readonly ns: boolean;\n readonly format: 'significance' | 'pValue';\n readonly referenceGroup: DataValue | null = null;\n readonly correctionMethod: PValueCorrectionMethod | null = null;\n readonly significanceLevels: SignificanceLevels;\n\n constructor(layer: OuterStatLayer) {\n super();\n this.statType = layer.statType;\n this.testMethod = layer.testMethod;\n this.paired = layer.paired ?? false;\n this.ns = layer.ns ?? true;\n this.format = layer.format ?? 'pValue';\n if (this.statType === 'referenceGroup') {\n this.referenceGroup = layer.referenceGroup ?? null;\n }\n if (this.statType === 'referenceGroup' || this.statType === 'pairwise') {\n this.correctionMethod = layer.correctionMethod ?? null;\n }\n this.significanceLevels = {\n one: layer.significanceLevels?.one ?? 0.05,\n two: layer.significanceLevels?.two ?? 0.01,\n three: layer.significanceLevels?.three ?? 0.001,\n };\n }\n\n isEqualForCalculation(otherLayer: DiscreteLayer) {\n return otherLayer.type === 'stat' && (Object.keys(this) as (keyof StatLayer)[]).every(key => this[key] === otherLayer[key]);\n }\n}\n\nexport type DiscreteLayer =\n | BoxLayer\n | ViolinLayer\n | DotLayer\n | LineLayer\n | ErrorBarLayer\n | BarLayer\n | StackedBarLayer\n | BinnedDotsLayer\n | PairedPointsLayer\n | SinaLayer\n | StatLayer\n | LogoPlotLayer;\n\nexport class DiscreteSettingsImpl implements SettingsInterface {\n readonly id: string;\n readonly type = 'discrete';\n readonly y: ColumnName;\n readonly keyColumn: ColumnName | null;\n readonly primaryGrouping: {\n columnName: ColumnName;\n order?: DataValue[];\n inheritedAes?: AesMap;\n allowNullGroup?: boolean;\n } | null;\n readonly secondaryGrouping: {\n columnName: ColumnName;\n order?: DataValue[];\n inheritedAes?: AesMap;\n allowNullGroup?: boolean;\n } | null;\n readonly facetSettings: {\n sharedX: boolean;\n sharedY: boolean;\n order?: Record<string, DataValue[]>; // map with ordered values of columns in \"facetBy\"\n nRows?: number;\n nCols?: number;\n titlePosition?: 'left' | 'right' | 'center';\n } | null;\n readonly facetBy: ColumnName[];\n readonly chartSettings: {\n readonly size: {width: number; height: number, outerOffset: number, innerOffset: number};\n readonly title: {name: string; show: boolean; position: TitlePosition};\n readonly orientation: Orientation;\n readonly yAxis: {\n title: string | ColumnName;\n scale: 'linear' | 'log';\n showGrid: boolean;\n showTicks: boolean;\n hiddenLabels: boolean;\n };\n readonly xAxis: {\n title: string | ColumnName;\n showGrid: boolean;\n linesBetweenCategories: boolean;\n showTicks: boolean;\n labelsPosition: 'center' | '45deg' | '90deg';\n hiddenLabels: boolean;\n };\n readonly frame: {type: FrameType};\n readonly legend: {show: boolean; position: LegendPosition};\n readonly tooltips: {\n box: {show: boolean};\n violin: {show: boolean};\n boxOutliers: {show: boolean};\n line: {show: boolean};\n dot: {show: boolean};\n errorBar: {show: boolean};\n binnedDots: {show: boolean};\n pairedPoints: {show: boolean};\n stackedBar: {show: boolean};\n logo: {show: boolean};\n };\n };\n\n readonly layers: DiscreteLayer[];\n\n constructor(settings: DiscreteSettings) {\n DiscreteSettingsSchema.parse(settings);\n this.id = lodash.uniqueId('settings');\n this.y = settings.y; // throw error if empty or if y.name doesn't exist in input table\n this.keyColumn = settings.keyColumn ?? null;\n this.primaryGrouping = settings.primaryGrouping ?? null; // check columnName\n this.secondaryGrouping = settings.secondaryGrouping ?? null; // check columnName\n this.facetSettings = {\n sharedX: true,\n sharedY: true,\n titlePosition: 'left',\n ...settings.facetSettings,\n };\n this.facetBy = settings.facetBy ?? [];\n this.chartSettings = {\n size: {\n width: settings?.size?.width ?? (this.facetBy.length ? DEFAULT_WIDTH_SMALL : DEFAULT_WIDTH),\n height: settings?.size?.height ?? (this.facetBy.length ? DEFAULT_HEIGHT_SMALL : DEFAULT_HEIGHT),\n outerOffset: settings?.size?.outerOffset ?? MIN_MARGIN,\n innerOffset: settings?.size?.innerOffset ?? PADDINGS.TOP\n },\n title: {\n position: 'center',\n show: true,\n ...settings.title,\n name: settings.title?.name ?? 'Chart',\n },\n orientation: settings.orientation ?? 'vertical',\n yAxis: {\n title: settings.y?.label ?? settings.y.value ?? '',\n scale: 'linear',\n showGrid: true,\n showTicks: true,\n hiddenLabels: false,\n ...settings.yAxis,\n },\n xAxis: {\n title: settings.primaryGrouping?.columnName?.label ?? settings.primaryGrouping?.columnName.value ?? '',\n showGrid: true,\n showTicks: true,\n linesBetweenCategories: true,\n labelsPosition: 'center',\n hiddenLabels: false,\n ...settings.xAxis,\n },\n frame: {type: settings.frame?.type ?? 'full'},\n legend: {\n show: true,\n position: 'right',\n ...settings.legend,\n },\n tooltips: {\n box: {show: true},\n violin: {show: true},\n boxOutliers: {show: true},\n line: {show: true},\n errorBar: {show: true},\n dot: {show: true},\n binnedDots: {show: true},\n pairedPoints: {show: true},\n stackedBar: {show: true},\n logo: {show: false},\n ...settings.tooltips,\n },\n };\n this.layers = settings.layers\n .map(layer => {\n if (layer.type === 'box') {\n return new BoxLayer(layer);\n }\n if (layer.type === 'violin') {\n return new ViolinLayer(layer);\n }\n if (layer.type === 'dot') {\n return new DotLayer(layer);\n }\n if (layer.type === 'line') {\n return new LineLayer(layer);\n }\n if (layer.type === 'errorbar') {\n return new ErrorBarLayer(layer);\n }\n if (layer.type === 'bar') {\n return new BarLayer(layer);\n }\n if (layer.type === 'stackedBar') {\n return new StackedBarLayer(layer);\n }\n if (layer.type === 'stat') {\n return new StatLayer(layer);\n }\n if (layer.type === 'binnedDots') {\n return new BinnedDotsLayer(layer);\n }\n if (layer.type === 'pairedPoints') {\n return new PairedPointsLayer(layer);\n }\n if (layer.type === 'sina') {\n return new SinaLayer(layer);\n }\n if (layer.type === 'logo') {\n return new LogoPlotLayer(layer);\n }\n exhaustive(layer, 'Unknown layer type');\n })\n .filter(Boolean) as DiscreteLayer[];\n }\n}\n"],"names":["DEFAULT_FILL","DEFAULT_DOT_SHAPE","DEFAULT_DOT_SIZE","BaseDiscreteLayer","BoxLayer","layer","__publicField","BLACK","otherLayer","key","ViolinLayer","DotLayer","LineLayer","ErrorBarLayer","BarLayer","StackedBarLayer","LogoPlotLayer","BinnedDotsLayer","_a","_b","PairedPointsLayer","SinaLayer","StatLayer","_c","DiscreteSettingsImpl","settings","DiscreteSettingsSchema","lodash","DEFAULT_WIDTH_SMALL","DEFAULT_WIDTH","DEFAULT_HEIGHT_SMALL","DEFAULT_HEIGHT","MIN_MARGIN","_d","PADDINGS","_e","_f","_h","_g","_i","_j","exhaustive"],"mappings":";;;;;;;;;;;;AAuCA,MAAMA,IAAe,WACfC,IAAoB,MACpBC,IAAmB;AAEzB,MAAeC,EAAkB;AAGjC;AAEO,MAAMC,UAAiBD,EAAkB;AAAA,EAqC5C,YAAYE,GA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AM,SAAS;AACf,eAAO,IAAIM,EAASN,CAAK;AAE7B,UAAIA,EAAM,SAAS;AACf,eAAO,IAAIO,EAAUP,CAAK;AAE9B,UAAIA,EAAM,SAAS;AACf,eAAO,IAAIQ,EAAcR,CAAK;AAElC,UAAIA,EAAM,SAAS;AACf,eAAO,IAAIS,EAAST,CAAK;AAE7B,UAAIA,EAAM,SAAS;AACf,eAAO,IAAIU,EAAgBV,CAAK;AAEpC,UAAIA,EAAM,SAAS;AACf,eAAO,IAAIiB,EAAUjB,CAAK;AAE9B,UAAIA,EAAM,SAAS;AACf,eAAO,IAAIY,EAAgBZ,CAAK;AAEpC,UAAIA,EAAM,SAAS;AACf,eAAO,IAAIe,EAAkBf,CAAK;AAEtC,UAAIA,EAAM,SAAS;AACf,eAAO,IAAIgB,EAAUhB,CAAK;AAE9B,UAAIA,EAAM,SAAS;AACf,eAAO,IAAIW,EAAcX,CAAK;AAElCoC,MAAAA,EAAWpC,GAAO,oBAAoB;AAAA,IAC1C,CAAC,EACA,OAAO,OAAO;AAAA,EACvB;AACJ;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"DiscreteSettingsImpl.js","sources":["../../../../../../node_modules/@milaboratories/miplots4/src/discrete/DiscreteSettingsImpl.ts"],"sourcesContent":["import { BLACK, DEFAULT_HEIGHT, DEFAULT_HEIGHT_SMALL, DEFAULT_WIDTH, DEFAULT_WIDTH_SMALL } from '../constants';\nimport type {\n AesRecord,\n Color,\n ColumnName,\n DataValue,\n DiscreteSettings,\n FrameType,\n InheritAesDiscrete,\n LegendPosition,\n LineShape,\n Orientation,\n BarLayer as OuterBarLayer,\n BinnedDotsLayer as OuterBinnedDotsLayer,\n BoxLayer as OuterBoxLayer,\n DotLayer as OuterDotLayer,\n ErrorBarLayer as OuterErrorBarLayer,\n LineLayer as OuterLineLayer,\n LogoPlotLayer as OuterLogoPlotLayer,\n PairedPointsLayer as OuterPairedPointsLayer,\n SinaLayer as OuterSinaLayer,\n StackedBarLayer as OuterStackedBarLayer,\n StatLayer as OuterStatLayer,\n ViolinLayer as OuterViolinLayer,\n PointShape,\n PValueCorrectionMethod,\n SettingsInterface,\n SignificanceLevels,\n StatTestMethod,\n SummaryErrorValue,\n SummaryGroupValue,\n TitlePosition,\n} from '../types';\nimport { DiscreteSettingsSchema } from '../types';\nimport { MIN_MARGIN, PADDINGS } from './constants';\n\nimport lodash from 'lodash';\nimport { exhaustive } from '../utils';\n\nconst DEFAULT_FILL = '#3e9838';\nconst DEFAULT_DOT_SHAPE = '21';\nconst DEFAULT_DOT_SIZE = 3;\n\nabstract class BaseDiscreteLayer {\n abstract type: string;\n abstract isEqualForCalculation(otherLayer: DiscreteLayer): boolean;\n}\n\nexport class BoxLayer extends BaseDiscreteLayer {\n readonly type = 'box';\n readonly stat: {\n upper: number;\n medium: number;\n lower: number;\n k: number;\n } = {\n upper: 0.75,\n medium: 0.5,\n lower: 0.25,\n k: 1.5,\n };\n readonly aes: {\n showOutliers: boolean;\n boxWidth: 'auto' | number;\n dotShape: InheritAesDiscrete | PointShape;\n dotSize: InheritAesDiscrete | number;\n dotFill: InheritAesDiscrete | string;\n lineColor: InheritAesDiscrete | string;\n fillColor: InheritAesDiscrete | string;\n lineWidth: number;\n lineShape: LineShape;\n opacity: number;\n } = {\n showOutliers: true,\n boxWidth: 'auto',\n dotShape: DEFAULT_DOT_SHAPE,\n dotFill: BLACK,\n dotSize: DEFAULT_DOT_SIZE,\n lineColor: BLACK,\n fillColor: DEFAULT_FILL,\n lineWidth: 1,\n lineShape: 'solid',\n opacity: 1,\n };\n\n constructor(layer: OuterBoxLayer) {\n super();\n this.stat = {\n ...this.stat,\n ...layer.stat,\n };\n this.aes = {\n ...this.aes,\n ...layer.aes,\n };\n }\n\n isEqualForCalculation(otherLayer: DiscreteLayer) {\n return (\n otherLayer.type === 'box' &&\n (Object.keys(this.stat) as (keyof BoxLayer['stat'])[]).every(key => this.stat[key] === otherLayer.stat[key])\n );\n }\n}\n\nexport class ViolinLayer extends BaseDiscreteLayer {\n readonly type = 'violin';\n readonly stat: {\n bandwidth: 'auto' | number;\n stepsCount: 'auto' | number;\n trim: boolean;\n } = {\n bandwidth: 'auto',\n stepsCount: 40,\n trim: true,\n };\n readonly aes: {\n width: 'auto' | number;\n lineColor: InheritAesDiscrete | string;\n fillColor: InheritAesDiscrete | string;\n lineWidth: number;\n lineShape: LineShape;\n opacity: number;\n showQuartiles: boolean;\n medianLineStyle: LineShape;\n quartilesLineStyle: LineShape;\n } = {\n width: 'auto',\n lineColor: BLACK,\n fillColor: DEFAULT_FILL,\n lineWidth: 1,\n lineShape: 'solid',\n opacity: 1,\n showQuartiles: true,\n medianLineStyle: 'solid',\n quartilesLineStyle: 'dashed'\n };\n\n constructor(layer: OuterViolinLayer) {\n super();\n this.stat = {\n ...this.stat,\n ...layer.stat,\n };\n this.aes = {\n ...this.aes,\n ...layer.aes,\n };\n }\n\n isEqualForCalculation(otherLayer: DiscreteLayer) {\n return (\n otherLayer.type === 'violin' && (\n this.stat.bandwidth !== otherLayer.stat.bandwidth ||\n this.stat.trim !== otherLayer.stat.trim ||\n this.stat.stepsCount !== otherLayer.stat.stepsCount\n )\n );\n }\n}\n\nexport class DotLayer extends BaseDiscreteLayer {\n readonly type = 'dot';\n readonly aes: {\n showOutliers: boolean;\n jitter: number;\n dotFill: InheritAesDiscrete | string;\n lineColor: InheritAesDiscrete | string;\n dotShape: InheritAesDiscrete | PointShape;\n dotSize: number;\n opacity: number;\n } = {\n showOutliers: true,\n jitter: 0.8,\n lineColor: 'none',\n dotFill: BLACK,\n dotShape: DEFAULT_DOT_SHAPE,\n dotSize: DEFAULT_DOT_SIZE,\n opacity: 1,\n };\n\n constructor(layer: OuterDotLayer) {\n super();\n this.aes = {\n ...this.aes,\n ...layer.aes,\n };\n }\n\n isEqualForCalculation(otherLayer: DiscreteLayer) {\n return otherLayer.type === 'dot' && this.aes.showOutliers === otherLayer.aes.showOutliers;\n }\n}\n\nexport class LineLayer extends BaseDiscreteLayer {\n readonly type = 'line';\n readonly pointsValues: SummaryGroupValue;\n readonly aes: {\n showOutliers: boolean;\n lineWidth: number;\n lineColor: InheritAesDiscrete | string;\n fillColor: InheritAesDiscrete | string;\n lineShape: InheritAesDiscrete | LineShape;\n dotShape: InheritAesDiscrete | PointShape;\n dotSize: number;\n opacity: number;\n } = {\n showOutliers: true,\n lineWidth: 1,\n lineShape: 'solid',\n fillColor: 'none',\n lineColor: BLACK,\n dotShape: DEFAULT_DOT_SHAPE,\n dotSize: DEFAULT_DOT_SIZE,\n opacity: 1,\n };\n\n constructor(layer: OuterLineLayer) {\n super();\n this.pointsValues = layer.pointsValues;\n this.aes = {\n ...this.aes,\n ...layer.aes,\n };\n }\n\n isEqualForCalculation(otherLayer: DiscreteLayer) {\n return otherLayer.type === 'line' && this.pointsValues === otherLayer.pointsValues;\n }\n}\n\nexport class ErrorBarLayer extends BaseDiscreteLayer {\n readonly type = 'errorbar';\n readonly pointsValues: SummaryGroupValue;\n readonly interval: SummaryErrorValue;\n readonly aes: {\n showDots: boolean;\n width: number | 'auto';\n lineWidth: number;\n lineColor: InheritAesDiscrete | string;\n fillColor: InheritAesDiscrete | string;\n dotShape: InheritAesDiscrete | PointShape;\n dotSize: number;\n opacity: number;\n } = {\n showDots: true,\n width: 'auto',\n lineWidth: 1,\n fillColor: 'none',\n lineColor: BLACK,\n dotShape: DEFAULT_DOT_SHAPE,\n dotSize: DEFAULT_DOT_SIZE,\n opacity: 1,\n };\n\n constructor(layer: OuterErrorBarLayer) {\n super();\n this.pointsValues = layer.pointsValues;\n this.interval = layer.interval;\n this.aes = {\n ...this.aes,\n ...layer.aes,\n };\n }\n\n isEqualForCalculation(otherLayer: DiscreteLayer) {\n return (\n otherLayer.type === 'errorbar' &&\n this.pointsValues === otherLayer.pointsValues &&\n this.interval === otherLayer.interval\n );\n }\n}\n\nexport class BarLayer extends BaseDiscreteLayer {\n readonly type = 'bar';\n readonly height: 'min' | 'max' | 'median' | 'mean';\n readonly aes: {\n width: number | 'auto';\n lineColor: InheritAesDiscrete | Color;\n fillColor: InheritAesDiscrete | Color;\n lineWidth: number;\n opacity: number;\n } = {\n width: 'auto',\n lineWidth: 1,\n fillColor: 'none',\n lineColor: BLACK,\n opacity: 1,\n };\n\n constructor(layer: OuterBarLayer) {\n super();\n this.height = layer.height ?? 'max';\n this.aes = {\n ...this.aes,\n ...layer.aes,\n };\n }\n\n isEqualForCalculation(otherLayer: DiscreteLayer) {\n return otherLayer.type === 'bar' && this.height === otherLayer.height;\n }\n}\n\nexport class StackedBarLayer extends BaseDiscreteLayer {\n readonly type = 'stackedBar';\n readonly normalize: boolean = false;\n readonly aes: {\n width: number | 'auto';\n lineColor: InheritAesDiscrete | Color;\n fillColor: InheritAesDiscrete | Color;\n lineWidth: number;\n opacity: number;\n } = {\n width: 'auto',\n lineWidth: 1,\n fillColor: DEFAULT_FILL,\n lineColor: 'none',\n opacity: 1,\n };\n\n constructor(layer: OuterStackedBarLayer) {\n super();\n this.normalize = layer.normalize ?? false;\n this.aes = {\n ...this.aes,\n ...layer.aes,\n };\n }\n\n isEqualForCalculation(otherLayer: DiscreteLayer) {\n return otherLayer.type === 'stackedBar' && otherLayer.normalize === this.normalize;\n }\n}\n\nexport class LogoPlotLayer extends BaseDiscreteLayer {\n readonly type = 'logo';\n readonly normalize: boolean = false;\n readonly aes: {\n width: number | 'auto';\n fillColor: Record<string, string> | Color;\n lineColor: Color;\n opacity: number;\n } = {\n width: 'auto',\n fillColor: DEFAULT_FILL,\n lineColor: 'none',\n opacity: 1,\n };\n\n constructor(layer: OuterLogoPlotLayer) {\n super();\n this.normalize = layer.normalize ?? false;\n this.aes = {\n ...this.aes,\n ...layer.aes,\n };\n }\n\n isEqualForCalculation(otherLayer: DiscreteLayer) {\n return otherLayer.type === 'logo' && otherLayer.normalize === this.normalize;\n }\n}\n\nexport class BinnedDotsLayer extends BaseDiscreteLayer {\n readonly type = 'binnedDots';\n readonly method: 'dotdensity' | 'histodot';\n readonly position: 'stack' | 'jitter';\n readonly keyColumn: ColumnName | null;\n readonly aes: {\n showOutliers: boolean;\n width: number | 'auto';\n lineColor: InheritAesDiscrete | Color;\n fillColor: InheritAesDiscrete | Color;\n dotSize?: number;\n lineWidth: number;\n opacity: number;\n } = {\n showOutliers: true,\n width: 'auto',\n lineWidth: 1,\n fillColor: 'none',\n lineColor: BLACK,\n opacity: 1,\n };\n\n constructor(layer: OuterBinnedDotsLayer) {\n super();\n this.method = layer.method ?? 'dotdensity';\n this.position = layer.position ?? 'stack';\n this.keyColumn = layer.keyColumn ?? null;\n this.aes = {\n ...this.aes,\n ...layer.aes,\n };\n }\n\n isEqualForCalculation(otherLayer: DiscreteLayer) {\n return (\n otherLayer.type === 'binnedDots' &&\n this.method === otherLayer.method &&\n this.position === otherLayer.position &&\n this.keyColumn?.value === otherLayer.keyColumn?.value\n );\n }\n}\n\nexport class PairedPointsLayer extends BaseDiscreteLayer {\n readonly type = 'pairedPoints';\n readonly linkColumn: ColumnName;\n readonly aes: {\n showOutliers: boolean;\n lineColor: InheritAesDiscrete | Color;\n lineWidth: number;\n lineShape: LineShape;\n dotFill: InheritAesDiscrete | Color;\n dotSize: number;\n dotShape: PointShape;\n opacity: number;\n } = {\n showOutliers: true,\n lineWidth: 1,\n lineColor: BLACK,\n lineShape: 'solid',\n dotFill: BLACK,\n dotSize: DEFAULT_DOT_SIZE,\n dotShape: DEFAULT_DOT_SHAPE,\n opacity: 1,\n };\n\n constructor(layer: OuterPairedPointsLayer) {\n super();\n this.linkColumn = layer.linkColumn;\n this.aes = {\n ...this.aes,\n ...layer.aes,\n };\n }\n\n isEqualForCalculation(otherLayer: DiscreteLayer) {\n return (\n otherLayer.type === 'pairedPoints' &&\n this.aes.showOutliers === otherLayer.aes.showOutliers &&\n this.linkColumn.value === otherLayer.linkColumn.value\n );\n }\n}\n\nexport class SinaLayer extends BaseDiscreteLayer {\n readonly type = 'sina';\n readonly aes: {\n showOutliers: boolean;\n width: number | 'auto';\n dotFill: InheritAesDiscrete | Color;\n dotSize: number;\n dotShape: InheritAesDiscrete | PointShape;\n opacity: number;\n } = {\n showOutliers: true,\n width: 'auto',\n dotFill: DEFAULT_FILL,\n dotSize: DEFAULT_DOT_SIZE,\n dotShape: DEFAULT_DOT_SHAPE,\n opacity: 1,\n };\n\n constructor(layer: OuterSinaLayer) {\n super();\n this.aes = {\n ...this.aes,\n ...layer.aes,\n };\n }\n\n isEqualForCalculation(otherLayer: DiscreteLayer) {\n return otherLayer.type === 'sina' && this.aes.showOutliers === otherLayer.aes.showOutliers;\n }\n}\n\nexport class StatLayer extends BaseDiscreteLayer {\n readonly type = 'stat';\n readonly statType: 'overall' | 'referenceGroup' | 'pairwise';\n readonly testMethod: StatTestMethod;\n readonly paired: boolean;\n readonly ns: boolean;\n readonly format: 'significance' | 'pValue';\n readonly referenceGroup: DataValue | null = null;\n readonly correctionMethod: PValueCorrectionMethod | null = null;\n readonly significanceLevels: SignificanceLevels;\n\n constructor(layer: OuterStatLayer) {\n super();\n this.statType = layer.statType;\n this.testMethod = layer.testMethod;\n this.paired = layer.paired ?? false;\n this.ns = layer.ns ?? true;\n this.format = layer.format ?? 'pValue';\n if (this.statType === 'referenceGroup') {\n this.referenceGroup = layer.referenceGroup ?? null;\n }\n if (this.statType === 'referenceGroup' || this.statType === 'pairwise') {\n this.correctionMethod = layer.correctionMethod ?? null;\n }\n this.significanceLevels = {\n one: layer.significanceLevels?.one ?? 0.05,\n two: layer.significanceLevels?.two ?? 0.01,\n three: layer.significanceLevels?.three ?? 0.001,\n };\n }\n\n isEqualForCalculation(otherLayer: DiscreteLayer) {\n return otherLayer.type === 'stat' && (Object.keys(this) as (keyof StatLayer)[]).every(key => this[key] === otherLayer[key]);\n }\n}\n\nexport type DiscreteLayer =\n | BoxLayer\n | ViolinLayer\n | DotLayer\n | LineLayer\n | ErrorBarLayer\n | BarLayer\n | StackedBarLayer\n | BinnedDotsLayer\n | PairedPointsLayer\n | SinaLayer\n | StatLayer\n | LogoPlotLayer;\n\nexport class DiscreteSettingsImpl implements SettingsInterface {\n readonly id: string;\n readonly type = 'discrete';\n readonly y: ColumnName;\n readonly keyColumn: ColumnName | null;\n readonly primaryGrouping: {\n columnName: ColumnName;\n order?: DataValue[];\n inheritedAes?: AesRecord;\n allowNullGroup?: boolean;\n } | null;\n readonly secondaryGrouping: {\n columnName: ColumnName;\n order?: DataValue[];\n inheritedAes?: AesRecord;\n allowNullGroup?: boolean;\n } | null;\n readonly facetSettings: {\n sharedX: boolean;\n sharedY: boolean;\n order?: Record<string, DataValue[]>; // map with ordered values of columns in \"facetBy\"\n nRows?: number;\n nCols?: number;\n titlePosition?: 'left' | 'right' | 'center';\n } | null;\n readonly facetBy: ColumnName[];\n readonly chartSettings: {\n readonly size: {width: number; height: number, outerOffset: number, innerOffset: number};\n readonly title: {name: string; show: boolean; position: TitlePosition};\n readonly orientation: Orientation;\n readonly yAxis: {\n title: string | ColumnName;\n scale: 'linear' | 'log';\n showGrid: boolean;\n showTicks: boolean;\n hiddenLabels: boolean;\n };\n readonly xAxis: {\n title: string | ColumnName;\n showGrid: boolean;\n linesBetweenCategories: boolean;\n showTicks: boolean;\n labelsPosition: 'center' | '45deg' | '90deg';\n hiddenLabels: boolean;\n };\n readonly frame: {type: FrameType};\n readonly legend: {show: boolean; position: LegendPosition};\n readonly tooltips: {\n box: {show: boolean};\n violin: {show: boolean};\n boxOutliers: {show: boolean};\n line: {show: boolean};\n dot: {show: boolean};\n errorBar: {show: boolean};\n binnedDots: {show: boolean};\n pairedPoints: {show: boolean};\n stackedBar: {show: boolean};\n logo: {show: boolean};\n };\n };\n\n readonly layers: DiscreteLayer[];\n\n constructor(settings: DiscreteSettings) {\n DiscreteSettingsSchema.parse(settings);\n this.id = lodash.uniqueId('settings');\n this.y = settings.y; // throw error if empty or if y.name doesn't exist in input table\n this.keyColumn = settings.keyColumn ?? null;\n this.primaryGrouping = settings.primaryGrouping ?? null; // check columnName\n this.secondaryGrouping = settings.secondaryGrouping ?? null; // check columnName\n this.facetSettings = {\n sharedX: true,\n sharedY: true,\n titlePosition: 'left',\n ...settings.facetSettings,\n };\n this.facetBy = settings.facetBy ?? [];\n this.chartSettings = {\n size: {\n width: settings?.size?.width ?? (this.facetBy.length ? DEFAULT_WIDTH_SMALL : DEFAULT_WIDTH),\n height: settings?.size?.height ?? (this.facetBy.length ? DEFAULT_HEIGHT_SMALL : DEFAULT_HEIGHT),\n outerOffset: settings?.size?.outerOffset ?? MIN_MARGIN,\n innerOffset: settings?.size?.innerOffset ?? PADDINGS.TOP\n },\n title: {\n position: 'center',\n show: true,\n ...settings.title,\n name: settings.title?.name ?? 'Chart',\n },\n orientation: settings.orientation ?? 'vertical',\n yAxis: {\n title: settings.y?.label ?? settings.y.value ?? '',\n scale: 'linear',\n showGrid: true,\n showTicks: true,\n hiddenLabels: false,\n ...settings.yAxis,\n },\n xAxis: {\n title: settings.primaryGrouping?.columnName?.label ?? settings.primaryGrouping?.columnName.value ?? '',\n showGrid: true,\n showTicks: true,\n linesBetweenCategories: true,\n labelsPosition: 'center',\n hiddenLabels: false,\n ...settings.xAxis,\n },\n frame: {type: settings.frame?.type ?? 'full'},\n legend: {\n show: true,\n position: 'right',\n ...settings.legend,\n },\n tooltips: {\n box: {show: true},\n violin: {show: true},\n boxOutliers: {show: true},\n line: {show: true},\n errorBar: {show: true},\n dot: {show: true},\n binnedDots: {show: true},\n pairedPoints: {show: true},\n stackedBar: {show: true},\n logo: {show: false},\n ...settings.tooltips,\n },\n };\n this.layers = settings.layers\n .map(layer => {\n if (layer.type === 'box') {\n return new BoxLayer(layer);\n }\n if (layer.type === 'violin') {\n return new ViolinLayer(layer);\n }\n if (layer.type === 'dot') {\n return new DotLayer(layer);\n }\n if (layer.type === 'line') {\n return new LineLayer(layer);\n }\n if (layer.type === 'errorbar') {\n return new ErrorBarLayer(layer);\n }\n if (layer.type === 'bar') {\n return new BarLayer(layer);\n }\n if (layer.type === 'stackedBar') {\n return new StackedBarLayer(layer);\n }\n if (layer.type === 'stat') {\n return new StatLayer(layer);\n }\n if (layer.type === 'binnedDots') {\n return new BinnedDotsLayer(layer);\n }\n if (layer.type === 'pairedPoints') {\n return new PairedPointsLayer(layer);\n }\n if (layer.type === 'sina') {\n return new SinaLayer(layer);\n }\n if (layer.type === 'logo') {\n return new LogoPlotLayer(layer);\n }\n exhaustive(layer, 'Unknown layer type');\n })\n .filter(Boolean) as DiscreteLayer[];\n }\n}\n"],"names":["DEFAULT_FILL","DEFAULT_DOT_SHAPE","DEFAULT_DOT_SIZE","BaseDiscreteLayer","BoxLayer","layer","__publicField","BLACK","otherLayer","key","ViolinLayer","DotLayer","LineLayer","ErrorBarLayer","BarLayer","StackedBarLayer","LogoPlotLayer","BinnedDotsLayer","_a","_b","PairedPointsLayer","SinaLayer","StatLayer","_c","DiscreteSettingsImpl","settings","DiscreteSettingsSchema","lodash","DEFAULT_WIDTH_SMALL","DEFAULT_WIDTH","DEFAULT_HEIGHT_SMALL","DEFAULT_HEIGHT","MIN_MARGIN","_d","PADDINGS","_e","_f","_h","_g","_i","_j","exhaustive"],"mappings":";;;;;;;;;;;;AAuCA,MAAMA,IAAe,WACfC,IAAoB,MACpBC,IAAmB;AAEzB,MAAeC,EAAkB;AAGjC;AAEO,MAAMC,UAAiBD,EAAkB;AAAA,EAqC5C,YAAYE,GAAsB;AAC9B,UAAA,GArCKC,EAAA,MAAA,QAAO,KAAA,GACPA,EAAA,MAAA,QAKL;AAAA,MACA,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,GAAG;AAAA,IAAA,CAAA,GAEEA,EAAA,MAAA,OAWL;AAAA,MACA,cAAc;AAAA,MACd,UAAU;AAAA,MACV,UAAUL;AAAAA,MACV,SAASM;AAAAA,MACT,SAASL;AAAAA,MACT,WAAWK;AAAAA,MACX,WAAWP;AAAAA,MACX,WAAW;AAAA,MACX,WAAW;AAAA,MACX,SAAS;AAAA,IAAA,CAAA,GAKT,KAAK,OAAO;AAAA,MACR,GAAG,KAAK;AAAA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,IAAIe,EAAkBf,CAAK;AAEtC,UAAIA,EAAM,SAAS;AACf,eAAO,IAAIgB,EAAUhB,CAAK;AAE9B,UAAIA,EAAM,SAAS;AACf,eAAO,IAAIW,EAAcX,CAAK;AAElCoC,MAAAA,EAAWpC,GAAO,oBAAoB;AAAA,IAC1C,CAAC,EACA,OAAO,OAAO;AAAA,EACvB;AACJ;","x_google_ignoreList":[0]}
@@ -1 +1 @@
1
- {"version":3,"file":"BoxElement.js","sources":["../../../../../../../../node_modules/@milaboratories/miplots4/src/discrete/components/layers/BoxElement.tsx"],"sourcesContent":["import { createPortal } from 'react-dom';\nimport type { TooltipsData } from '../../../common/Tooltip';\nimport { Tooltip } from '../../../common/Tooltip';\nimport { NO_GROUPED } from '../../../DataFrame';\nimport type { AesItem, InheritAesDiscrete, Orientation } from '../../../types';\nimport { getLineShape } from '../../../utils/getLineShape';\nimport { getPointShape } from '../../../utils/getPointShape';\nimport { numberFormat } from '../../../utils/numberFormat';\nimport type { BoxLayer } from '../../DiscreteSettingsImpl';\nimport type { Box } from '../../layers';\nimport type { ChartScales } from '../types';\n\ninterface BoxProps {\n facetKey: string;\n scales: ChartScales;\n box: Box;\n orientation: Orientation;\n aes: BoxLayer['aes'];\n hasKeyFromColumn: boolean;\n sideDistances: {\n left: number;\n right: number;\n top: number;\n bottom: number;\n };\n showTooltips: boolean;\n elementsAmount: number;\n tooltipsData: TooltipsData<unknown>;\n activeElementContainer?: Element;\n tooltipsContainer?: Element;\n}\n\nfunction getAesValue<ValueType>(\n scales: ChartScales,\n field: keyof AesItem,\n value: ValueType | InheritAesDiscrete,\n geom: Box\n): ValueType {\n if (value && typeof value === 'object' && 'type' in value) {\n if (value.type === 'primaryGrouping') {\n return geom.primaryGrouping !== NO_GROUPED\n ? scales.xPrimaryAes(geom.primaryGrouping)[field] as ValueType\n : undefined as ValueType;\n }\n if (value.type === 'secondaryGrouping') {\n return geom.secondaryGrouping !== NO_GROUPED\n ? scales.xSecondaryAes(geom.secondaryGrouping)[field] as ValueType\n : undefined as ValueType;\n }\n }\n return value as ValueType;\n}\n\nfunction getTooltipContent(outlier: Box['outliers'][0], hasKeyFromColumn: boolean) {\n if (hasKeyFromColumn) {\n return [outlier.id, `${numberFormat(outlier.y)}`];\n }\n return [`${numberFormat(outlier.y)}`];\n}\n\nexport function BoxElement({\n facetKey,\n scales,\n orientation,\n box,\n aes,\n hasKeyFromColumn,\n sideDistances,\n showTooltips,\n elementsAmount,\n activeElementContainer,\n tooltipsContainer,\n tooltipsData,\n}: BoxProps) {\n const isVertical = orientation === 'vertical';\n const boxXPosition =\n (scales.xPrimary(box.primaryGrouping as string) ?? 0) +\n (scales.xSecondary(box.secondaryGrouping as string) ?? 0) +\n scales.xSecondary.bandwidth() / 2;\n const boxOuterWidth = scales.xSecondary.bandwidth();\n const boxWidth = aes.boxWidth === 'auto' ? boxOuterWidth * 0.8 : Math.min(boxOuterWidth, aes.boxWidth);\n const boxHeight = Math.abs(scales.y(box.lower) - scales.y(box.upper));\n const lineColor = getAesValue(scales, 'lineColor', aes.lineColor, box);\n const fillColor = getAesValue(scales, 'fillColor', aes.fillColor, box);\n const outliersShape = getAesValue(scales, 'dotShape', aes.dotShape, box);\n const outliersSize = getAesValue(scales, 'dotSize', aes.dotSize, box);\n const shape = getPointShape(outliersShape, outliersSize, lineColor);\n\n const yRange = Math.abs(scales.y.range()[0] - scales.y.range()[1]);\n\n const dimmedBackground = activeElementContainer && tooltipsData.fixed;\n const highlightedBox = tooltipsData.selectedData === box && dimmedBackground;\n\n const boxElement = (\n <g\n transform={isVertical ? `translate(${boxXPosition},0)` : `translate(0, ${boxXPosition})`}\n opacity={aes.opacity}\n stroke={lineColor}\n strokeWidth={aes.lineWidth}\n strokeDasharray={getLineShape(aes.lineShape)}\n >\n <line\n x1={isVertical ? 0 : scales.y(box.min)}\n x2={isVertical ? 0 : scales.y(box.lower)}\n y1={isVertical ? scales.y(box.min) : 0}\n y2={isVertical ? scales.y(box.lower) : 0}\n />\n <line\n x1={isVertical ? 0 : scales.y(box.upper)}\n x2={isVertical ? 0 : scales.y(box.max)}\n y1={isVertical ? scales.y(box.upper) : 0}\n y2={isVertical ? scales.y(box.max) : 0}\n />\n <rect\n width={isVertical ? boxWidth : boxHeight}\n height={isVertical ? boxHeight : boxWidth}\n x={isVertical ? -boxWidth / 2 : scales.y(box.lower)}\n y={isVertical ? scales.y(box.upper) : -boxWidth / 2}\n fill={fillColor}\n />\n <line\n x1={isVertical ? -boxWidth / 2 : scales.y(box.middle)}\n x2={isVertical ? boxWidth / 2 : scales.y(box.middle)}\n y1={isVertical ? scales.y(box.middle) : -boxWidth / 2}\n y2={isVertical ? scales.y(box.middle) : boxWidth / 2}\n />\n {showTooltips && tooltipsContainer && (\n <rect\n onMouseOver={() => tooltipsData.onMouseEnter(box, facetKey)}\n onMouseLeave={tooltipsData.onMouseLeave}\n width={isVertical ? boxOuterWidth : yRange}\n x={isVertical ? -boxOuterWidth / 2 : 0}\n y={isVertical ? 0 : -boxOuterWidth / 2}\n height={isVertical ? yRange : boxOuterWidth}\n fill=\"transparent\"\n stroke=\"none\"\n />\n )}\n {aes.showOutliers &&\n box.outliers.map(outlier => {\n const highlightedOutlier = tooltipsData.selectedData === outlier && tooltipsData.currentFacet === facetKey && dimmedBackground;\n const x = isVertical ? (highlightedOutlier ? boxXPosition : 0) : scales.y(outlier.y);\n const y = isVertical ? scales.y(outlier.y) : (highlightedOutlier ? boxXPosition : 0);\n const el = (\n <g\n key={outlier.id}\n transform={`translate(${x},${y})`}\n strokeDasharray=\"0\"\n >\n {shape}\n {showTooltips && tooltipsContainer && (\n <circle\n onMouseOver={() => tooltipsData.onMouseEnter(outlier, facetKey)}\n onMouseLeave={tooltipsData.onMouseLeave}\n r=\"15\"\n fill=\"transparent\"\n stroke=\"none\"\n />\n )}\n {showTooltips && (\n <Tooltip\n content={getTooltipContent(outlier, hasKeyFromColumn)}\n x={isVertical ? boxXPosition : scales.y(outlier.y)}\n y={isVertical ? scales.y(outlier.y) : boxXPosition}\n sideDistances={sideDistances}\n horizontal\n active={tooltipsData.selectedData === outlier && tooltipsData.currentFacet === facetKey}\n onClose={tooltipsData.onClose}\n fixed={tooltipsData.fixed}\n container={tooltipsContainer}\n />\n )}\n </g>\n );\n return highlightedOutlier ? createPortal(el, activeElementContainer) : el;\n })}\n {showTooltips && (\n <Tooltip\n content={[\n `Max = ${numberFormat(box.max)}`,\n `Upper = ${numberFormat(box.upper)}`,\n `Median = ${numberFormat(box.middle)}`,\n `Lower = ${numberFormat(box.lower)}`,\n `Min = ${numberFormat(box.min)}`,\n ]}\n x={isVertical ? boxXPosition : scales.y(box.middle)}\n y={isVertical ? scales.y(box.middle) : boxXPosition}\n sideDistances={sideDistances}\n horizontal={isVertical}\n active={tooltipsData.active && tooltipsData.selectedData === box && tooltipsData.currentFacet === facetKey}\n fixed={tooltipsData.fixed}\n onClose={tooltipsData.onClose}\n offset={elementsAmount > 1 ? boxOuterWidth / 2 : boxOuterWidth / 4}\n container={tooltipsContainer}\n />\n )}\n </g>\n );\n return highlightedBox ? createPortal(boxElement, activeElementContainer) : boxElement;\n}\n"],"names":["getAesValue","scales","field","value","geom","NO_GROUPED","getTooltipContent","outlier","hasKeyFromColumn","numberFormat","BoxElement","facetKey","orientation","box","aes","sideDistances","showTooltips","elementsAmount","activeElementContainer","tooltipsContainer","tooltipsData","isVertical","boxXPosition","boxOuterWidth","boxWidth","boxHeight","lineColor","fillColor","outliersShape","outliersSize","shape","getPointShape","yRange","dimmedBackground","highlightedBox","boxElement","jsxs","getLineShape","jsx","highlightedOutlier","x","y","el","Tooltip","createPortal"],"mappings":";;;;;;;AAgCA,SAASA,EACLC,GACAC,GACAC,GACAC,GACS;AACT,MAAID,KAAS,OAAOA,KAAU,YAAY,UAAUA,GAAO;AACvD,QAAIA,EAAM,SAAS;AACf,aAAOC,EAAK,oBAAoBC,IAC1BJ,EAAO,YAAYG,EAAK,eAAe,EAAEF,CAAK,IAC9C;AAEV,QAAIC,EAAM,SAA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,IAAapB,EAAO,EAAEY,EAAI,MAAM,IAAIS;AAAAA,YACvC,eAAAP;AAAAA,YACA,YAAYM;AAAAA,YACZ,QAAQD,EAAa,UAAUA,EAAa,iBAAiBP,KAAOO,EAAa,iBAAiBT;AAAAA,YAClG,OAAOS,EAAa;AAAA,YACpB,SAASA,EAAa;AAAA,YACtB,QAAQH,IAAiB,IAAIM,IAAgB,IAAIA,IAAgB;AAAA,YACjE,WAAWJ;AAAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACf;AAAA,EAAA;AAIZ,SAAOe,IAAiBU,EAAAA,aAAaT,GAAYjB,CAAsB,IAAIiB;AAC/E;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"BoxElement.js","sources":["../../../../../../../../node_modules/@milaboratories/miplots4/src/discrete/components/layers/BoxElement.tsx"],"sourcesContent":["import { createPortal } from 'react-dom';\nimport type { TooltipsData } from '../../../common/Tooltip';\nimport { Tooltip } from '../../../common/Tooltip';\nimport { NO_GROUPED } from '../../../DataFrame';\nimport type { AesItem, InheritAesDiscrete, Orientation } from '../../../types';\nimport { getLineShape } from '../../../utils/getLineShape';\nimport { getPointShape } from '../../../utils/getPointShape';\nimport { numberFormat } from '../../../utils/numberFormat';\nimport type { BoxLayer } from '../../DiscreteSettingsImpl';\nimport type { Box } from '../../layers';\nimport type { ChartScales } from '../types';\n\ninterface BoxProps {\n facetKey: string;\n scales: ChartScales;\n box: Box;\n orientation: Orientation;\n aes: BoxLayer['aes'];\n hasKeyFromColumn: boolean;\n sideDistances: {\n left: number;\n right: number;\n top: number;\n bottom: number;\n };\n showTooltips: boolean;\n elementsAmount: number;\n tooltipsData: TooltipsData<unknown>;\n activeElementContainer?: Element;\n tooltipsContainer?: Element;\n}\n\nfunction getAesValue<ValueType>(\n scales: ChartScales,\n field: keyof AesItem,\n value: ValueType | InheritAesDiscrete,\n geom: Box\n): ValueType {\n if (value && typeof value === 'object' && 'type' in value) {\n if (value.type === 'primaryGrouping') {\n return geom.primaryGrouping !== NO_GROUPED\n ? scales.xPrimaryAes(geom.primaryGrouping)[field] as ValueType\n : undefined as ValueType;\n }\n if (value.type === 'secondaryGrouping') {\n return geom.secondaryGrouping !== NO_GROUPED\n ? scales.xSecondaryAes(geom.secondaryGrouping)[field] as ValueType\n : undefined as ValueType;\n }\n }\n return value as ValueType;\n}\n\nfunction getTooltipContent(outlier: Box['outliers'][number], hasKeyFromColumn: boolean) {\n if (hasKeyFromColumn) {\n return [outlier.id, `${numberFormat(outlier.y)}`];\n }\n return [`${numberFormat(outlier.y)}`];\n}\n\nexport function BoxElement({\n facetKey,\n scales,\n orientation,\n box,\n aes,\n hasKeyFromColumn,\n sideDistances,\n showTooltips,\n elementsAmount,\n activeElementContainer,\n tooltipsContainer,\n tooltipsData,\n}: BoxProps) {\n const isVertical = orientation === 'vertical';\n const boxXPosition =\n (scales.xPrimary(box.primaryGrouping as string) ?? 0) +\n (scales.xSecondary(box.secondaryGrouping as string) ?? 0) +\n scales.xSecondary.bandwidth() / 2;\n const boxOuterWidth = scales.xSecondary.bandwidth();\n const boxWidth = aes.boxWidth === 'auto' ? boxOuterWidth * 0.8 : Math.min(boxOuterWidth, aes.boxWidth);\n const boxHeight = Math.abs(scales.y(box.lower) - scales.y(box.upper));\n const lineColor = getAesValue(scales, 'lineColor', aes.lineColor, box);\n const fillColor = getAesValue(scales, 'fillColor', aes.fillColor, box);\n const outliersShape = getAesValue(scales, 'dotShape', aes.dotShape, box);\n const outliersSize = getAesValue(scales, 'dotSize', aes.dotSize, box);\n const shape = getPointShape(outliersShape, outliersSize, lineColor);\n\n const yRange = Math.abs(scales.y.range()[0] - scales.y.range()[1]);\n\n const dimmedBackground = activeElementContainer && tooltipsData.fixed;\n const highlightedBox = tooltipsData.selectedData === box && dimmedBackground;\n\n const boxElement = (\n <g\n transform={isVertical ? `translate(${boxXPosition},0)` : `translate(0, ${boxXPosition})`}\n opacity={aes.opacity}\n stroke={lineColor}\n strokeWidth={aes.lineWidth}\n strokeDasharray={getLineShape(aes.lineShape)}\n >\n <line\n x1={isVertical ? 0 : scales.y(box.min)}\n x2={isVertical ? 0 : scales.y(box.lower)}\n y1={isVertical ? scales.y(box.min) : 0}\n y2={isVertical ? scales.y(box.lower) : 0}\n />\n <line\n x1={isVertical ? 0 : scales.y(box.upper)}\n x2={isVertical ? 0 : scales.y(box.max)}\n y1={isVertical ? scales.y(box.upper) : 0}\n y2={isVertical ? scales.y(box.max) : 0}\n />\n <rect\n width={isVertical ? boxWidth : boxHeight}\n height={isVertical ? boxHeight : boxWidth}\n x={isVertical ? -boxWidth / 2 : scales.y(box.lower)}\n y={isVertical ? scales.y(box.upper) : -boxWidth / 2}\n fill={fillColor}\n />\n <line\n x1={isVertical ? -boxWidth / 2 : scales.y(box.middle)}\n x2={isVertical ? boxWidth / 2 : scales.y(box.middle)}\n y1={isVertical ? scales.y(box.middle) : -boxWidth / 2}\n y2={isVertical ? scales.y(box.middle) : boxWidth / 2}\n />\n {showTooltips && tooltipsContainer && (\n <rect\n onMouseOver={() => tooltipsData.onMouseEnter(box, facetKey)}\n onMouseLeave={tooltipsData.onMouseLeave}\n width={isVertical ? boxOuterWidth : yRange}\n x={isVertical ? -boxOuterWidth / 2 : 0}\n y={isVertical ? 0 : -boxOuterWidth / 2}\n height={isVertical ? yRange : boxOuterWidth}\n fill=\"transparent\"\n stroke=\"none\"\n />\n )}\n {aes.showOutliers &&\n box.outliers.map(outlier => {\n const highlightedOutlier = tooltipsData.selectedData === outlier && tooltipsData.currentFacet === facetKey && dimmedBackground;\n const x = isVertical ? (highlightedOutlier ? boxXPosition : 0) : scales.y(outlier.y);\n const y = isVertical ? scales.y(outlier.y) : (highlightedOutlier ? boxXPosition : 0);\n const el = (\n <g\n key={outlier.id}\n transform={`translate(${x},${y})`}\n strokeDasharray=\"0\"\n >\n {shape}\n {showTooltips && tooltipsContainer && (\n <circle\n onMouseOver={() => tooltipsData.onMouseEnter(outlier, facetKey)}\n onMouseLeave={tooltipsData.onMouseLeave}\n r=\"15\"\n fill=\"transparent\"\n stroke=\"none\"\n />\n )}\n {showTooltips && (\n <Tooltip\n content={getTooltipContent(outlier, hasKeyFromColumn)}\n x={isVertical ? boxXPosition : scales.y(outlier.y)}\n y={isVertical ? scales.y(outlier.y) : boxXPosition}\n sideDistances={sideDistances}\n horizontal\n active={tooltipsData.selectedData === outlier && tooltipsData.currentFacet === facetKey}\n onClose={tooltipsData.onClose}\n fixed={tooltipsData.fixed}\n container={tooltipsContainer}\n />\n )}\n </g>\n );\n return highlightedOutlier ? createPortal(el, activeElementContainer) : el;\n })}\n {showTooltips && (\n <Tooltip\n content={[\n `Max = ${numberFormat(box.max)}`,\n `Upper = ${numberFormat(box.upper)}`,\n `Median = ${numberFormat(box.middle)}`,\n `Lower = ${numberFormat(box.lower)}`,\n `Min = ${numberFormat(box.min)}`,\n ]}\n x={isVertical ? boxXPosition : scales.y(box.middle)}\n y={isVertical ? scales.y(box.middle) : boxXPosition}\n sideDistances={sideDistances}\n horizontal={isVertical}\n active={tooltipsData.active && tooltipsData.selectedData === box && tooltipsData.currentFacet === facetKey}\n fixed={tooltipsData.fixed}\n onClose={tooltipsData.onClose}\n offset={elementsAmount > 1 ? boxOuterWidth / 2 : boxOuterWidth / 4}\n container={tooltipsContainer}\n />\n )}\n </g>\n );\n return highlightedBox ? createPortal(boxElement, activeElementContainer) : boxElement;\n}\n"],"names":["getAesValue","scales","field","value","geom","NO_GROUPED","getTooltipContent","outlier","hasKeyFromColumn","numberFormat","BoxElement","facetKey","orientation","box","aes","sideDistances","showTooltips","elementsAmount","activeElementContainer","tooltipsContainer","tooltipsData","isVertical","boxXPosition","boxOuterWidth","boxWidth","boxHeight","lineColor","fillColor","outliersShape","outliersSize","shape","getPointShape","yRange","dimmedBackground","highlightedBox","boxElement","jsxs","getLineShape","jsx","highlightedOutlier","x","y","el","Tooltip","createPortal"],"mappings":";;;;;;;AAgCA,SAASA,EACLC,GACAC,GACAC,GACAC,GACS;AACT,MAAID,KAAS,O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