@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,40 +1,40 @@
1
- import { getFacetStringKey as y } from "../utils/getFacetStringKey.js";
2
- import S from "../../node_modules/d3-array/src/sum.js";
3
- function x(e, t, u, p) {
4
- let n = -1 / 0;
1
+ import { getFacetStringKey as S } from "../utils/getFacetStringKey.js";
2
+ import z from "../../node_modules/d3-array/src/sum.js";
3
+ function v(e, o, m, p) {
4
+ let t = -1 / 0;
5
5
  return {
6
6
  type: "logo",
7
- geoms: t.facet.reduce((a, g) => {
8
- const s = y(g);
9
- return a[s] = [], t.primary.forEach((i) => {
10
- let m = 0;
11
- const o = {};
12
- t.secondary.forEach((r) => {
13
- const h = u.getRowsByGrouping([...g, i, r]);
7
+ geoms: o.facet.reduce((n, l) => {
8
+ const s = S(l);
9
+ return n[s] = [], o.primary.forEach((i) => {
10
+ let g = 0;
11
+ const a = {};
12
+ o.secondary.forEach((r) => {
13
+ const h = m.getRowsByGrouping([...l, i, r]);
14
14
  if (!h.length)
15
15
  return;
16
- const l = S(h, (f) => Number(f[p.value]));
17
- o[String(r)] = {
18
- height: l,
16
+ const f = Array.from(h).map((y) => Number(m.getColumnValue(p.value, y))), u = z(f);
17
+ a[String(r)] = {
18
+ height: u,
19
19
  key: String(r)
20
- }, m += l;
20
+ }, g += u;
21
21
  });
22
- const c = m;
23
- e.normalize && t.secondary.forEach((r) => {
24
- o[String(r)] && (o[String(r)].height = o[String(r)].height / c * 100);
25
- }), n = Math.max(n, m), a[s].push({
22
+ const c = g;
23
+ e.normalize && o.secondary.forEach((r) => {
24
+ a[String(r)] && (a[String(r)].height = a[String(r)].height / c * 100);
25
+ }), t = Math.max(t, g), n[s].push({
26
26
  key: `logo_${String(i)}`,
27
- valuesMap: o,
27
+ valuesMap: a,
28
28
  primaryGrouping: i,
29
29
  boundsY: { min: 0, max: e.normalize ? c : 100 }
30
30
  });
31
- }), a;
31
+ }), n;
32
32
  }, {}),
33
- meta: { minY: 0, maxY: e.normalize ? 100 : n, normalize: e.normalize },
33
+ meta: { minY: 0, maxY: e.normalize ? 100 : t, normalize: e.normalize },
34
34
  aes: e.aes
35
35
  };
36
36
  }
37
37
  export {
38
- x as getLogoData
38
+ v as getLogoData
39
39
  };
40
40
  //# sourceMappingURL=logo.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"logo.js","sources":["../../../../../../../node_modules/@milaboratories/miplots4/src/discrete/layers/logo.ts"],"sourcesContent":["import type {GroupKey} from '../../DataFrame';\nimport type {DataFrame} from '../../DataFrame';\nimport type {LogoPlotLayer} from '../DiscreteSettingsImpl';\nimport type {LogoPlotData} from './types';\nimport {getFacetStringKey} from '../utils/getFacetStringKey';\nimport type {ColumnName, Row} from '../../types';\nimport {sum} from 'd3-array';\n\ntype LetterPart = {\n height: number,\n key: string\n}\n\nexport type LogoStack = {\n key: string;\n valuesMap: Record<string, LetterPart>;\n primaryGrouping: string;\n boundsY: {\n min: number;\n max: number;\n };\n};\n\nexport function getLogoData(\n layer: LogoPlotLayer,\n groupingKeys: {\n facet: GroupKey[][],\n primary: GroupKey[],\n secondary: GroupKey[]\n },\n data: DataFrame,\n y: ColumnName,\n): LogoPlotData {\n let maxY = -Infinity;\n\n return {\n type: 'logo',\n geoms: groupingKeys.facet.reduce((res: Record<string, LogoStack[]>, facetKey) => {\n const strFacetKey = getFacetStringKey(facetKey);\n res[strFacetKey] = [];\n groupingKeys.primary.forEach(primaryKey => {\n let currentHeight = 0;\n const letterParts:Record<string, LetterPart> = {};\n groupingKeys.secondary.forEach(secondaryKey => {\n const rows = data.getRowsByGrouping([...facetKey, primaryKey, secondaryKey]);\n if (!rows.length) {\n return;\n }\n const height = sum(rows, (row:Row) => Number(row[y.value]));\n letterParts[String(secondaryKey)] = {\n height,\n key: String(secondaryKey),\n };\n currentHeight += height;\n });\n const maxStackHeight = currentHeight;\n if (layer.normalize) { // show in percents of every stack\n groupingKeys.secondary.forEach(secondaryKey => {\n if (!letterParts[String(secondaryKey)]) {\n return;\n }\n letterParts[String(secondaryKey)].height = letterParts[String(secondaryKey)].height / maxStackHeight * 100;\n });\n }\n maxY = Math.max(maxY, currentHeight);\n res[strFacetKey].push({\n key: `logo_${String(primaryKey)}`,\n valuesMap: letterParts,\n primaryGrouping: primaryKey,\n boundsY: {min: 0, max: layer.normalize ? maxStackHeight : 100},\n } as LogoStack);\n });\n return res;\n }, {}),\n meta: {minY: 0, maxY: layer.normalize ? 100 : maxY, normalize: layer.normalize},\n aes: layer.aes,\n };\n}\n"],"names":["getLogoData","layer","groupingKeys","data","y","maxY","res","facetKey","strFacetKey","getFacetStringKey","primaryKey","currentHeight","letterParts","secondaryKey","rows","height","sum","row","maxStackHeight"],"mappings":";;AAuBO,SAASA,EACZC,GACAC,GAKAC,GACAC,GACY;AACZ,MAAIC,IAAO;AAEX,SAAO;AAAA,IACH,MAAM;AAAA,IACN,OAAOH,EAAa,MAAM,OAAO,CAACI,GAAkCC,MAAa;AAC7E,YAAMC,IAAcC,EAAkBF,CAAQ;AAC9C,aAAAD,EAAIE,CAAW,IAAI,CAAA,GACnBN,EAAa,QAAQ,QAAQ,CAAAQ,MAAc;AACvC,YAAIC,IAAgB;AACpB,cAAMC,IAAyC,CAAA;AAC/CV,QAAAA,EAAa,UAAU,QAAQ,CAAAW,MAAgB;AAC3C,gBAAMC,IAAOX,EAAK,kBAAkB,CAAC,GAAGI,GAAUG,GAAYG,CAAY,CAAC;AAC3E,cAAI,CAACC,EAAK;AACN;AAEJ,gBAAMC,IAASC,EAAIF,GAAM,CAACG,MAAY,OAAOA,EAAIb,EAAE,KAAK,CAAC,CAAC;AAC1DQ,UAAAA,EAAY,OAAOC,CAAY,CAAC,IAAI;AAAA,YAChC,QAAAE;AAAAA,YACA,KAAK,OAAOF,CAAY;AAAA,UAAA,GAE5BF,KAAiBI;AAAAA,QACrB,CAAC;AACD,cAAMG,IAAiBP;AACnBV,QAAAA,EAAM,aACNC,EAAa,UAAU,QAAQ,CAAAW,MAAgB;AACtCD,UAAAA,EAAY,OAAOC,CAAY,CAAC,MAGrCD,EAAY,OAAOC,CAAY,CAAC,EAAE,SAASD,EAAY,OAAOC,CAAY,CAAC,EAAE,SAAUK,IAAiB;AAAA,QAC5G,CAAC,GAELb,IAAO,KAAK,IAAIA,GAAMM,CAAa,GACnCL,EAAIE,CAAW,EAAE,KAAK;AAAA,UAClB,KAAK,QAAQ,OAAOE,CAAU,CAAC;AAAA,UAC/B,WAAWE;AAAAA,UACX,iBAAiBF;AAAAA,UACjB,SAAS,EAAC,KAAK,GAAG,KAAKT,EAAM,YAAYiB,IAAiB,IAAA;AAAA,QAAA,CAChD;AAAA,MAClB,CAAC,GACMZ;AAAAA,IACX,GAAG,CAAA,CAAE;AAAA,IACL,MAAM,EAAC,MAAM,GAAG,MAAML,EAAM,YAAY,MAAMI,GAAM,WAAWJ,EAAM,UAAA;AAAA,IACrE,KAAKA,EAAM;AAAA,EAAA;AAEnB;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"logo.js","sources":["../../../../../../../node_modules/@milaboratories/miplots4/src/discrete/layers/logo.ts"],"sourcesContent":["import { sum } from 'd3-array';\nimport type { DataFrame, GroupKey } from '../../DataFrame';\nimport type { ColumnName } from '../../types';\nimport type { LogoPlotLayer } from '../DiscreteSettingsImpl';\nimport { getFacetStringKey } from '../utils/getFacetStringKey';\nimport type { LogoPlotData } from './types';\n\ntype LetterPart = {\n height: number,\n key: string\n}\n\nexport type LogoStack = {\n key: string;\n valuesMap: Record<string, LetterPart>;\n primaryGrouping: string;\n boundsY: {\n min: number;\n max: number;\n };\n};\n\nexport function getLogoData(\n layer: LogoPlotLayer,\n groupingKeys: {\n facet: GroupKey[][],\n primary: GroupKey[],\n secondary: GroupKey[]\n },\n data: DataFrame,\n y: ColumnName,\n): LogoPlotData {\n let maxY = -Infinity;\n\n return {\n type: 'logo',\n geoms: groupingKeys.facet.reduce((res: Record<string, LogoStack[]>, facetKey) => {\n const strFacetKey = getFacetStringKey(facetKey);\n res[strFacetKey] = [];\n groupingKeys.primary.forEach(primaryKey => {\n let currentHeight = 0;\n const letterParts:Record<string, LetterPart> = {};\n groupingKeys.secondary.forEach(secondaryKey => {\n const indexes = data.getRowsByGrouping([...facetKey, primaryKey, secondaryKey]);\n if (!indexes.length) {\n return;\n }\n const values = Array.from(indexes).map(i => Number(data.getColumnValue(y.value, i)));\n const height = sum(values);\n letterParts[String(secondaryKey)] = {\n height,\n key: String(secondaryKey),\n };\n currentHeight += height;\n });\n const maxStackHeight = currentHeight;\n if (layer.normalize) { // show in percents of every stack\n groupingKeys.secondary.forEach(secondaryKey => {\n if (!letterParts[String(secondaryKey)]) {\n return;\n }\n letterParts[String(secondaryKey)].height = letterParts[String(secondaryKey)].height / maxStackHeight * 100;\n });\n }\n maxY = Math.max(maxY, currentHeight);\n res[strFacetKey].push({\n key: `logo_${String(primaryKey)}`,\n valuesMap: letterParts,\n primaryGrouping: primaryKey,\n boundsY: {min: 0, max: layer.normalize ? maxStackHeight : 100},\n } as LogoStack);\n });\n return res;\n }, {}),\n meta: {minY: 0, maxY: layer.normalize ? 100 : maxY, normalize: layer.normalize},\n aes: layer.aes,\n };\n}\n"],"names":["getLogoData","layer","groupingKeys","data","y","maxY","res","facetKey","strFacetKey","getFacetStringKey","primaryKey","currentHeight","letterParts","secondaryKey","indexes","values","i","height","sum","maxStackHeight"],"mappings":";;AAsBO,SAASA,EACZC,GACAC,GAKAC,GACAC,GACY;AACZ,MAAIC,IAAO;AAEX,SAAO;AAAA,IACH,MAAM;AAAA,IACN,OAAOH,EAAa,MAAM,OAAO,CAACI,GAAkCC,MAAa;AAC7E,YAAMC,IAAcC,EAAkBF,CAAQ;AAC9C,aAAAD,EAAIE,CAAW,IAAI,CAAA,GACnBN,EAAa,QAAQ,QAAQ,CAAAQ,MAAc;AACvC,YAAIC,IAAgB;AACpB,cAAMC,IAAyC,CAAA;AAC/CV,UAAa,UAAU,QAAQ,CAAAW,MAAgB;AAC3C,gBAAMC,IAAUX,EAAK,kBAAkB,CAAC,GAAGI,GAAUG,GAAYG,CAAY,CAAC;AAC9E,cAAI,CAACC,EAAQ;AACT;AAEJ,gBAAMC,IAAS,MAAM,KAAKD,CAAO,EAAE,IAAI,CAAAE,MAAK,OAAOb,EAAK,eAAeC,EAAE,OAAOY,CAAC,CAAC,CAAC,GAC7EC,IAASC,EAAIH,CAAM;AACzBH,UAAAA,EAAY,OAAOC,CAAY,CAAC,IAAI;AAAA,YAChC,QAAAI;AAAAA,YACA,KAAK,OAAOJ,CAAY;AAAA,UAAA,GAE5BF,KAAiBM;AAAAA,QACrB,CAAC;AACD,cAAME,IAAiBR;AACnBV,QAAAA,EAAM,aACNC,EAAa,UAAU,QAAQ,CAAAW,MAAgB;AACtCD,UAAAA,EAAY,OAAOC,CAAY,CAAC,MAGrCD,EAAY,OAAOC,CAAY,CAAC,EAAE,SAASD,EAAY,OAAOC,CAAY,CAAC,EAAE,SAAUM,IAAiB;AAAA,QAC5G,CAAC,GAELd,IAAO,KAAK,IAAIA,GAAMM,CAAa,GACnCL,EAAIE,CAAW,EAAE,KAAK;AAAA,UAClB,KAAK,QAAQ,OAAOE,CAAU,CAAC;AAAA,UAC/B,WAAWE;AAAAA,UACX,iBAAiBF;AAAAA,UACjB,SAAS,EAAC,KAAK,GAAG,KAAKT,EAAM,YAAYkB,IAAiB,IAAA;AAAA,QAAA,CAChD;AAAA,MAClB,CAAC,GACMb;AAAAA,IACX,GAAG,CAAA,CAAE;AAAA,IACL,MAAM,EAAC,MAAM,GAAG,MAAML,EAAM,YAAY,MAAMI,GAAM,WAAWJ,EAAM,UAAA;AAAA,IACrE,KAAKA,EAAM;AAAA,EAAA;AAEnB;","x_google_ignoreList":[0]}
@@ -1,89 +1,89 @@
1
- import { getOutliersBounds as Y } from "../utils/getOutliersBounds.js";
2
- import { getFacetStringKey as G } from "../utils/getFacetStringKey.js";
3
- import w from "../../node_modules/lodash/lodash.js";
4
- function O(n, a) {
5
- if (a.length === 2)
1
+ import { l as S } from "../../node_modules/lodash/lodash.js";
2
+ import { getOutliersBounds as b } from "../utils/getOutliersBounds.js";
3
+ import "../../utils/TextMeasurer/TextMeasurer.js";
4
+ import { getFacetStringKey as Y } from "../utils/getFacetStringKey.js";
5
+ function x(o, t) {
6
+ if (t.length === 2)
6
7
  return "secondary";
7
- if (n.length === 2 && a.length < 2)
8
+ if (o.length === 2 && t.length < 2)
8
9
  return "primary";
9
10
  throw Error("Too many groups for paired points layer");
10
11
  }
11
- function b(n, a, p, S, $, v, h, c, l) {
12
- const y = w.groupBy(p, (e) => e[$.value]), d = w.groupBy(S, (e) => e[$.value]), u = Object.keys(y), s = Object.keys(d);
13
- if (w.uniq(u).length !== u.length || w.uniq(s).length !== s.length)
14
- throw Error(`Non unique keys in groups ${String(n)}, ${String(a)} for paired points layer`);
15
- if (u.length !== s.length || w.intersection(u, s).length !== u.length)
16
- throw Error(`Keys in groups ${String(n)}, ${String(a)} not match for paired points layer`);
17
- const i = (e) => Number(e[v.value]);
18
- let t = 1 / 0, r = -1 / 0, k = !1;
19
- const g = l === "log";
20
- let M = u.map((e) => {
21
- const x = y[e][0], B = d[e][0], m = i(x), o = i(B);
22
- return (m === 0 || o === 0) && (k = !0), t = Math.min(t, g && m === 0 ? 1 / 0 : m, g && o === 0 ? 1 / 0 : o), r = Math.max(r, g && m === 0 ? -1 / 0 : m, g && o === 0 ? -1 / 0 : o), {
12
+ function B(o, t, m, M, $, k, y) {
13
+ const p = S.groupBy(m, (e) => e.link), g = S.groupBy(M, (e) => e.link), a = Object.keys(p), s = Object.keys(g);
14
+ if (S.uniq(a).length !== a.length || S.uniq(s).length !== s.length)
15
+ throw Error(`Non unique keys in groups ${String(o)}, ${String(t)} for paired points layer`);
16
+ if (a.length !== s.length || S.intersection(a, s).length !== a.length)
17
+ throw Error(`Keys in groups ${String(o)}, ${String(t)} not match for paired points layer`);
18
+ const h = (e) => e.y;
19
+ let r = 1 / 0, n = -1 / 0, d = !1;
20
+ const l = y === "log";
21
+ let v = a.map((e) => {
22
+ const u = p[e][0], c = g[e][0], f = h(u), i = h(c);
23
+ return (f === 0 || i === 0) && (d = !0), r = Math.min(r, l && f === 0 ? 1 / 0 : f, l && i === 0 ? 1 / 0 : i), n = Math.max(n, l && f === 0 ? -1 / 0 : f, l && i === 0 ? -1 / 0 : i), {
23
24
  id: e,
24
- key1: { id: `${e}_${String(n)}`, value: m, data: x },
25
- key2: { id: `${e}_${String(a)}`, value: o, data: B }
25
+ key1: { id: `${e}_${String(o)}`, value: f, data: u },
26
+ key2: { id: `${e}_${String(t)}`, value: i, data: c }
26
27
  };
27
28
  });
28
- if (!c) {
29
- t = 1 / 0, r = -1 / 0;
30
- const [e, x] = Y(p, l, i), [B, m] = Y(S, l, i);
31
- M = M.filter(({ key1: o, key2: f }) => o.value < e || o.value > x || f.value < B || f.value > m ? !1 : (t = Math.min(t, g && o.value === 0 ? 1 / 0 : o.value, g && f.value === 0 ? 1 / 0 : f.value), r = Math.max(r, g && o.value === 0 ? -1 / 0 : o.value, g && f.value === 0 ? -1 / 0 : f.value), !0));
29
+ if (!k) {
30
+ r = 1 / 0, n = -1 / 0;
31
+ const [e, u] = b(m.map(h), y), [c, f] = b(M.map(h), y);
32
+ v = v.filter(({ key1: i, key2: w }) => i.value < e || i.value > u || w.value < c || w.value > f ? !1 : (r = Math.min(r, l && i.value === 0 ? 1 / 0 : i.value, l && w.value === 0 ? 1 / 0 : w.value), n = Math.max(n, l && i.value === 0 ? -1 / 0 : i.value, l && w.value === 0 ? -1 / 0 : w.value), !0));
32
33
  }
33
- return t = k ? t / 10 : t, r = Math.max(r, t), {
34
- id: `${String(n)}_${String(a)}`,
35
- key1: String(n),
36
- key2: String(a),
37
- pairs: M.map((e) => ({
34
+ return r = d ? r / 10 : r, n = Math.max(n, r), {
35
+ id: `${String(o)}_${String(t)}`,
36
+ key1: String(o),
37
+ key2: String(t),
38
+ pairs: v.map((e) => ({
38
39
  ...e,
39
- key1: { ...e.key1, value: e.key1.value === 0 ? t : e.key1.value },
40
- key2: { ...e.key2, value: e.key2.value === 0 ? t : e.key2.value }
40
+ key1: { ...e.key1, value: e.key1.value === 0 ? r : e.key1.value },
41
+ key2: { ...e.key2, value: e.key2.value === 0 ? r : e.key2.value }
41
42
  })),
42
- grouping: h,
43
- boundsY: { min: t, max: r }
43
+ grouping: $,
44
+ boundsY: { min: r, max: n }
44
45
  };
45
46
  }
46
- function R(n, a, p, S, $) {
47
- const v = O(a.primary, a.secondary);
48
- let h = 1 / 0, c = -1 / 0;
47
+ function E(o, t, m, M, $) {
48
+ const k = x(t.primary, t.secondary), y = (a) => ({
49
+ y: Number(m.getColumnValue(M.value, a)),
50
+ link: m.getColumnValue(o.linkColumn.value, a)
51
+ });
52
+ let p = 1 / 0, g = -1 / 0;
49
53
  return {
50
54
  type: "pairedPoints",
51
- geoms: a.facet.reduce((l, y) => {
52
- const d = G(y);
53
- if (l[d] = [], v === "primary") {
54
- const [u, s] = a.primary, i = p.getRowsByGrouping([...y, u]), t = p.getRowsByGrouping([...y, s]), r = b(
55
- u,
56
- s,
57
- i,
58
- t,
59
- n.linkColumn,
60
- S,
55
+ geoms: t.facet.reduce((a, s) => {
56
+ const h = Y(s);
57
+ if (a[h] = [], k === "primary") {
58
+ const [r, n] = t.primary, d = m.getRowsByGrouping([...s, r]), l = m.getRowsByGrouping([...s, n]), v = Array.from(d).map(y), e = Array.from(l).map(y), u = B(
59
+ r,
60
+ n,
61
61
  v,
62
- n.aes.showOutliers,
62
+ e,
63
+ k,
64
+ o.aes.showOutliers,
63
65
  $.scale
64
66
  );
65
- h = Math.min(h, r.boundsY.min), c = Math.max(c, r.boundsY.max), l[d].push(r);
66
- } else v === "secondary" && a.primary.forEach((u) => {
67
- const [s, i] = a.secondary, t = p.getRowsByGrouping([...y, u, s]), r = p.getRowsByGrouping([...y, u, i]), k = b(
68
- s,
69
- i,
70
- t,
71
- r,
72
- n.linkColumn,
73
- S,
74
- v,
75
- n.aes.showOutliers,
67
+ p = Math.min(p, u.boundsY.min), g = Math.max(g, u.boundsY.max), a[h].push(u);
68
+ } else k === "secondary" && t.primary.forEach((r) => {
69
+ const [n, d] = t.secondary, l = m.getRowsByGrouping([...s, r, n]), v = m.getRowsByGrouping([...s, r, d]), e = Array.from(l).map(y), u = Array.from(v).map(y), c = B(
70
+ n,
71
+ d,
72
+ e,
73
+ u,
74
+ k,
75
+ o.aes.showOutliers,
76
76
  $.scale
77
77
  );
78
- h = Math.min(h, k.boundsY.min), c = Math.max(c, k.boundsY.max), l[d].push(k);
78
+ p = Math.min(p, c.boundsY.min), g = Math.max(g, c.boundsY.max), a[h].push(c);
79
79
  });
80
- return l;
80
+ return a;
81
81
  }, {}),
82
- meta: { minY: h, maxY: c },
83
- aes: n.aes
82
+ meta: { minY: p, maxY: g },
83
+ aes: o.aes
84
84
  };
85
85
  }
86
86
  export {
87
- R as getPairedPointsData
87
+ E as getPairedPointsData
88
88
  };
89
89
  //# sourceMappingURL=pairedPoints.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pairedPoints.js","sources":["../../../../../../../node_modules/@milaboratories/miplots4/src/discrete/layers/pairedPoints.ts"],"sourcesContent":["import type {GroupKey} from '../../DataFrame';\nimport type {DataFrame} from '../../DataFrame';\nimport type {DiscreteSettingsImpl} from '../DiscreteSettingsImpl';\nimport type {PairedPointsLayer} from '../DiscreteSettingsImpl';\nimport type {PairedPointsData} from './types';\nimport {getOutliersBounds} from '../utils';\nimport {getFacetStringKey} from '../utils/getFacetStringKey';\nimport type {ColumnName, Row} from '../../types';\nimport lodash from 'lodash';\n\ntype Point = {\n id: string;\n value: number;\n data: Row;\n};\n\nexport type PairedPoints = {\n id: string;\n key1: string;\n key2: string;\n grouping: 'primary' | 'secondary';\n pairs: {key1: Point; key2: Point; id: string}[];\n boundsY: {\n min: number;\n max: number;\n };\n};\n\nfunction getGroupingType(primaryKeys: GroupKey[], secondaryKeys: GroupKey[]) {\n if (secondaryKeys.length === 2) {\n return 'secondary';\n }\n if (primaryKeys.length === 2 && secondaryKeys.length < 2) {\n return 'primary';\n }\n throw Error('Too many groups for paired points layer');\n}\n\nfunction getPairedGroup(\n key1: GroupKey,\n key2: GroupKey,\n rowsGroup1: Row[],\n rowsGroup2: Row[],\n linkColumn: ColumnName,\n yColumn: ColumnName,\n grouping: 'primary' | 'secondary',\n showOutliers: boolean,\n scale: 'linear' | 'log'\n): PairedPoints {\n const group1 = lodash.groupBy(rowsGroup1, row => row[linkColumn.value]);\n const group2 = lodash.groupBy(rowsGroup2, row => row[linkColumn.value]);\n const pointKeys1 = Object.keys(group1);\n const pointKeys2 = Object.keys(group2);\n // Sets of point ids from group 1 and group 2 must be the same and must contain unique ids\n if (lodash.uniq(pointKeys1).length !== pointKeys1.length || lodash.uniq(pointKeys2).length !== pointKeys2.length) {\n throw Error(`Non unique keys in groups ${String(key1)}, ${String(key2)} for paired points layer`);\n }\n if (\n pointKeys1.length !== pointKeys2.length ||\n lodash.intersection(pointKeys1, pointKeys2).length !== pointKeys1.length\n ) {\n throw Error(`Keys in groups ${String(key1)}, ${String(key2)} not match for paired points layer`);\n }\n\n const yGetter = (row: Row) => Number(row[yColumn.value]);\n let min = Infinity;\n let max = -Infinity;\n let hasZero = false;\n const isLog = scale === 'log';\n let pairs = pointKeys1.map(pairKey => {\n const p1 = group1[pairKey][0];\n const p2 = group2[pairKey][0];\n const v1 = yGetter(p1);\n const v2 = yGetter(p2);\n if (v1 === 0 || v2 === 0) {\n hasZero = true;\n }\n min = Math.min(min, isLog && v1 === 0 ? Infinity : v1, isLog && v2 === 0 ? Infinity : v2);\n max = Math.max(max, isLog && v1 === 0 ? -Infinity : v1, isLog && v2 === 0 ? -Infinity : v2);\n return {\n id: pairKey,\n key1: {id: `${pairKey}_${String(key1)}`, value: v1, data: p1},\n key2: {id: `${pairKey}_${String(key2)}`, value: v2, data: p2},\n };\n });\n if (!showOutliers) {\n min = Infinity;\n max = -Infinity;\n const [boundsMin1, boundMax1] = getOutliersBounds(rowsGroup1, scale, yGetter);\n const [boundsMin2, boundMax2] = getOutliersBounds(rowsGroup2, scale, yGetter);\n pairs = pairs.filter(({key1, key2}) => {\n const outlier =\n key1.value < boundsMin1 || key1.value > boundMax1 || key2.value < boundsMin2 || key2.value > boundMax2;\n if (outlier) {\n return false;\n }\n min = Math.min(min, isLog && key1.value === 0 ? Infinity : key1.value, isLog && key2.value === 0 ? Infinity : key2.value);\n max = Math.max(max, isLog && key1.value === 0 ? -Infinity : key1.value, isLog && key2.value === 0 ? -Infinity : key2.value);\n return true;\n });\n }\n min = hasZero ? min / 10 : min;\n max = Math.max(max, min);\n return {\n id: `${String(key1)}_${String(key2)}`,\n key1: String(key1),\n key2: String(key2),\n pairs: pairs.map(pair => ({\n ...pair,\n key1: {...pair.key1, value: pair.key1.value === 0 ? min : pair.key1.value},\n key2: {...pair.key2, value: pair.key2.value === 0 ? min : pair.key2.value},\n })),\n grouping,\n boundsY: {min, max},\n };\n}\n\nexport function getPairedPointsData(\n layer: PairedPointsLayer,\n groupingKeys: {\n facet: GroupKey[][],\n primary: GroupKey[],\n secondary: GroupKey[]\n },\n data: DataFrame,\n y: ColumnName,\n yAxis: DiscreteSettingsImpl['chartSettings']['yAxis']\n): PairedPointsData {\n const grouping = getGroupingType(groupingKeys.primary, groupingKeys.secondary);\n let minY = Infinity;\n let maxY = -Infinity;\n\n return {\n type: 'pairedPoints',\n geoms: groupingKeys.facet.reduce((res: Record<string, PairedPoints[]>, facetKey) => {\n const strFacetKey = getFacetStringKey(facetKey);\n res[strFacetKey] = [];\n if (grouping === 'primary') {\n const [key1, key2] = groupingKeys.primary;\n const group1 = data.getRowsByGrouping([...facetKey, key1]);\n const group2 = data.getRowsByGrouping([...facetKey, key2]);\n const pairedPointsGroup = getPairedGroup(\n key1,\n key2,\n group1,\n group2,\n layer.linkColumn,\n y,\n grouping,\n layer.aes.showOutliers,\n yAxis.scale\n );\n minY = Math.min(minY, pairedPointsGroup.boundsY.min);\n maxY = Math.max(maxY, pairedPointsGroup.boundsY.max);\n res[strFacetKey].push(pairedPointsGroup);\n } else if (grouping === 'secondary') {\n groupingKeys.primary.forEach(primaryKey => {\n const [key1, key2] = groupingKeys.secondary;\n const group1 = data.getRowsByGrouping([...facetKey, primaryKey, key1]);\n const group2 = data.getRowsByGrouping([...facetKey, primaryKey, key2]);\n const pairedPointsGroup = getPairedGroup(\n key1,\n key2,\n group1,\n group2,\n layer.linkColumn,\n y,\n grouping,\n layer.aes.showOutliers,\n yAxis.scale\n );\n minY = Math.min(minY, pairedPointsGroup.boundsY.min);\n maxY = Math.max(maxY, pairedPointsGroup.boundsY.max);\n res[strFacetKey].push(pairedPointsGroup);\n });\n }\n return res;\n }, {}),\n meta: {minY, maxY},\n aes: layer.aes,\n };\n}\n"],"names":["getGroupingType","primaryKeys","secondaryKeys","getPairedGroup","key1","key2","rowsGroup1","rowsGroup2","linkColumn","yColumn","grouping","showOutliers","scale","group1","lodash","n","row","group2","pointKeys1","pointKeys2","yGetter","min","max","hasZero","isLog","pairs","pairKey","p1","p2","v1","v2","boundsMin1","boundMax1","getOutliersBounds","boundsMin2","boundMax2","pair","getPairedPointsData","layer","groupingKeys","data","y","yAxis","minY","maxY","res","facetKey","strFacetKey","getFacetStringKey","pairedPointsGroup","primaryKey"],"mappings":";;;AA4BA,SAASA,EAAgBC,GAAyBC,GAA2B;AACzE,MAAIA,EAAc,WAAW;AACzB,WAAO;AAEX,MAAID,EAAY,WAAW,KAAKC,EAAc,SAAS;AACnD,WAAO;AAEX,QAAM,MAAM,yCAAyC;AACzD;AAEA,SAASC,EACLC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACY;AACZ,QAAMC,IAASC,EAAO,QAAQR,GAAY,CAAAS,MAAOC,EAAIR,EAAW,KAAK,CAAC,GAChES,IAASH,EAAO,QAAQP,GAAY,CAAAQ,MAAOC,EAAIR,EAAW,KAAK,CAAC,GAChEU,IAAa,OAAO,KAAKL,CAAM,GAC/BM,IAAa,OAAO,KAAKF,CAAM;AAErC,MAAIH,EAAO,KAAKI,CAAU,EAAE,WAAWA,EAAW,UAAUJ,EAAO,KAAKK,CAAU,EAAE,WAAWA,EAAW;AACtG,UAAM,MAAM,6BAA6B,OAAOf,CAAI,CAAC,KAAK,OAAOC,CAAI,CAAC,0BAA0B;AAEpG,MACIa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AA,CAAE;AAAA,IACL,MAAM,EAAC,MAAAF,GAAM,MAAAC,EAAAA;AAAAA,IACb,KAAKN,EAAM;AAAA,EAAA;AAEnB;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"pairedPoints.js","sources":["../../../../../../../node_modules/@milaboratories/miplots4/src/discrete/layers/pairedPoints.ts"],"sourcesContent":["import {\n groupBy,\n intersection,\n uniq\n} from 'lodash';\nimport type { DataFrame, GroupKey } from '../../DataFrame';\nimport type { ColumnName, DataValue, Row } from '../../types';\nimport type { DiscreteSettingsImpl, PairedPointsLayer } from '../DiscreteSettingsImpl';\nimport { getOutliersBounds } from '../utils';\nimport { getFacetStringKey } from '../utils/getFacetStringKey';\nimport type { PairedPointsData } from './types';\n\ntype Point = {\n id: string;\n value: number;\n data: Row;\n};\n\nexport type PairedPoints = {\n id: string;\n key1: string;\n key2: string;\n grouping: 'primary' | 'secondary';\n pairs: {key1: Point; key2: Point; id: string}[];\n boundsY: {\n min: number;\n max: number;\n };\n};\n\nfunction getGroupingType(primaryKeys: GroupKey[], secondaryKeys: GroupKey[]) {\n if (secondaryKeys.length === 2) {\n return 'secondary';\n }\n if (primaryKeys.length === 2 && secondaryKeys.length < 2) {\n return 'primary';\n }\n throw Error('Too many groups for paired points layer');\n}\n\nfunction getPairedGroup(\n key1: GroupKey,\n key2: GroupKey,\n rowsGroup1: {y: number, link: DataValue}[],\n rowsGroup2: {y: number, link: DataValue}[],\n grouping: 'primary' | 'secondary',\n showOutliers: boolean,\n scale: 'linear' | 'log'\n): PairedPoints {\n const group1 = groupBy(rowsGroup1, row => row.link);\n const group2 = groupBy(rowsGroup2, row => row.link);\n const pointKeys1 = Object.keys(group1);\n const pointKeys2 = Object.keys(group2);\n // Sets of point ids from group 1 and group 2 must be the same and must contain unique ids\n if (uniq(pointKeys1).length !== pointKeys1.length || uniq(pointKeys2).length !== pointKeys2.length) {\n throw Error(`Non unique keys in groups ${String(key1)}, ${String(key2)} for paired points layer`);\n }\n if (\n pointKeys1.length !== pointKeys2.length ||\n intersection(pointKeys1, pointKeys2).length !== pointKeys1.length\n ) {\n throw Error(`Keys in groups ${String(key1)}, ${String(key2)} not match for paired points layer`);\n }\n\n const yGetter = (value: {y: number}) => value.y;\n let min = Infinity;\n let max = -Infinity;\n let hasZero = false;\n const isLog = scale === 'log';\n let pairs = pointKeys1.map(pairKey => {\n const p1 = group1[pairKey][0];\n const p2 = group2[pairKey][0];\n const v1 = yGetter(p1);\n const v2 = yGetter(p2);\n if (v1 === 0 || v2 === 0) {\n hasZero = true;\n }\n min = Math.min(min, isLog && v1 === 0 ? Infinity : v1, isLog && v2 === 0 ? Infinity : v2);\n max = Math.max(max, isLog && v1 === 0 ? -Infinity : v1, isLog && v2 === 0 ? -Infinity : v2);\n return {\n id: pairKey,\n key1: {id: `${pairKey}_${String(key1)}`, value: v1, data: p1},\n key2: {id: `${pairKey}_${String(key2)}`, value: v2, data: p2},\n };\n });\n if (!showOutliers) {\n min = Infinity;\n max = -Infinity;\n const [boundsMin1, boundMax1] = getOutliersBounds(rowsGroup1.map(yGetter), scale);\n const [boundsMin2, boundMax2] = getOutliersBounds(rowsGroup2.map(yGetter), scale);\n pairs = pairs.filter(({key1, key2}) => {\n const outlier =\n key1.value < boundsMin1 || key1.value > boundMax1 || key2.value < boundsMin2 || key2.value > boundMax2;\n if (outlier) {\n return false;\n }\n min = Math.min(min, isLog && key1.value === 0 ? Infinity : key1.value, isLog && key2.value === 0 ? Infinity : key2.value);\n max = Math.max(max, isLog && key1.value === 0 ? -Infinity : key1.value, isLog && key2.value === 0 ? -Infinity : key2.value);\n return true;\n });\n }\n min = hasZero ? min / 10 : min;\n max = Math.max(max, min);\n return {\n id: `${String(key1)}_${String(key2)}`,\n key1: String(key1),\n key2: String(key2),\n pairs: pairs.map(pair => ({\n ...pair,\n key1: {...pair.key1, value: pair.key1.value === 0 ? min : pair.key1.value},\n key2: {...pair.key2, value: pair.key2.value === 0 ? min : pair.key2.value},\n })),\n grouping,\n boundsY: {min, max},\n };\n}\n\nexport function getPairedPointsData(\n layer: PairedPointsLayer,\n groupingKeys: {\n facet: GroupKey[][],\n primary: GroupKey[],\n secondary: GroupKey[]\n },\n data: DataFrame,\n y: ColumnName,\n yAxis: DiscreteSettingsImpl['chartSettings']['yAxis']\n): PairedPointsData {\n const grouping = getGroupingType(groupingKeys.primary, groupingKeys.secondary);\n const groupGetter = (idx: number) => {\n return {\n y: Number(data.getColumnValue(y.value, idx)),\n link: data.getColumnValue(layer.linkColumn.value, idx),\n };\n };\n let minY = Infinity;\n let maxY = -Infinity;\n\n return {\n type: 'pairedPoints',\n geoms: groupingKeys.facet.reduce((res: Record<string, PairedPoints[]>, facetKey) => {\n const strFacetKey = getFacetStringKey(facetKey);\n res[strFacetKey] = [];\n if (grouping === 'primary') {\n const [key1, key2] = groupingKeys.primary;\n const group1Indexes = data.getRowsByGrouping([...facetKey, key1]);\n const group2Indexes = data.getRowsByGrouping([...facetKey, key2]);\n\n const group1 = Array.from(group1Indexes).map(groupGetter);\n const group2 = Array.from(group2Indexes).map(groupGetter);\n const pairedPointsGroup = getPairedGroup(\n key1,\n key2,\n group1,\n group2,\n grouping,\n layer.aes.showOutliers,\n yAxis.scale\n );\n minY = Math.min(minY, pairedPointsGroup.boundsY.min);\n maxY = Math.max(maxY, pairedPointsGroup.boundsY.max);\n res[strFacetKey].push(pairedPointsGroup);\n } else if (grouping === 'secondary') {\n groupingKeys.primary.forEach(primaryKey => {\n const [key1, key2] = groupingKeys.secondary;\n const group1Indexes = data.getRowsByGrouping([...facetKey, primaryKey, key1]);\n const group2Indexes = data.getRowsByGrouping([...facetKey, primaryKey, key2]);\n const group1 = Array.from(group1Indexes).map(groupGetter);\n const group2 = Array.from(group2Indexes).map(groupGetter);\n const pairedPointsGroup = getPairedGroup(\n key1,\n key2,\n group1,\n group2,\n grouping,\n layer.aes.showOutliers,\n yAxis.scale\n );\n minY = Math.min(minY, pairedPointsGroup.boundsY.min);\n maxY = Math.max(maxY, pairedPointsGroup.boundsY.max);\n res[strFacetKey].push(pairedPointsGroup);\n });\n }\n return res;\n }, {}),\n meta: {minY, maxY},\n aes: layer.aes,\n };\n}\n"],"names":["getGroupingType","primaryKeys","secondaryKeys","getPairedGroup","key1","key2","rowsGroup1","rowsGroup2","grouping","showOutliers","scale","group1","groupBy","row","group2","pointKeys1","pointKeys2","uniq","intersection","yGetter","value","min","max","hasZero","isLog","pairs","pairKey","p1","p2","v1","v2","boundsMin1","boundMax1","getOutliersBounds","boundsMin2","boundMax2","pair","getPairedPointsData","layer","groupingKeys","data","y","yAxis","groupGetter","idx","minY","maxY","res","facetKey","strFacetKey","getFacetStringKey","group1Indexes","group2Indexes","pairedPointsGroup","primaryKey"],"mappings":";;;;AA8BA,SAASA,EAAgBC,GAAyBC,GAA2B;AACzE,MAAIA,EAAc,WAAW;AACzB,WAAO;AAEX,MAAID,EAAY,WAAW,KAAKC,EAAc,SAAS;AACnD,WAAO;AAEX,QAAM,MAAM,yCAAyC;AACzD;AAEA,SAASC,EACLC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACY;AACZ,QAAMC,IAASC,EAAAA,QAAQN,GAAY,CAAAO,MAAOA,EAAI,IAAI,GAC5CC,IAASF,EAAAA,QAAQL,GAAY,CAAAM,MAAOA,EAAI,IAAI,GAC5CE,IAAa,OAAO,KAAKJ,CAAM,GAC/BK,IAAa,OAAO,KAAKF,CAAM;AAErC,MAAIG,EAAAA,KAAKF,CAAU,EAAE,WAAWA,EAAW,UAAUE,EAAAA,KAAKD,CAAU,EAAE,WAAWA,EAAW;AACxF,UAAM,MAAM,6BAA6B,OAAOZ,CAAI,CAAC,KAAK,OAAOC,CAAI,CAAC,0BAA0B;AAEpG,MACIU,EAAW,WAAWC,EAAW,UACjCE,EAAAA,aAAaH,GAAYC,CAAU,EAAE,WAAWD,EAAW;AAE3D,UAAM,MAAM,kBAAkB,OAAOX,CAAI,CAAC,KAAK,OAAOC,CAAI,CAAC,oCAAoC;AAGnG,QAAMc,I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AIA,GAAMO,EAAkB,QAAQ,GAAG,GACnDN,EAAIE,CAAW,EAAE,KAAKI,CAAiB;AAAA,MAC3C,CAAC;AAEL,aAAON;AAAAA,IACX,GAAG,CAAA,CAAE;AAAA,IACL,MAAM,EAAC,MAAAF,GAAM,MAAAC,EAAAA;AAAAA,IACb,KAAKR,EAAM;AAAA,EAAA;AAEnB;","x_google_ignoreList":[0]}
@@ -1,96 +1,92 @@
1
- import { getOutliersBounds as D } from "../utils/getOutliersBounds.js";
2
- import { getFacetStringKey as G } from "../utils/getFacetStringKey.js";
3
- import E from "../../node_modules/lodash/lodash.js";
4
- import O from "../../node_modules/d3-random/src/lcg.js";
1
+ import Y from "../../node_modules/lodash/lodash.js";
2
+ import { getOutliersBounds as v } from "../utils/getOutliersBounds.js";
3
+ import "../../utils/TextMeasurer/TextMeasurer.js";
4
+ import { getFacetStringKey as D } from "../utils/getFacetStringKey.js";
5
+ import G from "../../node_modules/d3-random/src/lcg.js";
5
6
  import q from "../../node_modules/d3-scale/src/linear.js";
6
- import N from "../../node_modules/d3-array/src/max.js";
7
- import { quantileSorted as v } from "../../node_modules/d3-array/src/quantile.js";
8
- import Y from "../../node_modules/d3-array/src/mean.js";
9
- var P = Object.defineProperty, j = (t, r, o) => r in t ? P(t, r, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[r] = o, g = (t, r, o) => j(t, typeof r != "symbol" ? r + "" : r, o);
10
- const k = 30;
11
- function B(t, r) {
12
- return function(o) {
13
- return r.map(function(e) {
14
- return Y(o, (m) => t(e - m));
7
+ import E from "../../node_modules/d3-array/src/max.js";
8
+ import { quantileSorted as S } from "../../node_modules/d3-array/src/quantile.js";
9
+ import M from "../../node_modules/d3-array/src/mean.js";
10
+ var O = Object.defineProperty, $ = (t, r, n) => r in t ? O(t, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[r] = n, f = (t, r, n) => $(t, typeof r != "symbol" ? r + "" : r, n);
11
+ const B = 30;
12
+ function j(t, r) {
13
+ return function(n) {
14
+ return r.map(function(i) {
15
+ return M(n, (c) => t(i - c));
15
16
  });
16
17
  };
17
18
  }
18
- function I(t) {
19
+ function k(t) {
19
20
  return function(r) {
20
21
  return 1 / Math.sqrt(2 * Math.PI) * Math.pow(Math.E, -0.5 * Math.pow(r / t, 2));
21
22
  };
22
23
  }
23
- function R(t) {
24
- const r = Y(t);
25
- return Y(t.map((o) => Math.pow(o - r, 2)));
24
+ function C(t) {
25
+ const r = M(t);
26
+ return M(t.map((n) => Math.pow(n - r, 2)));
26
27
  }
27
- function U(t) {
28
- return Math.sqrt(R(t));
28
+ function I(t) {
29
+ return Math.sqrt(C(t));
29
30
  }
30
- function _(t) {
31
- const r = v(t, 0.25), o = (v(t, 0.75) - r) / 1.34, e = U(t);
32
- return 1.06 * Math.min(e, o) * Math.pow(t.length, -1 / 5);
31
+ function P(t) {
32
+ const r = S(t, 0.25), n = (S(t, 0.75) - r) / 1.34, i = I(t);
33
+ return 1.06 * Math.min(i, n) * Math.pow(t.length, -1 / 5);
33
34
  }
34
- class $ {
35
- constructor(r, o, e, m, y, d) {
36
- g(this, "key"), g(this, "maxDensity"), g(this, "primaryGrouping"), g(this, "secondaryGrouping"), g(this, "points"), g(this, "boundsY");
37
- const b = k;
35
+ class R {
36
+ constructor(r, n, i, c, g) {
37
+ f(this, "key"), f(this, "maxDensity"), f(this, "primaryGrouping"), f(this, "secondaryGrouping"), f(this, "points"), f(this, "boundsY");
38
+ const y = B;
38
39
  if (r.length === 0)
39
40
  throw Error("Unable to calculate sina on empty data");
40
- this.primaryGrouping = String(m), this.secondaryGrouping = String(y), this.key = `sina_${this.primaryGrouping}_${this.secondaryGrouping}`;
41
- const c = (n) => e === "log" ? Math.log10(n) : n, l = (n) => e === "log" ? Math.pow(10, n) : n, a = (n) => Number(n[o.value]), p = r.filter((n) => e === "log" && a(n) === 0 ? (console.warn("Value = 0 on chart with log scale, it was removed from calculation"), !1) : !0).sort((n, f) => c(a(n)) - c(a(f))), u = p.map((n) => c(a(n))), h = u[0], s = u[p.length - 1], x = (s - h) / b, i = _(u), w = E.range(h + x, s, x);
41
+ this.primaryGrouping = String(i), this.secondaryGrouping = String(c), this.key = `sina_${this.primaryGrouping}_${this.secondaryGrouping}`;
42
+ const e = (o) => n === "log" ? Math.log10(o) : o, x = (o) => n === "log" ? Math.pow(10, o) : o, s = r.filter((o) => n === "log" && o === 0 ? (console.warn("Value = 0 on chart with log scale, it was removed from calculation"), !1) : !0).sort((o, h) => e(o) - e(h)), u = s.map(e), p = u[0], l = u[s.length - 1], d = (l - p) / y, b = P(u), m = Y.range(p + d, l, d);
42
43
  this.boundsY = {
43
- min: l(h),
44
- max: l(s)
44
+ min: x(p),
45
+ max: x(l)
45
46
  };
46
- const M = B(I(i), w)(u), S = q().domain(w).range(M).clamp(!0);
47
- this.maxDensity = N(M), this.points = p.map((n, f) => ({
48
- x: a(n),
49
- y: S(c(a(n))) / this.maxDensity,
50
- id: String(f),
51
- jitter: d(),
52
- data: n
47
+ const a = j(k(b), m)(u), w = q().domain(m).range(a).clamp(!0);
48
+ this.maxDensity = E(a), this.points = s.map((o, h) => ({
49
+ x: o,
50
+ y: w(e(o)) / this.maxDensity,
51
+ id: String(h),
52
+ jitter: g()
53
53
  }));
54
54
  }
55
55
  }
56
- function J(t, r, o, e, m) {
57
- let y = 0, d = 1 / 0, b = -1 / 0;
58
- const c = O(1);
56
+ function H(t, r, n, i, c) {
57
+ let g = 0, y = 1 / 0, e = -1 / 0;
58
+ const x = G(1);
59
59
  return {
60
60
  type: "sina",
61
- geoms: r.facet.reduce((l, a) => {
62
- const p = G(a);
63
- return l[p] = [], r.primary.forEach((u) => {
64
- r.secondary.forEach((h) => {
65
- const s = o.getRowsByGrouping([...a, u, h]);
66
- if (!s.length)
61
+ geoms: r.facet.reduce((s, u) => {
62
+ const p = D(u);
63
+ return s[p] = [], r.primary.forEach((l) => {
64
+ r.secondary.forEach((d) => {
65
+ const b = n.getRowsByGrouping([...u, l, d]);
66
+ if (!b.length)
67
67
  return;
68
- let x = s;
68
+ let m = Array.from(b).map((w) => Number(n.getColumnValue(i.value, w)));
69
69
  if (!t.aes.showOutliers) {
70
- const w = (n) => Number(n[e.value]), [M, S] = D(s, m.scale, w);
71
- x = s.filter((n) => {
72
- const f = w(n);
73
- return f >= M && f <= S;
74
- });
70
+ const [w, o] = v(m, c.scale);
71
+ m = m.filter((h) => h >= w && h <= o);
75
72
  }
76
- const i = new $(
77
- x,
78
- e,
79
- m.scale,
80
- u,
81
- h,
82
- c
73
+ const a = new R(
74
+ m,
75
+ c.scale,
76
+ l,
77
+ d,
78
+ x
83
79
  );
84
- i.maxDensity > y && (y = i.maxDensity), i.boundsY.min < d && (d = i.boundsY.min), i.boundsY.max > b && (b = i.boundsY.max), l[p].push(i);
80
+ a.maxDensity > g && (g = a.maxDensity), a.boundsY.min < y && (y = a.boundsY.min), a.boundsY.max > e && (e = a.boundsY.max), s[p].push(a);
85
81
  });
86
- }), l;
82
+ }), s;
87
83
  }, {}),
88
- meta: { maxDensity: y, minY: d, maxY: b },
84
+ meta: { maxDensity: g, minY: y, maxY: e },
89
85
  aes: t.aes
90
86
  };
91
87
  }
92
88
  export {
93
- $ as Sina,
94
- J as getSinaData
89
+ R as Sina,
90
+ H as getSinaData
95
91
  };
96
92
  //# sourceMappingURL=sina.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sina.js","sources":["../../../../../../../node_modules/@milaboratories/miplots4/src/discrete/layers/sina.ts"],"sourcesContent":["import type {GroupKey, NO_GROUPED} from '../../DataFrame';\nimport type {DataFrame} from '../../DataFrame';\nimport type {DiscreteSettingsImpl, SinaLayer} from '../DiscreteSettingsImpl';\nimport type {SinaData} from './types';\nimport {getOutliersBounds} from '../utils';\nimport {getFacetStringKey} from '../utils/getFacetStringKey';\nimport type {ColumnName, DataValue, Row} from '../../types';\nimport {max, mean, quantileSorted} from 'd3-array';\nimport {randomLcg} from 'd3-random';\nimport {scaleLinear} from 'd3-scale';\nimport lodash from 'lodash';\n\nconst DEFAULT_STEPS_COUNT = 30;\n\nfunction kernelDensityEstimator(kernel: (v: number) => number, thresholds: number[]) {\n return function (arr: number[]) {\n return thresholds.map(function (x):number {\n return mean(arr, v => kernel(x - v)) as number;\n });\n };\n}\n\nfunction kernelGaussian(bandwidth: number) {\n return function (v: number) {\n return (1 / Math.sqrt(2 * Math.PI)) * Math.pow(Math.E, -0.5 * Math.pow(v / bandwidth, 2));\n };\n}\n\nfunction getVariance(arr: number[]) {\n const vMean = mean(arr) as number;\n\n return mean(arr.map(v => Math.pow(v - vMean, 2))) as number;\n}\nfunction getStandardDeviation(arr: number[]) {\n return Math.sqrt(getVariance(arr));\n}\nfunction nrdBandwidth(arr: number[]) {\n const q1 = quantileSorted(arr, 0.25) as number;\n const q3 = quantileSorted(arr, 0.75) as number;\n const iqr = q3 - q1;\n const h = iqr / 1.34;\n const sigma = getStandardDeviation(arr);\n\n return 1.06 * Math.min(sigma, h) * Math.pow(arr.length, -1 / 5);\n}\n\nexport class Sina {\n key: string;\n maxDensity: number;\n primaryGrouping: string;\n secondaryGrouping: string;\n\n points: {x: number, y: number, jitter: number, id: string, data: Row}[];\n\n boundsY: {\n min: number;\n max: number;\n };\n\n constructor(\n rowValues: Row[],\n y:ColumnName,\n scale: 'linear' | 'log',\n primaryGrouping: DataValue | typeof NO_GROUPED,\n secondaryGrouping: DataValue | typeof NO_GROUPED,\n getJitter: () => number\n ) {\n const stepsCount = DEFAULT_STEPS_COUNT;\n if (rowValues.length === 0) {\n throw Error('Unable to calculate sina on empty data');\n }\n\n this.primaryGrouping = String(primaryGrouping);\n this.secondaryGrouping = String(secondaryGrouping);\n this.key = `sina_${this.primaryGrouping}_${this.secondaryGrouping}`;\n\n const convertToScale = (v: number) => (scale === 'log' ? Math.log10(v) : v);\n const convertFromScale = (v: number) => (scale === 'log' ? Math.pow(10, v) : v);\n const getterY = (r:Row) => Number(r[y.value]);\n\n const sortedGroup = rowValues\n .filter((r:Row) => {\n if (scale === 'log' && getterY(r) === 0) {\n console.warn('Value = 0 on chart with log scale, it was removed from calculation');\n return false;\n }\n return true;\n })\n .sort((a, b) => convertToScale(getterY(a)) - convertToScale(getterY(b)));\n const sortedValues = sortedGroup.map((r) => convertToScale(getterY(r)));\n const minV = sortedValues[0];\n const maxV = sortedValues[sortedGroup.length - 1];\n const xRange = maxV - minV;\n const step = xRange / stepsCount;\n const bandwidth = nrdBandwidth(sortedValues);\n const thresholds = lodash.range(minV + step, maxV, step);\n\n this.boundsY = {\n min: convertFromScale(minV),\n max: convertFromScale(maxV),\n };\n\n const kde = kernelDensityEstimator(kernelGaussian(bandwidth), thresholds);\n const density = kde(sortedValues);\n const scaleY = scaleLinear().domain(thresholds).range(density).clamp(true);\n\n this.maxDensity = max(density) as number;\n\n this.points = sortedGroup.map((row:Row, idx) => {\n return {\n x: getterY(row),\n y: scaleY(convertToScale(getterY(row))) / this.maxDensity,\n id: String(idx),\n jitter: getJitter(),\n data: row\n };\n });\n }\n}\n\nexport function getSinaData(\n layer: SinaLayer,\n groupingKeys: {\n facet: GroupKey[][],\n primary: GroupKey[],\n secondary: GroupKey[]\n },\n data: DataFrame,\n y: DiscreteSettingsImpl['y'],\n yAxis: DiscreteSettingsImpl['chartSettings']['yAxis']\n): SinaData {\n let maxDensity = 0;\n let minY = Infinity;\n let maxY = -Infinity;\n const getJitter = randomLcg(1);\n\n const geoms = groupingKeys.facet.reduce((res: Record<string, Sina[]>, facetKey) => {\n const strFacetKey = getFacetStringKey(facetKey);\n res[strFacetKey] = [];\n groupingKeys.primary.forEach(primaryKey => {\n groupingKeys.secondary.forEach(secondaryKey => {\n const values = data.getRowsByGrouping([...facetKey, primaryKey, secondaryKey]);\n if (!values.length) {\n return;\n }\n let valuesFiltered = values;\n if (!layer.aes.showOutliers) {\n const yGetter = (r:Row) => Number(r[y.value]);\n const [boundsMin, boundMax] = getOutliersBounds(values, yAxis.scale, yGetter);\n valuesFiltered = values.filter((row: Row) => {\n const value = yGetter(row);\n return value >= boundsMin && value <= boundMax;\n });\n }\n const sina = new Sina(\n valuesFiltered,\n y,\n yAxis.scale,\n primaryKey,\n secondaryKey,\n getJitter\n );\n\n if (sina.maxDensity > maxDensity) {\n maxDensity = sina.maxDensity;\n }\n if (sina.boundsY.min < minY) {\n minY = sina.boundsY.min;\n }\n if (sina.boundsY.max > maxY) {\n maxY = sina.boundsY.max;\n }\n res[strFacetKey].push(sina);\n });\n });\n return res;\n }, {});\n\n return {\n type: 'sina',\n geoms,\n meta: {maxDensity, minY, maxY},\n aes: layer.aes,\n };\n}\n"],"names":["DEFAULT_STEPS_COUNT","kernelDensityEstimator","kernel","thresholds","arr","x","mean","v","kernelGaussian","bandwidth","getVariance","vMean","getStandardDeviation","nrdBandwidth","q1","quantileSorted","h","sigma","Sina","rowValues","y","scale","primaryGrouping","secondaryGrouping","getJitter","__publicField","stepsCount","convertToScale","convertFromScale","getterY","r","sortedGroup","a","b","sortedValues","minV","maxV","step","lodash","density","scaleY","scaleLinear","max","row","idx","getSinaData","layer","groupingKeys","data","yAxis","maxDensity","minY","maxY","randomLcg","res","facetKey","strFacetKey","getFacetStringKey","primaryKey","secondaryKey","values","valuesFiltered","yGetter","boundsMin","boundMax","getOutliersBounds","value","sina"],"mappings":";;;;;;;;;AAYA,MAAMA,IAAsB;AAE5B,SAASC,EAAuBC,GAA+BC,GAAsB;AACjF,SAAO,SAAUC,GAAe;AAC5B,WAAOD,EAAW,IAAI,SAAUE,GAAU;AACtC,aAAOC,EAAKF,GAAK,CAAAG,MAAKL,EAAOG,IAAIE,CAAC,CAAC;AAAA,IACvC,CAAC;AAAA,EACL;AACJ;AAEA,SAASC,EAAeC,GAAmB;AACvC,SAAO,SAAUF,GAAW;AACxB,WAAQ,IAAI,KAAK,KAAK,IAAI,KAAK,EAAE,IAAK,KAAK,IAAI,KAAK,GAAG,OAAO,KAAK,IAAIA,IAAIE,GAAW,CAAC,CAAC;AAAA,EAC5F;AACJ;AAEA,SAASC,EAAYN,GAAe;AAChC,QAAMO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,MAAgB;AAC3C,gBAAMC,IAASZ,EAAK,kBAAkB,CAAC,GAAGO,GAAUG,GAAYC,CAAY,CAAC;AAC7E,cAAI,CAACC,EAAO;AACR;AAEJ,cAAIC,IAAiBD;AACrB,cAAI,CAACd,EAAM,IAAI,cAAc;AACzB,kBAAMgB,IAAU,CAAChC,MAAU,OAAOA,EAAEV,EAAE,KAAK,CAAC,GACtC,CAAC2C,GAAWC,CAAQ,IAAIC,EAAkBL,GAAQX,EAAM,OAAOa,CAAO;AAC5ED,gBAAiBD,EAAO,OAAO,CAACjB,MAAa;AACzC,oBAAMuB,IAAQJ,EAAQnB,CAAG;AACzB,qBAAOuB,KAASH,KAAaG,KAASF;AAAAA,YAC1C,CAAC;AAAA,UACL;AACA,gBAAMG,IAAO,IAAIjD;AAAAA,YACb2C;AAAAA,YACAzC;AAAAA,YACA6B,EAAM;AAAA,YACNS;AAAAA,YACAC;AAAAA,YACAnC;AAAAA,UAAA;AAGA2C,UAAAA,EAAK,aAAajB,MAClBA,IAAaiB,EAAK,aAElBA,EAAK,QAAQ,MAAMhB,MACnBA,IAAOgB,EAAK,QAAQ,MAEpBA,EAAK,QAAQ,MAAMf,MACnBA,IAAOe,EAAK,QAAQ,MAExBb,EAAIE,CAAW,EAAE,KAAKW,CAAI;AAAA,QAC9B,CAAC;AAAA,MACL,CAAC,GACMb;AAAAA,IACX,GAAG,CAAA,CAAE;AAAA,IAKD,MAAM,EAAC,YAAAJ,GAAY,MAAAC,GAAM,MAAAC,EAAAA;AAAAA,IACzB,KAAKN,EAAM;AAAA,EAAA;AAEnB;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"sina.js","sources":["../../../../../../../node_modules/@milaboratories/miplots4/src/discrete/layers/sina.ts"],"sourcesContent":["import { max, mean, quantileSorted } from 'd3-array';\nimport { randomLcg } from 'd3-random';\nimport { scaleLinear } from 'd3-scale';\nimport lodash from 'lodash';\nimport type { DataFrame, GroupKey, NO_GROUPED } from '../../DataFrame';\nimport type { DataValue } from '../../types';\nimport type { DiscreteSettingsImpl, SinaLayer } from '../DiscreteSettingsImpl';\nimport { getOutliersBounds } from '../utils';\nimport { getFacetStringKey } from '../utils/getFacetStringKey';\nimport type { SinaData } from './types';\n\nconst DEFAULT_STEPS_COUNT = 30;\n\nfunction kernelDensityEstimator(kernel: (v: number) => number, thresholds: number[]) {\n return function (arr: number[]) {\n return thresholds.map(function (x):number {\n return mean(arr, v => kernel(x - v)) as number;\n });\n };\n}\n\nfunction kernelGaussian(bandwidth: number) {\n return function (v: number) {\n return (1 / Math.sqrt(2 * Math.PI)) * Math.pow(Math.E, -0.5 * Math.pow(v / bandwidth, 2));\n };\n}\n\nfunction getVariance(arr: number[]) {\n const vMean = mean(arr) as number;\n\n return mean(arr.map(v => Math.pow(v - vMean, 2))) as number;\n}\nfunction getStandardDeviation(arr: number[]) {\n return Math.sqrt(getVariance(arr));\n}\nfunction nrdBandwidth(arr: number[]) {\n const q1 = quantileSorted(arr, 0.25) as number;\n const q3 = quantileSorted(arr, 0.75) as number;\n const iqr = q3 - q1;\n const h = iqr / 1.34;\n const sigma = getStandardDeviation(arr);\n\n return 1.06 * Math.min(sigma, h) * Math.pow(arr.length, -1 / 5);\n}\n\nexport class Sina {\n key: string;\n maxDensity: number;\n primaryGrouping: string;\n secondaryGrouping: string;\n\n points: {x: number, y: number, jitter: number, id: string}[];\n\n boundsY: {\n min: number;\n max: number;\n };\n\n constructor(\n values: number[],\n scale: 'linear' | 'log',\n primaryGrouping: DataValue | typeof NO_GROUPED,\n secondaryGrouping: DataValue | typeof NO_GROUPED,\n getJitter: () => number\n ) {\n const stepsCount = DEFAULT_STEPS_COUNT;\n if (values.length === 0) {\n throw Error('Unable to calculate sina on empty data');\n }\n\n this.primaryGrouping = String(primaryGrouping);\n this.secondaryGrouping = String(secondaryGrouping);\n this.key = `sina_${this.primaryGrouping}_${this.secondaryGrouping}`;\n\n const convertToScale = (v: number) => (scale === 'log' ? Math.log10(v) : v);\n const convertFromScale = (v: number) => (scale === 'log' ? Math.pow(10, v) : v);\n\n const sortedGroup = values\n .filter((v: number) => {\n if (scale === 'log' && v === 0) {\n console.warn('Value = 0 on chart with log scale, it was removed from calculation');\n return false;\n }\n return true;\n })\n .sort((a, b) => convertToScale(a) - convertToScale(b));\n const sortedValues = sortedGroup.map(convertToScale);\n const minV = sortedValues[0];\n const maxV = sortedValues[sortedGroup.length - 1];\n const xRange = maxV - minV;\n const step = xRange / stepsCount;\n const bandwidth = nrdBandwidth(sortedValues);\n const thresholds = lodash.range(minV + step, maxV, step);\n\n this.boundsY = {\n min: convertFromScale(minV),\n max: convertFromScale(maxV),\n };\n\n const kde = kernelDensityEstimator(kernelGaussian(bandwidth), thresholds);\n const density = kde(sortedValues);\n const scaleY = scaleLinear().domain(thresholds).range(density).clamp(true);\n\n this.maxDensity = max(density) as number;\n\n this.points = sortedGroup.map((y:number, idx) => {\n return {\n x: y,\n y: scaleY(convertToScale(y)) / this.maxDensity,\n id: String(idx),\n jitter: getJitter(),\n };\n });\n }\n}\n\nexport function getSinaData(\n layer: SinaLayer,\n groupingKeys: {\n facet: GroupKey[][],\n primary: GroupKey[],\n secondary: GroupKey[]\n },\n data: DataFrame,\n y: DiscreteSettingsImpl['y'],\n yAxis: DiscreteSettingsImpl['chartSettings']['yAxis']\n): SinaData {\n let maxDensity = 0;\n let minY = Infinity;\n let maxY = -Infinity;\n const getJitter = randomLcg(1);\n\n const geoms = groupingKeys.facet.reduce((res: Record<string, Sina[]>, facetKey) => {\n const strFacetKey = getFacetStringKey(facetKey);\n res[strFacetKey] = [];\n groupingKeys.primary.forEach(primaryKey => {\n groupingKeys.secondary.forEach(secondaryKey => {\n const indexes = data.getRowsByGrouping([...facetKey, primaryKey, secondaryKey]);\n if (!indexes.length) {\n return;\n }\n let valuesFiltered = Array.from(indexes).map(idx => Number(data.getColumnValue(y.value, idx)));\n if (!layer.aes.showOutliers) {\n const [boundsMin, boundMax] = getOutliersBounds(valuesFiltered, yAxis.scale);\n valuesFiltered = valuesFiltered.filter((value: number) => {\n return value >= boundsMin && value <= boundMax;\n });\n }\n const sina = new Sina(\n valuesFiltered,\n yAxis.scale,\n primaryKey,\n secondaryKey,\n getJitter\n );\n\n if (sina.maxDensity > maxDensity) {\n maxDensity = sina.maxDensity;\n }\n if (sina.boundsY.min < minY) {\n minY = sina.boundsY.min;\n }\n if (sina.boundsY.max > maxY) {\n maxY = sina.boundsY.max;\n }\n res[strFacetKey].push(sina);\n });\n });\n return res;\n }, {});\n\n return {\n type: 'sina',\n geoms,\n meta: {maxDensity, minY, maxY},\n aes: layer.aes,\n };\n}\n"],"names":["DEFAULT_STEPS_COUNT","kernelDensityEstimator","kernel","thresholds","arr","x","mean","v","kernelGaussian","bandwidth","getVariance","vMean","getStandardDeviation","nrdBandwidth","q1","quantileSorted","h","sigma","Sina","values","scale","primaryGrouping","secondaryGrouping","getJitter","__publicField","stepsCount","convertToScale","convertFromScale","sortedGroup","a","b","sortedValues","minV","maxV","step","lodash","density","scaleY","scaleLinear","max","y","idx","getSinaData","layer","groupingKeys","data","yAxis","maxDensity","minY","maxY","randomLcg","res","facetKey","strFacetKey","getFacetStringKey","primaryKey","secondaryKey","indexes","valuesFiltered","boundsMin","boundMax","getOutliersBounds","value","sina"],"mappings":";;;;;;;;;;AAWA,MAAMA,IAAsB;AAE5B,SAASC,EAAuBC,GAA+BC,GAAsB;AACjF,SAAO,SAAUC,GAAe;AAC5B,WAAOD,EAAW,IAAI,SAAUE,GAAU;AACtC,aAAOC,EAAKF,GAAK,CAAAG,MAAKL,EAAOG,IAAIE,CAAC,CAAC;AAAA,IACvC,CAAC;AAAA,EACL;AACJ;AAEA,SAASC,EAAeC,GAAmB;AACvC,SAAO,SAAUF,GAAW;AACxB,WAAQ,IAAI,KAAK,KAAK,IAAI,KAAK,EAAE,IAAK,KAAK,IAAI,KAAK,GAAG,OAAO,KAAK,IAAIA,IAAIE,GAAW,CAAC,CAAC;AAAA,EAC5F;AACJ;AAEA,SAASC,EAAYN,GA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AhB,MAAO,OAAOI,EAAK,eAAeL,EAAE,OAAOC,CAAG,CAAC,CAAC;AAC7F,cAAI,CAACE,EAAM,IAAI,cAAc;AACzB,kBAAM,CAACgB,GAAWC,CAAQ,IAAIC,EAAkBH,GAAgBZ,EAAM,KAAK;AAC3EY,YAAAA,IAAiBA,EAAe,OAAO,CAACI,MAC7BA,KAASH,KAAaG,KAASF,CACzC;AAAA,UACL;AACA,gBAAMG,IAAO,IAAI7C;AAAAA,YACbwC;AAAAA,YACAZ,EAAM;AAAA,YACNS;AAAAA,YACAC;AAAAA,YACAjC;AAAAA,UAAA;AAGAwC,YAAK,aAAahB,MAClBA,IAAagB,EAAK,aAElBA,EAAK,QAAQ,MAAMf,MACnBA,IAAOe,EAAK,QAAQ,MAEpBA,EAAK,QAAQ,MAAMd,MACnBA,IAAOc,EAAK,QAAQ,MAExBZ,EAAIE,CAAW,EAAE,KAAKU,CAAI;AAAA,QAC9B,CAAC;AAAA,MACL,CAAC,GACMZ;AAAAA,IACX,GAAG,CAAA,CAAE;AAAA,IAKD,MAAM,EAAC,YAAAJ,GAAY,MAAAC,GAAM,MAAAC,EAAAA;AAAAA,IACzB,KAAKN,EAAM;AAAA,EAAA;AAEnB;","x_google_ignoreList":[0]}
@@ -1,41 +1,41 @@
1
1
  import { NO_GROUPED as y } from "../../DataFrame.js";
2
- import { getFacetStringKey as x } from "../utils/getFacetStringKey.js";
2
+ import { getFacetStringKey as k } from "../utils/getFacetStringKey.js";
3
3
  import E from "../../node_modules/d3-array/src/sum.js";
4
- function G(a, o, d, z) {
4
+ function G(e, o, c, x) {
5
5
  let m = -1 / 0, i = 1 / 0;
6
6
  return {
7
7
  type: "stackedBar",
8
- geoms: o.facet.reduce((s, l) => {
9
- const u = x(l);
10
- return s[u] = [], o.primary.forEach((c) => {
8
+ geoms: o.facet.reduce((s, g) => {
9
+ const u = k(g);
10
+ return s[u] = [], o.primary.forEach((l) => {
11
11
  let n = 0;
12
12
  const t = {};
13
- o.secondary.forEach((r) => {
14
- const e = r === y ? "null" : r, p = d.getRowsByGrouping([...l, c, r]);
15
- if (!p.length)
13
+ o.secondary.forEach((a) => {
14
+ const r = a === y ? "null" : a, f = c.getRowsByGrouping([...g, l, a]);
15
+ if (!f.length)
16
16
  return;
17
- const f = E(p, (k) => Number(k[z.value]));
18
- t[e] = {
19
- height: f,
20
- key: String(e)
21
- }, n += f;
17
+ const d = E(f, (z) => Number(c.getColumnValue(x.value, z)));
18
+ t[r] = {
19
+ height: d,
20
+ key: String(r)
21
+ }, n += d;
22
22
  });
23
- const g = n;
24
- a.normalize && o.secondary.forEach((r) => {
25
- const e = r === y ? "null" : r;
26
- t[e] && (t[e].height = t[e].height / g * 100);
23
+ const h = n;
24
+ e.normalize && o.secondary.forEach((a) => {
25
+ const r = a === y ? "null" : a;
26
+ t[r] && (t[r].height = t[r].height / h * 100);
27
27
  }), m = Math.max(m, 0, n), i = Math.min(i, 0, n);
28
- const h = a.normalize ? 100 : g;
28
+ const p = e.normalize ? 100 : h;
29
29
  s[u].push({
30
- key: `stackedBar_${String(c)}`,
30
+ key: `stackedBar_${String(l)}`,
31
31
  valuesMap: t,
32
- primaryGrouping: c,
33
- boundsY: { min: Math.min(h, 0), max: Math.max(h, 0) }
32
+ primaryGrouping: l,
33
+ boundsY: { min: Math.min(p, 0), max: Math.max(p, 0) }
34
34
  });
35
35
  }), s;
36
36
  }, {}),
37
- meta: { minY: a.normalize ? 0 : i, maxY: a.normalize ? 100 : m, normalize: a.normalize },
38
- aes: a.aes
37
+ meta: { minY: e.normalize ? 0 : i, maxY: e.normalize ? 100 : m, normalize: e.normalize },
38
+ aes: e.aes
39
39
  };
40
40
  }
41
41
  export {