@milaboratories/miplots4 1.0.179 → 1.2.0
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/MiPlots.d.ts.map +1 -1
- package/dist/MiPlots.js +16 -14
- package/dist/MiPlots.js.map +1 -1
- package/dist/common/ContinuousAxis.d.ts +3 -1
- package/dist/common/ContinuousAxis.d.ts.map +1 -1
- package/dist/common/ContinuousAxis.js +8 -8
- package/dist/common/ContinuousAxis.js.map +1 -1
- package/dist/common/Legend.d.ts +12 -1
- package/dist/common/Legend.d.ts.map +1 -1
- package/dist/common/Legend.js +14 -6
- package/dist/common/Legend.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/scatterplot/ChartRenderer.d.ts +2 -2
- package/dist/scatterplot/ChartRenderer.d.ts.map +1 -1
- package/dist/scatterplot/ChartRenderer.js +155 -115
- package/dist/scatterplot/ChartRenderer.js.map +1 -1
- package/dist/scatterplot/ScatterplotSettingsImpl.d.ts +11 -1
- package/dist/scatterplot/ScatterplotSettingsImpl.d.ts.map +1 -1
- package/dist/scatterplot/ScatterplotSettingsImpl.js +20 -0
- package/dist/scatterplot/ScatterplotSettingsImpl.js.map +1 -1
- package/dist/scatterplot/components/ChartLayersData.d.ts +5 -0
- package/dist/scatterplot/components/ChartLayersData.d.ts.map +1 -1
- package/dist/scatterplot/components/ChartLayersData.js +115 -35
- package/dist/scatterplot/components/ChartLayersData.js.map +1 -1
- package/dist/scatterplot/components/types.d.ts +2 -0
- package/dist/scatterplot/components/types.d.ts.map +1 -1
- package/dist/scatterplot/getLayersData.d.ts +11 -2
- package/dist/scatterplot/getLayersData.d.ts.map +1 -1
- package/dist/scatterplot/getLayersData.js +36 -19
- package/dist/scatterplot/getLayersData.js.map +1 -1
- package/dist/scatterplot/index.d.ts.map +1 -1
- package/dist/scatterplot/index.js +51 -33
- package/dist/scatterplot/index.js.map +1 -1
- package/dist/scatterplot/linearRegression.js +1 -1
- package/dist/scatterplot/utils/createAesGetter.d.ts.map +1 -1
- package/dist/scatterplot/utils/createAesGetter.js +5 -3
- package/dist/scatterplot/utils/createAesGetter.js.map +1 -1
- package/dist/scatterplot/utils/createLegendInfo.d.ts +11 -2
- package/dist/scatterplot/utils/createLegendInfo.d.ts.map +1 -1
- package/dist/scatterplot/utils/createLegendInfo.js +21 -16
- package/dist/scatterplot/utils/createLegendInfo.js.map +1 -1
- package/dist/scatterplot-umap/ChartRenderer.d.ts +6 -6
- package/dist/scatterplot-umap/ChartRenderer.d.ts.map +1 -1
- package/dist/scatterplot-umap/ChartRenderer.js +99 -57
- package/dist/scatterplot-umap/ChartRenderer.js.map +1 -1
- package/dist/scatterplot-umap/SettingsImpl.d.ts +11 -1
- package/dist/scatterplot-umap/SettingsImpl.d.ts.map +1 -1
- package/dist/scatterplot-umap/SettingsImpl.js +21 -1
- package/dist/scatterplot-umap/SettingsImpl.js.map +1 -1
- package/dist/scatterplot-umap/components/LowerSVG.d.ts +3 -2
- package/dist/scatterplot-umap/components/LowerSVG.d.ts.map +1 -1
- package/dist/scatterplot-umap/components/LowerSVG.js +159 -108
- package/dist/scatterplot-umap/components/LowerSVG.js.map +1 -1
- package/dist/scatterplot-umap/components/SVGLayer.d.ts +1 -1
- package/dist/scatterplot-umap/components/SVGLayer.d.ts.map +1 -1
- package/dist/scatterplot-umap/components/SVGLayer.js +9 -8
- package/dist/scatterplot-umap/components/SVGLayer.js.map +1 -1
- package/dist/scatterplot-umap/index.d.ts +6 -1
- package/dist/scatterplot-umap/index.d.ts.map +1 -1
- package/dist/scatterplot-umap/index.js +65 -31
- package/dist/scatterplot-umap/index.js.map +1 -1
- package/dist/scatterplot-umap/types.d.ts +7 -0
- package/dist/scatterplot-umap/types.d.ts.map +1 -1
- package/dist/selection/ChartRenderer.d.ts +90 -0
- package/dist/selection/ChartRenderer.d.ts.map +1 -0
- package/dist/selection/ChartRenderer.js +254 -0
- package/dist/selection/ChartRenderer.js.map +1 -0
- package/dist/selection/SelectionSettingsImpl.d.ts +53 -0
- package/dist/selection/SelectionSettingsImpl.d.ts.map +1 -0
- package/dist/selection/SelectionSettingsImpl.js +47 -0
- package/dist/selection/SelectionSettingsImpl.js.map +1 -0
- package/dist/selection/components/Chart/Bars/GroupSelectedBars.d.ts +8 -0
- package/dist/selection/components/Chart/Bars/GroupSelectedBars.d.ts.map +1 -0
- package/dist/selection/components/Chart/Bars/GroupSelectedBars.js +57 -0
- package/dist/selection/components/Chart/Bars/GroupSelectedBars.js.map +1 -0
- package/dist/selection/components/Chart/Bars/StackedBars.d.ts +12 -0
- package/dist/selection/components/Chart/Bars/StackedBars.d.ts.map +1 -0
- package/dist/selection/components/Chart/Bars/StackedBars.js +58 -0
- package/dist/selection/components/Chart/Bars/StackedBars.js.map +1 -0
- package/dist/selection/components/Chart/Bars/UngroupedBars.d.ts +6 -0
- package/dist/selection/components/Chart/Bars/UngroupedBars.d.ts.map +1 -0
- package/dist/selection/components/Chart/Bars/UngroupedBars.js +38 -0
- package/dist/selection/components/Chart/Bars/UngroupedBars.js.map +1 -0
- package/dist/selection/components/Chart/Bars.d.ts +10 -0
- package/dist/selection/components/Chart/Bars.d.ts.map +1 -0
- package/dist/selection/components/Chart/Bars.js +48 -0
- package/dist/selection/components/Chart/Bars.js.map +1 -0
- package/dist/selection/components/Chart/ChartAxes.d.ts +7 -0
- package/dist/selection/components/Chart/ChartAxes.d.ts.map +1 -0
- package/dist/selection/components/Chart/ChartAxes.js +51 -0
- package/dist/selection/components/Chart/ChartAxes.js.map +1 -0
- package/dist/selection/components/Chart/ChartFrame.d.ts +9 -0
- package/dist/selection/components/Chart/ChartFrame.d.ts.map +1 -0
- package/dist/selection/components/Chart/ChartFrame.js +41 -0
- package/dist/selection/components/Chart/ChartFrame.js.map +1 -0
- package/dist/selection/components/Chart/Dividers.d.ts +8 -0
- package/dist/selection/components/Chart/Dividers.d.ts.map +1 -0
- package/dist/selection/components/Chart/Dividers.js +27 -0
- package/dist/selection/components/Chart/Dividers.js.map +1 -0
- package/dist/selection/components/Chart/Gridlines.d.ts +10 -0
- package/dist/selection/components/Chart/Gridlines.d.ts.map +1 -0
- package/dist/selection/components/Chart/Gridlines.js +32 -0
- package/dist/selection/components/Chart/Gridlines.js.map +1 -0
- package/dist/selection/components/Chart/Ribbons/GroupFlowRibbon.d.ts +9 -0
- package/dist/selection/components/Chart/Ribbons/GroupFlowRibbon.d.ts.map +1 -0
- package/dist/selection/components/Chart/Ribbons/GroupFlowRibbon.js +36 -0
- package/dist/selection/components/Chart/Ribbons/GroupFlowRibbon.js.map +1 -0
- package/dist/selection/components/Chart/Ribbons/MultiGroupRibbon.d.ts +6 -0
- package/dist/selection/components/Chart/Ribbons/MultiGroupRibbon.d.ts.map +1 -0
- package/dist/selection/components/Chart/Ribbons/MultiGroupRibbon.js +22 -0
- package/dist/selection/components/Chart/Ribbons/MultiGroupRibbon.js.map +1 -0
- package/dist/selection/components/Chart/Ribbons/SimpleRibbon.d.ts +10 -0
- package/dist/selection/components/Chart/Ribbons/SimpleRibbon.d.ts.map +1 -0
- package/dist/selection/components/Chart/Ribbons/SimpleRibbon.js +33 -0
- package/dist/selection/components/Chart/Ribbons/SimpleRibbon.js.map +1 -0
- package/dist/selection/components/Chart/Ribbons/StackedGroupFlowRibbon.d.ts +10 -0
- package/dist/selection/components/Chart/Ribbons/StackedGroupFlowRibbon.d.ts.map +1 -0
- package/dist/selection/components/Chart/Ribbons/StackedGroupFlowRibbon.js +65 -0
- package/dist/selection/components/Chart/Ribbons/StackedGroupFlowRibbon.js.map +1 -0
- package/dist/selection/components/Chart/Ribbons/ribbonPath.d.ts +10 -0
- package/dist/selection/components/Chart/Ribbons/ribbonPath.d.ts.map +1 -0
- package/dist/selection/components/Chart/Ribbons/ribbonPath.js +13 -0
- package/dist/selection/components/Chart/Ribbons/ribbonPath.js.map +1 -0
- package/dist/selection/components/Chart/Ribbons.d.ts +9 -0
- package/dist/selection/components/Chart/Ribbons.d.ts.map +1 -0
- package/dist/selection/components/Chart/Ribbons.js +58 -0
- package/dist/selection/components/Chart/Ribbons.js.map +1 -0
- package/dist/selection/components/Chart/StageCounts.d.ts +7 -0
- package/dist/selection/components/Chart/StageCounts.d.ts.map +1 -0
- package/dist/selection/components/Chart/StageCounts.js +20 -0
- package/dist/selection/components/Chart/StageCounts.js.map +1 -0
- package/dist/selection/components/Chart/types.d.ts +132 -0
- package/dist/selection/components/Chart/types.d.ts.map +1 -0
- package/dist/selection/components/Chart.d.ts +22 -0
- package/dist/selection/components/Chart.d.ts.map +1 -0
- package/dist/selection/components/Chart.js +97 -0
- package/dist/selection/components/Chart.js.map +1 -0
- package/dist/selection/components/ChartsGroup.d.ts +18 -0
- package/dist/selection/components/ChartsGroup.d.ts.map +1 -0
- package/dist/selection/components/ChartsGroup.js +181 -0
- package/dist/selection/components/ChartsGroup.js.map +1 -0
- package/dist/selection/components/FacetCell.d.ts +22 -0
- package/dist/selection/components/FacetCell.d.ts.map +1 -0
- package/dist/selection/components/FacetCell.js +18 -0
- package/dist/selection/components/FacetCell.js.map +1 -0
- package/dist/selection/components/types.d.ts +58 -0
- package/dist/selection/components/types.d.ts.map +1 -0
- package/dist/selection/constants.d.ts +25 -0
- package/dist/selection/constants.d.ts.map +1 -0
- package/dist/selection/constants.js +4 -0
- package/dist/selection/constants.js.map +1 -0
- package/dist/selection/createSelectionData.d.ts +50 -0
- package/dist/selection/createSelectionData.d.ts.map +1 -0
- package/dist/selection/createSelectionData.js +92 -0
- package/dist/selection/createSelectionData.js.map +1 -0
- package/dist/selection/index.d.ts +26 -0
- package/dist/selection/index.d.ts.map +1 -0
- package/dist/selection/index.js +96 -0
- package/dist/selection/index.js.map +1 -0
- package/dist/selection/utils.d.ts +4 -0
- package/dist/selection/utils.d.ts.map +1 -0
- package/dist/selection/utils.js +13 -0
- package/dist/selection/utils.js.map +1 -0
- package/dist/types/bubble.d.ts +42 -0
- package/dist/types/bubble.d.ts.map +1 -1
- package/dist/types/common.d.ts +38 -0
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types/common.js +1 -0
- package/dist/types/common.js.map +1 -1
- package/dist/types/dendro.d.ts +103 -0
- package/dist/types/dendro.d.ts.map +1 -1
- package/dist/types/discrete.d.ts +167 -0
- package/dist/types/discrete.d.ts.map +1 -1
- package/dist/types/heatmap.d.ts +159 -0
- package/dist/types/heatmap.d.ts.map +1 -1
- package/dist/types/histogram.d.ts +22 -0
- package/dist/types/histogram.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -0
- package/dist/types/scatterplot-umap.d.ts +951 -87
- package/dist/types/scatterplot-umap.d.ts.map +1 -1
- package/dist/types/scatterplot-umap.js +19 -3
- package/dist/types/scatterplot-umap.js.map +1 -1
- package/dist/types/scatterplot.d.ts +1647 -44
- package/dist/types/scatterplot.d.ts.map +1 -1
- package/dist/types/scatterplot.js +27 -3
- package/dist/types/scatterplot.js.map +1 -1
- package/dist/types/selection.d.ts +452 -0
- package/dist/types/selection.d.ts.map +1 -0
- package/dist/types/selection.js +53 -0
- package/dist/types/selection.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { ScaleBand, ScaleLinear } from 'd3-scale';
|
|
2
|
+
import { TooltipsData } from '../../../common/Tooltip';
|
|
3
|
+
import { FrameType } from '../../../types';
|
|
4
|
+
import { StageInfo } from '../../createSelectionData';
|
|
5
|
+
/** Tooltip payload emitted on bar hover; consumed by Tooltip via Chart -> ChartsGroup. */
|
|
6
|
+
export type StageTooltipData = {
|
|
7
|
+
stageIndex: number;
|
|
8
|
+
section: 'preserved' | 'discarded';
|
|
9
|
+
groupName?: string;
|
|
10
|
+
count: number;
|
|
11
|
+
total: number;
|
|
12
|
+
percent: number;
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
};
|
|
16
|
+
export type TooltipEnterParams = {
|
|
17
|
+
stageIndex: number;
|
|
18
|
+
section: 'preserved' | 'discarded';
|
|
19
|
+
stage: StageInfo;
|
|
20
|
+
anchorX: number;
|
|
21
|
+
anchorY: number;
|
|
22
|
+
groupName?: string;
|
|
23
|
+
};
|
|
24
|
+
/** Tooltip enter/leave callbacks shared across stage layers. */
|
|
25
|
+
export type TooltipCallbacks = {
|
|
26
|
+
onEnter: (params: TooltipEnterParams) => void;
|
|
27
|
+
onLeave: () => void;
|
|
28
|
+
};
|
|
29
|
+
/** Geometry of one bar column. */
|
|
30
|
+
export type BarGeometry = {
|
|
31
|
+
left: number;
|
|
32
|
+
width: number;
|
|
33
|
+
centerX: number;
|
|
34
|
+
height: number;
|
|
35
|
+
yScale: (v: number) => number;
|
|
36
|
+
};
|
|
37
|
+
/** Shared inputs every bar variant needs. */
|
|
38
|
+
export type BarsCommon = {
|
|
39
|
+
stageIndex: number;
|
|
40
|
+
stage: StageInfo;
|
|
41
|
+
geometry: BarGeometry;
|
|
42
|
+
layerOpacity: number;
|
|
43
|
+
tooltip: TooltipCallbacks;
|
|
44
|
+
};
|
|
45
|
+
/** Horizontal extent + vertical bounds + opacity shared by every ribbon variant. */
|
|
46
|
+
export type RibbonContext = {
|
|
47
|
+
x0: number;
|
|
48
|
+
x1: number;
|
|
49
|
+
height: number;
|
|
50
|
+
layerOpacity: number;
|
|
51
|
+
};
|
|
52
|
+
/** Adjacent stage data for ribbons that flow between two stages. */
|
|
53
|
+
export type StagePair = {
|
|
54
|
+
current: StageInfo;
|
|
55
|
+
next: StageInfo;
|
|
56
|
+
};
|
|
57
|
+
/** Per-cell geometry — origin, size, scales, edge-suppression flags. */
|
|
58
|
+
export type CellLayout = {
|
|
59
|
+
width: number;
|
|
60
|
+
height: number;
|
|
61
|
+
dimensionsLeft: number;
|
|
62
|
+
dimensionsTop: number;
|
|
63
|
+
paddingLeft: number;
|
|
64
|
+
paddingTop: number;
|
|
65
|
+
paddingBottom: number;
|
|
66
|
+
xScale: ScaleBand<string>;
|
|
67
|
+
yScale: ScaleLinear<number, number>;
|
|
68
|
+
/** When false, suppress the X-axis labels for this cell (non-bottom-edge faceted cells). */
|
|
69
|
+
showXAxis: boolean;
|
|
70
|
+
/** When false, suppress the Y-axis ticks for this cell (non-left-edge faceted cells). */
|
|
71
|
+
showYAxis: boolean;
|
|
72
|
+
};
|
|
73
|
+
/** Visual style applied uniformly to every cell. */
|
|
74
|
+
export type ChartStyle = {
|
|
75
|
+
frameType?: FrameType;
|
|
76
|
+
barColor: string;
|
|
77
|
+
opacity: number;
|
|
78
|
+
colorMap: Map<string, string>;
|
|
79
|
+
};
|
|
80
|
+
/** Hover/click/tooltip wiring forwarded from ChartsGroup to each Chart cell. */
|
|
81
|
+
export type ChartInteraction = {
|
|
82
|
+
hoveredGroup: string | null;
|
|
83
|
+
selectedGroup: string | null;
|
|
84
|
+
onGroupClick: (name: string) => void;
|
|
85
|
+
onGroupHover: (name: string | null) => void;
|
|
86
|
+
tooltipsData: TooltipsData<StageTooltipData>;
|
|
87
|
+
/** Facet key under which this Chart's tooltip enters/leaves register. */
|
|
88
|
+
facetKey?: string;
|
|
89
|
+
};
|
|
90
|
+
/** X-axis config + per-cell data (used by Chart). */
|
|
91
|
+
export type ChartXAxis = {
|
|
92
|
+
labels: Record<string, string[]>;
|
|
93
|
+
counts?: Record<string, string>;
|
|
94
|
+
countsFontSize?: number;
|
|
95
|
+
labelsPosition?: 'center' | '45deg' | '90deg';
|
|
96
|
+
showGrid?: boolean;
|
|
97
|
+
showTicks?: boolean;
|
|
98
|
+
hiddenLabels?: boolean;
|
|
99
|
+
title?: string;
|
|
100
|
+
};
|
|
101
|
+
/** Y-axis config (used by Chart). */
|
|
102
|
+
export type ChartYAxis = {
|
|
103
|
+
showGrid?: boolean;
|
|
104
|
+
showTicks?: boolean;
|
|
105
|
+
hiddenLabels?: boolean;
|
|
106
|
+
title?: string;
|
|
107
|
+
};
|
|
108
|
+
/** Per-stage rendering context — all bars/ribbons/dividers live in this coordinate space. */
|
|
109
|
+
export type StageGeometry = {
|
|
110
|
+
xScale: ScaleBand<string>;
|
|
111
|
+
yScale: ScaleLinear<number, number>;
|
|
112
|
+
height: number;
|
|
113
|
+
};
|
|
114
|
+
/** Group-rendering inputs for the bar/ribbon dispatch. */
|
|
115
|
+
export type GroupContext = {
|
|
116
|
+
grouped: boolean;
|
|
117
|
+
groupNames: string[];
|
|
118
|
+
/** Click-pinned active group, or null. Drives single-group rendering. */
|
|
119
|
+
facetActiveGroup: string | null;
|
|
120
|
+
/** Hovered group, or null. Drives the two-band hover ribbon. */
|
|
121
|
+
facetHoveredGroup: string | null;
|
|
122
|
+
/** Stage-stacking order (user-preferred, filtered to groups present in this facet). */
|
|
123
|
+
stackOrder: string[];
|
|
124
|
+
};
|
|
125
|
+
/** Per-stage event handlers shared across bars/ribbons/dividers. */
|
|
126
|
+
export type StageHandlers = {
|
|
127
|
+
onGroupClick: (name: string) => void;
|
|
128
|
+
onGroupHover: (name: string | null) => void;
|
|
129
|
+
onTooltipEnter: (params: TooltipEnterParams) => void;
|
|
130
|
+
onTooltipLeave: () => void;
|
|
131
|
+
};
|
|
132
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/selection/components/Chart/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAE3D,0FAA0F;AAC1F,MAAM,MAAM,gBAAgB,GAAG;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,WAAW,GAAG,WAAW,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,M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,KAAK,IAAI,CAAC;IACrD,cAAc,EAAE,MAAM,IAAI,CAAC;CAC5B,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AggregatedSelectionData } from '../createSelectionData';
|
|
2
|
+
import { CellLayout, ChartInteraction, ChartStyle, ChartXAxis, ChartYAxis } from './Chart/types';
|
|
3
|
+
export type { StageTooltipData } from './Chart/types';
|
|
4
|
+
type Props = {
|
|
5
|
+
data: AggregatedSelectionData;
|
|
6
|
+
grouped: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* User-preferred group iteration order (union across all facets) — drives
|
|
9
|
+
* stacked-bar rendering. When omitted, falls back to the per-facet
|
|
10
|
+
* `data.groupNames` order. Per-facet `data.groupNames` is alphabetical, so
|
|
11
|
+
* without this prop the user's chosen order in the Layers form has no
|
|
12
|
+
* effect on the chart.
|
|
13
|
+
*/
|
|
14
|
+
orderedGroupNames?: string[];
|
|
15
|
+
layout: CellLayout;
|
|
16
|
+
xAxis: ChartXAxis;
|
|
17
|
+
yAxis: ChartYAxis;
|
|
18
|
+
style: ChartStyle;
|
|
19
|
+
interaction: ChartInteraction;
|
|
20
|
+
};
|
|
21
|
+
export declare const Chart: import('react').NamedExoticComponent<Props>;
|
|
22
|
+
//# sourceMappingURL=Chart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Chart.d.ts","sourceRoot":"","sources":["../../../src/selection/components/Chart.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAQtE,OAAO,KAAK,EACV,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,UAAU,EAIX,MAAM,eAAe,CAAC;AAEvB,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,uBAAuB,CAAC;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,UAAU,CAAC;IAClB,KAAK,EAAE,UAAU,CAAC;IAClB,KAAK,EAAE,UAAU,CAAC;IAClB,WAAW,EAAE,gBAAgB,CAAC;CAC/B,CAAC;AAEF,eAAO,MAAM,KAAK,6CAoGhB,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { useFunction as e } from "../../utils/hooks/useFunction.js";
|
|
2
|
+
import { Bars as t } from "./Chart/Bars.js";
|
|
3
|
+
import { ChartAxes as n } from "./Chart/ChartAxes.js";
|
|
4
|
+
import { ChartFrame as r } from "./Chart/ChartFrame.js";
|
|
5
|
+
import { Dividers as i } from "./Chart/Dividers.js";
|
|
6
|
+
import { Gridlines as a } from "./Chart/Gridlines.js";
|
|
7
|
+
import { Ribbons as o } from "./Chart/Ribbons.js";
|
|
8
|
+
import { StageCounts as s } from "./Chart/StageCounts.js";
|
|
9
|
+
import { memo as c } from "react";
|
|
10
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
11
|
+
const d = c(function({ data: c, grouped: d, orderedGroupNames: f, layout: p, xAxis: m, yAxis: h, style: g, interaction: _ }) {
|
|
12
|
+
let { stages: v, groupNames: y } = c;
|
|
13
|
+
if (v.length === 0) return null;
|
|
14
|
+
let { width: b, height: x, dimensionsLeft: S, dimensionsTop: C, paddingLeft: w, paddingTop: T, xScale: E, yScale: D } = p, { hoveredGroup: O, selectedGroup: k, onGroupClick: A, onGroupHover: j, tooltipsData: M, facetKey: N } = _, P = k && y.includes(k) ? k : null, F = O && y.includes(O) ? O : null, I = f ? f.filter((e) => y.includes(e)) : y, L = e(({ stageIndex: e, section: t, stage: n, anchorX: r, anchorY: i, groupName: a }) => {
|
|
15
|
+
let o = n.total, s = t === "preserved" ? n.surviving : n.discarded;
|
|
16
|
+
if (a) {
|
|
17
|
+
let e = n.groups.find((e) => e.name === a);
|
|
18
|
+
s = t === "preserved" ? e?.surviving ?? 0 : e?.discarded ?? 0;
|
|
19
|
+
}
|
|
20
|
+
M.onMouseEnter({
|
|
21
|
+
stageIndex: e,
|
|
22
|
+
section: t,
|
|
23
|
+
groupName: a,
|
|
24
|
+
count: s,
|
|
25
|
+
total: o,
|
|
26
|
+
percent: o > 0 ? s / o * 100 : 0,
|
|
27
|
+
x: r,
|
|
28
|
+
y: i
|
|
29
|
+
}, N);
|
|
30
|
+
}), R = e(() => M.onMouseLeave()), z = {
|
|
31
|
+
xScale: E,
|
|
32
|
+
yScale: D,
|
|
33
|
+
height: x
|
|
34
|
+
}, B = {
|
|
35
|
+
grouped: d,
|
|
36
|
+
groupNames: y,
|
|
37
|
+
facetActiveGroup: P,
|
|
38
|
+
facetHoveredGroup: F,
|
|
39
|
+
stackOrder: I
|
|
40
|
+
}, V = {
|
|
41
|
+
onGroupClick: A,
|
|
42
|
+
onGroupHover: j,
|
|
43
|
+
onTooltipEnter: L,
|
|
44
|
+
onTooltipLeave: R
|
|
45
|
+
}, H = m.showGrid ?? !1, U = h.showGrid ?? !0, W = g.frameType ?? "left-bottom";
|
|
46
|
+
return /* @__PURE__ */ u("g", {
|
|
47
|
+
transform: `translate(${S + w},${C + T})`,
|
|
48
|
+
children: [
|
|
49
|
+
/* @__PURE__ */ l(a, {
|
|
50
|
+
xScale: E,
|
|
51
|
+
yScale: D,
|
|
52
|
+
width: b,
|
|
53
|
+
height: x,
|
|
54
|
+
xShow: H,
|
|
55
|
+
yShow: U
|
|
56
|
+
}),
|
|
57
|
+
/* @__PURE__ */ l(o, {
|
|
58
|
+
stages: v,
|
|
59
|
+
geometry: z,
|
|
60
|
+
groupCtx: B,
|
|
61
|
+
style: g
|
|
62
|
+
}),
|
|
63
|
+
/* @__PURE__ */ l(t, {
|
|
64
|
+
stages: v,
|
|
65
|
+
geometry: z,
|
|
66
|
+
groupCtx: B,
|
|
67
|
+
style: g,
|
|
68
|
+
handlers: V
|
|
69
|
+
}),
|
|
70
|
+
/* @__PURE__ */ l(i, {
|
|
71
|
+
stages: v,
|
|
72
|
+
geometry: z,
|
|
73
|
+
suppressed: P !== null
|
|
74
|
+
}),
|
|
75
|
+
/* @__PURE__ */ l(r, {
|
|
76
|
+
width: b,
|
|
77
|
+
height: x,
|
|
78
|
+
frameType: W,
|
|
79
|
+
xShowGrid: H,
|
|
80
|
+
yShowGrid: U
|
|
81
|
+
}),
|
|
82
|
+
/* @__PURE__ */ l(s, {
|
|
83
|
+
xScale: E,
|
|
84
|
+
counts: m.counts,
|
|
85
|
+
fontSize: m.countsFontSize
|
|
86
|
+
}),
|
|
87
|
+
/* @__PURE__ */ l(n, {
|
|
88
|
+
layout: p,
|
|
89
|
+
xAxis: m,
|
|
90
|
+
yAxis: h
|
|
91
|
+
})
|
|
92
|
+
]
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
export { d as Chart };
|
|
96
|
+
|
|
97
|
+
//# sourceMappingURL=Chart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Chart.js","names":[],"sources":["../../../src/selection/components/Chart.tsx"],"sourcesContent":["import { memo } from 'react';\n\nimport { useFunction } from '../../utils/hooks/useFunction';\nimport type { AggregatedSelectionData } from '../createSelectionData';\nimport { Bars } from './Chart/Bars';\nimport { ChartAxes } from './Chart/ChartAxes';\nimport { ChartFrame } from './Chart/ChartFrame';\nimport { Dividers } from './Chart/Dividers';\nimport { Gridlines } from './Chart/Gridlines';\nimport { Ribbons } from './Chart/Ribbons';\nimport { StageCounts } from './Chart/StageCounts';\nimport type {\n CellLayout,\n ChartInteraction,\n ChartStyle,\n ChartXAxis,\n ChartYAxis,\n GroupContext,\n StageHandlers,\n TooltipEnterParams,\n} from './Chart/types';\n\nexport type { StageTooltipData } from './Chart/types';\n\ntype Props = {\n data: AggregatedSelectionData;\n grouped: boolean;\n /**\n * User-preferred group iteration order (union across all facets) — drives\n * stacked-bar rendering. When omitted, falls back to the per-facet\n * `data.groupNames` order. Per-facet `data.groupNames` is alphabetical, so\n * without this prop the user's chosen order in the Layers form has no\n * effect on the chart.\n */\n orderedGroupNames?: string[];\n layout: CellLayout;\n xAxis: ChartXAxis;\n yAxis: ChartYAxis;\n style: ChartStyle;\n interaction: ChartInteraction;\n};\n\nexport const Chart = memo(function Chart({\n data,\n grouped,\n orderedGroupNames,\n layout,\n xAxis,\n yAxis,\n style,\n interaction,\n}: Props) {\n const { stages, groupNames } = data;\n if (stages.length === 0) return null;\n\n const { width, height, dimensionsLeft, dimensionsTop, paddingLeft, paddingTop, xScale, yScale } =\n layout;\n const { hoveredGroup, selectedGroup, onGroupClick, onGroupHover, tooltipsData, facetKey } =\n interaction;\n\n // Click-pinned active group (only): drives single-group bar rendering.\n // Hover never hides bars — only dims them and re-routes the ribbon flow.\n const facetActiveGroup =\n selectedGroup && groupNames.includes(selectedGroup) ? selectedGroup : null;\n const facetHoveredGroup = hoveredGroup && groupNames.includes(hoveredGroup) ? hoveredGroup : null;\n const stackOrder = orderedGroupNames\n ? orderedGroupNames.filter((g) => groupNames.includes(g))\n : groupNames;\n\n const onTooltipEnter = useFunction(\n ({ stageIndex, section, stage, anchorX, anchorY, groupName }: TooltipEnterParams) => {\n const total = stage.total;\n let count = section === 'preserved' ? stage.surviving : stage.discarded;\n if (groupName) {\n const g = stage.groups.find((gg) => gg.name === groupName);\n count = section === 'preserved' ? (g?.surviving ?? 0) : (g?.discarded ?? 0);\n }\n tooltipsData.onMouseEnter(\n {\n stageIndex,\n section,\n groupName,\n count,\n total,\n percent: total > 0 ? (count / total) * 100 : 0,\n x: anchorX,\n y: anchorY,\n },\n facetKey,\n );\n },\n );\n const onTooltipLeave = useFunction(() => tooltipsData.onMouseLeave());\n\n const geometry = { xScale, yScale, height };\n const groupCtx: GroupContext = {\n grouped,\n groupNames,\n facetActiveGroup,\n facetHoveredGroup,\n stackOrder,\n };\n const handlers: StageHandlers = {\n onGroupClick,\n onGroupHover,\n onTooltipEnter,\n onTooltipLeave,\n };\n const xShowGrid = xAxis.showGrid ?? false;\n const yShowGrid = yAxis.showGrid ?? true;\n const frameType = style.frameType ?? 'left-bottom';\n\n return (\n <g transform={`translate(${dimensionsLeft + paddingLeft},${dimensionsTop + paddingTop})`}>\n <Gridlines\n xScale={xScale}\n yScale={yScale}\n width={width}\n height={height}\n xShow={xShowGrid}\n yShow={yShowGrid}\n />\n <Ribbons stages={stages} geometry={geometry} groupCtx={groupCtx} style={style} />\n <Bars\n stages={stages}\n geometry={geometry}\n groupCtx={groupCtx}\n style={style}\n handlers={handlers}\n />\n <Dividers stages={stages} geometry={geometry} suppressed={facetActiveGroup !== null} />\n <ChartFrame\n width={width}\n height={height}\n frameType={frameType}\n xShowGrid={xShowGrid}\n yShowGrid={yShowGrid}\n />\n <StageCounts xScale={xScale} counts={xAxis.counts} fontSize={xAxis.countsFontSize} />\n <ChartAxes layout={layout} xAxis={xAxis} yAxis={yAxis} />\n </g>\n );\n});\n"],"mappings":";;;;;;;;;;AA0CA,MAAa,IAAQ,EAAK,SAAe,EACvC,SACA,YACA,sBACA,WACA,UACA,UACA,UACA,kBACQ;CACR,IAAM,EAAE,WAAQ,kBAAe;AAC/B,KAAI,EAAO,WAAW,EAAG,QAAO;CAEhC,IAAM,EAAE,UAAO,WAAQ,mBAAgB,kBAAe,gBAAa,eAAY,WAAQ,cACrF,GACI,EAAE,iBAAc,kBAAe,iBAAc,iBAAc,iBAAc,gBAC7E,GAII,IACJ,KAAiB,EAAW,SAAS,EAAc,GAAG,IAAgB,MAClE,IAAoB,KAAgB,EAAW,SAAS,EAAa,GAAG,IAAe,MACvF,IAAa,IACf,EAAkB,QAAQ,MAAM,EAAW,SAAS,EAAE,CAAC,GACvD,GAEE,IAAiB,GACpB,EAAE,eAAY,YAAS,UAAO,YAAS,YAAS,mBAAoC;EACnF,IAAM,IAAQ,EAAM,OAChB,IAAQ,MAAY,cAAc,EAAM,YAAY,EAAM;AAC9D,MAAI,GAAW;GACb,IAAM,IAAI,EAAM,OAAO,MAAM,MAAO,EAAG,SAAS,EAAU;AAC1D,OAAQ,MAAY,cAAe,GAAG,aAAa,IAAM,GAAG,aAAa;;AAE3E,IAAa,aACX;GACE;GACA;GACA;GACA;GACA;GACA,SAAS,IAAQ,IAAK,IAAQ,IAAS,MAAM;GAC7C,GAAG;GACH,GAAG;GACJ,EACD,EACD;GAEJ,EACK,IAAiB,QAAkB,EAAa,cAAc,CAAC,EAE/D,IAAW;EAAE;EAAQ;EAAQ;EAAQ,EACrC,IAAyB;EAC7B;EACA;EACA;EACA;EACA;EACD,EACK,IAA0B;EAC9B;EACA;EACA;EACA;EACD,EACK,IAAY,EAAM,YAAY,IAC9B,IAAY,EAAM,YAAY,IAC9B,IAAY,EAAM,aAAa;AAErC,QACE,kBAAC,KAAD;EAAG,WAAW,aAAa,IAAiB,EAAY,GAAG,IAAgB,EAAW;YAAtF;GACE,kBAAC,GAAD;IACU;IACA;IACD;IACC;IACR,OAAO;IACP,OAAO;IACP,CAAA;GACF,kBAAC,GAAD;IAAiB;IAAkB;IAAoB;IAAiB;IAAS,CAAA;GACjF,kBAAC,GAAD;IACU;IACE;IACA;IACH;IACG;IACV,CAAA;GACF,kBAAC,GAAD;IAAkB;IAAkB;IAAU,YAAY,MAAqB;IAAQ,CAAA;GACvF,kBAAC,GAAD;IACS;IACC;IACG;IACA;IACA;IACX,CAAA;GACF,kBAAC,GAAD;IAAqB;IAAQ,QAAQ,EAAM;IAAQ,UAAU,EAAM;IAAkB,CAAA;GACrF,kBAAC,GAAD;IAAmB;IAAe;IAAc;IAAS,CAAA;GACvD;;EAEN"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { LegendData } from '../../common/types';
|
|
2
|
+
import { ChartYAxis } from './Chart/types';
|
|
3
|
+
import { ChartsGroupStyle, ChartsGroupTitle, ChartsGroupXAxis, FacetData, GridLayout } from './types';
|
|
4
|
+
type Props = {
|
|
5
|
+
facetData: FacetData;
|
|
6
|
+
gridLayout: GridLayout;
|
|
7
|
+
xAxis: ChartsGroupXAxis;
|
|
8
|
+
yAxis: ChartYAxis;
|
|
9
|
+
style: ChartsGroupStyle;
|
|
10
|
+
title: ChartsGroupTitle;
|
|
11
|
+
legend: LegendData;
|
|
12
|
+
showFacetLabels: boolean;
|
|
13
|
+
grouped: boolean;
|
|
14
|
+
orderedGroupNames: string[];
|
|
15
|
+
};
|
|
16
|
+
export declare function ChartsGroup({ facetData, gridLayout, xAxis, yAxis, style, title, legend, showFacetLabels, grouped, orderedGroupNames, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=ChartsGroup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChartsGroup.d.ts","sourceRoot":"","sources":["../../../src/selection/components/ChartsGroup.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAKrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAGhD,OAAO,KAAK,EACV,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,SAAS,EACT,UAAU,EACX,MAAM,SAAS,CAAC;AAajB,KAAK,KAAK,GAAG;IACX,SAAS,EAAE,SAAS,CAAC;IACrB,UAAU,EAAE,UAAU,CAAC;IACvB,KAAK,EAAE,gBAAgB,CAAC;IACxB,KAAK,EAAE,UAAU,CAAC;IAClB,KAAK,EAAE,gBAAgB,CAAC;IACxB,KAAK,EAAE,gBAAgB,CAAC;IACxB,MAAM,EAAE,UAAU,CAAC;IACnB,eAAe,EAAE,OAAO,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,iBAAiB,EAAE,MAAM,EAAE,CAAC;CAC7B,CAAC;AAEF,wBAAgB,WAAW,CAAC,EAC1B,SAAS,EACT,UAAU,EACV,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,MAAM,EACN,eAAe,EACf,OAAO,EACP,iBAAiB,GAClB,EAAE,KAAK,2CAsOP"}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import e from "../../common/fonts.js";
|
|
2
|
+
import { Tooltip as t, useTooltip as n } from "../../common/Tooltip.js";
|
|
3
|
+
import { ErrorBoundary as r } from "../../common/ErrorBoundary.js";
|
|
4
|
+
import { ChartsTitle as i } from "../../common/ChartsTitle.js";
|
|
5
|
+
import { Legend as a } from "../../common/Legend.js";
|
|
6
|
+
import { getChartEdgeSides as o } from "../../utils/getChartEdgeSides.js";
|
|
7
|
+
import { BAR_WIDTH_RATIO as s } from "../constants.js";
|
|
8
|
+
import { formatCount as c } from "../utils.js";
|
|
9
|
+
import { FacetCell as ee } from "./FacetCell.js";
|
|
10
|
+
import { scaleBand as te, scaleLinear as l } from "d3-scale";
|
|
11
|
+
import { useCallback as u, useEffect as ne, useMemo as d, useRef as re, useState as f } from "react";
|
|
12
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
13
|
+
var h = (e, t) => ({
|
|
14
|
+
col: e % t,
|
|
15
|
+
row: Math.floor(e / t)
|
|
16
|
+
});
|
|
17
|
+
function g(e, t) {
|
|
18
|
+
return e ? e === "null" ? t ?? "N/A" : e : "All";
|
|
19
|
+
}
|
|
20
|
+
function _({ facetData: _, gridLayout: ie, xAxis: v, yAxis: y, style: b, title: x, legend: S, showFacetLabels: ae, grouped: oe, orderedGroupNames: C }) {
|
|
21
|
+
let { faceted: w, facetLabels: T, facetTitles: E } = _, { nRows: D, nCols: O, totalWidth: k, totalHeight: A, margins: j, cellPlotWidth: M, cellPlotHeight: N, cellLabelHeight: P, topPad: F, rightPad: I, colLeftPads: L, rowBottomPads: R, colXOffsets: z, rowYOffsets: B, sharedX: V, sharedY: H } = ie, { nullValueLabel: U } = b, W = n(), [G, K] = f(null), [q, se] = f(null), [ce, le] = f(), J = re(null);
|
|
22
|
+
ne(() => {
|
|
23
|
+
J.current && le(J.current);
|
|
24
|
+
}, []);
|
|
25
|
+
let Y = u((e) => {
|
|
26
|
+
se((t) => t === e ? null : e), K(null), W.onClose();
|
|
27
|
+
}, [W]), X = k - j.left - j.right, ue = d(() => l().domain([0, 100]).range([N, 0]), [N]), Z = d(() => {
|
|
28
|
+
let e = w.byFacet[w.facetKeys[0]];
|
|
29
|
+
return e ? e.stages.map((e, t) => String(t)) : [];
|
|
30
|
+
}, [w]), de = d(() => {
|
|
31
|
+
let e = te().domain(Z).range([0, M]), t = Z.length;
|
|
32
|
+
if (t > 0) {
|
|
33
|
+
let n = Math.min(80, Math.max(12, M / t * s)), r = M / t, i = r > 0 ? Math.max(0, Math.min(.95, 1 - n / r)) : 0;
|
|
34
|
+
e.paddingInner(i), e.paddingOuter(i / 2);
|
|
35
|
+
}
|
|
36
|
+
return e;
|
|
37
|
+
}, [M, Z]), fe = j.left + X - I + 20, Q = j.top + F + P, pe = d(() => {
|
|
38
|
+
let e = W.selectedData;
|
|
39
|
+
if (!e) return [];
|
|
40
|
+
let t = e.section === "preserved" ? "Preserved" : "Discarded", n = g(e.groupName, U), r = (T[W.currentFacet] ?? []).join(" / ");
|
|
41
|
+
return [`${r ? `${r} · ${n}` : n} — ${t}`, `${c(e.count)} / ${c(e.total)} (${e.percent.toFixed(1)}%)`];
|
|
42
|
+
}, [
|
|
43
|
+
W.selectedData,
|
|
44
|
+
W.currentFacet,
|
|
45
|
+
T
|
|
46
|
+
]), $ = W.selectedData, me = d(() => {
|
|
47
|
+
if (!$) return {
|
|
48
|
+
left: 0,
|
|
49
|
+
right: 0,
|
|
50
|
+
top: 0,
|
|
51
|
+
bottom: 0
|
|
52
|
+
};
|
|
53
|
+
let { col: e, row: t } = h(w.facetKeys.indexOf(W.currentFacet), O), n = j.left + z[e], r = j.top + B[t], i = n + L[e], a = r + F + P;
|
|
54
|
+
return {
|
|
55
|
+
left: i,
|
|
56
|
+
right: k - i,
|
|
57
|
+
top: a,
|
|
58
|
+
bottom: A - a
|
|
59
|
+
};
|
|
60
|
+
}, [
|
|
61
|
+
$,
|
|
62
|
+
W.currentFacet,
|
|
63
|
+
w.facetKeys,
|
|
64
|
+
O,
|
|
65
|
+
j,
|
|
66
|
+
z,
|
|
67
|
+
B,
|
|
68
|
+
L,
|
|
69
|
+
F,
|
|
70
|
+
P,
|
|
71
|
+
k,
|
|
72
|
+
A
|
|
73
|
+
]), he = $?.x ?? 0, ge = $?.y ?? 0, _e = w.facetKeys.length;
|
|
74
|
+
return /* @__PURE__ */ p(r, {
|
|
75
|
+
dataId: "selection-chart",
|
|
76
|
+
children: /* @__PURE__ */ m("svg", {
|
|
77
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
78
|
+
viewBox: `0 0 ${k} ${A}`,
|
|
79
|
+
width: k,
|
|
80
|
+
height: A,
|
|
81
|
+
children: [
|
|
82
|
+
/* @__PURE__ */ p("defs", { children: e }),
|
|
83
|
+
/* @__PURE__ */ m("g", {
|
|
84
|
+
transform: `translate(${j.left},${j.top})`,
|
|
85
|
+
fontFamily: "Manrope",
|
|
86
|
+
children: [/* @__PURE__ */ p(i, {
|
|
87
|
+
title: x.text,
|
|
88
|
+
show: x.show,
|
|
89
|
+
position: x.position,
|
|
90
|
+
leftPadding: 0,
|
|
91
|
+
rightPadding: 0,
|
|
92
|
+
chartsWidth: X
|
|
93
|
+
}), w.facetKeys.map((e, t) => {
|
|
94
|
+
let { col: n, row: r } = h(t, O), i = w.byFacet[e];
|
|
95
|
+
if (!i) return null;
|
|
96
|
+
let a = o(t, _e, O, D), s = a.includes("left"), c = a.includes("bottom");
|
|
97
|
+
return /* @__PURE__ */ p("g", {
|
|
98
|
+
transform: `translate(${z[n]},${B[r]})`,
|
|
99
|
+
children: /* @__PURE__ */ p(ee, {
|
|
100
|
+
titleStrip: {
|
|
101
|
+
lines: E[e] ?? [],
|
|
102
|
+
show: ae,
|
|
103
|
+
x: L[n],
|
|
104
|
+
height: P
|
|
105
|
+
},
|
|
106
|
+
data: i,
|
|
107
|
+
grouped: oe,
|
|
108
|
+
orderedGroupNames: C,
|
|
109
|
+
layout: {
|
|
110
|
+
width: M,
|
|
111
|
+
height: N,
|
|
112
|
+
dimensionsLeft: 0,
|
|
113
|
+
dimensionsTop: P,
|
|
114
|
+
paddingLeft: L[n],
|
|
115
|
+
paddingTop: F,
|
|
116
|
+
paddingBottom: R[r],
|
|
117
|
+
xScale: de,
|
|
118
|
+
yScale: ue,
|
|
119
|
+
showXAxis: !V || c,
|
|
120
|
+
showYAxis: !H || s
|
|
121
|
+
},
|
|
122
|
+
xAxis: {
|
|
123
|
+
labels: v.labelsByFacet[e],
|
|
124
|
+
counts: v.countsByFacet[e],
|
|
125
|
+
countsFontSize: v.countsFontSize,
|
|
126
|
+
labelsPosition: v.labelsPosition,
|
|
127
|
+
showGrid: v.showGrid,
|
|
128
|
+
showTicks: v.showTicks,
|
|
129
|
+
hiddenLabels: v.hiddenLabels,
|
|
130
|
+
title: c ? v.title : ""
|
|
131
|
+
},
|
|
132
|
+
yAxis: {
|
|
133
|
+
showGrid: y.showGrid,
|
|
134
|
+
showTicks: y.showTicks,
|
|
135
|
+
hiddenLabels: y.hiddenLabels,
|
|
136
|
+
title: s ? y.title : ""
|
|
137
|
+
},
|
|
138
|
+
style: b,
|
|
139
|
+
interaction: {
|
|
140
|
+
hoveredGroup: G,
|
|
141
|
+
selectedGroup: q,
|
|
142
|
+
onGroupClick: Y,
|
|
143
|
+
onGroupHover: K,
|
|
144
|
+
tooltipsData: W,
|
|
145
|
+
facetKey: e
|
|
146
|
+
}
|
|
147
|
+
})
|
|
148
|
+
}, e);
|
|
149
|
+
})]
|
|
150
|
+
}),
|
|
151
|
+
/* @__PURE__ */ p("g", {
|
|
152
|
+
transform: `translate(${fe},${Q})`,
|
|
153
|
+
fontFamily: "Manrope",
|
|
154
|
+
children: /* @__PURE__ */ p(a, {
|
|
155
|
+
legendData: S,
|
|
156
|
+
onItemHover: K,
|
|
157
|
+
onItemClick: Y
|
|
158
|
+
})
|
|
159
|
+
}),
|
|
160
|
+
W.active && /* @__PURE__ */ p(t, {
|
|
161
|
+
content: pe,
|
|
162
|
+
x: he,
|
|
163
|
+
y: ge,
|
|
164
|
+
active: W.active,
|
|
165
|
+
fixed: W.fixed,
|
|
166
|
+
container: ce,
|
|
167
|
+
sideDistances: me,
|
|
168
|
+
onClose: W.onClose,
|
|
169
|
+
horizontal: !1
|
|
170
|
+
}),
|
|
171
|
+
/* @__PURE__ */ p("g", {
|
|
172
|
+
ref: J,
|
|
173
|
+
style: { outline: "none" }
|
|
174
|
+
})
|
|
175
|
+
]
|
|
176
|
+
})
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
export { _ as ChartsGroup };
|
|
180
|
+
|
|
181
|
+
//# sourceMappingURL=ChartsGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChartsGroup.js","names":[],"sources":["../../../src/selection/components/ChartsGroup.tsx"],"sourcesContent":["import { scaleBand, scaleLinear } from 'd3-scale';\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { ChartsTitle } from '../../common/ChartsTitle';\nimport { ErrorBoundary } from '../../common/ErrorBoundary';\nimport fonts from '../../common/fonts';\nimport { Legend } from '../../common/Legend';\nimport { Tooltip, useTooltip } from '../../common/Tooltip';\nimport type { LegendData } from '../../common/types';\nimport { getChartEdgeSides } from '../../utils/getChartEdgeSides';\nimport { BAR_WIDTH_RATIO, LEGEND_OFFSET, MAX_BAR_WIDTH, MIN_BAR_WIDTH } from '../constants';\nimport type { AggregatedSelectionData } from '../createSelectionData';\nimport { formatCount } from '../utils';\nimport type { ChartYAxis } from './Chart/types';\nimport { type StageTooltipData } from './Chart/types';\nimport { FacetCell } from './FacetCell';\nimport type {\n ChartsGroupStyle,\n ChartsGroupTitle,\n ChartsGroupXAxis,\n FacetData,\n GridLayout,\n} from './types';\n\nconst facetPosition = (idx: number, nCols: number) => ({\n col: idx % nCols,\n row: Math.floor(idx / nCols),\n});\n\nfunction displayGroup(name: string | undefined, nullValueLabel: string | undefined): string {\n if (!name) return 'All';\n if (name === 'null') return nullValueLabel ?? 'N/A';\n return name;\n}\n\ntype Props = {\n facetData: FacetData;\n gridLayout: GridLayout;\n xAxis: ChartsGroupXAxis;\n yAxis: ChartYAxis;\n style: ChartsGroupStyle;\n title: ChartsGroupTitle;\n legend: LegendData;\n showFacetLabels: boolean;\n grouped: boolean;\n orderedGroupNames: string[];\n};\n\nexport function ChartsGroup({\n facetData,\n gridLayout,\n xAxis,\n yAxis,\n style,\n title,\n legend,\n showFacetLabels,\n grouped,\n orderedGroupNames,\n}: Props) {\n const { faceted, facetLabels, facetTitles } = facetData;\n const {\n nRows,\n nCols,\n totalWidth,\n totalHeight,\n margins,\n cellPlotWidth,\n cellPlotHeight,\n cellLabelHeight,\n topPad,\n rightPad,\n colLeftPads,\n rowBottomPads,\n colXOffsets,\n rowYOffsets,\n sharedX,\n sharedY,\n } = gridLayout;\n const { nullValueLabel } = style;\n const tooltipsData = useTooltip<StageTooltipData>();\n const [hoveredGroup, setHoveredGroup] = useState<string | null>(null);\n const [selectedGroup, setSelectedGroup] = useState<string | null>(null);\n const [tooltipsContainer, setTooltipsContainer] = useState<SVGGElement>();\n const tooltipsRef = useRef<SVGGElement>(null);\n\n useEffect(() => {\n if (tooltipsRef.current) setTooltipsContainer(tooltipsRef.current);\n }, []);\n\n // Clicking a bar swaps StackedBars ↔ GroupSelectedBars; the originally\n // hovered <rect> unmounts mid-hover so its onMouseLeave never fires. Clear\n // hover + tooltip state explicitly so the tooltip doesn't stay stuck.\n const handleGroupClick = useCallback(\n (name: string) => {\n setSelectedGroup((prev) => (prev === name ? null : name));\n setHoveredGroup(null);\n tooltipsData.onClose();\n },\n [tooltipsData],\n );\n\n const chartsWidth = totalWidth - margins.left - margins.right;\n\n // Shared y scale (percent 0..100 → pixels within the cell plot body).\n const yScale = useMemo(\n () => scaleLinear().domain([0, 100]).range([cellPlotHeight, 0]),\n [cellPlotHeight],\n );\n\n // x scale uses stage count from the first non-empty facet. Stage lists\n // should be identical across facets because valueLabelsMap drives them —\n // but we still guard against empty.\n const stageKeys = useMemo(() => {\n const firstFacet: AggregatedSelectionData | undefined = faceted.byFacet[faceted.facetKeys[0]];\n return firstFacet ? firstFacet.stages.map((_, i) => String(i)) : [];\n }, [faceted]);\n const xScale = useMemo(() => {\n const s = scaleBand<string>().domain(stageKeys).range([0, cellPlotWidth]);\n const nStages = stageKeys.length;\n if (nStages > 0) {\n const desiredBar = Math.min(\n MAX_BAR_WIDTH,\n Math.max(MIN_BAR_WIDTH, (cellPlotWidth / nStages) * BAR_WIDTH_RATIO),\n );\n const step = cellPlotWidth / nStages;\n const paddingInner = step > 0 ? Math.max(0, Math.min(0.95, 1 - desiredBar / step)) : 0;\n s.paddingInner(paddingInner);\n s.paddingOuter(paddingInner / 2);\n }\n return s;\n }, [cellPlotWidth, stageKeys]);\n\n const legendLeft = margins.left + chartsWidth - rightPad + LEGEND_OFFSET;\n const legendTop = margins.top + topPad + cellLabelHeight;\n\n const tooltipContent = useMemo(() => {\n const d = tooltipsData.selectedData;\n if (!d) return [];\n const sectionLabel = d.section === 'preserved' ? 'Preserved' : 'Discarded';\n const groupLabel = displayGroup(d.groupName, nullValueLabel);\n const facetLabel = (facetLabels[tooltipsData.currentFacet] ?? []).join(' / ');\n const header = facetLabel ? `${facetLabel} · ${groupLabel}` : groupLabel;\n return [\n `${header} — ${sectionLabel}`,\n `${formatCount(d.count)} / ${formatCount(d.total)} (${d.percent.toFixed(1)}%)`,\n ];\n }, [tooltipsData.selectedData, tooltipsData.currentFacet, facetLabels]);\n\n // Tooltip side distances — computed relative to the active cell.\n const active = tooltipsData.selectedData;\n const sideDistances = useMemo(() => {\n if (!active) return { left: 0, right: 0, top: 0, bottom: 0 };\n const idx = faceted.facetKeys.indexOf(tooltipsData.currentFacet);\n const { col, row } = facetPosition(idx, nCols);\n const cellX = margins.left + colXOffsets[col];\n const cellY = margins.top + rowYOffsets[row];\n const plotOriginX = cellX + colLeftPads[col];\n const plotOriginY = cellY + topPad + cellLabelHeight;\n return {\n left: plotOriginX,\n right: totalWidth - plotOriginX,\n top: plotOriginY,\n bottom: totalHeight - plotOriginY,\n };\n }, [\n active,\n tooltipsData.currentFacet,\n faceted.facetKeys,\n nCols,\n margins,\n colXOffsets,\n rowYOffsets,\n colLeftPads,\n topPad,\n cellLabelHeight,\n totalWidth,\n totalHeight,\n ]);\n\n const tooltipAnchorX = active?.x ?? 0;\n const tooltipAnchorY = active?.y ?? 0;\n\n const n = faceted.facetKeys.length;\n\n return (\n <ErrorBoundary dataId=\"selection-chart\">\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox={`0 0 ${totalWidth} ${totalHeight}`}\n width={totalWidth}\n height={totalHeight}\n >\n <defs>{fonts}</defs>\n <g transform={`translate(${margins.left},${margins.top})`} fontFamily=\"Manrope\">\n <ChartsTitle\n title={title.text}\n show={title.show}\n position={title.position}\n leftPadding={0}\n rightPadding={0}\n chartsWidth={chartsWidth}\n />\n {faceted.facetKeys.map((fk, idx) => {\n const { col, row } = facetPosition(idx, nCols);\n const cellData = faceted.byFacet[fk];\n if (!cellData) return null;\n const edges = getChartEdgeSides(idx, n, nCols, nRows);\n const isLeftEdge = edges.includes('left');\n const isBottomEdge = edges.includes('bottom');\n return (\n <g key={fk} transform={`translate(${colXOffsets[col]},${rowYOffsets[row]})`}>\n <FacetCell\n titleStrip={{\n lines: facetTitles[fk] ?? [],\n show: showFacetLabels,\n x: colLeftPads[col],\n height: cellLabelHeight,\n }}\n data={cellData}\n grouped={grouped}\n orderedGroupNames={orderedGroupNames}\n layout={{\n width: cellPlotWidth,\n height: cellPlotHeight,\n dimensionsLeft: 0,\n dimensionsTop: cellLabelHeight,\n paddingLeft: colLeftPads[col],\n paddingTop: topPad,\n paddingBottom: rowBottomPads[row],\n xScale,\n yScale,\n showXAxis: !sharedX || isBottomEdge,\n showYAxis: !sharedY || isLeftEdge,\n }}\n xAxis={{\n labels: xAxis.labelsByFacet[fk],\n counts: xAxis.countsByFacet[fk],\n countsFontSize: xAxis.countsFontSize,\n labelsPosition: xAxis.labelsPosition,\n showGrid: xAxis.showGrid,\n showTicks: xAxis.showTicks,\n hiddenLabels: xAxis.hiddenLabels,\n title: isBottomEdge ? xAxis.title : '',\n }}\n yAxis={{\n showGrid: yAxis.showGrid,\n showTicks: yAxis.showTicks,\n hiddenLabels: yAxis.hiddenLabels,\n title: isLeftEdge ? yAxis.title : '',\n }}\n style={style}\n interaction={{\n hoveredGroup,\n selectedGroup,\n onGroupClick: handleGroupClick,\n onGroupHover: setHoveredGroup,\n tooltipsData,\n facetKey: fk,\n }}\n />\n </g>\n );\n })}\n </g>\n <g transform={`translate(${legendLeft},${legendTop})`} fontFamily=\"Manrope\">\n <Legend\n legendData={legend}\n onItemHover={setHoveredGroup}\n onItemClick={handleGroupClick}\n />\n </g>\n {tooltipsData.active && (\n <Tooltip\n content={tooltipContent}\n x={tooltipAnchorX}\n y={tooltipAnchorY}\n active={tooltipsData.active}\n fixed={tooltipsData.fixed}\n container={tooltipsContainer}\n sideDistances={sideDistances}\n onClose={tooltipsData.onClose}\n horizontal={false}\n />\n )}\n <g ref={tooltipsRef} style={{ outline: 'none' }} />\n </svg>\n </ErrorBoundary>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAwBA,IAAM,KAAiB,GAAa,OAAmB;CACrD,KAAK,IAAM;CACX,KAAK,KAAK,MAAM,IAAM,EAAM;CAC7B;AAED,SAAS,EAAa,GAA0B,GAA4C;AAG1F,QAFK,IACD,MAAS,SAAe,KAAkB,QACvC,IAFW;;AAkBpB,SAAgB,EAAY,EAC1B,cACA,gBACA,UACA,UACA,UACA,UACA,WACA,qBACA,aACA,wBACQ;CACR,IAAM,EAAE,YAAS,gBAAa,mBAAgB,GACxC,EACJ,UACA,UACA,eACA,gBACA,YACA,kBACA,mBACA,oBACA,WACA,aACA,gBACA,kBACA,gBACA,gBACA,YACA,eACE,IACE,EAAE,sBAAmB,GACrB,IAAe,GAA8B,EAC7C,CAAC,G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ACb,aAAa;MACb,CAAA;KACA,CAAA;IACH,EAAa,UACZ,kBAAC,GAAD;KACE,SAAS;KACT,GAAG;KACH,GAAG;KACH,QAAQ,EAAa;KACrB,OAAO,EAAa;KACpB,WAAW;KACI;KACf,SAAS,EAAa;KACtB,YAAY;KACZ,CAAA;IAEJ,kBAAC,KAAD;KAAG,KAAK;KAAa,OAAO,EAAE,SAAS,QAAQ;KAAI,CAAA;IAC/C;;EACQ,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AggregatedSelectionData } from '../createSelectionData';
|
|
2
|
+
import { CellLayout, ChartInteraction, ChartStyle, ChartXAxis, ChartYAxis } from './Chart/types';
|
|
3
|
+
type Props = {
|
|
4
|
+
/** Wrapped facet title rendered above the chart cell. */
|
|
5
|
+
titleStrip: {
|
|
6
|
+
lines: string[];
|
|
7
|
+
show: boolean;
|
|
8
|
+
x: number;
|
|
9
|
+
height: number;
|
|
10
|
+
};
|
|
11
|
+
data: AggregatedSelectionData;
|
|
12
|
+
grouped: boolean;
|
|
13
|
+
orderedGroupNames?: string[];
|
|
14
|
+
layout: CellLayout;
|
|
15
|
+
xAxis: ChartXAxis;
|
|
16
|
+
yAxis: ChartYAxis;
|
|
17
|
+
style: ChartStyle;
|
|
18
|
+
interaction: ChartInteraction;
|
|
19
|
+
};
|
|
20
|
+
export declare const FacetCell: import('react').NamedExoticComponent<Props>;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=FacetCell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FacetCell.d.ts","sourceRoot":"","sources":["../../../src/selection/components/FacetCell.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEtE,OAAO,KAAK,EACV,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,UAAU,EACX,MAAM,eAAe,CAAC;AAEvB,KAAK,KAAK,GAAG;IACX,yDAAyD;IACzD,UAAU,EAAE;QAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,IAAI,EAAE,OAAO,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAE1E,IAAI,EAAE,uBAAuB,CAAC;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,UAAU,CAAC;IAClB,KAAK,EAAE,UAAU,CAAC;IAClB,KAAK,EAAE,UAAU,CAAC;IAClB,WAAW,EAAE,gBAAgB,CAAC;CAC/B,CAAC;AAGF,eAAO,MAAM,SAAS,6CAwBpB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import "../constants.js";
|
|
2
|
+
import { Chart as e } from "./Chart.js";
|
|
3
|
+
import { memo as t } from "react";
|
|
4
|
+
import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
+
const a = t(function({ titleStrip: t, ...a }) {
|
|
6
|
+
let o = t.height - 24 - (t.lines.length - 1) * 24;
|
|
7
|
+
return /* @__PURE__ */ i(n, { children: [t.show && t.lines.map((e, n) => /* @__PURE__ */ r("text", {
|
|
8
|
+
x: t.x,
|
|
9
|
+
y: o + n * 24,
|
|
10
|
+
fontSize: "20px",
|
|
11
|
+
fontWeight: "500",
|
|
12
|
+
fill: "#1c1c1c",
|
|
13
|
+
children: e
|
|
14
|
+
}, n)), /* @__PURE__ */ r(e, { ...a })] });
|
|
15
|
+
});
|
|
16
|
+
export { a as FacetCell };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=FacetCell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FacetCell.js","names":[],"sources":["../../../src/selection/components/FacetCell.tsx"],"sourcesContent":["import { memo } from 'react';\n\nimport { FACET_LABEL_FILL, FACET_TITLE_LINE_HEIGHT, FACET_TITLE_OFFSET } from '../constants';\nimport type { AggregatedSelectionData } from '../createSelectionData';\nimport { Chart } from './Chart';\nimport type {\n CellLayout,\n ChartInteraction,\n ChartStyle,\n ChartXAxis,\n ChartYAxis,\n} from './Chart/types';\n\ntype Props = {\n /** Wrapped facet title rendered above the chart cell. */\n titleStrip: { lines: string[]; show: boolean; x: number; height: number };\n // Pass-through to Chart — ChartsGroup builds these per-cell.\n data: AggregatedSelectionData;\n grouped: boolean;\n orderedGroupNames?: string[];\n layout: CellLayout;\n xAxis: ChartXAxis;\n yAxis: ChartYAxis;\n style: ChartStyle;\n interaction: ChartInteraction;\n};\n\n// One faceted cell: facet title strip rendered above a single <Chart>.\nexport const FacetCell = memo(function FacetCell({ titleStrip, ...chartProps }: Props) {\n const firstBaselineY =\n titleStrip.height -\n FACET_TITLE_OFFSET -\n (titleStrip.lines.length - 1) * FACET_TITLE_LINE_HEIGHT;\n\n return (\n <>\n {titleStrip.show &&\n titleStrip.lines.map((line, lineIdx) => (\n <text\n key={lineIdx}\n x={titleStrip.x}\n y={firstBaselineY + lineIdx * FACET_TITLE_LINE_HEIGHT}\n fontSize=\"20px\"\n fontWeight=\"500\"\n fill={FACET_LABEL_FILL}\n >\n {line}\n </text>\n ))}\n <Chart {...chartProps} />\n </>\n );\n});\n"],"mappings":";;;;AA4BA,MAAa,IAAY,EAAK,SAAmB,EAAE,eAAY,GAAG,KAAqB;CACrF,IAAM,IACJ,EAAW,SAAA,MAEV,EAAW,MAAM,SAAS,KAAA;AAE7B,QACE,kBAAA,GAAA,EAAA,UAAA,CACG,EAAW,QACV,EAAW,MAAM,KAAK,GAAM,MAC1B,kBAAC,QAAD;EAEE,GAAG,EAAW;EACd,GAAG,IAAiB,IAAA;EACpB,UAAS;EACT,YAAW;EACX,MAAA;YAEC;EACI,EARA,EAQA,CACP,EACJ,kBAAC,GAAD,EAAO,GAAI,GAAc,CAAA,CACxB,EAAA,CAAA;EAEL"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { TitlePosition } from '../../types';
|
|
2
|
+
import { FacetedSelectionData } from '../createSelectionData';
|
|
3
|
+
import { ChartStyle } from './Chart/types';
|
|
4
|
+
export type Margins = {
|
|
5
|
+
top: number;
|
|
6
|
+
bottom: number;
|
|
7
|
+
left: number;
|
|
8
|
+
right: number;
|
|
9
|
+
};
|
|
10
|
+
/** Whole-grid geometry — drives ChartsGroup's layout and per-cell positioning. */
|
|
11
|
+
export type GridLayout = {
|
|
12
|
+
nRows: number;
|
|
13
|
+
nCols: number;
|
|
14
|
+
totalWidth: number;
|
|
15
|
+
totalHeight: number;
|
|
16
|
+
margins: Margins;
|
|
17
|
+
cellPlotWidth: number;
|
|
18
|
+
cellPlotHeight: number;
|
|
19
|
+
cellLabelHeight: number;
|
|
20
|
+
topPad: number;
|
|
21
|
+
rightPad: number;
|
|
22
|
+
colLeftPads: number[];
|
|
23
|
+
rowBottomPads: number[];
|
|
24
|
+
colXOffsets: number[];
|
|
25
|
+
rowYOffsets: number[];
|
|
26
|
+
/** Edge-only X-axis labels when true (always true for faceted Selection). */
|
|
27
|
+
sharedX: boolean;
|
|
28
|
+
/** Edge-only Y-axis ticks when true (always true for faceted Selection). */
|
|
29
|
+
sharedY: boolean;
|
|
30
|
+
};
|
|
31
|
+
/** X-axis config + per-facet data (used by ChartsGroup; sliced into ChartXAxis per cell). */
|
|
32
|
+
export type ChartsGroupXAxis = {
|
|
33
|
+
labelsByFacet: Record<string, Record<string, string[]>>;
|
|
34
|
+
countsByFacet: Record<string, Record<string, string>>;
|
|
35
|
+
countsFontSize?: number;
|
|
36
|
+
labelsPosition?: 'center' | '45deg' | '90deg';
|
|
37
|
+
showGrid?: boolean;
|
|
38
|
+
showTicks?: boolean;
|
|
39
|
+
hiddenLabels?: boolean;
|
|
40
|
+
title?: string;
|
|
41
|
+
};
|
|
42
|
+
/** Visual style for the whole grid; superset of Chart's style (adds nullValueLabel for tooltip). */
|
|
43
|
+
export type ChartsGroupStyle = ChartStyle & {
|
|
44
|
+
nullValueLabel?: string;
|
|
45
|
+
};
|
|
46
|
+
/** Main title + show/position config. */
|
|
47
|
+
export type ChartsGroupTitle = {
|
|
48
|
+
text: string[];
|
|
49
|
+
show: boolean;
|
|
50
|
+
position: TitlePosition;
|
|
51
|
+
};
|
|
52
|
+
/** Faceted data + per-facet titles/labels. */
|
|
53
|
+
export type FacetData = {
|
|
54
|
+
faceted: FacetedSelectionData;
|
|
55
|
+
facetLabels: Record<string, string[]>;
|
|
56
|
+
facetTitles: Record<string, string[]>;
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/selection/components/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,MAAM,MAAM,OAAO,GAAG;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,kFAAkF;AAClF,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,aAAa,EAAE,MAAM,E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