@milaboratories/graph-maker 1.1.138 → 1.1.139
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/GraphMaker/components/LassoControls/index.vue.js +15 -13
- package/dist/GraphMaker/components/LassoControls/index.vue.js.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeBubbleSettings.d.ts +9 -3
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeBubbleSettings.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeDendroSettings.d.ts +17 -2
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeDendroSettings.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeDiscreteSettings.d.ts +13 -4
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeDiscreteSettings.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeHeatmapSettings.d.ts +28 -7
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeHeatmapSettings.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeHistogramSettings.d.ts +6 -2
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeHistogramSettings.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.d.ts +16 -2
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.d.ts +14 -2
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.d.ts.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/DataFrame.js +95 -72
- package/dist/node_modules/@milaboratories/miplots4/dist/DataFrame.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/MiPlots.js +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/bubble/ChartRenderer.js +124 -122
- package/dist/node_modules/@milaboratories/miplots4/dist/bubble/ChartRenderer.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/bubble/components/Chart.js +72 -91
- package/dist/node_modules/@milaboratories/miplots4/dist/bubble/components/Chart.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/bubble/components/ChartsGroup.js +43 -41
- package/dist/node_modules/@milaboratories/miplots4/dist/bubble/components/ChartsGroup.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/bubble/getCellTooltip.js +28 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/bubble/getCellTooltip.js.map +1 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/bubble/getGroupedCellsData.js +94 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/bubble/getGroupedCellsData.js.map +1 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/bubble/index.js +42 -38
- package/dist/node_modules/@milaboratories/miplots4/dist/bubble/index.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/bubble/utils/calculateCaptionTails.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/common/Legend.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/common/Tooltip.js +11 -11
- package/dist/node_modules/@milaboratories/miplots4/dist/common/Tooltip.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/common/useDataFrame.js +20 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/common/useDataFrame.js.map +1 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/dendro/ChartRenderer.js +181 -181
- package/dist/node_modules/@milaboratories/miplots4/dist/dendro/ChartRenderer.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/dendro/DendroSettingsImpl.js +2 -2
- package/dist/node_modules/@milaboratories/miplots4/dist/dendro/DendroSettingsImpl.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/dendro/components/Chart.js +45 -45
- package/dist/node_modules/@milaboratories/miplots4/dist/dendro/components/Chart.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/dendro/components/Heatmap.js +27 -27
- package/dist/node_modules/@milaboratories/miplots4/dist/dendro/components/Heatmap.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/dendro/components/Legend.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/dendro/components/LinksGroup.js +18 -18
- package/dist/node_modules/@milaboratories/miplots4/dist/dendro/components/LinksGroup.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/dendro/components/NodesGroup.js +36 -36
- package/dist/node_modules/@milaboratories/miplots4/dist/dendro/components/NodesGroup.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/dendro/getHeatmapData.js +45 -41
- package/dist/node_modules/@milaboratories/miplots4/dist/dendro/getHeatmapData.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/dendro/getHierarchyData.js +33 -33
- package/dist/node_modules/@milaboratories/miplots4/dist/dendro/getHierarchyData.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/dendro/index.js +90 -93
- package/dist/node_modules/@milaboratories/miplots4/dist/dendro/index.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/ChartRenderer.js +200 -199
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/ChartRenderer.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/DiscreteSettingsImpl.js +17 -17
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/DiscreteSettingsImpl.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/components/layers/BoxElement.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/index.js +102 -99
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/index.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/bar.js +31 -36
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/bar.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/binnedDots.js +62 -74
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/binnedDots.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/boxes.js +52 -53
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/boxes.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/dots.js +32 -32
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/dots.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/lines.js +7 -6
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/lines.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/logo.js +23 -23
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/logo.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/pairedPoints.js +63 -63
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/pairedPoints.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/sina.js +60 -64
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/sina.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/stackedBar.js +23 -23
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/stackedBar.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/utils/getOutliersBounds.js +5 -5
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/utils/getOutliersBounds.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/utils/splitTextByWidth.js +13 -13
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/utils/splitTextByWidth.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/ChartRenderer.js +258 -256
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/ChartRenderer.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/HeatmapSettingsImpl.js +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/HeatmapSettingsImpl.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Annotations/Annotation.js +45 -44
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Annotations/Annotation.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Chart.js +107 -106
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Chart.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/ChartsGroup.js +18 -18
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/ChartsGroup.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/getCells.js +99 -95
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/getCells.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/index.js +30 -29
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/index.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/utils/calculateAnnotationTitleSizes.js +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/utils/calculateAnnotationTitleSizes.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/utils/calculateCaptionTails.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/histogram/ChartRenderer.js +143 -142
- package/dist/node_modules/@milaboratories/miplots4/dist/histogram/ChartRenderer.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/histogram/HistogramSettingsImpl.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/histogram/components/Chart.js +30 -30
- package/dist/node_modules/@milaboratories/miplots4/dist/histogram/components/Chart.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/histogram/components/ChartsGroup.js +7 -7
- package/dist/node_modules/@milaboratories/miplots4/dist/histogram/getHistogramData.js +53 -54
- package/dist/node_modules/@milaboratories/miplots4/dist/histogram/getHistogramData.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/histogram/index.js +59 -55
- package/dist/node_modules/@milaboratories/miplots4/dist/histogram/index.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/@d3fc/d3fc-axis/src/axisBase.js +7 -7
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-array/src/min.js +6 -12
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-array/src/min.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-shape/src/line.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/kdbush/index.js +148 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/kdbush/index.js.map +1 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/ChartRenderer.js +172 -168
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/ChartRenderer.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/ScatterplotSettingsImpl.js +26 -26
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/ScatterplotSettingsImpl.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/Chart.js +11 -11
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartAxisTitles.js +30 -29
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartAxisTitles.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartLayersData.js +135 -153
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartLayersData.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartTooltip.js +35 -32
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartTooltip.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartTrendsData.js +27 -27
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartTrendsData.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartsGroup.js +14 -14
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/constants.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/dots.js +24 -22
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/dots.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/getLayersData.js +11 -14
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/getLayersData.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/index.js +57 -58
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/index.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/linearRegression.js +85 -83
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/linearRegression.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/createAesGetter.js +20 -20
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/createAesGetter.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/createLegendInfo.js +44 -37
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/createLegendInfo.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/formatColumnValue.js +11 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/formatColumnValue.js.map +1 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/getVisibleLabels.js +46 -56
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/getVisibleLabels.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/ChartRenderer.js +223 -205
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/ChartRenderer.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/SettingsImpl.js +22 -22
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/SettingsImpl.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/colors.js +42 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/colors.js.map +1 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/components/LowerSVG.js +84 -81
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/components/LowerSVG.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/components/SVGLayer.js +11 -11
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/components/UpperSVG.js +15 -14
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/components/UpperSVG.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/index.js +89 -114
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/index.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/types/common.js +3 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/types/common.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/types/dendro.js +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/types/dendro.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/types/discrete.js +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/types/discrete.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/types/heatmap.js +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/types/heatmap.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/types/histogram.js +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/types/histogram.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/types/scatterplot-umap.js +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/types/scatterplot-umap.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/types/scatterplot.js +4 -4
- package/dist/node_modules/@milaboratories/miplots4/dist/types/scatterplot.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/utils/TextMeasurer/TextMeasurer.js +39 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/utils/TextMeasurer/TextMeasurer.js.map +1 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/utils/TextMeasurer/charToWidth.json.js +101 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/utils/TextMeasurer/charToWidth.json.js.map +1 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/utils/arrangeLegendParts.js +4 -4
- package/dist/node_modules/@milaboratories/miplots4/dist/utils/arrangeLegendParts.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/utils/getLegendWidth.js +3 -3
- package/dist/node_modules/@milaboratories/miplots4/dist/utils/getLegendWidth.js.map +1 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/index.js +1031 -1023
- package/dist/node_modules/@milaboratories/pf-plots/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/node_modules/@milaboratories/miplots4/dist/bubble/getCells.js +0 -91
- package/dist/node_modules/@milaboratories/miplots4/dist/bubble/getCells.js.map +0 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/add.js +0 -30
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/add.js.map +0 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/cover.js +0 -29
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/cover.js.map +0 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/data.js +0 -12
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/data.js.map +0 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/extent.js +0 -7
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/extent.js.map +0 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/find.js +0 -26
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/find.js.map +0 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/quad.js +0 -7
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/quad.js.map +0 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/quadtree.js +0 -51
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/quadtree.js.map +0 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/remove.js +0 -21
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/remove.js.map +0 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/root.js +0 -7
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/root.js.map +0 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/size.js +0 -12
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/size.js.map +0 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/visit.js +0 -14
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/visit.js.map +0 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/visitAfter.js +0 -19
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/visitAfter.js.map +0 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/x.js +0 -11
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/x.js.map +0 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/y.js +0 -11
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/y.js.map +0 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/utils/TextMeasurer.js +0 -24
- package/dist/node_modules/@milaboratories/miplots4/dist/utils/TextMeasurer.js.map +0 -1
|
@@ -1,131 +1,112 @@
|
|
|
1
|
-
import { j as
|
|
1
|
+
import { j as e } from "../../node_modules/react/jsx-runtime.js";
|
|
2
2
|
import { r as O } from "../../_virtual/index.js";
|
|
3
3
|
import { r as H } from "../../node_modules/react-dom/index.js";
|
|
4
|
-
import { Tooltip as
|
|
5
|
-
import { BLACK as
|
|
6
|
-
import { FONT_SIZE as
|
|
4
|
+
import { Tooltip as I } from "../../common/Tooltip.js";
|
|
5
|
+
import { BLACK as X } from "../../constants.js";
|
|
6
|
+
import { FONT_SIZE as Y, FACET_TITLE_OFFSET as N } from "../constants.js";
|
|
7
7
|
import { AxisCaptions as P } from "./AxisCaptions.js";
|
|
8
|
-
function
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
`X: ${t.xLabels[e.x]}`,
|
|
20
|
-
`Y: ${t.yLabels[e.y]}`,
|
|
21
|
-
`Value (color): ${m(e.colorValue)}${e.colorValue !== e.normalizedColorValue ? ` (${m(e.normalizedColorValue)})` : ""}`,
|
|
22
|
-
`Value (size): ${m(e.sizeValue)}${e.sizeValue !== e.normalizedSizeValue ? ` (${m(e.normalizedSizeValue)})` : ""}`
|
|
23
|
-
];
|
|
24
|
-
for (const n of o)
|
|
25
|
-
u.push(`${n.label}: ${f[n.valueLabels ?? n.value]}`);
|
|
26
|
-
return u;
|
|
27
|
-
}
|
|
28
|
-
function te({
|
|
29
|
-
facetKey: e,
|
|
30
|
-
dimensions: t,
|
|
31
|
-
scales: o,
|
|
32
|
-
cells: f,
|
|
33
|
-
colorScale: u,
|
|
34
|
-
sizeScale: n,
|
|
35
|
-
chartSettings: h,
|
|
36
|
-
cellsMeta: g,
|
|
37
|
-
stepX: x,
|
|
38
|
-
stepY: y,
|
|
8
|
+
function $({
|
|
9
|
+
facetKey: p,
|
|
10
|
+
dimensions: l,
|
|
11
|
+
scales: s,
|
|
12
|
+
cells: y,
|
|
13
|
+
colorScale: A,
|
|
14
|
+
sizeScale: D,
|
|
15
|
+
chartSettings: x,
|
|
16
|
+
cellsMeta: u,
|
|
17
|
+
stepX: n,
|
|
18
|
+
stepY: d,
|
|
39
19
|
aes: S,
|
|
40
|
-
labelAngles:
|
|
41
|
-
chartSizes:
|
|
42
|
-
margins:
|
|
43
|
-
tooltipsContainer:
|
|
44
|
-
tooltipsData:
|
|
20
|
+
labelAngles: E,
|
|
21
|
+
chartSizes: c,
|
|
22
|
+
margins: f,
|
|
23
|
+
tooltipsContainer: z,
|
|
24
|
+
tooltipsData: t,
|
|
25
|
+
getTooltip: L
|
|
45
26
|
}) {
|
|
46
|
-
const [
|
|
47
|
-
left:
|
|
48
|
-
right:
|
|
49
|
-
top:
|
|
50
|
-
bottom:
|
|
51
|
-
},
|
|
52
|
-
return /* @__PURE__ */
|
|
53
|
-
/* @__PURE__ */
|
|
54
|
-
|
|
27
|
+
const [m, v] = O.useState(), { xAxis: B, yAxis: M } = x, { width: V, height: _ } = l.inner, { padding: i, sideElementBBoxes: r } = l, { xLabels: w, yLabels: F } = u, h = s.x.domain(), j = s.y.domain(), K = {
|
|
28
|
+
left: f.left + l.left + i.left,
|
|
29
|
+
right: c.totalWidth - (f.left + l.left + i.left),
|
|
30
|
+
top: f.top + l.top + i.top,
|
|
31
|
+
bottom: c.totalHeight - (f.top + l.top + i.top)
|
|
32
|
+
}, T = !1, W = t.fixed && m;
|
|
33
|
+
return /* @__PURE__ */ e.jsxs("g", { transform: `translate(${l.left},${l.top})`, fontSize: Y, children: [
|
|
34
|
+
/* @__PURE__ */ e.jsxs("g", { transform: `translate(${i.left},${i.top})`, children: [
|
|
35
|
+
r.top.facetTitle.isVisible && /* @__PURE__ */ e.jsx(
|
|
55
36
|
"text",
|
|
56
37
|
{
|
|
57
|
-
x:
|
|
58
|
-
y:
|
|
38
|
+
x: r.top.facetTitle.x,
|
|
39
|
+
y: r.top.facetTitle.y + r.top.facetTitle.height - N,
|
|
59
40
|
fontWeight: "500",
|
|
60
41
|
fontSize: "20px",
|
|
61
|
-
children:
|
|
42
|
+
children: u.facetKeyValues[p].join(", ")
|
|
62
43
|
}
|
|
63
44
|
),
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
(
|
|
67
|
-
var
|
|
68
|
-
const
|
|
45
|
+
T,
|
|
46
|
+
h.map(
|
|
47
|
+
(a) => j.map((g) => {
|
|
48
|
+
var b;
|
|
49
|
+
const o = (b = y == null ? void 0 : y[a]) == null ? void 0 : b[g], k = W && o && t.selectedData === o, C = o ? /* @__PURE__ */ e.jsx(
|
|
69
50
|
"circle",
|
|
70
51
|
{
|
|
71
|
-
cx:
|
|
72
|
-
cy:
|
|
73
|
-
r:
|
|
52
|
+
cx: s.x(a) + n / 2,
|
|
53
|
+
cy: s.y(g) + d / 2,
|
|
54
|
+
r: D(o.normalizedSizeValue),
|
|
74
55
|
stroke: S.cellStrokeColor,
|
|
75
|
-
fill:
|
|
76
|
-
onMouseOver: () =>
|
|
77
|
-
onMouseLeave: () =>
|
|
56
|
+
fill: o.colorValue === null ? S.emptyCellColor : A(o.normalizedColorValue),
|
|
57
|
+
onMouseOver: () => t.onMouseEnter(o, p),
|
|
58
|
+
onMouseLeave: () => t.onMouseLeave()
|
|
78
59
|
},
|
|
79
|
-
|
|
60
|
+
o ? o.id : `${a}_${g}`
|
|
80
61
|
) : null;
|
|
81
|
-
return k ? H.createPortal(C,
|
|
62
|
+
return k ? H.createPortal(C, m) : C;
|
|
82
63
|
})
|
|
83
64
|
),
|
|
84
|
-
/* @__PURE__ */
|
|
85
|
-
/* @__PURE__ */
|
|
65
|
+
/* @__PURE__ */ e.jsx("g", { children: x.frame.type === "full" && /* @__PURE__ */ e.jsx("rect", { fill: "none", stroke: X, x: "0", y: "0", width: V, height: _ }) }),
|
|
66
|
+
/* @__PURE__ */ e.jsx("g", { fontWeight: "500", children: /* @__PURE__ */ e.jsx(
|
|
86
67
|
P,
|
|
87
68
|
{
|
|
88
|
-
sideElementBBoxes:
|
|
89
|
-
xKeys:
|
|
69
|
+
sideElementBBoxes: r,
|
|
70
|
+
xKeys: h,
|
|
90
71
|
yKeys: j,
|
|
91
|
-
scales:
|
|
92
|
-
xAxis:
|
|
72
|
+
scales: s,
|
|
73
|
+
xAxis: B,
|
|
93
74
|
yAxis: M,
|
|
94
|
-
stepX:
|
|
95
|
-
stepY:
|
|
96
|
-
labelAngles:
|
|
97
|
-
xLabels:
|
|
98
|
-
yLabels:
|
|
99
|
-
debug:
|
|
75
|
+
stepX: n,
|
|
76
|
+
stepY: d,
|
|
77
|
+
labelAngles: E,
|
|
78
|
+
xLabels: w,
|
|
79
|
+
yLabels: F,
|
|
80
|
+
debug: T
|
|
100
81
|
}
|
|
101
82
|
) }),
|
|
102
|
-
|
|
103
|
-
/* @__PURE__ */
|
|
83
|
+
t.fixed && /* @__PURE__ */ e.jsx("rect", { width: c.chartWidth, height: c.chartHeight, fill: "rgba(255,255,255,0.8)" }),
|
|
84
|
+
/* @__PURE__ */ e.jsx(
|
|
104
85
|
"g",
|
|
105
86
|
{
|
|
106
|
-
ref: (
|
|
107
|
-
|
|
87
|
+
ref: (a) => {
|
|
88
|
+
a && !m && v(a);
|
|
108
89
|
}
|
|
109
90
|
}
|
|
110
91
|
)
|
|
111
92
|
] }),
|
|
112
|
-
|
|
113
|
-
|
|
93
|
+
x.tooltips.show && t.selectedData && t.currentFacet === p && /* @__PURE__ */ e.jsx(
|
|
94
|
+
I,
|
|
114
95
|
{
|
|
115
|
-
content:
|
|
116
|
-
x:
|
|
117
|
-
y:
|
|
118
|
-
offset:
|
|
96
|
+
content: L(t.selectedData),
|
|
97
|
+
x: s.x(String(t.selectedData.x)) + n / 2,
|
|
98
|
+
y: s.y(String(t.selectedData.y)) + d / 2,
|
|
99
|
+
offset: h.length > 1 ? n / 2 : 0,
|
|
119
100
|
active: !0,
|
|
120
101
|
sideDistances: K,
|
|
121
|
-
container:
|
|
122
|
-
onClose:
|
|
123
|
-
fixed:
|
|
102
|
+
container: z,
|
|
103
|
+
onClose: t.onClose,
|
|
104
|
+
fixed: t.fixed
|
|
124
105
|
}
|
|
125
106
|
)
|
|
126
107
|
] });
|
|
127
108
|
}
|
|
128
109
|
export {
|
|
129
|
-
|
|
110
|
+
$ as Chart
|
|
130
111
|
};
|
|
131
112
|
//# sourceMappingURL=Chart.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chart.js","sources":["../../../../../../../node_modules/@milaboratories/miplots4/src/bubble/components/Chart.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { createPortal } from 'react-dom';\nimport type { TooltipsData } from '../../common/Tooltip';\nimport { Tooltip } from '../../common/Tooltip';\nimport { BLACK } from '../../constants';\nimport type { ColumnName, DataValue } from '../../types';\nimport type { BubbleSettingsImpl } from '../BubbleSettingsImpl';\nimport { FACET_TITLE_OFFSET, FONT_SIZE } from '../constants';\nimport type { Cell, GroupedCellsData } from '../getCells';\nimport { AxisCaptions } from './AxisCaptions';\nimport type { CaptionsSizes, ChartDimensionsData, ChartScales, ChartSizes, LabelAngles, Margins } from './types';\n\nfunction formatCellValue (v:DataValue):number|string {\n if (v === null) {\n return 'null';\n }\n if (typeof v === 'number') {\n const whole = v > 0 ? Math.floor(v) : Math.ceil(v);\n const decimal = v - whole;\n return whole + Number(decimal.toPrecision(2));\n }\n return v;\n}\nfunction getTooltipContent(cell: Cell, cellsMeta:GroupedCellsData['meta'], columnsList: ColumnName[] = []) {\n const row = cell.data;\n const lines = [\n `X: ${cellsMeta.xLabels[cell.x as string]}`,\n `Y: ${cellsMeta.yLabels[cell.y as string]}`,\n `Value (color): ${formatCellValue(cell.colorValue)}${cell.colorValue !== cell.normalizedColorValue ? ` (${formatCellValue(cell.normalizedColorValue)})`: ''}`,\n `Value (size): ${formatCellValue(cell.sizeValue)}${cell.sizeValue !== cell.normalizedSizeValue ? ` (${formatCellValue(cell.normalizedSizeValue)})`: ''}`,\n ];\n for (const column of columnsList) {\n lines.push(`${column.label}: ${row[column.valueLabels ?? column.value]}`);\n }\n return lines;\n}\n\nexport function Chart({\n facetKey,\n dimensions,\n scales,\n cells,\n colorScale,\n sizeScale,\n chartSettings,\n cellsMeta,\n stepX,\n stepY,\n aes,\n labelAngles,\n chartSizes,\n margins,\n tooltipsContainer,\n tooltipsData\n}: {\n facetKey: string;\n chartSizes: ChartSizes;\n captionsSizes: CaptionsSizes;\n dimensions: ChartDimensionsData;\n scales: ChartScales;\n cells: GroupedCellsData['facets'][keyof GroupedCellsData['facets']]['cells'];\n colorScale: (value: DataValue) => string;\n sizeScale: (value: DataValue) => number;\n chartSettings: BubbleSettingsImpl['chartSettings'];\n cellsMeta: GroupedCellsData['meta'];\n stepX: number;\n stepY: number;\n aes: BubbleSettingsImpl['aes'];\n labelAngles: LabelAngles;\n margins: Margins;\n tooltipsContainer?: Element;\n tooltipsData: TooltipsData<Cell>\n}) {\n const [activeElementContainer, setActiveElementContainer] = useState<SVGGElement>();\n\n const {xAxis, yAxis, tooltips} = chartSettings;\n const {width, height} = dimensions.inner;\n const {padding, sideElementBBoxes} = dimensions;\n const {xLabels, yLabels} = cellsMeta;\n\n const xKeys = scales.x.domain();\n const yKeys = scales.y.domain();\n\n const sideDistances = {\n left: margins.left + dimensions.left + padding.left,\n right: chartSizes.totalWidth - (margins.left + dimensions.left + padding.left),\n top: margins.top + dimensions.top + padding.top,\n bottom: chartSizes.totalHeight - (margins.top + dimensions.top + padding.top),\n };\n\n const debug = false;\n\n const dimmedBackground = tooltipsData.fixed && activeElementContainer;\n return (\n <g transform={`translate(${dimensions.left},${dimensions.top})`} fontSize={FONT_SIZE}>\n <g transform={`translate(${padding.left},${padding.top})`}>\n {/* facet title */}\n {sideElementBBoxes.top.facetTitle.isVisible && (\n <text\n x={sideElementBBoxes.top.facetTitle.x}\n y={\n sideElementBBoxes.top.facetTitle.y +\n sideElementBBoxes.top.facetTitle.height -\n FACET_TITLE_OFFSET\n }\n fontWeight=\"500\"\n fontSize=\"20px\"\n >\n {cellsMeta.facetKeyValues[facetKey].join(', ')}\n </text>\n )}\n {debug && (\n <g fill=\"green\" opacity=\"0.2\">\n <rect\n x={-padding.left}\n y={-padding.top}\n width={dimensions.outer.width}\n height={dimensions.outer.height}\n fill=\"none\"\n stroke=\"red\"\n />\n <rect x={-padding.left} y=\"0\" width={padding.left} height={height} />\n <rect x={width} y=\"0\" width={padding.right} height={height} />\n <rect x=\"0\" y={-padding.top} width={width} height={padding.top} />\n <rect x=\"0\" y={height} width={width} height={padding.bottom} />\n </g>\n )}\n {/* cells */}\n {xKeys.map(xKey =>\n yKeys.map(yKey => {\n const cell = cells?.[xKey]?.[yKey];\n const highlighted = dimmedBackground && cell && tooltipsData.selectedData === cell;\n const cellElement = cell ? (\n <circle\n key={cell ? cell.id : `${xKey}_${yKey}`}\n cx={scales.x(xKey) + stepX / 2}\n cy={scales.y(yKey) + stepY / 2}\n r={sizeScale(cell.normalizedSizeValue as number)}\n stroke={aes.cellStrokeColor}\n fill={cell.colorValue === null ? aes.emptyCellColor : colorScale(cell.normalizedColorValue)}\n onMouseOver={() => tooltipsData.onMouseEnter(cell, facetKey)}\n onMouseLeave={() => tooltipsData.onMouseLeave()}\n />\n ) : null;\n return highlighted ? createPortal(cellElement, activeElementContainer) : cellElement;\n })\n )}\n <g>\n {chartSettings.frame.type === 'full' && <rect fill=\"none\" stroke={BLACK} x=\"0\" y=\"0\" width={width} height={height} />}\n </g>\n <g fontWeight=\"500\">\n <AxisCaptions\n sideElementBBoxes={sideElementBBoxes}\n xKeys={xKeys}\n yKeys={yKeys}\n scales={scales}\n xAxis={xAxis}\n yAxis={yAxis}\n stepX={stepX}\n stepY={stepY}\n labelAngles={labelAngles}\n xLabels={xLabels}\n yLabels={yLabels}\n debug={debug}\n />\n </g>\n {tooltipsData.fixed && <rect width={chartSizes.chartWidth} height={chartSizes.chartHeight} fill=\"rgba(255,255,255,0.8)\"/>}\n <g ref={node => {\n if (node && !activeElementContainer) {\n setActiveElementContainer(node);\n }\n }}\n />\n </g>\n {chartSettings.tooltips.show && tooltipsData.selectedData && tooltipsData.currentFacet === facetKey && (\n <Tooltip\n content={getTooltipContent(tooltipsData.selectedData, cellsMeta, tooltips?.content)}\n x={scales.x(String(tooltipsData.selectedData.x)) + stepX / 2}\n y={scales.y(String(tooltipsData.selectedData.y)) + stepY / 2}\n offset={xKeys.length > 1 ? stepX / 2 : 0}\n active\n sideDistances={sideDistances}\n container={tooltipsContainer}\n onClose={tooltipsData.onClose}\n fixed={tooltipsData.fixed}\n />\n )}\n </g>\n );\n}\n"],"names":["formatCellValue","v","whole","decimal","getTooltipContent","cell","cellsMeta","columnsList","row","lines","column","Chart","facetKey","dimensions","scales","cells","colorScale","sizeScale","chartSettings","stepX","stepY","aes","labelAngles","chartSizes","margins","tooltipsContainer","tooltipsData","activeElementContainer","setActiveElementContainer","useState","xAxis","yAxis","tooltips","width","height","padding","sideElementBBoxes","xLabels","yLabels","xKeys","yKeys","sideDistances","debug","dimmedBackground","jsxs","FONT_SIZE","jsx","FACET_TITLE_OFFSET","xKey","yKey","_a","highlighted","cellElement","createPortal","n","BLACK","AxisCaptions","node","Tooltip"],"mappings":";;;;;;;AAYA,SAASA,EAAiBC,GAA2B;AACjD,MAAIA,MAAM;AACN,WAAO;AAEX,MAAI,OAAOA,KAAM,UAAU;AACvB,UAAMC,IAAQD,IAAI,IAAI,KAAK,MAAMA,CAAC,IAAI,KAAK,KAAKA,CAAC,GAC3CE,IAAUF,IAAIC;AACpB,WAAOA,IAAQ,OAAOC,EAAQ,YAAY,CAAC,CAAC;AAAA,EAChD;AACA,SAAOF;AACX;AACA,SAASG,EAAkBC,GAAYC,GAAoCC,IAA4B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,MAAQ;AACRA,YAAAA,KAAQ,CAAC9B,KACTC,EAA0B6B,CAAI;AAAA,UAEtC;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA,GAEJ;AAAA,IACCvC,EAAc,SAAS,QAAQQ,EAAa,gBAAgBA,EAAa,iBAAiBd,KACvFkC,gBAAAA,EAAAA;AAAAA,MAACY;AAAAA,MAAA;AAAA,QACG,SAAStD,EAAkBsB,EAAa,cAAcpB,GAAW0B,KAAA,OAAA,SAAAA,EAAU,OAAO;AAAA,QAClF,GAAGlB,EAAO,EAAE,OAAOY,EAAa,aAAa,CAAC,CAAC,IAAIP,IAAQ;AAAA,QAC3D,GAAGL,EAAO,EAAE,OAAOY,EAAa,aAAa,CAAC,CAAC,IAAIN,IAAQ;AAAA,QAC3D,QAAQmB,EAAM,SAAS,IAAIpB,IAAQ,IAAI;AAAA,QACvC,QAAM;AAAA,QACN,eAAAsB;AAAAA,QACA,WAAWhB;AAAAA,QACX,SAASC,EAAa;AAAA,QACtB,OAAOA,EAAa;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,GAGhC;AAER;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"Chart.js","sources":["../../../../../../../node_modules/@milaboratories/miplots4/src/bubble/components/Chart.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { createPortal } from 'react-dom';\nimport type { TooltipsData } from '../../common/Tooltip';\nimport { Tooltip } from '../../common/Tooltip';\nimport { BLACK } from '../../constants';\nimport type { DataValue } from '../../types';\nimport type { BubbleSettingsImpl } from '../BubbleSettingsImpl';\nimport { FACET_TITLE_OFFSET, FONT_SIZE } from '../constants';\nimport type { Cell, GroupedCellsData } from '../getGroupedCellsData';\nimport { AxisCaptions } from './AxisCaptions';\nimport type { CaptionsSizes, ChartDimensionsData, ChartScales, ChartSizes, LabelAngles, Margins } from './types';\n\nexport function Chart({\n facetKey,\n dimensions,\n scales,\n cells,\n colorScale,\n sizeScale,\n chartSettings,\n cellsMeta,\n stepX,\n stepY,\n aes,\n labelAngles,\n chartSizes,\n margins,\n tooltipsContainer,\n tooltipsData,\n getTooltip\n}: {\n facetKey: string;\n chartSizes: ChartSizes;\n captionsSizes: CaptionsSizes;\n dimensions: ChartDimensionsData;\n scales: ChartScales;\n cells: GroupedCellsData['facets'][keyof GroupedCellsData['facets']]['cells'];\n colorScale: (value: DataValue) => string;\n sizeScale: (value: DataValue) => number;\n chartSettings: BubbleSettingsImpl['chartSettings'];\n cellsMeta: GroupedCellsData['meta'];\n stepX: number;\n stepY: number;\n aes: BubbleSettingsImpl['aes'];\n labelAngles: LabelAngles;\n margins: Margins;\n tooltipsContainer?: Element;\n tooltipsData: TooltipsData<Cell>\n getTooltip: (cell: Cell) => string[],\n}) {\n const [activeElementContainer, setActiveElementContainer] = useState<SVGGElement>();\n\n const {xAxis, yAxis} = chartSettings;\n const {width, height} = dimensions.inner;\n const {padding, sideElementBBoxes} = dimensions;\n const {xLabels, yLabels} = cellsMeta;\n\n const xKeys = scales.x.domain();\n const yKeys = scales.y.domain();\n\n const sideDistances = {\n left: margins.left + dimensions.left + padding.left,\n right: chartSizes.totalWidth - (margins.left + dimensions.left + padding.left),\n top: margins.top + dimensions.top + padding.top,\n bottom: chartSizes.totalHeight - (margins.top + dimensions.top + padding.top),\n };\n\n const debug = false;\n\n const dimmedBackground = tooltipsData.fixed && activeElementContainer;\n return (\n <g transform={`translate(${dimensions.left},${dimensions.top})`} fontSize={FONT_SIZE}>\n <g transform={`translate(${padding.left},${padding.top})`}>\n {/* facet title */}\n {sideElementBBoxes.top.facetTitle.isVisible && (\n <text\n x={sideElementBBoxes.top.facetTitle.x}\n y={\n sideElementBBoxes.top.facetTitle.y +\n sideElementBBoxes.top.facetTitle.height -\n FACET_TITLE_OFFSET\n }\n fontWeight=\"500\"\n fontSize=\"20px\"\n >\n {cellsMeta.facetKeyValues[facetKey].join(', ')}\n </text>\n )}\n {debug && (\n <g fill=\"green\" opacity=\"0.2\">\n <rect\n x={-padding.left}\n y={-padding.top}\n width={dimensions.outer.width}\n height={dimensions.outer.height}\n fill=\"none\"\n stroke=\"red\"\n />\n <rect x={-padding.left} y=\"0\" width={padding.left} height={height} />\n <rect x={width} y=\"0\" width={padding.right} height={height} />\n <rect x=\"0\" y={-padding.top} width={width} height={padding.top} />\n <rect x=\"0\" y={height} width={width} height={padding.bottom} />\n </g>\n )}\n {/* cells */}\n {xKeys.map(xKey =>\n yKeys.map(yKey => {\n const cell = cells?.[xKey]?.[yKey];\n const highlighted = dimmedBackground && cell && tooltipsData.selectedData === cell;\n const cellElement = cell ? (\n <circle\n key={cell ? cell.id : `${xKey}_${yKey}`}\n cx={scales.x(xKey) + stepX / 2}\n cy={scales.y(yKey) + stepY / 2}\n r={sizeScale(cell.normalizedSizeValue as number)}\n stroke={aes.cellStrokeColor}\n fill={cell.colorValue === null ? aes.emptyCellColor : colorScale(cell.normalizedColorValue)}\n onMouseOver={() => tooltipsData.onMouseEnter(cell, facetKey)}\n onMouseLeave={() => tooltipsData.onMouseLeave()}\n />\n ) : null;\n return highlighted ? createPortal(cellElement, activeElementContainer) : cellElement;\n })\n )}\n <g>\n {chartSettings.frame.type === 'full' && <rect fill=\"none\" stroke={BLACK} x=\"0\" y=\"0\" width={width} height={height} />}\n </g>\n <g fontWeight=\"500\">\n <AxisCaptions\n sideElementBBoxes={sideElementBBoxes}\n xKeys={xKeys}\n yKeys={yKeys}\n scales={scales}\n xAxis={xAxis}\n yAxis={yAxis}\n stepX={stepX}\n stepY={stepY}\n labelAngles={labelAngles}\n xLabels={xLabels}\n yLabels={yLabels}\n debug={debug}\n />\n </g>\n {tooltipsData.fixed && <rect width={chartSizes.chartWidth} height={chartSizes.chartHeight} fill=\"rgba(255,255,255,0.8)\"/>}\n <g ref={node => {\n if (node && !activeElementContainer) {\n setActiveElementContainer(node);\n }\n }}\n />\n </g>\n {chartSettings.tooltips.show && tooltipsData.selectedData && tooltipsData.currentFacet === facetKey && (\n <Tooltip\n content={getTooltip(tooltipsData.selectedData)}\n x={scales.x(String(tooltipsData.selectedData.x)) + stepX / 2}\n y={scales.y(String(tooltipsData.selectedData.y)) + stepY / 2}\n offset={xKeys.length > 1 ? stepX / 2 : 0}\n active\n sideDistances={sideDistances}\n container={tooltipsContainer}\n onClose={tooltipsData.onClose}\n fixed={tooltipsData.fixed}\n />\n )}\n </g>\n );\n}\n"],"names":["Chart","facetKey","dimensions","scales","cells","colorScale","sizeScale","chartSettings","cellsMeta","stepX","stepY","aes","labelAngles","chartSizes","margins","tooltipsContainer","tooltipsData","getTooltip","activeElementContainer","setActiveElementContainer","useState","xAxis","yAxis","width","height","padding","sideElementBBoxes","xLabels","yLabels","xKeys","yKeys","sideDistances","debug","dimmedBackground","jsxs","FONT_SIZE","jsx","FACET_TITLE_OFFSET","xKey","yKey","cell","_a","highlighted","cellElement","createPortal","t","BLACK","AxisCaptions","node","Tooltip"],"mappings":";;;;;;;AAYO,SAASA,EAAM;AAAA,EAClB,UAAAC;AAAAA,EACA,YAAAC;AAAAA,EACA,QAAAC;AAAAA,EACA,OAAAC;AAAAA,EACA,YAAAC;AAAAA,EACA,WAAAC;AAAAA,EACA,eAAAC;AAAAA,EACA,WAAAC;AAAAA,EACA,OAAAC;AAAAA,EACA,OAAAC;AAAAA,EACA,KAAAC;AAAAA,EACA,aAAAC;AAAAA,EACA,YAAAC;AAAAA,EACA,SAAAC;AAAAA,EACA,mBAAAC;AAAAA,EACA,cAAAC;AAAAA,EACA,YAAAC;AACJ,GAmBG;AACC,QAAM,CAACC,GAAwBC,CAAyB,IAAIC,cAEtD,EAAC,OAAAC,GAAO,OAAAC,MAASf,GACjB,EAAC,OAAAgB,GAAO,QAAAC,EAAAA,IAAUtB,EAAW,OAC7B,EAAC,SAAAuB,GAAS,mBAAAC,MAAqBxB,GAC/B,EAAC,SAAAyB,GAAS,SAAAC,MAAWpB,GAErBqB,IAAQ1B,EAAO,EAAE,UACjB2B,IAAQ3B,EAAO,EAAE,OAAA,GAEjB4B,IAAgB;AAAA,IAClB,M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KAAQ,CAAC9B,KACTC,EAA0B6B,CAAI;AAAA,UAEtC;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA,GAEJ;AAAA,IACCzC,EAAc,SAAS,QAAQS,EAAa,gBAAgBA,EAAa,iBAAiBf,KACvFmC,gBAAAA,EAAAA;AAAAA,MAACa;AAAAA,MAAA;AAAA,QACG,SAAShC,EAAWD,EAAa,YAAY;AAAA,QAC7C,GAAGb,EAAO,EAAE,OAAOa,EAAa,aAAa,CAAC,CAAC,IAAIP,IAAQ;AAAA,QAC3D,GAAGN,EAAO,EAAE,OAAOa,EAAa,aAAa,CAAC,CAAC,IAAIN,IAAQ;AAAA,QAC3D,QAAQmB,EAAM,SAAS,IAAIpB,IAAQ,IAAI;AAAA,QACvC,QAAM;AAAA,QACN,eAAAsB;AAAAA,QACA,WAAWhB;AAAAA,QACX,SAASC,EAAa;AAAA,QACtB,OAAOA,EAAa;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,GAGhC;AAER;","x_google_ignoreList":[0]}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { j as t } from "../../node_modules/react/jsx-runtime.js";
|
|
2
|
-
import { Chart as $ } from "./Chart.js";
|
|
3
|
-
import { ErrorBoundary as b } from "../../common/ErrorBoundary.js";
|
|
4
|
-
import { ChartsTitle as H } from "../../common/ChartsTitle.js";
|
|
5
|
-
import { LEGEND_OFFSET as L } from "../constants.js";
|
|
6
|
-
import { useTooltip as M } from "../../common/Tooltip.js";
|
|
7
2
|
import { r as n } from "../../_virtual/index.js";
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
import { ChartsTitle as b } from "../../common/ChartsTitle.js";
|
|
4
|
+
import { ErrorBoundary as B } from "../../common/ErrorBoundary.js";
|
|
5
|
+
import H from "../../common/fonts.js";
|
|
6
|
+
import { Legend as L } from "../../common/Legend.js";
|
|
7
|
+
import { useTooltip as M } from "../../common/Tooltip.js";
|
|
8
|
+
import { LEGEND_OFFSET as P } from "../constants.js";
|
|
9
|
+
import { Chart as A } from "./Chart.js";
|
|
10
|
+
function _({
|
|
11
|
+
margins: s,
|
|
12
|
+
captionsSizes: h,
|
|
13
13
|
settingsId: m,
|
|
14
14
|
chartSettings: a,
|
|
15
|
-
chartSizes:
|
|
16
|
-
chartsDimensions:
|
|
15
|
+
chartSizes: e,
|
|
16
|
+
chartsDimensions: i,
|
|
17
17
|
facetKeys: r,
|
|
18
18
|
scales: d,
|
|
19
19
|
colorScale: g,
|
|
@@ -24,46 +24,47 @@ function Y({
|
|
|
24
24
|
legend: S,
|
|
25
25
|
aes: j,
|
|
26
26
|
columnsCount: w,
|
|
27
|
-
labelAngles:
|
|
27
|
+
labelAngles: C,
|
|
28
|
+
getCellTooltip: y,
|
|
28
29
|
onTooltipHintSwitch: z
|
|
29
30
|
}) {
|
|
30
|
-
const
|
|
31
|
+
const T = M(z), [W, D] = n.useState(), l = n.useRef(null);
|
|
31
32
|
n.useEffect(() => {
|
|
32
|
-
l.current &&
|
|
33
|
+
l.current && D(l.current);
|
|
33
34
|
}, []);
|
|
34
|
-
const
|
|
35
|
-
return /* @__PURE__ */ t.jsx(
|
|
35
|
+
const p = i[r[0]].padding, E = i[r[w - 1]].padding, v = s.left + e.chartsWidth + P, F = s.top + p.top;
|
|
36
|
+
return /* @__PURE__ */ t.jsx(B, { dataId: m, children: /* @__PURE__ */ t.jsxs(
|
|
36
37
|
"svg",
|
|
37
38
|
{
|
|
38
39
|
xmlns: "http://www.w3.org/2000/svg",
|
|
39
|
-
viewBox: `0 0 ${
|
|
40
|
-
width:
|
|
41
|
-
height:
|
|
40
|
+
viewBox: `0 0 ${e.totalWidth} ${e.totalHeight}`,
|
|
41
|
+
width: e.totalWidth,
|
|
42
|
+
height: e.totalHeight,
|
|
42
43
|
fontFamily: "Manrope",
|
|
43
44
|
children: [
|
|
44
|
-
/* @__PURE__ */ t.jsx("defs", { children:
|
|
45
|
-
/* @__PURE__ */ t.jsxs("g", { transform: `translate(${
|
|
45
|
+
/* @__PURE__ */ t.jsx("defs", { children: H }),
|
|
46
|
+
/* @__PURE__ */ t.jsxs("g", { transform: `translate(${s.left},${s.top})`, children: [
|
|
46
47
|
/* @__PURE__ */ t.jsx(
|
|
47
|
-
|
|
48
|
+
b,
|
|
48
49
|
{
|
|
49
50
|
title: [a.title.name],
|
|
50
51
|
show: a.title.show,
|
|
51
52
|
position: a.title.position,
|
|
52
|
-
leftPadding:
|
|
53
|
-
rightPadding:
|
|
54
|
-
chartsWidth:
|
|
53
|
+
leftPadding: p.left,
|
|
54
|
+
rightPadding: E.right,
|
|
55
|
+
chartsWidth: e.chartsWidth
|
|
55
56
|
}
|
|
56
57
|
),
|
|
57
|
-
r.map((
|
|
58
|
-
const { cells:
|
|
58
|
+
r.map((o) => {
|
|
59
|
+
const { cells: $ } = u[o];
|
|
59
60
|
return /* @__PURE__ */ t.jsx(
|
|
60
|
-
|
|
61
|
+
A,
|
|
61
62
|
{
|
|
62
|
-
captionsSizes:
|
|
63
|
-
facetKey:
|
|
64
|
-
dimensions: o
|
|
63
|
+
captionsSizes: h,
|
|
64
|
+
facetKey: o,
|
|
65
|
+
dimensions: i[o],
|
|
65
66
|
scales: d,
|
|
66
|
-
cells:
|
|
67
|
+
cells: $,
|
|
67
68
|
cellsMeta: x,
|
|
68
69
|
stepX: c.x,
|
|
69
70
|
stepY: c.y,
|
|
@@ -71,23 +72,24 @@ function Y({
|
|
|
71
72
|
sizeScale: f,
|
|
72
73
|
chartSettings: a,
|
|
73
74
|
aes: j,
|
|
74
|
-
labelAngles:
|
|
75
|
-
margins:
|
|
76
|
-
chartSizes:
|
|
77
|
-
tooltipsData:
|
|
78
|
-
tooltipsContainer: W
|
|
75
|
+
labelAngles: C,
|
|
76
|
+
margins: s,
|
|
77
|
+
chartSizes: e,
|
|
78
|
+
tooltipsData: T,
|
|
79
|
+
tooltipsContainer: W,
|
|
80
|
+
getTooltip: y
|
|
79
81
|
},
|
|
80
|
-
|
|
82
|
+
o
|
|
81
83
|
);
|
|
82
84
|
})
|
|
83
85
|
] }),
|
|
84
|
-
/* @__PURE__ */ t.jsx("g", { transform: `translate(${
|
|
86
|
+
/* @__PURE__ */ t.jsx("g", { transform: `translate(${v},${F})`, children: /* @__PURE__ */ t.jsx(L, { legendData: S }) }),
|
|
85
87
|
/* @__PURE__ */ t.jsx("g", { ref: l, style: { outline: "none" } })
|
|
86
88
|
]
|
|
87
89
|
}
|
|
88
90
|
) });
|
|
89
91
|
}
|
|
90
92
|
export {
|
|
91
|
-
|
|
93
|
+
_ as ChartsGroup
|
|
92
94
|
};
|
|
93
95
|
//# sourceMappingURL=ChartsGroup.js.map
|
package/dist/node_modules/@milaboratories/miplots4/dist/bubble/components/ChartsGroup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartsGroup.js","sources":["../../../../../../../node_modules/@milaboratories/miplots4/src/bubble/components/ChartsGroup.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"ChartsGroup.js","sources":["../../../../../../../node_modules/@milaboratories/miplots4/src/bubble/components/ChartsGroup.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport { ChartsTitle } from '../../common/ChartsTitle';\nimport { ErrorBoundary } from '../../common/ErrorBoundary';\nimport fonts from '../../common/fonts';\nimport { Legend } from '../../common/Legend';\nimport { useTooltip } from '../../common/Tooltip';\nimport type { LegendData } from '../../common/types';\nimport type { DataValue } from '../../types';\nimport type { BubbleSettingsImpl } from '../BubbleSettingsImpl';\nimport { LEGEND_OFFSET } from '../constants';\nimport type { Cell, GroupedCellsData } from '../getGroupedCellsData';\nimport { Chart } from './Chart';\nimport type {\n CaptionsSizes,\n ChartDimensionsData,\n ChartScales,\n ChartSizes, LabelAngles, Margins\n} from './types';\n\nexport function ChartsGroup({\n margins,\n captionsSizes,\n settingsId,\n chartSettings,\n chartSizes,\n chartsDimensions,\n facetKeys,\n scales,\n colorScale,\n sizeScale,\n groupedCells,\n cellsMeta,\n step,\n legend,\n aes,\n columnsCount,\n labelAngles,\n getCellTooltip,\n onTooltipHintSwitch\n}: {\n margins: Margins;\n captionsSizes: CaptionsSizes;\n chartSettings: BubbleSettingsImpl['chartSettings'];\n facetSettings: BubbleSettingsImpl['facetSettings'];\n chartSizes: ChartSizes;\n chartsDimensions: Record<string, ChartDimensionsData>;\n scales: ChartScales;\n facetKeys: string[];\n settingsId: string;\n colorScale: (value: DataValue) => string;\n sizeScale: (value: DataValue) => number;\n groupedCells: GroupedCellsData['facets'];\n cellsMeta: GroupedCellsData['meta'];\n step: {x: number; y: number};\n legend: LegendData;\n aes: BubbleSettingsImpl['aes'];\n columnsCount: number;\n labelAngles: LabelAngles;\n getCellTooltip: (cell: Cell) => string[],\n onTooltipHintSwitch: (v: boolean) => void\n}) {\n const tooltipsData = useTooltip<Cell>(onTooltipHintSwitch);\n const [tooltipsContainer, setTooltipsContainer] = useState<SVGGElement>();\n const tooltipsRef = useRef<SVGGElement>(null);\n useEffect(() => {\n if (tooltipsRef.current) {\n setTooltipsContainer(tooltipsRef.current);\n }\n }, []);\n\n const leftTopChartPadding = chartsDimensions[facetKeys[0]].padding;\n const rightTopChartPadding = chartsDimensions[facetKeys[columnsCount - 1]].padding;\n\n const legendLeft = margins.left + chartSizes.chartsWidth + LEGEND_OFFSET;\n const legendTop = margins.top + leftTopChartPadding.top;\n\n return (\n <ErrorBoundary dataId={settingsId}>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox={`0 0 ${chartSizes.totalWidth} ${chartSizes.totalHeight}`}\n width={chartSizes.totalWidth}\n height={chartSizes.totalHeight}\n fontFamily=\"Manrope\"\n >\n <defs>{fonts}</defs>\n <g transform={`translate(${margins.left},${margins.top})`}>\n <ChartsTitle\n title={[chartSettings.title.name]}\n show={chartSettings.title.show}\n position={chartSettings.title.position}\n leftPadding={leftTopChartPadding.left}\n rightPadding={rightTopChartPadding.right}\n chartsWidth={chartSizes.chartsWidth}\n />\n {facetKeys.map(facetKey => {\n const {cells} = groupedCells[facetKey];\n return (\n <Chart\n captionsSizes={captionsSizes}\n key={facetKey}\n facetKey={facetKey}\n dimensions={chartsDimensions[facetKey]}\n scales={scales}\n cells={cells}\n cellsMeta={cellsMeta}\n stepX={step.x}\n stepY={step.y}\n colorScale={colorScale}\n sizeScale={sizeScale}\n chartSettings={chartSettings}\n aes={aes}\n labelAngles={labelAngles}\n margins={margins}\n chartSizes={chartSizes}\n tooltipsData={tooltipsData}\n tooltipsContainer={tooltipsContainer}\n getTooltip={getCellTooltip}\n />\n );\n })}\n </g>\n <g transform={`translate(${legendLeft},${legendTop})`}>\n <Legend legendData={legend} />\n </g>\n <g ref={tooltipsRef} style={{outline: 'none'}} />\n </svg>\n </ErrorBoundary>\n );\n}\n"],"names":["ChartsGroup","margins","captionsSizes","settingsId","chartSettings","chartSizes","chartsDimensions","facetKeys","scales","colorScale","sizeScale","groupedCells","cellsMeta","step","legend","aes","columnsCount","labelAngles","getCellTooltip","onTooltipHintSwitch","tooltipsData","useTooltip","tooltipsContainer","setTooltipsContainer","useState","tooltipsRef","useRef","useEffect","leftTopChartPadding","rightTopChartPadding","legendLeft","LEGEND_OFFSET","legendTop","jsx","ErrorBoundary","jsxs","fonts","ChartsTitle","facetKey","cells","Chart","Legend"],"mappings":";;;;;;;;;AAmBO,SAASA,EAAY;AAAA,EACxB,SAAAC;AAAAA,EACA,eAAAC;AAAAA,EACA,YAAAC;AAAAA,EACA,eAAAC;AAAAA,EACA,YAAAC;AAAAA,EACA,kBAAAC;AAAAA,EACA,WAAAC;AAAAA,EACA,QAAAC;AAAAA,EACA,YAAAC;AAAAA,EACA,WAAAC;AAAAA,EACA,cAAAC;AAAAA,EACA,WAAAC;AAAAA,EACA,MAAAC;AAAAA,EACA,QAAAC;AAAAA,EACA,KAAAC;AAAAA,EACA,cAAAC;AAAAA,EACA,aAAAC;AAAAA,EACA,gBAAAC;AAAAA,EACA,qBAAAC;AACJ,GAqB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C,mBACIL,gBAAAA,EAAAA;AAAAA,cAACO;AAAAA,cAAA;AAAA,gBACG,eAAAtC;AAAAA,gBAEA,UAAAoC;AAAAA,gBACA,YAAYhC,EAAiBgC,CAAQ;AAAA,gBACrC,QAAA9B;AAAAA,gBACA,OAAA+B;AAAAA,gBACA,WAAA3B;AAAAA,gBACA,OAAOC,EAAK;AAAA,gBACZ,OAAOA,EAAK;AAAA,gBACZ,YAAAJ;AAAAA,gBACA,WAAAC;AAAAA,gBACA,eAAAN;AAAAA,gBACA,KAAAW;AAAAA,gBACA,aAAAE;AAAAA,gBACA,SAAAhB;AAAAA,gBACA,YAAAI;AAAAA,gBACA,cAAAe;AAAAA,gBACA,mBAAAE;AAAAA,gBACA,YAAYJ;AAAAA,cAAA;AAAA,cAjBPoB;AAAAA,YAAA;AAAA,UAoBjB,CAAC;AAAA,QAAA,GACL;AAAA,QACAL,gBAAAA,EAAAA,IAAC,KAAA,EAAE,WAAW,aAAaH,CAAU,IAAIE,CAAS,KAC9C,UAAAC,gBAAAA,EAAAA,IAACQ,GAAA,EAAO,YAAY3B,EAAAA,CAAQ,GAChC;AAAA,QACAmB,gBAAAA,MAAC,KAAA,EAAE,KAAKR,GAAa,OAAO,EAAC,SAAS,SAAA,CAAS;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,GAEvD;AAER;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
function s(e, l, u, i = []) {
|
|
2
|
+
const o = [
|
|
3
|
+
`X: ${u.xLabels[l.x]}`,
|
|
4
|
+
`Y: ${u.yLabels[l.y]}`,
|
|
5
|
+
`Value (color): ${a(l.colorValue)}${l.colorValue !== l.normalizedColorValue ? ` (${a(l.normalizedColorValue)})` : ""}`,
|
|
6
|
+
`Value (size): ${a(l.sizeValue)}${l.sizeValue !== l.normalizedSizeValue ? ` (${a(l.normalizedSizeValue)})` : ""}`
|
|
7
|
+
];
|
|
8
|
+
for (const n of i) {
|
|
9
|
+
const r = n.valueLabels ?? n.value;
|
|
10
|
+
if (r === void 0) continue;
|
|
11
|
+
const t = e.getColumnValue(r, l.idx);
|
|
12
|
+
o.push(`${n.label}: ${t}`);
|
|
13
|
+
}
|
|
14
|
+
return o;
|
|
15
|
+
}
|
|
16
|
+
function a(e) {
|
|
17
|
+
if (e === null)
|
|
18
|
+
return "null";
|
|
19
|
+
if (typeof e == "number") {
|
|
20
|
+
const l = e > 0 ? Math.floor(e) : Math.ceil(e), u = e - l;
|
|
21
|
+
return l + Number(u.toPrecision(2));
|
|
22
|
+
}
|
|
23
|
+
return e;
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
s as getCellTooltip
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=getCellTooltip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getCellTooltip.js","sources":["../../../../../../node_modules/@milaboratories/miplots4/src/bubble/getCellTooltip.ts"],"sourcesContent":["import type { DataFrame } from '../DataFrame';\nimport type { ColumnName, DataValue } from '../types';\nimport type { Cell, GroupedCellsData } from './getGroupedCellsData';\n\nexport function getCellTooltip(dataFrame: DataFrame, cell: Cell, cellsMeta: GroupedCellsData['meta'], columnsList: ColumnName[] = []) {\n const lines = [\n `X: ${cellsMeta.xLabels[cell.x as string]}`,\n `Y: ${cellsMeta.yLabels[cell.y as string]}`,\n `Value (color): ${formatCellValue(cell.colorValue)}${cell.colorValue !== cell.normalizedColorValue ? ` (${formatCellValue(cell.normalizedColorValue)})`: ''}`,\n `Value (size): ${formatCellValue(cell.sizeValue)}${cell.sizeValue !== cell.normalizedSizeValue ? ` (${formatCellValue(cell.normalizedSizeValue)})`: ''}`,\n ];\n for (const column of columnsList) {\n const labelColumn =column.valueLabels ?? column.value;\n if (labelColumn === undefined) continue;\n const valueLabel = dataFrame.getColumnValue(labelColumn, cell.idx);\n lines.push(`${column.label}: ${valueLabel}`);\n }\n return lines;\n}\n\nfunction formatCellValue (v: DataValue): number | string {\n if (v === null) {\n return 'null';\n }\n if (typeof v === 'number') {\n const whole = v > 0 ? Math.floor(v) : Math.ceil(v);\n const decimal = v - whole;\n return whole + Number(decimal.toPrecision(2));\n }\n return v;\n}"],"names":["getCellTooltip","dataFrame","cell","cellsMeta","columnsList","lines","formatCellValue","column","labelColumn","valueLabel","v","whole","decimal"],"mappings":"AAIO,SAASA,EAAeC,GAAsBC,GAAYC,GAAqCC,IAA4B,CAAA,GAAI;AAClI,QAAMC,IAAQ;AAAA,IACV,MAAMF,EAAU,QAAQD,EAAK,CAAW,CAAC;AAAA,IACzC,MAAMC,EAAU,QAAQD,EAAK,CAAW,CAAC;AAAA,IACzC,kBAAkBI,EAAgBJ,EAAK,UAAU,CAAC,GAAGA,EAAK,eAAeA,EAAK,uBAAuB,KAAKI,EAAgBJ,EAAK,oBAAoB,CAAC,MAAK,EAAE;AAAA,IAC3J,iBAAiBI,EAAgBJ,EAAK,SAAS,CAAC,GAAGA,EAAK,cAAcA,EAAK,sBAAsB,KAAKI,EAAgBJ,EAAK,mBAAmB,CAAC,MAAK,EAAE;AAAA,EAAA;AAE1J,aAAWK,KAAUH,GAAa;AAC9B,UAAMI,IAAaD,EAAO,eAAeA,EAAO;AAChD,QAAIC,MAAgB,OAAW;AAC/B,UAAMC,IAAaR,EAAU,eAAeO,GAAaN,EAAK,GAAG;AACjEG,IAAAA,EAAM,KAAK,GAAGE,EAAO,KAAK,KAAKE,CAAU,EAAE;AAAA,EAC/C;AACA,SAAOJ;AACX;AAEA,SAASC,EAAiBI,GAA+B;AACrD,MAAIA,MAAM;AACN,WAAO;AAEX,MAAI,OAAOA,KAAM,UAAU;AACvB,UAAMC,IAAQD,IAAI,IAAI,KAAK,MAAMA,CAAC,IAAI,KAAK,KAAKA,CAAC,GAC3CE,IAAUF,IAAIC;AACpB,WAAOA,IAAQ,OAAOC,EAAQ,YAAY,CAAC,CAAC;AAAA,EAChD;AACA,SAAOF;AACX;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { l as w } from "../node_modules/lodash/lodash.js";
|
|
2
|
+
import j from "../node_modules/d3-array/src/deviation.js";
|
|
3
|
+
import L from "../node_modules/d3-array/src/mean.js";
|
|
4
|
+
import q from "../node_modules/d3-array/src/extent.js";
|
|
5
|
+
const _ = 1e6;
|
|
6
|
+
function D(o) {
|
|
7
|
+
const r = j(o), u = L(o);
|
|
8
|
+
return r === void 0 || u === void 0 || r === 0 ? (s) => s : (s) => (s - u) / r;
|
|
9
|
+
}
|
|
10
|
+
function N(o) {
|
|
11
|
+
const r = L(o), [u, s] = q(o);
|
|
12
|
+
return r === void 0 || u === void 0 || s === void 0 ? (x) => x : (x) => (x - r) / (s - u);
|
|
13
|
+
}
|
|
14
|
+
function B(o, r) {
|
|
15
|
+
return o === "standardScaling" ? D(r) : o === "meanNormalization" ? N(r) : (u) => u;
|
|
16
|
+
}
|
|
17
|
+
function A(o, r, u, s, x, C, g, h, z) {
|
|
18
|
+
const V = g.map((t) => t.join("_")), e = {
|
|
19
|
+
meta: {
|
|
20
|
+
facetKeys: V,
|
|
21
|
+
xKeys: [],
|
|
22
|
+
yKeys: [],
|
|
23
|
+
xLabels: {},
|
|
24
|
+
yLabels: {},
|
|
25
|
+
facetKeyValues: V.reduce((t, a, l) => (t[a] = g[l], t), {}),
|
|
26
|
+
valueExtentSize: [1 / 0, -1 / 0],
|
|
27
|
+
valueExtentColor: [1 / 0, -1 / 0]
|
|
28
|
+
},
|
|
29
|
+
facets: {}
|
|
30
|
+
}, p = /* @__PURE__ */ new Set(), S = /* @__PURE__ */ new Set(), M = r.valueLabels ?? r.value, $ = u.valueLabels ?? u.value;
|
|
31
|
+
for (let t = 0; t < o.rowsCount; t++) {
|
|
32
|
+
const a = C.length ? C.map((c) => o.getColumnValue(c.value, t)).join("_") : "null", l = o.getColumnValue(r.value, t), n = o.getColumnValue(u.value, t), i = o.getColumnValue(s.value, t) ?? z, m = o.getColumnValue(x.value, t) ?? z;
|
|
33
|
+
if (l === null || n === null || i === null || m === null)
|
|
34
|
+
continue;
|
|
35
|
+
e.facets[a] || (e.facets[a] = {
|
|
36
|
+
xKeys: [],
|
|
37
|
+
yKeys: [],
|
|
38
|
+
cells: {}
|
|
39
|
+
}), e.facets[a].xKeys.push(l), e.facets[a].yKeys.push(n), p.has(l) || (p.add(l), e.meta.xKeys.push(l)), S.has(n) || (S.add(n), e.meta.yKeys.push(n)), e.facets[a].cells[l] || (e.facets[a].cells[l] = {}), e.meta.valueExtentSize[0] = Math.min(i, e.meta.valueExtentSize[0]), e.meta.valueExtentSize[1] = Math.max(i, e.meta.valueExtentSize[1]), e.meta.valueExtentColor[0] = Math.min(m, e.meta.valueExtentColor[0]), e.meta.valueExtentColor[1] = Math.max(m, e.meta.valueExtentColor[1]);
|
|
40
|
+
const K = String(o.getColumnValue(M, t)), d = String(o.getColumnValue($, t));
|
|
41
|
+
if (e.facets[a].cells[l][n])
|
|
42
|
+
throw Error(`More than 1 value for x=${l}, y=${n}`);
|
|
43
|
+
if (e.meta.xLabels[l] && K !== e.meta.xLabels[l])
|
|
44
|
+
throw Error(`More than 1 x-label value for x=${l}`);
|
|
45
|
+
if (e.meta.yLabels[n] && d !== e.meta.yLabels[n])
|
|
46
|
+
throw Error(`More than 1 y-label value for y=${n}`);
|
|
47
|
+
e.meta.xLabels[l] = K, e.meta.yLabels[n] = d, e.facets[a].cells[l][n] = {
|
|
48
|
+
id: `${l}_${n}`,
|
|
49
|
+
idx: t,
|
|
50
|
+
x: l,
|
|
51
|
+
y: n,
|
|
52
|
+
sizeValue: i,
|
|
53
|
+
normalizedSizeValue: i,
|
|
54
|
+
colorValue: m,
|
|
55
|
+
normalizedColorValue: m
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
if (e.meta.facetKeys = e.meta.facetKeys.filter((t) => e.facets[t]), e.meta.facetKeys.forEach((t) => {
|
|
59
|
+
const a = e.facets[t];
|
|
60
|
+
if (a.xKeys = w.uniq(a.xKeys), a.yKeys = w.uniq(a.yKeys), a.xKeys.length * a.yKeys.length > _)
|
|
61
|
+
throw Error(`Too many cells for graph rendering (${a.xKeys.length * a.yKeys.length})`);
|
|
62
|
+
}), h) {
|
|
63
|
+
const t = [1 / 0, -1 / 0];
|
|
64
|
+
e.meta.facetKeys.forEach((a) => {
|
|
65
|
+
if (!e.facets[a])
|
|
66
|
+
return;
|
|
67
|
+
const { xKeys: l, yKeys: n, cells: i } = e.facets[a], m = h.direction === "row" ? l : n, K = h.direction === "row" ? n : l, d = h.direction === "row" ? (c, v) => {
|
|
68
|
+
var f;
|
|
69
|
+
return (f = i[c]) == null ? void 0 : f[v];
|
|
70
|
+
} : (c, v) => {
|
|
71
|
+
var f;
|
|
72
|
+
return (f = i[v]) == null ? void 0 : f[c];
|
|
73
|
+
};
|
|
74
|
+
K.forEach((c) => {
|
|
75
|
+
const v = [];
|
|
76
|
+
m.forEach((E) => {
|
|
77
|
+
var y;
|
|
78
|
+
const b = (y = d(E, c)) == null ? void 0 : y.colorValue;
|
|
79
|
+
b !== void 0 && v.push(b);
|
|
80
|
+
});
|
|
81
|
+
const f = B(h.method, v);
|
|
82
|
+
m.forEach((E) => {
|
|
83
|
+
const y = d(E, c);
|
|
84
|
+
y !== void 0 && (y.normalizedColorValue = f(y.colorValue), t[0] = Math.min(y.normalizedColorValue, t[0]), t[1] = Math.max(y.normalizedColorValue, t[1]));
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
}), e.meta.valueExtentColor = t;
|
|
88
|
+
}
|
|
89
|
+
return e.meta.valueExtentSize[0] === 1 / 0 && (e.meta.valueExtentSize[0] = 0), e.meta.valueExtentSize[1] === -1 / 0 && (e.meta.valueExtentSize[1] = 0), e.meta.valueExtentColor[0] === 1 / 0 && (e.meta.valueExtentColor[0] = 0), e.meta.valueExtentColor[1] === -1 / 0 && (e.meta.valueExtentColor[1] = 0), e;
|
|
90
|
+
}
|
|
91
|
+
export {
|
|
92
|
+
A as getGroupedCellsData
|
|
93
|
+
};
|
|
94
|
+
//# sourceMappingURL=getGroupedCellsData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getGroupedCellsData.js","sources":["../../../../../../node_modules/@milaboratories/miplots4/src/bubble/getGroupedCellsData.ts"],"sourcesContent":["import { deviation, extent, mean } from 'd3-array';\nimport { uniq } from 'lodash';\nimport type { DataFrame } from '../DataFrame';\nimport type { ColumnName, DataValue, NormalizationMethod } from '../types';\nimport type { BubbleSettingsImpl } from './BubbleSettingsImpl';\n\nconst MAX_RENDERED_CELLS_COUNT = 1000000;\nfunction normalizeByStd(values: number[]) {\n const stdValue = deviation(values);\n const meanValue = mean(values);\n\n if (stdValue === undefined || meanValue === undefined || stdValue === 0) {\n return (v: number) => v;\n }\n return (v: number) => (v - meanValue) / stdValue;\n}\n\nfunction normalizeByMinMax(values: number[]) {\n const meanValue = mean(values);\n const [min, max] = extent(values);\n if (meanValue === undefined || min === undefined || max === undefined) {\n return (v: number) => v;\n }\n return (v: number) => (v - meanValue) / (max - min);\n}\n\nfunction getNormalizationFn(method: NormalizationMethod, values: number[]) {\n if (method === 'standardScaling') {\n return normalizeByStd(values);\n }\n if (method === 'meanNormalization') {\n return normalizeByMinMax(values);\n }\n return (v: number) => v;\n}\n\nexport type Cell = {\n id: string;\n idx: number;\n sizeValue: DataValue;\n colorValue: DataValue;\n normalizedSizeValue: DataValue;\n normalizedColorValue: DataValue;\n x: DataValue;\n y: DataValue;\n};\n\nexport type GroupedCellsData = {\n meta: {\n facetKeys: string[];\n facetKeyValues: Record<string, string[]>;\n xKeys: string[]; // all the keys from facets\n yKeys: string[]; // all the keys from facets\n xLabels: Record<string, string>;\n yLabels: Record<string, string>;\n valueExtentSize: [number, number]; // for size scales\n valueExtentColor: [number, number]; // for color scales\n };\n //facet groups\n facets: Record<\n string,\n {\n // axis keys\n xKeys: string[];\n yKeys: string[];\n // cells grouped by X, then by Y\n cells: Record<string, Record<string, Cell>>;\n }\n >;\n};\n\nexport function getGroupedCellsData(\n data: DataFrame,\n xColumn: ColumnName,\n yColumn: ColumnName,\n valueColumnSize: ColumnName,\n valueColumnColor: ColumnName,\n facetBy: ColumnName[],\n facetKeysCombinations: string[][],\n normalization: BubbleSettingsImpl['normalization'],\n NAValueAs: BubbleSettingsImpl['NAValueAs']\n): GroupedCellsData {\n const facetKeys = facetKeysCombinations.map(v => v.join('_'));\n const result: GroupedCellsData = {\n meta: {\n facetKeys,\n xKeys: [],\n yKeys: [],\n xLabels: {},\n yLabels: {},\n facetKeyValues: facetKeys.reduce((res: Record<string, string[]>, key, index) => {\n res[key] = facetKeysCombinations[index];\n return res;\n }, {}),\n valueExtentSize: [Infinity, -Infinity],\n valueExtentColor: [Infinity, -Infinity],\n },\n facets: {},\n };\n const usedXKeys = new Set();\n const usedYKeys = new Set();\n\n const xLabelsSource = xColumn.valueLabels ?? xColumn.value;\n const yLabelsSource = yColumn.valueLabels ?? yColumn.value;\n\n for (let i = 0; i < data.rowsCount; i++) {\n const facetKey = facetBy.length ? facetBy.map(column => data.getColumnValue(column.value, i)).join('_') : 'null';\n const x = data.getColumnValue(xColumn.value, i) as string;\n const y = data.getColumnValue(yColumn.value, i) as string;\n const sizeValue = (data.getColumnValue(valueColumnSize.value, i) ?? NAValueAs) as (null | number);\n const colorValue = (data.getColumnValue(valueColumnColor.value, i) ?? NAValueAs) as (null | number);\n \n if (x === null || y === null || sizeValue === null || colorValue === null) {\n continue;\n }\n\n if (!result.facets[facetKey]) {\n result.facets[facetKey] = {\n xKeys: [],\n yKeys: [],\n cells: {},\n };\n }\n result.facets[facetKey].xKeys.push(x);\n result.facets[facetKey].yKeys.push(y);\n\n if (!usedXKeys.has(x)) {\n usedXKeys.add(x);\n result.meta.xKeys.push(x);\n }\n if (!usedYKeys.has(y)) {\n usedYKeys.add(y);\n result.meta.yKeys.push(y);\n }\n if (!result.facets[facetKey].cells[x]) {\n result.facets[facetKey].cells[x] = {};\n }\n result.meta.valueExtentSize[0] = Math.min(sizeValue, result.meta.valueExtentSize[0]);\n result.meta.valueExtentSize[1] = Math.max(sizeValue, result.meta.valueExtentSize[1]);\n result.meta.valueExtentColor[0] = Math.min(colorValue, result.meta.valueExtentColor[0]);\n result.meta.valueExtentColor[1] = Math.max(colorValue, result.meta.valueExtentColor[1]);\n\n const xLabelsValueStr = String(data.getColumnValue(xLabelsSource, i));\n const yLabelsValueStr = String(data.getColumnValue(yLabelsSource, i));\n\n if (result.facets[facetKey].cells[x][y]) {\n throw Error(`More than 1 value for x=${x}, y=${y}`);\n }\n if (result.meta.xLabels[x] && xLabelsValueStr !== result.meta.xLabels[x]) {\n throw Error(`More than 1 x-label value for x=${x}`);\n }\n if (result.meta.yLabels[y] && yLabelsValueStr !== result.meta.yLabels[y]) {\n throw Error(`More than 1 y-label value for y=${y}`);\n }\n result.meta.xLabels[x] = xLabelsValueStr;\n result.meta.yLabels[y] = yLabelsValueStr;\n result.facets[facetKey].cells[x][y] = {\n id: `${x}_${y}`,\n idx: i,\n x,\n y,\n sizeValue,\n normalizedSizeValue: sizeValue,\n colorValue,\n normalizedColorValue: colorValue,\n };\n }\n result.meta.facetKeys = result.meta.facetKeys.filter((key) => result.facets[key]); // filter only used;\n\n // make uniq x, y, x-group and y-group keys\n result.meta.facetKeys.forEach(facetKey => {\n const facet = result.facets[facetKey];\n facet.xKeys = uniq(facet.xKeys);\n facet.yKeys = uniq(facet.yKeys);\n\n if (facet.xKeys.length * facet.yKeys.length > MAX_RENDERED_CELLS_COUNT) {\n throw Error(`Too many cells for graph rendering (${facet.xKeys.length * facet.yKeys.length})`);\n }\n });\n\n if (normalization) {\n //const valueExtentSize = [Infinity, -Infinity] as [number, number];\n const valueExtentColor = [Infinity, -Infinity] as [number, number];\n result.meta.facetKeys.forEach(facetKey => {\n if (!result.facets[facetKey]) {\n return;\n }\n const {xKeys, yKeys, cells} = result.facets[facetKey];\n const cellKeys = normalization.direction === 'row' ? xKeys : yKeys;\n const groupKeys = normalization.direction === 'row' ? yKeys : xKeys;\n const cellGetter =\n normalization.direction === 'row'\n ? (cellKey: string, groupKey: string) => cells[cellKey]?.[groupKey]\n : (cellKey: string, groupKey: string) => cells[groupKey]?.[cellKey];\n groupKeys.forEach(groupKey => {\n //const sizeValues:number[] = [];\n const colorValues: number[] = [];\n cellKeys.forEach(cellKey => {\n //const sizeV = cellGetter(cellKey, groupKey)?.sizeValue;\n const colorV = cellGetter(cellKey, groupKey)?.colorValue;\n // if (sizeV !== undefined) {\n // sizeValues.push(sizeV as number);\n // }\n if (colorV !== undefined) {\n colorValues.push(colorV as number);\n }\n });\n // const normalizeSize = getNormalizationFn(normalization.method, sizeValues);\n const normalizeColor = getNormalizationFn(normalization.method, colorValues);\n cellKeys.forEach(cellKey => {\n const cell = cellGetter(cellKey, groupKey);\n if (cell !== undefined) {\n // cell.normalizedSizeValue = normalizeSize(cell.sizeValue as number);\n cell.normalizedColorValue = normalizeColor(cell.colorValue as number);\n // valueExtentSize[0] = Math.min(cell.normalizedSizeValue, valueExtentSize[0]);\n // valueExtentSize[1] = Math.max(cell.normalizedSizeValue, valueExtentSize[1]);\n valueExtentColor[0] = Math.min(cell.normalizedColorValue, valueExtentColor[0]);\n valueExtentColor[1] = Math.max(cell.normalizedColorValue, valueExtentColor[1]);\n }\n });\n });\n });\n // result.meta.valueExtentSize = valueExtentSize;\n result.meta.valueExtentColor = valueExtentColor;\n }\n\n // avoid render errors on empty data\n if (result.meta.valueExtentSize[0] === Infinity) {\n result.meta.valueExtentSize[0] = 0;\n }\n if (result.meta.valueExtentSize[1] === -Infinity) {\n result.meta.valueExtentSize[1] = 0;\n }\n if (result.meta.valueExtentColor[0] === Infinity) {\n result.meta.valueExtentColor[0] = 0;\n }\n if (result.meta.valueExtentColor[1] === -Infinity) {\n result.meta.valueExtentColor[1] = 0;\n }\n\n return result;\n}\n"],"names":["MAX_RENDERED_CELLS_COUNT","normalizeByStd","values","stdValue","deviation","meanValue","mean","v","normalizeByMinMax","min","max","extent","getNormalizationFn","method","getGroupedCellsData","data","xColumn","yColumn","valueColumnSize","valueColumnColor","facetBy","facetKeysCombinations","normalization","NAValueAs","facetKeys","result","res","key","index","usedXKeys","usedYKeys","xLabelsSource","yLabelsSource","i","facetKey","column","x","y","sizeValue","colorValue","xLabelsValueStr","yLabelsValueStr","facet","uniq","valueExtentColor","xKeys","yKeys","cells","cellKeys","groupKeys","cellGetter","cellKey","groupKey","_a","colorValues","colorV","normalizeColor","cell"],"mappings":";;;;AAMA,MAAMA,IAA2B;AACjC,SAASC,EAAeC,GAAkB;AACtC,QAAMC,IAAWC,EAAUF,CAAM,GAC3BG,IAAYC,EAAKJ,CAAM;AAE7B,SAAIC,MAAa,UAAaE,MAAc,UAAaF,MAAa,IAC3D,CAACI,MAAcA,IAEnB,CAACA,OAAeA,IAAIF,KAAaF;AAC5C;AAEA,SAASK,EAAkBN,GAAkB;AACzC,QAAMG,IAAYC,EAAKJ,CAAM,GACvB,CAACO,GAAKC,CAAG,IAAIC,EAAOT,CAAM;AAChC,SAAIG,MAAc,UAAaI,MAAQ,UAAaC,MAAQ,SACjD,CAACH,MAAcA,IAEnB,CAACA,OAAeA,IAAIF,MAAcK,IAAMD;AACnD;AAEA,SAASG,EAAmBC,GAA6BX,GAAkB;AACvE,SAAIW,MAAW,oBACJZ,EAAeC,CAAM,IAE5BW,MAAW,sBACJL,EAAkBN,CAAM,IAE5B,CAACK,MAAcA;AAC1B;AAqCO,SAASO,EACZC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACgB;AAChB,QAAMC,IAAYH,EAAsB,IAAI,CAAA,MAAKd,EAAE,KAAK,GAAG,CAAC,GACtDkB,IAA2B;AAAA,IAC7B,MAAM;AAAA,MACF,WAAAD;AAAAA,MACA,OAAO,CAAA;AAAA,MACP,OAAO,CAAA;AAAA,MACP,SAAS,CAAA;AAAA,MACT,SAAS,CAAA;AAAA,MACT,gBAAgBA,EAAU,OAAO,CAACE,GAA+BC,GAAKC,OAClEF,EAAIC,CAAG,IAAIN,EAA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