@milaboratories/miplots4 1.0.129 → 1.0.131
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/DataFrame.d.ts +15 -9
- package/dist/DataFrame.d.ts.map +1 -1
- package/dist/DataFrame.js +105 -81
- package/dist/DataFrame.js.map +1 -1
- package/dist/bubble/ChartRenderer.d.ts +6 -5
- package/dist/bubble/ChartRenderer.d.ts.map +1 -1
- package/dist/bubble/ChartRenderer.js +123 -121
- package/dist/bubble/ChartRenderer.js.map +1 -1
- package/dist/bubble/components/Chart.d.ts +3 -2
- package/dist/bubble/components/Chart.d.ts.map +1 -1
- package/dist/bubble/components/Chart.js +78 -97
- package/dist/bubble/components/Chart.js.map +1 -1
- package/dist/bubble/components/ChartsGroup.d.ts +6 -5
- package/dist/bubble/components/ChartsGroup.d.ts.map +1 -1
- package/dist/bubble/components/ChartsGroup.js +39 -37
- package/dist/bubble/components/ChartsGroup.js.map +1 -1
- package/dist/bubble/getCellTooltip.d.ts +5 -0
- package/dist/bubble/getCellTooltip.d.ts.map +1 -0
- package/dist/bubble/getCellTooltip.js +28 -0
- package/dist/bubble/getCellTooltip.js.map +1 -0
- package/dist/bubble/{getCells.d.ts → getGroupedCellsData.d.ts} +4 -4
- package/dist/bubble/getGroupedCellsData.d.ts.map +1 -0
- package/dist/bubble/getGroupedCellsData.js +94 -0
- package/dist/bubble/getGroupedCellsData.js.map +1 -0
- package/dist/bubble/index.d.ts +4 -4
- package/dist/bubble/index.d.ts.map +1 -1
- package/dist/bubble/index.js +47 -42
- package/dist/bubble/index.js.map +1 -1
- package/dist/bubble/utils/calculateCaptionTails.d.ts +2 -2
- package/dist/bubble/utils/calculateCaptionTails.d.ts.map +1 -1
- package/dist/bubble/utils/calculateCaptionTails.js.map +1 -1
- package/dist/common/Legend.d.ts.map +1 -1
- package/dist/common/Legend.js.map +1 -1
- package/dist/common/Tooltip.js +1 -1
- package/dist/common/Tooltip.js.map +1 -1
- package/dist/common/types.d.ts +1 -1
- package/dist/common/types.d.ts.map +1 -1
- package/dist/common/useDataFrame.d.ts +11 -0
- package/dist/common/useDataFrame.d.ts.map +1 -0
- package/dist/common/useDataFrame.js +20 -0
- package/dist/common/useDataFrame.js.map +1 -0
- package/dist/dendro/ChartRenderer.d.ts +9 -8
- package/dist/dendro/ChartRenderer.d.ts.map +1 -1
- package/dist/dendro/ChartRenderer.js +187 -187
- package/dist/dendro/ChartRenderer.js.map +1 -1
- package/dist/dendro/components/Chart.d.ts +8 -8
- package/dist/dendro/components/Chart.d.ts.map +1 -1
- package/dist/dendro/components/Chart.js +35 -35
- package/dist/dendro/components/Chart.js.map +1 -1
- package/dist/dendro/components/Heatmap.d.ts +3 -3
- package/dist/dendro/components/Heatmap.d.ts.map +1 -1
- package/dist/dendro/components/Heatmap.js +23 -23
- package/dist/dendro/components/Heatmap.js.map +1 -1
- package/dist/dendro/components/Legend.d.ts.map +1 -1
- package/dist/dendro/components/Legend.js.map +1 -1
- package/dist/dendro/components/LinksGroup.d.ts +6 -6
- package/dist/dendro/components/LinksGroup.d.ts.map +1 -1
- package/dist/dendro/components/LinksGroup.js +17 -17
- package/dist/dendro/components/LinksGroup.js.map +1 -1
- package/dist/dendro/components/NodesGroup.d.ts +7 -7
- package/dist/dendro/components/NodesGroup.d.ts.map +1 -1
- package/dist/dendro/components/NodesGroup.js +29 -29
- package/dist/dendro/components/NodesGroup.js.map +1 -1
- package/dist/dendro/components/types.d.ts +2 -2
- package/dist/dendro/components/types.d.ts.map +1 -1
- package/dist/dendro/getHeatmapData.d.ts +2 -2
- package/dist/dendro/getHeatmapData.d.ts.map +1 -1
- package/dist/dendro/getHeatmapData.js +48 -44
- package/dist/dendro/getHeatmapData.js.map +1 -1
- package/dist/dendro/getHierarchyData.d.ts +3 -3
- package/dist/dendro/getHierarchyData.d.ts.map +1 -1
- package/dist/dendro/getHierarchyData.js +31 -31
- package/dist/dendro/getHierarchyData.js.map +1 -1
- package/dist/dendro/index.d.ts +5 -5
- package/dist/dendro/index.d.ts.map +1 -1
- package/dist/dendro/index.js +86 -89
- package/dist/dendro/index.js.map +1 -1
- package/dist/discrete/ChartRenderer.d.ts +6 -6
- package/dist/discrete/ChartRenderer.d.ts.map +1 -1
- package/dist/discrete/ChartRenderer.js +197 -196
- package/dist/discrete/ChartRenderer.js.map +1 -1
- package/dist/discrete/DiscreteSettingsImpl.d.ts +3 -3
- package/dist/discrete/DiscreteSettingsImpl.d.ts.map +1 -1
- package/dist/discrete/DiscreteSettingsImpl.js +8 -8
- package/dist/discrete/DiscreteSettingsImpl.js.map +1 -1
- package/dist/discrete/components/layers/BoxElement.js.map +1 -1
- package/dist/discrete/index.d.ts +1 -1
- package/dist/discrete/index.d.ts.map +1 -1
- package/dist/discrete/index.js +109 -106
- package/dist/discrete/index.js.map +1 -1
- package/dist/discrete/layers/bar.d.ts +2 -2
- package/dist/discrete/layers/bar.d.ts.map +1 -1
- package/dist/discrete/layers/bar.js +32 -37
- package/dist/discrete/layers/bar.js.map +1 -1
- package/dist/discrete/layers/binnedDots.d.ts +3 -3
- package/dist/discrete/layers/binnedDots.d.ts.map +1 -1
- package/dist/discrete/layers/binnedDots.js +66 -78
- package/dist/discrete/layers/binnedDots.js.map +1 -1
- package/dist/discrete/layers/boxes.d.ts +3 -4
- package/dist/discrete/layers/boxes.d.ts.map +1 -1
- package/dist/discrete/layers/boxes.js +59 -60
- package/dist/discrete/layers/boxes.js.map +1 -1
- package/dist/discrete/layers/dots.d.ts +2 -3
- package/dist/discrete/layers/dots.d.ts.map +1 -1
- package/dist/discrete/layers/dots.js +30 -30
- package/dist/discrete/layers/dots.js.map +1 -1
- package/dist/discrete/layers/lines.js +11 -10
- package/dist/discrete/layers/lines.js.map +1 -1
- package/dist/discrete/layers/logo.d.ts +2 -2
- package/dist/discrete/layers/logo.d.ts.map +1 -1
- package/dist/discrete/layers/logo.js +21 -21
- package/dist/discrete/layers/logo.js.map +1 -1
- package/dist/discrete/layers/pairedPoints.d.ts +2 -2
- package/dist/discrete/layers/pairedPoints.d.ts.map +1 -1
- package/dist/discrete/layers/pairedPoints.js +62 -62
- package/dist/discrete/layers/pairedPoints.js.map +1 -1
- package/dist/discrete/layers/sina.d.ts +3 -4
- package/dist/discrete/layers/sina.d.ts.map +1 -1
- package/dist/discrete/layers/sina.js +67 -71
- package/dist/discrete/layers/sina.js.map +1 -1
- package/dist/discrete/layers/stackedBar.d.ts +1 -1
- package/dist/discrete/layers/stackedBar.d.ts.map +1 -1
- package/dist/discrete/layers/stackedBar.js +25 -25
- package/dist/discrete/layers/stackedBar.js.map +1 -1
- package/dist/discrete/layers/violins.js +13 -13
- package/dist/discrete/utils/getOutliersBounds.d.ts +1 -1
- package/dist/discrete/utils/getOutliersBounds.d.ts.map +1 -1
- package/dist/discrete/utils/getOutliersBounds.js +5 -5
- package/dist/discrete/utils/getOutliersBounds.js.map +1 -1
- package/dist/discrete/utils/splitTextByWidth.js +1 -1
- package/dist/discrete/utils/splitTextByWidth.js.map +1 -1
- package/dist/heatmap/ChartRenderer.d.ts +7 -6
- package/dist/heatmap/ChartRenderer.d.ts.map +1 -1
- package/dist/heatmap/ChartRenderer.js +232 -230
- package/dist/heatmap/ChartRenderer.js.map +1 -1
- package/dist/heatmap/HeatmapSettingsImpl.d.ts +2 -2
- package/dist/heatmap/HeatmapSettingsImpl.d.ts.map +1 -1
- package/dist/heatmap/HeatmapSettingsImpl.js +1 -1
- package/dist/heatmap/HeatmapSettingsImpl.js.map +1 -1
- package/dist/heatmap/components/Annotations/Annotation.d.ts.map +1 -1
- package/dist/heatmap/components/Annotations/Annotation.js +40 -39
- package/dist/heatmap/components/Annotations/Annotation.js.map +1 -1
- package/dist/heatmap/components/Chart.d.ts.map +1 -1
- package/dist/heatmap/components/Chart.js +90 -89
- package/dist/heatmap/components/Chart.js.map +1 -1
- package/dist/heatmap/components/ChartsGroup.d.ts +2 -2
- package/dist/heatmap/components/ChartsGroup.d.ts.map +1 -1
- package/dist/heatmap/components/ChartsGroup.js +14 -14
- package/dist/heatmap/components/ChartsGroup.js.map +1 -1
- package/dist/heatmap/components/types.d.ts +3 -2
- package/dist/heatmap/components/types.d.ts.map +1 -1
- package/dist/heatmap/getCells.d.ts +3 -2
- package/dist/heatmap/getCells.d.ts.map +1 -1
- package/dist/heatmap/getCells.js +97 -93
- package/dist/heatmap/getCells.js.map +1 -1
- package/dist/heatmap/index.d.ts +3 -3
- package/dist/heatmap/index.d.ts.map +1 -1
- package/dist/heatmap/index.js +13 -12
- package/dist/heatmap/index.js.map +1 -1
- package/dist/heatmap/utils/calculateAnnotationTitleSizes.d.ts.map +1 -1
- package/dist/heatmap/utils/calculateAnnotationTitleSizes.js +1 -1
- package/dist/heatmap/utils/calculateAnnotationTitleSizes.js.map +1 -1
- package/dist/heatmap/utils/calculateCaptionTails.d.ts +1 -1
- package/dist/heatmap/utils/calculateCaptionTails.d.ts.map +1 -1
- package/dist/heatmap/utils/calculateCaptionTails.js.map +1 -1
- package/dist/histogram/ChartRenderer.d.ts +6 -5
- package/dist/histogram/ChartRenderer.d.ts.map +1 -1
- package/dist/histogram/ChartRenderer.js +154 -153
- package/dist/histogram/ChartRenderer.js.map +1 -1
- package/dist/histogram/HistogramSettingsImpl.d.ts +2 -2
- package/dist/histogram/HistogramSettingsImpl.d.ts.map +1 -1
- package/dist/histogram/HistogramSettingsImpl.js.map +1 -1
- package/dist/histogram/components/Chart.js +48 -48
- package/dist/histogram/components/Chart.js.map +1 -1
- package/dist/histogram/components/types.d.ts +4 -3
- package/dist/histogram/components/types.d.ts.map +1 -1
- package/dist/histogram/getHistogramData.d.ts +7 -7
- package/dist/histogram/getHistogramData.d.ts.map +1 -1
- package/dist/histogram/getHistogramData.js +52 -53
- package/dist/histogram/getHistogramData.js.map +1 -1
- package/dist/histogram/index.d.ts +3 -3
- package/dist/histogram/index.d.ts.map +1 -1
- package/dist/histogram/index.js +49 -45
- package/dist/histogram/index.js.map +1 -1
- package/dist/node_modules/@d3fc/d3fc-axis/src/axisBase.js +10 -10
- package/dist/node_modules/d3-array/src/min.js +5 -11
- package/dist/node_modules/d3-array/src/min.js.map +1 -1
- package/dist/node_modules/d3-shape/src/area.js +30 -30
- package/dist/node_modules/d3-shape/src/line.js +6 -6
- package/dist/node_modules/d3-shape/src/line.js.map +1 -1
- package/dist/node_modules/kdbush/index.js +148 -0
- package/dist/node_modules/kdbush/index.js.map +1 -0
- package/dist/scatterplot/ChartRenderer.d.ts +7 -6
- package/dist/scatterplot/ChartRenderer.d.ts.map +1 -1
- package/dist/scatterplot/ChartRenderer.js +213 -209
- package/dist/scatterplot/ChartRenderer.js.map +1 -1
- package/dist/scatterplot/ScatterplotSettingsImpl.d.ts +2 -2
- package/dist/scatterplot/ScatterplotSettingsImpl.d.ts.map +1 -1
- package/dist/scatterplot/ScatterplotSettingsImpl.js +28 -28
- package/dist/scatterplot/ScatterplotSettingsImpl.js.map +1 -1
- package/dist/scatterplot/components/ChartAxisTitles.d.ts.map +1 -1
- package/dist/scatterplot/components/ChartAxisTitles.js +31 -30
- package/dist/scatterplot/components/ChartAxisTitles.js.map +1 -1
- package/dist/scatterplot/components/ChartLayersData.d.ts.map +1 -1
- package/dist/scatterplot/components/ChartLayersData.js +138 -156
- package/dist/scatterplot/components/ChartLayersData.js.map +1 -1
- package/dist/scatterplot/components/ChartTooltip.d.ts.map +1 -1
- package/dist/scatterplot/components/ChartTooltip.js +41 -38
- package/dist/scatterplot/components/ChartTooltip.js.map +1 -1
- package/dist/scatterplot/components/ChartTrendsData.js +21 -21
- package/dist/scatterplot/components/ChartTrendsData.js.map +1 -1
- package/dist/scatterplot/components/types.d.ts +7 -7
- package/dist/scatterplot/components/types.d.ts.map +1 -1
- package/dist/scatterplot/constants.d.ts +1 -1
- package/dist/scatterplot/constants.d.ts.map +1 -1
- package/dist/scatterplot/constants.js.map +1 -1
- package/dist/scatterplot/dots.d.ts +2 -2
- package/dist/scatterplot/dots.d.ts.map +1 -1
- package/dist/scatterplot/dots.js +27 -25
- package/dist/scatterplot/dots.js.map +1 -1
- package/dist/scatterplot/getLayersData.d.ts +3 -3
- package/dist/scatterplot/getLayersData.d.ts.map +1 -1
- package/dist/scatterplot/getLayersData.js +12 -15
- package/dist/scatterplot/getLayersData.js.map +1 -1
- package/dist/scatterplot/index.d.ts +4 -4
- package/dist/scatterplot/index.d.ts.map +1 -1
- package/dist/scatterplot/index.js +71 -72
- package/dist/scatterplot/index.js.map +1 -1
- package/dist/scatterplot/linearRegression.d.ts +5 -4
- package/dist/scatterplot/linearRegression.d.ts.map +1 -1
- package/dist/scatterplot/linearRegression.js +88 -86
- package/dist/scatterplot/linearRegression.js.map +1 -1
- package/dist/scatterplot/utils/createAesGetter.d.ts +3 -2
- package/dist/scatterplot/utils/createAesGetter.d.ts.map +1 -1
- package/dist/scatterplot/utils/createAesGetter.js +21 -21
- package/dist/scatterplot/utils/createAesGetter.js.map +1 -1
- package/dist/scatterplot/utils/createLegendInfo.d.ts +2 -10
- package/dist/scatterplot/utils/createLegendInfo.d.ts.map +1 -1
- package/dist/scatterplot/utils/createLegendInfo.js +44 -37
- package/dist/scatterplot/utils/createLegendInfo.js.map +1 -1
- package/dist/scatterplot/utils/formatColumnValue.d.ts +5 -0
- package/dist/scatterplot/utils/formatColumnValue.d.ts.map +1 -0
- package/dist/scatterplot/utils/formatColumnValue.js +11 -0
- package/dist/scatterplot/utils/formatColumnValue.js.map +1 -0
- package/dist/scatterplot/utils/getVisibleLabels.d.ts +6 -9
- package/dist/scatterplot/utils/getVisibleLabels.d.ts.map +1 -1
- package/dist/scatterplot/utils/getVisibleLabels.js +46 -56
- package/dist/scatterplot/utils/getVisibleLabels.js.map +1 -1
- package/dist/scatterplot-umap/ChartRenderer.d.ts +18 -15
- package/dist/scatterplot-umap/ChartRenderer.d.ts.map +1 -1
- package/dist/scatterplot-umap/ChartRenderer.js +231 -214
- package/dist/scatterplot-umap/ChartRenderer.js.map +1 -1
- package/dist/scatterplot-umap/SettingsImpl.d.ts +2 -2
- package/dist/scatterplot-umap/SettingsImpl.d.ts.map +1 -1
- package/dist/scatterplot-umap/SettingsImpl.js +25 -25
- package/dist/scatterplot-umap/SettingsImpl.js.map +1 -1
- package/dist/scatterplot-umap/colors.d.ts +6 -0
- package/dist/scatterplot-umap/colors.d.ts.map +1 -0
- package/dist/scatterplot-umap/colors.js +42 -0
- package/dist/scatterplot-umap/colors.js.map +1 -0
- package/dist/scatterplot-umap/components/LowerSVG.d.ts +2 -2
- package/dist/scatterplot-umap/components/LowerSVG.d.ts.map +1 -1
- package/dist/scatterplot-umap/components/LowerSVG.js +97 -94
- package/dist/scatterplot-umap/components/LowerSVG.js.map +1 -1
- package/dist/scatterplot-umap/components/UpperSVG.d.ts.map +1 -1
- package/dist/scatterplot-umap/components/UpperSVG.js +20 -19
- package/dist/scatterplot-umap/components/UpperSVG.js.map +1 -1
- package/dist/scatterplot-umap/index.d.ts +0 -2
- package/dist/scatterplot-umap/index.d.ts.map +1 -1
- package/dist/scatterplot-umap/index.js +77 -102
- package/dist/scatterplot-umap/index.js.map +1 -1
- package/dist/scatterplot-umap/types.d.ts +7 -10
- package/dist/scatterplot-umap/types.d.ts.map +1 -1
- package/dist/types/bubble.d.ts +44 -12
- package/dist/types/bubble.d.ts.map +1 -1
- package/dist/types/common.d.ts +22 -3
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types/common.js +3 -1
- package/dist/types/common.js.map +1 -1
- package/dist/types/dendro.d.ts +113 -10
- package/dist/types/dendro.d.ts.map +1 -1
- package/dist/types/dendro.js +1 -1
- package/dist/types/dendro.js.map +1 -1
- package/dist/types/discrete.d.ts +99 -22
- package/dist/types/discrete.d.ts.map +1 -1
- package/dist/types/discrete.js +3 -3
- package/dist/types/discrete.js.map +1 -1
- package/dist/types/heatmap.d.ts +187 -28
- package/dist/types/heatmap.d.ts.map +1 -1
- package/dist/types/heatmap.js +1 -1
- package/dist/types/heatmap.js.map +1 -1
- package/dist/types/histogram.d.ts +30 -8
- package/dist/types/histogram.d.ts.map +1 -1
- package/dist/types/histogram.js +1 -1
- package/dist/types/histogram.js.map +1 -1
- package/dist/types/scatterplot-umap.d.ts +149 -15
- package/dist/types/scatterplot-umap.d.ts.map +1 -1
- package/dist/types/scatterplot-umap.js +9 -9
- package/dist/types/scatterplot-umap.js.map +1 -1
- package/dist/types/scatterplot.d.ts +164 -12
- package/dist/types/scatterplot.d.ts.map +1 -1
- package/dist/types/scatterplot.js +1 -1
- package/dist/types/scatterplot.js.map +1 -1
- package/dist/utils/TextMeasurer/TextMeasurer.d.ts +7 -0
- package/dist/utils/TextMeasurer/TextMeasurer.d.ts.map +1 -0
- package/dist/utils/TextMeasurer/TextMeasurer.js +42 -0
- package/dist/utils/TextMeasurer/TextMeasurer.js.map +1 -0
- package/dist/utils/TextMeasurer/charToWidth.json.js +155 -0
- package/dist/utils/TextMeasurer/charToWidth.json.js.map +1 -0
- package/dist/utils/arrangeLegendParts.js +1 -1
- package/dist/utils/arrangeLegendParts.js.map +1 -1
- package/dist/utils/getChartEdgeSides.d.ts +1 -1
- package/dist/utils/getLegendWidth.d.ts.map +1 -1
- package/dist/utils/getLegendWidth.js +1 -1
- package/dist/utils/getLegendWidth.js.map +1 -1
- package/package.json +5 -3
- package/dist/bubble/getCells.d.ts.map +0 -1
- package/dist/bubble/getCells.js +0 -91
- package/dist/bubble/getCells.js.map +0 -1
- package/dist/node_modules/d3-quadtree/src/add.js +0 -30
- package/dist/node_modules/d3-quadtree/src/add.js.map +0 -1
- package/dist/node_modules/d3-quadtree/src/cover.js +0 -29
- package/dist/node_modules/d3-quadtree/src/cover.js.map +0 -1
- package/dist/node_modules/d3-quadtree/src/data.js +0 -12
- package/dist/node_modules/d3-quadtree/src/data.js.map +0 -1
- package/dist/node_modules/d3-quadtree/src/extent.js +0 -7
- package/dist/node_modules/d3-quadtree/src/extent.js.map +0 -1
- package/dist/node_modules/d3-quadtree/src/find.js +0 -26
- package/dist/node_modules/d3-quadtree/src/find.js.map +0 -1
- package/dist/node_modules/d3-quadtree/src/quad.js +0 -7
- package/dist/node_modules/d3-quadtree/src/quad.js.map +0 -1
- package/dist/node_modules/d3-quadtree/src/quadtree.js +0 -51
- package/dist/node_modules/d3-quadtree/src/quadtree.js.map +0 -1
- package/dist/node_modules/d3-quadtree/src/remove.js +0 -21
- package/dist/node_modules/d3-quadtree/src/remove.js.map +0 -1
- package/dist/node_modules/d3-quadtree/src/root.js +0 -7
- package/dist/node_modules/d3-quadtree/src/root.js.map +0 -1
- package/dist/node_modules/d3-quadtree/src/size.js +0 -12
- package/dist/node_modules/d3-quadtree/src/size.js.map +0 -1
- package/dist/node_modules/d3-quadtree/src/visit.js +0 -14
- package/dist/node_modules/d3-quadtree/src/visit.js.map +0 -1
- package/dist/node_modules/d3-quadtree/src/visitAfter.js +0 -19
- package/dist/node_modules/d3-quadtree/src/visitAfter.js.map +0 -1
- package/dist/node_modules/d3-quadtree/src/x.js +0 -11
- package/dist/node_modules/d3-quadtree/src/x.js.map +0 -1
- package/dist/node_modules/d3-quadtree/src/y.js +0 -11
- package/dist/node_modules/d3-quadtree/src/y.js.map +0 -1
- package/dist/utils/TextMeasurer.d.ts +0 -8
- package/dist/utils/TextMeasurer.d.ts.map +0 -1
- package/dist/utils/TextMeasurer.js +0 -27
- package/dist/utils/TextMeasurer.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getHeatmapData.js","sources":["../../src/dendro/getHeatmapData.ts"],"sourcesContent":["import type {DataFrame} from '../DataFrame';\nimport type {DendroSettingsImpl} from './DendroSettingsImpl';\nimport type {TreeNodeData} from './getHierarchyData';\nimport type {Cell} from './components/types';\nimport type {HierarchyNode} from 'd3-hierarchy';\n\nexport type HeatmapData = {\n xKeys: string[];\n yKeys: string[];\n xGroupKeys: string[];\n xKeysByGroups: Record<string, string[]>;\n cells: Record<string, Record<string, Cell>>;\n meta: {\n valueExtent: [number, number];\n uniqueValues: Set<string>;\n xLabels: Record<string, string>;\n };\n};\n\nexport function getHeatmapData(\n data:DataFrame,\n type: DendroSettingsImpl['heatmapSettings']['valueType'],\n heatmapAnnotation: DendroSettingsImpl['heatmapAnnotation'],\n heatmapAxis: DendroSettingsImpl['heatmapAxis'],\n heatmapGroup: DendroSettingsImpl['heatmapGroup'],\n id: DendroSettingsImpl['id'],\n hierarchy: HierarchyNode<TreeNodeData>\n) {\n return type === 'stringSource'\n ? getHeatmapDataByStringSource(data, heatmapAnnotation, id, hierarchy)\n : getHeatmapDataWithAxisColumn(data, type, heatmapAnnotation, heatmapAxis, heatmapGroup, id, hierarchy);\n}\nexport function getHeatmapDataWithAxisColumn(\n data:DataFrame,\n type: DendroSettingsImpl['heatmapSettings']['valueType'],\n heatmapAnnotation: DendroSettingsImpl['heatmapAnnotation'],\n heatmapAxis: DendroSettingsImpl['heatmapAxis'],\n heatmapGroup: DendroSettingsImpl['heatmapGroup'],\n id: DendroSettingsImpl['id'],\n hierarchy: HierarchyNode<TreeNodeData>\n) : HeatmapData | null {\n if (!heatmapAnnotation || !heatmapAxis) {\n return null;\n }\n const yKeys = hierarchy.leaves().map((node) => String(node.data.rawData[0][id.value]));\n const result:HeatmapData = {\n xKeys: [],\n xGroupKeys: [],\n xKeysByGroups: {},\n yKeys: yKeys,\n cells: {},\n meta: {\n valueExtent: [Infinity, -Infinity],\n uniqueValues: new Set(),\n xLabels: {},\n }\n };\n const valueColumn = heatmapAnnotation;\n const xGroupBy = heatmapGroup;\n const xColumn = heatmapAxis;\n const yColumn = id;\n\n const xKeysSet = new Set<string>();\n const xKeysByGroups:Record<string, Set<string>> = {};\n const xGroupKeys = new Set<string>();\n data.rows.forEach(row => {\n const xGroupKey = xGroupBy.length ? xGroupBy.map(column => String(row[column.value])).join('_') : 'null';\n let x = row[xColumn.value];\n let y = row[yColumn.value];\n if (x === null || y === null) {\n return;\n }\n x = String(x);\n y = String(y);\n if (!xKeysByGroups[xGroupKey]) {\n xKeysByGroups[xGroupKey] = new Set<string>();\n xGroupKeys.add(xGroupKey);\n }\n xKeysSet.add(x);\n xKeysByGroups[xGroupKey].add(x);\n\n if (!result.cells[x]) {\n result.cells[x] = {};\n }\n\n const value = row[valueColumn.value];\n\n if (type === 'discrete') {\n result.meta.uniqueValues.add(String(value));\n }\n if (type === 'continuous') {\n result.meta.valueExtent[0] = Math.min(value as number, result.meta.valueExtent[0]);\n result.meta.valueExtent[1] = Math.max(value as number, result.meta.valueExtent[1]);\n }\n\n if (result.cells[x][y] && value !== value) {\n throw Error(`More than 1 value for x=${x}, y=${y}`);\n }\n const label = String(row[xColumn.valueLabels ?? xColumn.value]);\n if (result.meta.xLabels[x] && label !== result.meta.xLabels[x]) {\n throw Error(`More than 1 x-label value for x=${x}`);\n }\n result.meta.xLabels[x] = label;\n\n result.cells[x][y] = {\n id: `${x}_${y}`,\n x,\n y,\n value: row[valueColumn.value],\n data: row,\n };\n });\n result.xGroupKeys = [...xGroupKeys];\n result.xKeysByGroups = [...xGroupKeys].reduce((res:HeatmapData['xKeysByGroups'], key) => {\n res[key] = [...xKeysByGroups[key]];\n return res;\n }, {});\n result.xKeys = result.xGroupKeys.reduce((res:string[], groupKey) => {\n res = res.concat(result.xKeysByGroups[groupKey]);\n return res;\n }, []);\n return result;\n}\n\nfunction getHeatmapDataByStringSource(\n data:DataFrame,\n heatmapAnnotation: DendroSettingsImpl['heatmapAnnotation'],\n id: DendroSettingsImpl['id'],\n hierarchy: HierarchyNode<TreeNodeData>\n) : HeatmapData | null {\n if (!heatmapAnnotation) {\n return null;\n }\n const yKeys = hierarchy.leaves().map((node) => String(node.data.rawData[0][id.value]));\n const result:HeatmapData = {\n xKeys: [],\n xGroupKeys: [],\n xKeysByGroups: {},\n yKeys: yKeys,\n cells: {},\n meta: {\n valueExtent: [Infinity, -Infinity],\n uniqueValues: new Set(),\n xLabels: {},\n }\n };\n const valueColumn = heatmapAnnotation;\n const yColumn = id;\n\n const xKeysByGroups:Record<string, Set<string>> = {'null': new Set()};\n const xGroupKeys = ['null'];\n let maxLine = 0;\n\n data.rows.forEach(row => {\n const line = row[valueColumn.value] as string;\n let y = row[yColumn.value];\n if (line === null || y === null) {\n return;\n }\n y = String(y);\n for (let i = 0; i < line.length; i++) {\n maxLine = Math.max(maxLine, line.length);\n const x = String(i);\n const value = line[i];\n xKeysByGroups['null'].add(x);\n\n result.meta.uniqueValues.add(value);\n result.meta.xLabels[x] = x;\n\n if (!result.cells[x]) {\n result.cells[x] = {};\n }\n result.cells[x][y] = {id: `${x}_${y}`, x, y, value, data: row};\n }\n });\n result.xGroupKeys = xGroupKeys;\n result.xKeysByGroups = xGroupKeys.reduce((res:HeatmapData['xKeysByGroups'], key) => {\n res[key] = [...xKeysByGroups[key]];\n return res;\n }, {});\n result.xKeys = new Array(maxLine).fill(null).map((_v, idx) => String(idx));\n return result;\n}\n"],"names":["getHeatmapData","data","type","heatmapAnnotation","heatmapAxis","heatmapGroup","id","hierarchy","getHeatmapDataByStringSource","getHeatmapDataWithAxisColumn","yKeys","node","result","valueColumn","xGroupBy","xColumn","yColumn","xKeysSet","xKeysByGroups","xGroupKeys","row","xGroupKey","column","x","value","label","res","key","groupKey","maxLine","line","y","i","_v","idx"],"mappings":"AAmBO,SAASA,EACZC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACF;AACE,SAAOL,MAAS,iBACVM,EAA6BP,GAAME,GAAmBG,GAAIC,CAAS,IACnEE,EAA6BR,GAAMC,GAAMC,GAAmBC,GAAaC,GAAcC,GAAIC,CAAS;AAC9G;AACO,SAASE,EACZR,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACmB;AACnB,MAAI,CAACJ,KAAqB,CAACC;AACvB,WAAO;AAEX,QAAMM,IAAQH,EAAU,OAAA,EAAS,IAAI,CAACI,MAAS,OAAOA,EAAK,KAAK,QAAQ,CAAC,EAAEL,EAAG,KAAK,CAAC,CAAC,GAC/EM,IAAqB;AAAA,IACvB,OAAO,CAAA;AAAA,IACP,YAAY,CAAA;AAAA,IACZ,eAAe,CAAA;AAAA,IACf,OAAAF;A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port type { DataFrame } from '../DataFrame';\nimport type { Cell } from './components/types';\nimport type { DendroSettingsImpl } from './DendroSettingsImpl';\nimport type { TreeNodeData } from './getHierarchyData';\n\nexport type HeatmapData = {\n xKeys: string[];\n yKeys: string[];\n xGroupKeys: string[];\n xKeysByGroups: Record<string, string[]>;\n cells: Record<string, Record<string, Cell>>;\n meta: {\n valueExtent: [number, number];\n uniqueValues: Set<string>;\n xLabels: Record<string, string>;\n };\n};\n\nexport function getHeatmapData(\n data:DataFrame,\n type: DendroSettingsImpl['heatmapSettings']['valueType'],\n heatmapAnnotation: DendroSettingsImpl['heatmapAnnotation'],\n heatmapAxis: DendroSettingsImpl['heatmapAxis'],\n heatmapGroup: DendroSettingsImpl['heatmapGroup'],\n id: DendroSettingsImpl['id'],\n hierarchy: HierarchyNode<TreeNodeData>\n) {\n return type === 'stringSource'\n ? getHeatmapDataByStringSource(data, heatmapAnnotation, id, hierarchy)\n : getHeatmapDataWithAxisColumn(data, type, heatmapAnnotation, heatmapAxis, heatmapGroup, id, hierarchy);\n}\nexport function getHeatmapDataWithAxisColumn(\n data:DataFrame,\n type: DendroSettingsImpl['heatmapSettings']['valueType'],\n heatmapAnnotation: DendroSettingsImpl['heatmapAnnotation'],\n heatmapAxis: DendroSettingsImpl['heatmapAxis'],\n heatmapGroup: DendroSettingsImpl['heatmapGroup'],\n id: DendroSettingsImpl['id'],\n hierarchy: HierarchyNode<TreeNodeData>\n) : HeatmapData | null {\n if (!heatmapAnnotation || !heatmapAxis) {\n return null;\n }\n const yKeys = hierarchy.leaves().map((node) => String(data.getColumnValue(id.value, node.data.rawIndexes[0])));\n const result:HeatmapData = {\n xKeys: [],\n xGroupKeys: [],\n xKeysByGroups: {},\n yKeys: yKeys,\n cells: {},\n meta: {\n valueExtent: [Infinity, -Infinity],\n uniqueValues: new Set(),\n xLabels: {},\n }\n };\n const valueColumn = heatmapAnnotation;\n const xGroupBy = heatmapGroup;\n const xColumn = heatmapAxis;\n const yColumn = id;\n\n const xKeysSet = new Set<string>();\n const xKeysByGroups:Record<string, Set<string>> = {};\n const xGroupKeys = new Set<string>();\n\n for (let i = 0; i < data.rowsCount; i++) {\n const xGroupKey = xGroupBy.length ? xGroupBy.map(column => String(data.getColumnValue(column.value, i))).join('_') : 'null';\n let x = data.getColumnValue(xColumn.value, i);\n let y = data.getColumnValue(yColumn.value, i);\n if (x === null || y === null) {\n continue;\n }\n\n x = String(x);\n y = String(y);\n if (!xKeysByGroups[xGroupKey]) {\n xKeysByGroups[xGroupKey] = new Set<string>();\n xGroupKeys.add(xGroupKey);\n }\n xKeysSet.add(x);\n xKeysByGroups[xGroupKey].add(x);\n\n if (!result.cells[x]) {\n result.cells[x] = {};\n }\n\n const value = data.getColumnValue(valueColumn.value, i);\n\n if (type === 'discrete') {\n result.meta.uniqueValues.add(String(value));\n }\n if (type === 'continuous') {\n result.meta.valueExtent[0] = Math.min(value as number, result.meta.valueExtent[0]);\n result.meta.valueExtent[1] = Math.max(value as number, result.meta.valueExtent[1]);\n }\n\n if (result.cells[x][y] && value !== value) {\n throw Error(`More than 1 value for x=${x}, y=${y}`);\n }\n const label = String(\n data.getColumnValue(xColumn.valueLabels ?? xColumn.value, i)\n );\n if (result.meta.xLabels[x] && label !== result.meta.xLabels[x]) {\n throw Error(`More than 1 x-label value for x=${x}`);\n }\n result.meta.xLabels[x] = label;\n\n result.cells[x][y] = {\n idx: i,\n id: `${x}_${y}`,\n x,\n y,\n value: data.getColumnValue(valueColumn.value, i),\n };\n }\n\n result.xGroupKeys = [...xGroupKeys];\n result.xKeysByGroups = [...xGroupKeys].reduce((res:HeatmapData['xKeysByGroups'], key) => {\n res[key] = [...xKeysByGroups[key]];\n return res;\n }, {});\n result.xKeys = result.xGroupKeys.reduce((res:string[], groupKey) => {\n res = res.concat(result.xKeysByGroups[groupKey]);\n return res;\n }, []);\n return result;\n}\n\nfunction getHeatmapDataByStringSource(\n data:DataFrame,\n heatmapAnnotation: DendroSettingsImpl['heatmapAnnotation'],\n id: DendroSettingsImpl['id'],\n hierarchy: HierarchyNode<TreeNodeData>\n) : HeatmapData | null {\n if (!heatmapAnnotation) {\n return null;\n }\n const yKeys = hierarchy.leaves().map((node) => String(data.getColumnValue(id.value, node.data.rawIndexes[0])));\n const result:HeatmapData = {\n xKeys: [],\n xGroupKeys: [],\n xKeysByGroups: {},\n yKeys: yKeys,\n cells: {},\n meta: {\n valueExtent: [Infinity, -Infinity],\n uniqueValues: new Set(),\n xLabels: {},\n }\n };\n const valueColumn = heatmapAnnotation;\n const yColumn = id;\n\n const xKeysByGroups:Record<string, Set<string>> = {'null': new Set()};\n const xGroupKeys = ['null'];\n let maxLine = 0;\n\n for (let i = 0; i < data.rowsCount; i++) {\n const line = data.getColumnValue(valueColumn.value, i) as string;\n let y = data.getColumnValue(yColumn.value, i);\n if (line === null || y === null) {\n continue;\n }\n y = String(y);\n for (let j = 0; j < line.length; j++) {\n maxLine = Math.max(maxLine, line.length);\n const x = String(j);\n const value = line[j];\n xKeysByGroups['null'].add(x);\n\n result.meta.uniqueValues.add(value);\n result.meta.xLabels[x] = x;\n\n if (!result.cells[x]) {\n result.cells[x] = {};\n }\n result.cells[x][y] = {idx: i, id: `${x}_${y}`, x, y, value};\n }\n }\n \n result.xGroupKeys = xGroupKeys;\n result.xKeysByGroups = xGroupKeys.reduce((res:HeatmapData['xKeysByGroups'], key) => {\n res[key] = [...xKeysByGroups[key]];\n return res;\n }, {});\n result.xKeys = new Array(maxLine).fill(null).map((_v, idx) => String(idx));\n return result;\n}\n"],"names":["getHeatmapData","data","type","heatmapAnnotation","heatmapAxis","heatmapGroup","id","hierarchy","getHeatmapDataByStringSource","getHeatmapDataWithAxisColumn","yKeys","node","result","valueColumn","xGroupBy","xColumn","yColumn","xKeysSet","xKeysByGroups","xGroupKeys","i","xGroupKey","column","x","y","value","label","res","key","groupKey","maxLine","line","j","_v","idx"],"mappings":"AAmBO,SAASA,EACZC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACF;AACE,SA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O,MAAMW,CAAC,IAAI,CAAA,IAEtBX,EAAO,MAAMW,CAAC,EAAE,CAAC,IAAI,EAAC,KAAKH,GAAG,IAAI,GAAGG,CAAC,IAAI,CAAC,IAAI,GAAAA,GAAG,GAAG,OAAAE,EAAA;AAAA,MACzD;AAAA;AAAA,EACJ;AAEA,SAAAb,EAAO,aAAaO,GACpBP,EAAO,gBAAgBO,EAAW,OAAO,CAACQ,GAAkCC,OACxED,EAAIC,CAAG,IAAI,CAAC,GAAGV,EAAcU,CAAG,CAAC,GAC1BD,IACR,CAAA,CAAE,GACLf,EAAO,QAAQ,IAAI,MAAMkB,CAAO,EAAE,KAAK,IAAI,EAAE,IAAI,CAACG,GAAIC,MAAQ,OAAOA,CAAG,CAAC,GAClEtB;AACX;"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { Row } from '../types';
|
|
2
1
|
import { HierarchyPointNode } from 'd3-hierarchy';
|
|
2
|
+
import { DataFrame } from '../DataFrame';
|
|
3
3
|
export type TreeNodeData = {
|
|
4
4
|
id: string;
|
|
5
5
|
parentId: string | null;
|
|
6
6
|
height: number;
|
|
7
7
|
label: string | null;
|
|
8
8
|
isFake: boolean;
|
|
9
|
-
|
|
9
|
+
rawIndexes: number[];
|
|
10
10
|
};
|
|
11
|
-
export declare function getHierarchy(idKey: string, parentIdKey: string, heightIdKey: string | null, labelIdKey: string | null,
|
|
11
|
+
export declare function getHierarchy(dataFrame: DataFrame, idKey: string, parentIdKey: string, heightIdKey: string | null, labelIdKey: string | null, useAllNodesAsLeaves?: boolean): import('d3-hierarchy').HierarchyNode<TreeNodeData>;
|
|
12
12
|
export declare function updateLinksHeight(root: HierarchyPointNode<TreeNodeData>, chartHeight: number, alignLeavesToLine?: boolean): void;
|
|
13
13
|
export declare function updateNodesHorizontalPosition(root: HierarchyPointNode<TreeNodeData>): void;
|
|
14
14
|
//# sourceMappingURL=getHierarchyData.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getHierarchyData.d.ts","sourceRoot":"","sources":["../../src/dendro/getHierarchyData.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getHierarchyData.d.ts","sourceRoot":"","sources":["../../src/dendro/getHierarchyData.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,kBAAkB,EAAY,MAAM,cAAc,CAAC;AAEjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,MAAM,YAAY,GAAG;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAEF,wBAAgB,YAAY,CACxB,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,GAAG,IAAI,EAC1B,UAAU,EAAE,MAAM,GAAG,IAAI,EACzB,mBAAmB,UAAQ,sDA0C9B;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,kBAAkB,CAAC,YAAY,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,iBAAiB,UAAQ,QAkBvH;AAED,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,kBAAkB,CAAC,YAAY,CAAC,QAMnF"}
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
import h from "../node_modules/lodash/lodash.js";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
function
|
|
5
|
-
const
|
|
6
|
-
const
|
|
1
|
+
import { l as h } from "../node_modules/lodash/lodash.js";
|
|
2
|
+
import g from "../node_modules/d3-hierarchy/src/stratify.js";
|
|
3
|
+
import y from "../node_modules/d3-array/src/max.js";
|
|
4
|
+
function V(t, i, l, r, s, a = !1) {
|
|
5
|
+
const n = h.groupBy(t.rowIndexes, (e) => t.getColumnValue(i, e)), o = Object.keys(n).map((e) => {
|
|
6
|
+
const d = n[e], p = d[0], f = t.getColumnValue(l, p), w = s ? h.uniq(d.map((q) => t.getColumnValue(s, q))).join(", ") : null, R = r ? Number(t.getColumnValue(r, p)) : 1;
|
|
7
7
|
return {
|
|
8
8
|
id: String(e),
|
|
9
|
-
parentId: f
|
|
10
|
-
label:
|
|
11
|
-
height:
|
|
9
|
+
parentId: f === null ? null : String(f),
|
|
10
|
+
label: w,
|
|
11
|
+
height: R,
|
|
12
12
|
isFake: !1,
|
|
13
|
-
|
|
13
|
+
rawIndexes: d
|
|
14
14
|
// save source row data to avoid any modifications
|
|
15
15
|
};
|
|
16
|
-
}), u =
|
|
17
|
-
if (!
|
|
16
|
+
}), u = g().id((e) => e.id).parentId((e) => e.parentId)(o);
|
|
17
|
+
if (!a)
|
|
18
18
|
return u;
|
|
19
|
-
const
|
|
19
|
+
const x = new Set(u.leaves().map((e) => e.id)), m = o.filter((e) => !x.has(e.id)).map((e) => ({
|
|
20
20
|
id: `${e.id}_extra`,
|
|
21
21
|
parentId: e.id,
|
|
22
22
|
height: 0,
|
|
23
23
|
label: null,
|
|
24
24
|
isFake: !0,
|
|
25
|
-
|
|
26
|
-
})),
|
|
27
|
-
return
|
|
25
|
+
rawIndexes: e.rawIndexes
|
|
26
|
+
})), I = o.concat(m);
|
|
27
|
+
return g().id((e) => e.id).parentId((e) => e.parentId)(I);
|
|
28
28
|
}
|
|
29
|
-
function
|
|
30
|
-
|
|
31
|
-
function r(
|
|
32
|
-
return
|
|
29
|
+
function b(t, i, l = !1) {
|
|
30
|
+
t.data.height = 0;
|
|
31
|
+
function r(n) {
|
|
32
|
+
return n.data.height;
|
|
33
33
|
}
|
|
34
|
-
function s(
|
|
35
|
-
return r(
|
|
34
|
+
function s(n) {
|
|
35
|
+
return r(n) + (n.children ? y(n.children, s) : 0);
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
|
|
37
|
+
function a(n, c, o) {
|
|
38
|
+
n.y = !n.children && l ? i : (c += r(n)) * o, n.children && n.children.forEach((u) => a(u, c, o));
|
|
39
39
|
}
|
|
40
|
-
|
|
40
|
+
a(t, 0, i / s(t));
|
|
41
41
|
}
|
|
42
|
-
function
|
|
43
|
-
|
|
44
|
-
!
|
|
42
|
+
function k(t) {
|
|
43
|
+
t.descendants().forEach((i) => {
|
|
44
|
+
!i.children && i.data.isFake && i.parent && (i.parent.x = i.x);
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
export {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
V as getHierarchy,
|
|
49
|
+
b as updateLinksHeight,
|
|
50
|
+
k as updateNodesHorizontalPosition
|
|
51
51
|
};
|
|
52
52
|
//# sourceMappingURL=getHierarchyData.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getHierarchyData.js","sources":["../../src/dendro/getHierarchyData.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"getHierarchyData.js","sources":["../../src/dendro/getHierarchyData.ts"],"sourcesContent":["import { max as d3max } from 'd3-array';\nimport { type HierarchyPointNode, stratify } from 'd3-hierarchy';\nimport { groupBy, uniq } from 'lodash';\nimport type { DataFrame } from '../DataFrame';\n\nexport type TreeNodeData = {\n id: string;\n parentId: string | null;\n height: number;\n label: string | null;\n isFake: boolean; // true for additional nodes for mode with all nodes used as leaves\n rawIndexes: number[];\n};\n\nexport function getHierarchy(\n dataFrame: DataFrame,\n idKey: string,\n parentIdKey: string,\n heightIdKey: string | null,\n labelIdKey: string | null,\n useAllNodesAsLeaves = false\n) {\n const groupedByNodeId = groupBy(dataFrame.rowIndexes, idx => dataFrame.getColumnValue(idKey, idx));\n const uniqueKeys = Object.keys(groupedByNodeId);\n\n const uniqueNodeRows: TreeNodeData[] = uniqueKeys\n .map((key) => {\n const indexes = groupedByNodeId[key];\n const first = indexes[0]; // some values must be the same for every row with the same NodeId, we can take them from any row of group\n const parentId = dataFrame.getColumnValue(parentIdKey, first);\n const label = labelIdKey ? uniq(indexes.map(idx => dataFrame.getColumnValue(labelIdKey, idx))).join(', ') : null;\n const height = heightIdKey ? Number(dataFrame.getColumnValue(heightIdKey, first)) : 1;\n return ({\n id: String(key),\n parentId: parentId === null ? null : String(parentId),\n label,\n height,\n isFake: false,\n rawIndexes: indexes, // save source row data to avoid any modifications\n } as TreeNodeData);\n });\n const tree = stratify<TreeNodeData>()\n .id(d => d.id)\n .parentId(d => d.parentId)(uniqueNodeRows);\n if (!useAllNodesAsLeaves) {\n return tree;\n }\n // for tree layout with every node aligned by side rows\n const leavesIdSet = new Set(tree.leaves().map(node => node.id));\n const noLeafRows = uniqueNodeRows.filter(row => !leavesIdSet.has(row.id));\n const extraRows = noLeafRows.map(row => ({\n id: `${row.id}_extra`,\n parentId: row.id,\n height: 0,\n label: null,\n isFake: true,\n rawIndexes: row.rawIndexes,\n }));\n const expandedRows = uniqueNodeRows.concat(extraRows);\n return stratify<TreeNodeData>()\n .id(d => d.id)\n .parentId(d => d.parentId)(expandedRows);\n}\n\nexport function updateLinksHeight(root: HierarchyPointNode<TreeNodeData>, chartHeight: number, alignLeavesToLine = false) {\n root.data.height = 0;\n function heightGetter(d: HierarchyPointNode<TreeNodeData>) {\n return d.data.height;\n }\n\n function maxLength(d: HierarchyPointNode<TreeNodeData>): number {\n return heightGetter(d) + (d.children ? (d3max(d.children, maxLength) as number) : 0);\n }\n\n function setHeight(d: HierarchyPointNode<TreeNodeData>, y0: number, k: number) {\n d.y = !d.children && alignLeavesToLine ? chartHeight : (y0 += heightGetter(d)) * k;\n if (d.children) {\n d.children.forEach(d => setHeight(d, y0, k));\n }\n }\n\n setHeight(root, 0, chartHeight / maxLength(root));\n}\n\nexport function updateNodesHorizontalPosition(root: HierarchyPointNode<TreeNodeData>) {\n root.descendants().forEach((d: HierarchyPointNode<TreeNodeData>) => {\n if (!d.children && d.data.isFake && d.parent) {\n d.parent.x = d.x;\n }\n });\n}\n"],"names":["getHierarchy","dataFrame","idKey","parentIdKey","heightIdKey","labelIdKey","useAllNodesAsLeaves","groupedByNodeId","groupBy","idx","uniqueNodeRows","key","indexes","first","parentId","label","uniq","height","tree","stratify","d","leavesIdSet","node","extraRows","row","expandedRows","updateLinksHeight","root","chartHeight","alignLeavesToLine","heightGetter","maxLength","d3max","setHeight","y0","k","updateNodesHorizontalPosition"],"mappings":";;;AAcO,SAASA,EACZC,GACAC,GACAC,GACAC,GACAC,GACAC,IAAsB,IACxB;AACE,QAAMC,IAAkBC,EAAAA,QAAQP,EAAU,YAAY,OAAOA,EAAU,eAAeC,GAAOO,CAAG,CAAC,GAG3FC,IAFa,OAAO,KAAKH,CAAe,EAGzC,IAAI,CAACI,MAAQ;AACV,UAAMC,IAAUL,EAAgBI,CAAG,GAC7BE,IAAQD,EAAQ,CAAC,GACjBE,IAAWb,EAAU,eAAeE,GAAaU,CAAK,GACtDE,IAAQV,IAAaW,EAAAA,KAAKJ,EAAQ,IAAI,CAAAH,MAAOR,EAAU,eAAeI,GAAYI,CAAG,CAAC,CAAC,EAAE,KAAK,IAAI,IAAI,MACtGQ,IAASb,IAAc,OAAOH,EAAU,eAAeG,GAAaS,CAAK,CAAC,IAAI;AACpF,WAAQ;AAAA,MACJ,IAAI,OAAOF,CAAG;AAAA,MACd,UAAUG,MAAa,OAAO,OAAO,OAAOA,CAAQ;AAAA,MACpD,OAAAC;AAAA,MACA,QAAAE;AAAA,MACA,QAAQ;AAAA,MACR,YAAYL;AAAA;AAAA,IAAA;AAAA,EAEpB,CAAC,GACCM,IAAOC,EAAA,EACR,GAAG,CAAAC,MAAKA,EAAE,EAAE,EACZ,SAAS,CAAAA,MAAKA,EAAE,QAAQ,EAAEV,CAAc;AAC7C,MAAI,CAACJ;AACD,WAAOY;AAGX,QAAMG,IAAc,IAAI,IAAIH,EAAK,OAAA,EAAS,IAAI,CAAAI,MAAQA,EAAK,EAAE,CAAC,GAExDC,IADab,EAAe,OAAO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hierarchy';
|
|
1
2
|
import { AbstractChart } from '../AbstractChart';
|
|
3
|
+
import { DataFrame } from '../DataFrame';
|
|
4
|
+
import { ClickEventData, DendroEventHandlers, DendroLegendInfo, DendroSettings } from '../types';
|
|
5
|
+
import { default as ChartRenderer } from './ChartRenderer';
|
|
2
6
|
import { ChartSizes } from './components/types';
|
|
7
|
+
import { DendroSettingsImpl } from './DendroSettingsImpl';
|
|
3
8
|
import { HeatmapData } from './getHeatmapData';
|
|
4
9
|
import { TreeNodeData } from './getHierarchyData';
|
|
5
|
-
import { default as ChartRenderer } from './ChartRenderer';
|
|
6
|
-
import { ClickEventData, DendroEventHandlers, DendroLegendInfo, DendroSettings } from '../types';
|
|
7
|
-
import { DendroSettingsImpl } from './DendroSettingsImpl';
|
|
8
|
-
import { DataFrame } from '../DataFrame';
|
|
9
|
-
import { HierarchyNode } from 'd3-hierarchy';
|
|
10
10
|
export declare class ChartDendro extends AbstractChart {
|
|
11
11
|
settings: DendroSettingsImpl;
|
|
12
12
|
onClick: (data: ClickEventData) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dendro/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dendro/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAIlD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAKR,cAAc,EAGd,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EAGjB,MAAM,UAAU,CAAC;AAClB,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,kBAAkB,EAAE,MAAM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var _ = Object.defineProperty;
|
|
2
|
+
var A = (l, h, e) => h in l ? _(l, h, { enumerable: !0, configurable: !0, writable: !0, value: e }) : l[h] = e;
|
|
3
|
+
var v = (l, h, e) => A(l, typeof h != "symbol" ? h + "" : h, e);
|
|
4
|
+
import { l as L } from "../node_modules/lodash/lodash.js";
|
|
5
|
+
import { renderToString as S } from "../node_modules/react-dom/server.browser.js";
|
|
6
|
+
import { undefined as b } from "../node_modules/zod/lib/index.js";
|
|
7
|
+
import { AbstractChart as y } from "../AbstractChart.js";
|
|
8
|
+
import R from "./ChartRenderer.js";
|
|
9
|
+
import { USER_UPDATE_EVENT as w } from "./constants.js";
|
|
10
|
+
import { DendroSettingsImpl as C } from "./DendroSettingsImpl.js";
|
|
11
|
+
import { getHeatmapData as N } from "./getHeatmapData.js";
|
|
12
|
+
import { getHierarchy as I } from "./getHierarchyData.js";
|
|
13
|
+
function g(l) {
|
|
14
|
+
return typeof l != "object" ? !1 : "valuesMap" in l;
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
const { nodeColor: e, nodeShape: t, lineColor:
|
|
18
|
-
|
|
16
|
+
function D(l, h) {
|
|
17
|
+
const { nodeColor: e, nodeShape: t, lineColor: s } = h, u = [e, t, s].filter(
|
|
18
|
+
g
|
|
19
19
|
);
|
|
20
|
-
return
|
|
21
|
-
const { columnName:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
})),
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
values: i.map(r).sort(),
|
|
36
|
-
usedAes: [...c],
|
|
37
|
-
aesMap: h,
|
|
38
|
-
labels: i.reduce((s, o) => (s[r(o)] = f(o), s), {})
|
|
20
|
+
return L.uniqBy(u, (n) => n.columnName.value).reduce((n, p) => {
|
|
21
|
+
const { columnName: r } = p, o = l.getColumnCategories(r.value, !1), m = (a) => String(
|
|
22
|
+
(r.valueLabels ? l.getColumnValue(r.valueLabels, l.getColumnCategoryRowIndex(r.value, a)) : b) ?? a
|
|
23
|
+
), i = /* @__PURE__ */ new Set(), d = o.reduce((a, f) => (a[f] || (a[f] = {}), a), {});
|
|
24
|
+
return g(e) && r.value === e.columnName.value && (i.add("dotFill"), o.forEach((a) => {
|
|
25
|
+
d[a].dotFill = e.valuesMap[a];
|
|
26
|
+
})), g(t) && r.value === t.columnName.value && (i.add("dotShape"), o.forEach((a) => {
|
|
27
|
+
d[a].dotShape = t.valuesMap[a];
|
|
28
|
+
})), g(s) && r.value === s.columnName.value && (i.add("lineColor"), o.forEach((a) => {
|
|
29
|
+
d[a].lineColor = s.valuesMap[a];
|
|
30
|
+
})), n[r.value] = {
|
|
31
|
+
values: o.sort(),
|
|
32
|
+
usedAes: [...i],
|
|
33
|
+
aesMap: d,
|
|
34
|
+
labels: o.reduce((a, f) => (a[f] = m(f), a), {})
|
|
39
35
|
}, n;
|
|
40
36
|
}, {});
|
|
41
37
|
}
|
|
42
|
-
class
|
|
43
|
-
constructor(e, t,
|
|
38
|
+
class z extends y {
|
|
39
|
+
constructor(e, t, s) {
|
|
44
40
|
super(e, t);
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
this.settings = new
|
|
41
|
+
v(this, "settings");
|
|
42
|
+
v(this, "onClick", () => b);
|
|
43
|
+
v(this, "chartRenderer", new R());
|
|
44
|
+
v(this, "calculatedData", null);
|
|
45
|
+
this.settings = new C(t), s && (this.onClick = s[0]);
|
|
50
46
|
}
|
|
51
47
|
mount(e) {
|
|
52
48
|
try {
|
|
53
49
|
this.chartRenderer.init(e), this._updateData(), this._updateChart();
|
|
54
50
|
} catch (t) {
|
|
55
|
-
t instanceof Error && this.chartRenderer.renderError(t.message);
|
|
51
|
+
t instanceof Error && (this.chartRenderer.renderError(t.message), console.error(t));
|
|
56
52
|
}
|
|
57
53
|
}
|
|
58
54
|
unmount() {
|
|
@@ -60,54 +56,54 @@ class F extends A {
|
|
|
60
56
|
}
|
|
61
57
|
updateSettingsAndData(e, t) {
|
|
62
58
|
try {
|
|
63
|
-
const
|
|
64
|
-
this.settings = new
|
|
65
|
-
} catch (
|
|
66
|
-
|
|
59
|
+
const s = this.settings, u = this.data;
|
|
60
|
+
this.settings = new C(t), this.data = e, this._needUpdateCalculatedDataBySettings(s, this.settings) || this._needUpdateCalculatedDataByData(u, this.data) ? this._updateData() : this._updateAesInData(), this._updateChart();
|
|
61
|
+
} catch (s) {
|
|
62
|
+
s instanceof Error && (this.chartRenderer.renderError(s.message), console.error(s));
|
|
67
63
|
}
|
|
68
64
|
}
|
|
69
65
|
updateChartState(e, t) {
|
|
70
66
|
if (document) {
|
|
71
|
-
const
|
|
72
|
-
document.dispatchEvent(
|
|
67
|
+
const s = new CustomEvent(w, { detail: { [e]: t } });
|
|
68
|
+
document.dispatchEvent(s);
|
|
73
69
|
}
|
|
74
70
|
}
|
|
75
71
|
export() {
|
|
76
|
-
return this._updateChart(),
|
|
72
|
+
return this._updateChart(), S(this.chartRenderer.component);
|
|
77
73
|
}
|
|
78
74
|
_needUpdateCalculatedDataBySettings(e, t) {
|
|
79
|
-
var
|
|
80
|
-
const { mode:
|
|
81
|
-
function
|
|
82
|
-
return
|
|
75
|
+
var m, i;
|
|
76
|
+
const { mode: s, id: u, parentId: c, heatmapAnnotation: n, heatmapAxis: p, heatmapGroup: r } = t;
|
|
77
|
+
function o(d, a) {
|
|
78
|
+
return d.length !== a.length || d.some((f, E) => f.value !== a[E].value);
|
|
83
79
|
}
|
|
84
|
-
return e.mode !==
|
|
80
|
+
return e.mode !== s || e.id.value !== u.value || e.parentId.value !== c.value || ((m = e.heatmapAnnotation) == null ? void 0 : m.value) !== (n == null ? void 0 : n.value) || ((i = e.heatmapAxis) == null ? void 0 : i.value) !== (p == null ? void 0 : p.value) || o(e.heatmapGroup, r);
|
|
85
81
|
}
|
|
86
82
|
_needUpdateCalculatedDataByData(e, t) {
|
|
87
|
-
const
|
|
88
|
-
return e.id !== t.id ||
|
|
83
|
+
const s = Object.keys(e.data), u = Object.keys(t.data);
|
|
84
|
+
return e.id !== t.id || s.length !== u.length || s.some((c) => {
|
|
89
85
|
var n;
|
|
90
|
-
return e.data[
|
|
86
|
+
return e.data[c].length !== ((n = t.data[c]) == null ? void 0 : n.length);
|
|
91
87
|
});
|
|
92
88
|
}
|
|
93
89
|
_updateData() {
|
|
94
|
-
const { mode: e, id: t, parentId:
|
|
90
|
+
const { mode: e, id: t, parentId: s, aes: u, heatmapAnnotation: c, heatmapAxis: n, heatmapGroup: p, heatmapSettings: r, height: o, labels: m } = this.settings, i = I(
|
|
91
|
+
this.data,
|
|
95
92
|
t.value,
|
|
96
|
-
|
|
97
|
-
(
|
|
98
|
-
|
|
99
|
-
this.data.rows,
|
|
93
|
+
s.value,
|
|
94
|
+
(o == null ? void 0 : o.value) ?? null,
|
|
95
|
+
m.valueLabels ?? m.value ?? null,
|
|
100
96
|
e === "useAllNodesAsLeaves"
|
|
101
|
-
),
|
|
97
|
+
), d = N(this.data, r.valueType, c, n, p, t, i), a = D(this.data, u);
|
|
102
98
|
this.calculatedData = {
|
|
103
99
|
chartSizes: this.chartRenderer.chartSizes,
|
|
104
|
-
hierarchy:
|
|
105
|
-
heatmapData:
|
|
106
|
-
legendLabels:
|
|
100
|
+
hierarchy: i,
|
|
101
|
+
heatmapData: d,
|
|
102
|
+
legendLabels: a
|
|
107
103
|
};
|
|
108
104
|
}
|
|
109
105
|
_updateAesInData() {
|
|
110
|
-
this.calculatedData && (this.calculatedData.legendLabels =
|
|
106
|
+
this.calculatedData && (this.calculatedData.legendLabels = D(this.data, this.settings.aes));
|
|
111
107
|
}
|
|
112
108
|
_updateChart() {
|
|
113
109
|
if (!this.calculatedData)
|
|
@@ -115,40 +111,41 @@ class F extends A {
|
|
|
115
111
|
const {
|
|
116
112
|
heatmapAnnotation: e,
|
|
117
113
|
chartSettings: t,
|
|
118
|
-
connectionType:
|
|
119
|
-
edgeInheritance:
|
|
120
|
-
rootPosition:
|
|
114
|
+
connectionType: s,
|
|
115
|
+
edgeInheritance: u,
|
|
116
|
+
rootPosition: c,
|
|
121
117
|
showNodes: n,
|
|
122
|
-
showEdges:
|
|
123
|
-
showLeavesLabels:
|
|
124
|
-
showNodesLabels:
|
|
125
|
-
aes:
|
|
126
|
-
labels:
|
|
127
|
-
heatmapSettings:
|
|
128
|
-
leavesMode:
|
|
118
|
+
showEdges: p,
|
|
119
|
+
showLeavesLabels: r,
|
|
120
|
+
showNodesLabels: o,
|
|
121
|
+
aes: m,
|
|
122
|
+
labels: i,
|
|
123
|
+
heatmapSettings: d,
|
|
124
|
+
leavesMode: a
|
|
129
125
|
} = this.settings;
|
|
130
126
|
this.chartRenderer.render(
|
|
127
|
+
this.data,
|
|
131
128
|
t,
|
|
132
129
|
this.calculatedData.hierarchy,
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
130
|
+
s,
|
|
131
|
+
c,
|
|
132
|
+
u,
|
|
136
133
|
n,
|
|
137
|
-
|
|
138
|
-
l,
|
|
139
|
-
i,
|
|
134
|
+
p,
|
|
140
135
|
r,
|
|
141
|
-
|
|
136
|
+
o,
|
|
137
|
+
m,
|
|
138
|
+
i,
|
|
142
139
|
e,
|
|
143
140
|
this.calculatedData.heatmapData,
|
|
144
|
-
|
|
141
|
+
d,
|
|
145
142
|
this.calculatedData.legendLabels,
|
|
146
|
-
|
|
143
|
+
a,
|
|
147
144
|
this.onClick
|
|
148
145
|
);
|
|
149
146
|
}
|
|
150
147
|
}
|
|
151
148
|
export {
|
|
152
|
-
|
|
149
|
+
z as ChartDendro
|
|
153
150
|
};
|
|
154
151
|
//# sourceMappingURL=index.js.map
|
package/dist/dendro/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/dendro/index.ts"],"sourcesContent":["import {AbstractChart} from '../AbstractChart';\nimport type {ChartSizes} from './components/types';\nimport {USER_UPDATE_EVENT} from './constants';\nimport type {HeatmapData} from './getHeatmapData';\nimport {getHeatmapData} from './getHeatmapData';\nimport type {TreeNodeData} from './getHierarchyData';\nimport {getHierarchy} from './getHierarchyData';\nimport {renderToString} from 'react-dom/server';\nimport {undefined} from 'zod';\nimport ChartRenderer from './ChartRenderer';\nimport type {\n AesItem,\n AesMap,\n CategoricalAesFromColumn,\n ClickEventData,\n ColumnName,\n ContinuousAesFromColumn,\n DendroEventHandlers,\n DendroLegendInfo,\n DendroSettings,\n LineShape,\n PointShape,\n Row,\n} from '../types';\nimport {DendroSettingsImpl} from './DendroSettingsImpl';\nimport type {DataFrame} from '../DataFrame';\nimport type {HierarchyNode} from 'd3-hierarchy';\nimport lodash from 'lodash';\n\nfunction isCategoricalAes<InputType extends string | number | PointShape | LineShape>(\n item: InputType | CategoricalAesFromColumn<InputType> | ContinuousAesFromColumn<InputType>\n): item is CategoricalAesFromColumn<InputType> {\n if (typeof item !== 'object') {\n return false;\n }\n return 'valuesMap' in item;\n}\nfunction getLegendLabelsMap(data: DataFrame, aes: DendroSettingsImpl['aes']): DendroLegendInfo {\n const {nodeColor, nodeShape, lineColor} = aes;\n const aesGrouping: CategoricalAesFromColumn<string | PointShape>[] = [nodeColor, nodeShape, lineColor].filter(\n isCategoricalAes\n );\n const uniqueColumns = lodash.uniqBy(aesGrouping, item => item.columnName.value);\n return uniqueColumns.reduce((res: DendroLegendInfo, item) => {\n const {columnName} = item;\n const uniqRowsByGrouping = lodash.uniqBy(data.rows, row => row[columnName.value]);\n const getValue = (row: Row) => String(row[columnName.value]);\n const getValueLabel = (row: Row) =>\n columnName.valueLabels ? String(row[columnName.valueLabels]) : getValue(row);\n\n const usedAes = new Set<keyof AesItem>();\n const aesMap: AesMap = uniqRowsByGrouping.reduce((res: AesMap, row) => {\n const value = getValue(row);\n if (!res[value]) {\n res[value] = {} as AesItem;\n }\n return res;\n }, {});\n if (isCategoricalAes(nodeColor) && columnName.value === nodeColor.columnName.value) {\n usedAes.add('dotFill');\n uniqRowsByGrouping.forEach(row => {\n const value = getValue(row);\n aesMap[value]['dotFill'] = nodeColor.valuesMap[value];\n });\n }\n if (isCategoricalAes(nodeShape) && columnName.value === nodeShape.columnName.value) {\n usedAes.add('dotShape');\n uniqRowsByGrouping.forEach(row => {\n const value = getValue(row);\n aesMap[value]['dotShape'] = nodeShape.valuesMap[value];\n });\n }\n if (isCategoricalAes(lineColor) && columnName.value === lineColor.columnName.value) {\n usedAes.add('lineColor');\n uniqRowsByGrouping.forEach(row => {\n const value = getValue(row);\n aesMap[value]['lineColor'] = lineColor.valuesMap[value];\n });\n }\n res[columnName.value] = {\n values: uniqRowsByGrouping.map(getValue).sort(),\n usedAes: [...usedAes],\n aesMap,\n labels: uniqRowsByGrouping.reduce((res: Record<string, string>, row) => {\n res[getValue(row)] = getValueLabel(row);\n return res;\n }, {}),\n };\n return res;\n }, {});\n}\n\nexport class ChartDendro extends AbstractChart {\n settings: DendroSettingsImpl;\n onClick: (data: ClickEventData) => void = () => undefined;\n chartRenderer = new ChartRenderer();\n\n calculatedData: {\n chartSizes: ChartSizes;\n hierarchy: HierarchyNode<TreeNodeData>;\n heatmapData: HeatmapData | null;\n legendLabels: DendroLegendInfo;\n } | null = null;\n\n constructor(data: DataFrame, settings: DendroSettings, eventHandlers?: DendroEventHandlers) {\n super(data, settings);\n\n this.settings = new DendroSettingsImpl(settings);\n if (eventHandlers) {\n this.onClick = eventHandlers[0];\n }\n }\n\n mount(node: HTMLElement) {\n try {\n this.chartRenderer.init(node);\n this._updateData();\n this._updateChart();\n } catch (err) {\n if (err instanceof Error) {\n this.chartRenderer.renderError(err.message as string);\n }\n }\n }\n\n unmount() {\n this.chartRenderer.clear();\n }\n\n updateSettingsAndData(data: DataFrame, settings: DendroSettings) {\n try {\n const previousSettings = this.settings;\n const previousData = this.data;\n this.settings = new DendroSettingsImpl(settings);\n this.data = data;\n if (\n this._needUpdateCalculatedDataBySettings(previousSettings, this.settings) ||\n this._needUpdateCalculatedDataByData(previousData, this.data)\n ) {\n this._updateData();\n } else {\n this._updateAesInData();\n }\n this._updateChart();\n } catch (err) {\n if (err instanceof Error) {\n this.chartRenderer.renderError(err.message as string);\n }\n }\n }\n\n updateChartState(field: string, value: unknown) {\n if (document) {\n const event = new CustomEvent(USER_UPDATE_EVENT, {detail: {[field]: value}});\n document.dispatchEvent(event);\n }\n }\n\n export(): string {\n this._updateChart();\n return renderToString(this.chartRenderer.component);\n }\n\n _needUpdateCalculatedDataBySettings(prevSettings: DendroSettingsImpl, settings: DendroSettingsImpl) {\n const {mode, id, parentId, heatmapAnnotation, heatmapAxis, heatmapGroup} = settings;\n\n function compareColumnGroups(columns1: ColumnName[], columns2: ColumnName[]) {\n return (\n columns1.length !== columns2.length ||\n columns1.some((column, idx) => column.value !== columns2[idx].value)\n );\n }\n\n return (\n prevSettings.mode !== mode ||\n prevSettings.id.value !== id.value ||\n prevSettings.parentId.value !== parentId.value ||\n prevSettings.heatmapAnnotation?.value !== heatmapAnnotation?.value ||\n prevSettings.heatmapAxis?.value !== heatmapAxis?.value ||\n compareColumnGroups(prevSettings.heatmapGroup, heatmapGroup)\n );\n }\n\n _needUpdateCalculatedDataByData(prevData: DataFrame, data: DataFrame) {\n const prevKeys = Object.keys(prevData.data);\n const keys = Object.keys(data.data);\n return (\n prevData.id !== data.id ||\n prevKeys.length !== keys.length ||\n prevKeys.some(key => prevData.data[key].length !== data.data[key]?.length)\n );\n }\n\n _updateData() {\n const {mode, id, parentId, aes, heatmapAnnotation, heatmapAxis, heatmapGroup, heatmapSettings, height, labels} = this.settings;\n const hierarchy = getHierarchy(\n id.value,\n parentId.value,\n height?.value ?? null,\n labels.valueLabels ?? labels.value ?? null,\n this.data.rows,\n mode === 'useAllNodesAsLeaves'\n );\n const heatmapData = getHeatmapData(this.data, heatmapSettings.valueType, heatmapAnnotation, heatmapAxis, heatmapGroup, id, hierarchy);\n\n const legendLabels = getLegendLabelsMap(this.data, aes);\n\n this.calculatedData = {\n chartSizes: this.chartRenderer.chartSizes,\n hierarchy,\n heatmapData,\n legendLabels,\n };\n }\n\n _updateAesInData() {\n if (!this.calculatedData) {\n return;\n }\n this.calculatedData.legendLabels = getLegendLabelsMap(this.data, this.settings.aes);\n }\n\n _updateChart() {\n if (!this.calculatedData) {\n return;\n }\n const {\n heatmapAnnotation,\n chartSettings,\n connectionType,\n edgeInheritance,\n rootPosition,\n showNodes,\n showEdges,\n showLeavesLabels,\n showNodesLabels,\n aes,\n labels,\n heatmapSettings,\n leavesMode\n } = this.settings;\n\n this.chartRenderer.render(\n chartSettings,\n this.calculatedData.hierarchy,\n connectionType,\n rootPosition,\n edgeInheritance,\n showNodes,\n showEdges,\n showLeavesLabels,\n showNodesLabels,\n aes,\n labels,\n heatmapAnnotation,\n this.calculatedData.heatmapData,\n heatmapSettings,\n this.calculatedData.legendLabels,\n leavesMode,\n this.onClick\n );\n }\n}\n"],"names":["isCategoricalAes","item","getLegendLabelsMap","data","aes","nodeColor","nodeShape","lineColor","aesGrouping","lodash","res","columnName","uniqRowsByGrouping","row","getValue","getValueLabel","usedAes","aesMap","value","ChartDendro","AbstractChart","settings","eventHandlers","__publicField","undefined","ChartRenderer","DendroSettingsImpl","node","err","previousSettings","previousData","field","event","USER_UPDATE_EVENT","renderToString","prevSettings","mode","id","parentId","heatmapAnnotation","heatmapAxis","heatmapGroup","compareColumnGroups","columns1","columns2","column","idx","_a","_b","prevData","prevKeys","keys","key","heatmapSettings","height","labels","hierarchy","getHierarchy","heatmapData","getHeatmapData","legendLabels","chartSettings","connectionType","edgeInheritance","rootPosition","showNodes","showEdges","showLeavesLabels","showNodesLabels","leavesMode"],"mappings":";;;;;;;;;;;;AA6BA,SAASA,EACLC,GAC2C;AAC3C,SAAI,OAAOA,KAAS,WACT,KAEJ,eAAeA;AAC1B;AACA,SAASC,EAAmBC,GAAiBC,GAAkD;AAC3F,QAAM,EAAC,WAAAC,GAAW,WAAAC,GAAW,WAAAC,EAAA,IAAaH,GACpCI,IAA+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ACA,KAAK,eAAe;AAAA,MACpBC;AAAA,MACAE;AAAA,MACAD;AAAA,MACAE;AAAA,MACAC;AAAA,MACAC;AAAA,MACAC;AAAA,MACAhE;AAAA,MACAmD;AAAA,MACAhB;AAAA,MACA,KAAK,eAAe;AAAA,MACpBc;AAAA,MACA,KAAK,eAAe;AAAA,MACpBgB;AAAA,MACA,KAAK;AAAA,IAAA;AAAA,EAEb;AACJ;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/dendro/index.ts"],"sourcesContent":["import type { HierarchyNode } from 'd3-hierarchy';\nimport { uniqBy } from 'lodash';\nimport { renderToString } from 'react-dom/server';\nimport { undefined } from 'zod';\nimport { AbstractChart } from '../AbstractChart';\nimport type { DataFrame } from '../DataFrame';\nimport type {\n AesItem,\n AesRecord,\n CategoricalAesFromColumn,\n Category,\n ClickEventData,\n ColumnName,\n ContinuousAesFromColumn,\n DendroEventHandlers,\n DendroLegendInfo,\n DendroSettings,\n LineShape,\n PointShape\n} from '../types';\nimport ChartRenderer from './ChartRenderer';\nimport type { ChartSizes } from './components/types';\nimport { USER_UPDATE_EVENT } from './constants';\nimport { DendroSettingsImpl } from './DendroSettingsImpl';\nimport type { HeatmapData } from './getHeatmapData';\nimport { getHeatmapData } from './getHeatmapData';\nimport type { TreeNodeData } from './getHierarchyData';\nimport { getHierarchy } from './getHierarchyData';\n\nfunction isCategoricalAes<InputType extends string | number | PointShape | LineShape>(\n item: InputType | CategoricalAesFromColumn<InputType> | ContinuousAesFromColumn<InputType>\n): item is CategoricalAesFromColumn<InputType> {\n if (typeof item !== 'object') {\n return false;\n }\n return 'valuesMap' in item;\n}\nfunction getLegendLabelsMap(data: DataFrame, aes: DendroSettingsImpl['aes']): DendroLegendInfo {\n const {nodeColor, nodeShape, lineColor} = aes;\n const aesGrouping: CategoricalAesFromColumn<string | PointShape>[] = [nodeColor, nodeShape, lineColor].filter(\n isCategoricalAes\n );\n const uniqueColumns = uniqBy(aesGrouping, item => item.columnName.value);\n return uniqueColumns.reduce((res: DendroLegendInfo, item) => {\n const {columnName} = item;\n const categories = data.getColumnCategories(columnName.value, false);\n const getValueLabel = (category: Category) => String(\n (columnName.valueLabels\n ? data.getColumnValue(columnName.valueLabels, data.getColumnCategoryRowIndex(columnName.value, category))\n : undefined\n ) ?? category\n );\n\n const usedAes = new Set<keyof AesItem>();\n const aesMap: AesRecord = categories.reduce((res: AesRecord, category) => {\n if (!res[category]) {\n res[category] = {} as AesItem;\n }\n return res;\n }, {});\n if (isCategoricalAes(nodeColor) && columnName.value === nodeColor.columnName.value) {\n usedAes.add('dotFill');\n categories.forEach(category => {\n aesMap[category]['dotFill'] = nodeColor.valuesMap[category];\n });\n }\n if (isCategoricalAes(nodeShape) && columnName.value === nodeShape.columnName.value) {\n usedAes.add('dotShape');\n categories.forEach(category => {\n aesMap[category]['dotShape'] = nodeShape.valuesMap[category];\n });\n }\n if (isCategoricalAes(lineColor) && columnName.value === lineColor.columnName.value) {\n usedAes.add('lineColor');\n categories.forEach(category => {\n aesMap[category]['lineColor'] = lineColor.valuesMap[category];\n });\n }\n res[columnName.value] = {\n values: categories.sort(),\n usedAes: [...usedAes],\n aesMap,\n labels: categories.reduce((res: Record<string, string>, category) => {\n res[category] = getValueLabel(category);\n return res;\n }, {}),\n };\n return res;\n }, {});\n}\n\nexport class ChartDendro extends AbstractChart {\n settings: DendroSettingsImpl;\n onClick: (data: ClickEventData) => void = () => undefined;\n chartRenderer = new ChartRenderer();\n\n calculatedData: {\n chartSizes: ChartSizes;\n hierarchy: HierarchyNode<TreeNodeData>;\n heatmapData: HeatmapData | null;\n legendLabels: DendroLegendInfo;\n } | null = null;\n\n constructor(data: DataFrame, settings: DendroSettings, eventHandlers?: DendroEventHandlers) {\n super(data, settings);\n\n this.settings = new DendroSettingsImpl(settings);\n if (eventHandlers) {\n this.onClick = eventHandlers[0];\n }\n }\n\n mount(node: HTMLElement) {\n try {\n this.chartRenderer.init(node);\n this._updateData();\n this._updateChart();\n } catch (err) {\n if (err instanceof Error) {\n this.chartRenderer.renderError(err.message as string);\n console.error(err);\n }\n }\n }\n\n unmount() {\n this.chartRenderer.clear();\n }\n\n updateSettingsAndData(data: DataFrame, settings: DendroSettings) {\n try {\n const previousSettings = this.settings;\n const previousData = this.data;\n this.settings = new DendroSettingsImpl(settings);\n this.data = data;\n if (\n this._needUpdateCalculatedDataBySettings(previousSettings, this.settings) ||\n this._needUpdateCalculatedDataByData(previousData, this.data)\n ) {\n this._updateData();\n } else {\n this._updateAesInData();\n }\n this._updateChart();\n } catch (err) {\n if (err instanceof Error) {\n this.chartRenderer.renderError(err.message as string);\n console.error(err);\n }\n }\n }\n\n updateChartState(field: string, value: unknown) {\n if (document) {\n const event = new CustomEvent(USER_UPDATE_EVENT, {detail: {[field]: value}});\n document.dispatchEvent(event);\n }\n }\n\n export(): string {\n this._updateChart();\n return renderToString(this.chartRenderer.component);\n }\n\n _needUpdateCalculatedDataBySettings(prevSettings: DendroSettingsImpl, settings: DendroSettingsImpl) {\n const {mode, id, parentId, heatmapAnnotation, heatmapAxis, heatmapGroup} = settings;\n\n function compareColumnGroups(columns1: ColumnName[], columns2: ColumnName[]) {\n return (\n columns1.length !== columns2.length ||\n columns1.some((column, idx) => column.value !== columns2[idx].value)\n );\n }\n\n return (\n prevSettings.mode !== mode ||\n prevSettings.id.value !== id.value ||\n prevSettings.parentId.value !== parentId.value ||\n prevSettings.heatmapAnnotation?.value !== heatmapAnnotation?.value ||\n prevSettings.heatmapAxis?.value !== heatmapAxis?.value ||\n compareColumnGroups(prevSettings.heatmapGroup, heatmapGroup)\n );\n }\n\n _needUpdateCalculatedDataByData(prevData: DataFrame, data: DataFrame) {\n const prevKeys = Object.keys(prevData.data);\n const keys = Object.keys(data.data);\n return (\n prevData.id !== data.id ||\n prevKeys.length !== keys.length ||\n prevKeys.some(key => prevData.data[key].length !== data.data[key]?.length)\n );\n }\n\n _updateData() {\n const {mode, id, parentId, aes, heatmapAnnotation, heatmapAxis, heatmapGroup, heatmapSettings, height, labels} = this.settings;\n const hierarchy = getHierarchy(\n this.data,\n id.value,\n parentId.value,\n height?.value ?? null,\n labels.valueLabels ?? labels.value ?? null,\n mode === 'useAllNodesAsLeaves'\n );\n const heatmapData = getHeatmapData(this.data, heatmapSettings.valueType, heatmapAnnotation, heatmapAxis, heatmapGroup, id, hierarchy);\n\n const legendLabels = getLegendLabelsMap(this.data, aes);\n\n this.calculatedData = {\n chartSizes: this.chartRenderer.chartSizes,\n hierarchy,\n heatmapData,\n legendLabels,\n };\n }\n\n _updateAesInData() {\n if (!this.calculatedData) {\n return;\n }\n this.calculatedData.legendLabels = getLegendLabelsMap(this.data, this.settings.aes);\n }\n\n _updateChart() {\n if (!this.calculatedData) {\n return;\n }\n const {\n heatmapAnnotation,\n chartSettings,\n connectionType,\n edgeInheritance,\n rootPosition,\n showNodes,\n showEdges,\n showLeavesLabels,\n showNodesLabels,\n aes,\n labels,\n heatmapSettings,\n leavesMode\n } = this.settings;\n\n this.chartRenderer.render(\n this.data,\n chartSettings,\n this.calculatedData.hierarchy,\n connectionType,\n rootPosition,\n edgeInheritance,\n showNodes,\n showEdges,\n showLeavesLabels,\n showNodesLabels,\n aes,\n labels,\n heatmapAnnotation,\n this.calculatedData.heatmapData,\n heatmapSettings,\n this.calculatedData.legendLabels,\n leavesMode,\n this.onClick\n );\n }\n}\n"],"names":["isCategoricalAes","item","getLegendLabelsMap","data","aes","nodeColor","nodeShape","lineColor","aesGrouping","uniqBy","res","columnName","categories","getValueLabel","category","undefined","usedAes","aesMap","ChartDendro","AbstractChart","settings","eventHandlers","__publicField","ChartRenderer","DendroSettingsImpl","node","err","previousSettings","previousData","field","value","event","USER_UPDATE_EVENT","renderToString","prevSettings","mode","id","parentId","heatmapAnnotation","heatmapAxis","heatmapGroup","compareColumnGroups","columns1","columns2","column","idx","_a","_b","prevData","prevKeys","keys","key","heatmapSettings","height","labels","hierarchy","getHierarchy","heatmapData","getHeatmapData","legendLabels","chartSettings","connectionType","edgeInheritance","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BAAAF;AAAA,MACA,YAAAgB;AAAA,IAAA,IACA,KAAK;AAET,SAAK,cAAc;AAAA,MACf,KAAK;AAAA,MACLR;AAAA,MACA,KAAK,eAAe;AAAA,MACpBC;AAAA,MACAE;AAAA,MACAD;AAAA,MACAE;AAAA,MACAC;AAAA,MACAC;AAAA,MACAC;AAAA,MACA/D;AAAA,MACAkD;AAAA,MACAhB;AAAA,MACA,KAAK,eAAe;AAAA,MACpBc;AAAA,MACA,KAAK,eAAe;AAAA,MACpBgB;AAAA,MACA,KAAK;AAAA,IAAA;AAAA,EAEb;AACJ;"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { GroupKey } from '../DataFrame';
|
|
2
|
-
import { Margins, CaptionsSizes, ChartDimensionsData, ChartSizes, ChartsScales } from './components/types';
|
|
3
|
-
import { DiscreteSettingsImpl } from './DiscreteSettingsImpl';
|
|
4
|
-
import { StatsData, LayerData } from './layers/types';
|
|
5
|
-
import { GroupingData, ColumnName, Orientation } from '../types';
|
|
6
1
|
import { ReactElement } from 'react';
|
|
7
2
|
import { Root } from 'react-dom/client';
|
|
8
3
|
import { LegendData } from '../common/types';
|
|
4
|
+
import { DataFrame, GroupKey } from '../DataFrame';
|
|
5
|
+
import { ColumnName, GroupingData, Orientation } from '../types';
|
|
6
|
+
import { CaptionsSizes, ChartDimensionsData, ChartSizes, ChartsScales, Margins } from './components/types';
|
|
7
|
+
import { DiscreteSettingsImpl } from './DiscreteSettingsImpl';
|
|
8
|
+
import { LayerData, StatsData } from './layers/types';
|
|
9
9
|
declare class ChartRenderer {
|
|
10
10
|
reactRoot: Root | null;
|
|
11
11
|
parentNode: HTMLElement | null;
|
|
@@ -34,7 +34,7 @@ declare class ChartRenderer {
|
|
|
34
34
|
updateCaptionsSize(orientation: Orientation, facetKeys: string[], xAxis: DiscreteSettingsImpl['chartSettings']['xAxis'], yAxis: DiscreteSettingsImpl['chartSettings']['yAxis']): void;
|
|
35
35
|
updateMargins(orientation: Orientation, facetKeys: string[], size: DiscreteSettingsImpl['chartSettings']['size']): void;
|
|
36
36
|
updateLegendSize(legend: DiscreteSettingsImpl['chartSettings']['legend'], primaryGrouping: GroupingData, secondaryGrouping: GroupingData, layersData: LayerData[]): void;
|
|
37
|
-
render(settingsId: string, chartSettings: DiscreteSettingsImpl['chartSettings'], primaryGrouping: GroupingData, secondaryGrouping: GroupingData, facetSettings: DiscreteSettingsImpl['facetSettings'], facetKeys: string[], facetLabels: string[][], layersData: LayerData[], statsData: StatsData[], keyColumn: ColumnName | null, nonEmptyGroupsByFacets: Record<string, string[]>, onlyPositive: boolean, onTooltipHintSwitch: (v: boolean) => void): void;
|
|
37
|
+
render(dataFrame: DataFrame, settingsId: string, chartSettings: DiscreteSettingsImpl['chartSettings'], primaryGrouping: GroupingData, secondaryGrouping: GroupingData, facetSettings: DiscreteSettingsImpl['facetSettings'], facetKeys: string[], facetLabels: string[][], layersData: LayerData[], statsData: StatsData[], keyColumn: ColumnName | null, nonEmptyGroupsByFacets: Record<string, string[]>, onlyPositive: boolean, onTooltipHintSwitch: (v: boolean) => void): void;
|
|
38
38
|
renderError(message: string): void;
|
|
39
39
|
}
|
|
40
40
|
export default ChartRenderer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartRenderer.d.ts","sourceRoot":"","sources":["../../src/discrete/ChartRenderer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"ChartRenderer.d.ts","sourceRoot":"","sources":["../../src/discrete/ChartRenderer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAG7C,OAAO,KAAK,EAAE,UAAU,EAA8B,MAAM,iBAAiB,CAAC;AAG9E,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExD,OAAO,KAAK,EAAW,U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