@milaboratories/miplots4 1.2.1 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/dist/DataFrame.d.ts.map +1 -1
  2. package/dist/DataFrame.js +2 -1
  3. package/dist/DataFrame.js.map +1 -1
  4. package/dist/common/ContinuousGrid.d.ts.map +1 -1
  5. package/dist/common/ContinuousGrid.js +90 -56
  6. package/dist/common/ContinuousGrid.js.map +1 -1
  7. package/dist/histogram/ChartRenderer.d.ts.map +1 -1
  8. package/dist/histogram/ChartRenderer.js +6 -0
  9. package/dist/histogram/ChartRenderer.js.map +1 -1
  10. package/dist/histogram/HistogramSettingsImpl.d.ts +5 -1
  11. package/dist/histogram/HistogramSettingsImpl.d.ts.map +1 -1
  12. package/dist/histogram/HistogramSettingsImpl.js.map +1 -1
  13. package/dist/scatterplot/components/Grid.d.ts.map +1 -1
  14. package/dist/scatterplot/components/Grid.js +109 -71
  15. package/dist/scatterplot/components/Grid.js.map +1 -1
  16. package/dist/selection/ChartRenderer.d.ts.map +1 -1
  17. package/dist/selection/ChartRenderer.js +9 -11
  18. package/dist/selection/ChartRenderer.js.map +1 -1
  19. package/dist/selection/SelectionSettingsImpl.d.ts +0 -1
  20. package/dist/selection/SelectionSettingsImpl.d.ts.map +1 -1
  21. package/dist/selection/SelectionSettingsImpl.js +0 -1
  22. package/dist/selection/SelectionSettingsImpl.js.map +1 -1
  23. package/dist/selection/components/Chart/Bars/GroupSelectedBars.js +1 -1
  24. package/dist/selection/components/Chart/Bars/GroupSelectedBars.js.map +1 -1
  25. package/dist/selection/components/Chart/Bars/StackedBars.d.ts.map +1 -1
  26. package/dist/selection/components/Chart/Bars/StackedBars.js +11 -11
  27. package/dist/selection/components/Chart/Bars/StackedBars.js.map +1 -1
  28. package/dist/selection/components/Chart/ChartAxes.d.ts.map +1 -1
  29. package/dist/selection/components/Chart/ChartAxes.js +7 -8
  30. package/dist/selection/components/Chart/ChartAxes.js.map +1 -1
  31. package/dist/selection/components/Chart/ChartFrame.d.ts +1 -2
  32. package/dist/selection/components/Chart/ChartFrame.d.ts.map +1 -1
  33. package/dist/selection/components/Chart/ChartFrame.js +8 -8
  34. package/dist/selection/components/Chart/ChartFrame.js.map +1 -1
  35. package/dist/selection/components/Chart/Gridlines.d.ts +2 -6
  36. package/dist/selection/components/Chart/Gridlines.d.ts.map +1 -1
  37. package/dist/selection/components/Chart/Gridlines.js +14 -26
  38. package/dist/selection/components/Chart/Gridlines.js.map +1 -1
  39. package/dist/selection/components/Chart/Ribbons/GroupFlowRibbon.js +1 -1
  40. package/dist/selection/components/Chart/Ribbons/GroupFlowRibbon.js.map +1 -1
  41. package/dist/selection/components/Chart/Ribbons/StackedGroupFlowRibbon.d.ts.map +1 -1
  42. package/dist/selection/components/Chart/Ribbons/StackedGroupFlowRibbon.js +27 -27
  43. package/dist/selection/components/Chart/Ribbons/StackedGroupFlowRibbon.js.map +1 -1
  44. package/dist/selection/components/Chart/SelectionXAxis.d.ts +18 -0
  45. package/dist/selection/components/Chart/SelectionXAxis.d.ts.map +1 -0
  46. package/dist/selection/components/Chart/SelectionXAxis.js +47 -0
  47. package/dist/selection/components/Chart/SelectionXAxis.js.map +1 -0
  48. package/dist/selection/components/Chart/types.d.ts +0 -1
  49. package/dist/selection/components/Chart/types.d.ts.map +1 -1
  50. package/dist/selection/components/Chart.d.ts.map +1 -1
  51. package/dist/selection/components/Chart.js +7 -12
  52. package/dist/selection/components/Chart.js.map +1 -1
  53. package/dist/selection/components/ChartsGroup.d.ts.map +1 -1
  54. package/dist/selection/components/ChartsGroup.js +73 -72
  55. package/dist/selection/components/ChartsGroup.js.map +1 -1
  56. package/dist/selection/components/types.d.ts +0 -1
  57. package/dist/selection/components/types.d.ts.map +1 -1
  58. package/dist/selection/constants.d.ts +1 -2
  59. package/dist/selection/constants.d.ts.map +1 -1
  60. package/dist/selection/constants.js +2 -2
  61. package/dist/selection/constants.js.map +1 -1
  62. package/dist/selection/createSelectionData.d.ts +2 -6
  63. package/dist/selection/createSelectionData.d.ts.map +1 -1
  64. package/dist/selection/createSelectionData.js +45 -59
  65. package/dist/selection/createSelectionData.js.map +1 -1
  66. package/dist/types/bubble.d.ts +8 -8
  67. package/dist/types/common.d.ts +62 -6
  68. package/dist/types/common.d.ts.map +1 -1
  69. package/dist/types/common.js +15 -6
  70. package/dist/types/common.js.map +1 -1
  71. package/dist/types/dendro.d.ts +6 -6
  72. package/dist/types/discrete.d.ts +41 -13
  73. package/dist/types/discrete.d.ts.map +1 -1
  74. package/dist/types/heatmap.d.ts +4 -4
  75. package/dist/types/histogram.d.ts +59 -10
  76. package/dist/types/histogram.d.ts.map +1 -1
  77. package/dist/types/histogram.js +60 -66
  78. package/dist/types/histogram.js.map +1 -1
  79. package/dist/types/scatterplot-umap.d.ts +74 -18
  80. package/dist/types/scatterplot-umap.d.ts.map +1 -1
  81. package/dist/types/scatterplot.d.ts +74 -18
  82. package/dist/types/scatterplot.d.ts.map +1 -1
  83. package/dist/types/selection.d.ts +8 -13
  84. package/dist/types/selection.d.ts.map +1 -1
  85. package/dist/types/selection.js +0 -1
  86. package/dist/types/selection.js.map +1 -1
  87. package/dist/utils/getChartEdgeSides.d.ts +1 -1
  88. package/dist/utils/significantLinesStyle.d.ts +8 -0
  89. package/dist/utils/significantLinesStyle.d.ts.map +1 -0
  90. package/dist/utils/significantLinesStyle.js +12 -0
  91. package/dist/utils/significantLinesStyle.js.map +1 -0
  92. package/package.json +1 -1
@@ -1,96 +1,134 @@
1
1
  import { GRID_GRAY as e } from "../../constants.js";
2
- import { getLineShape as t } from "../../utils/getLineShape.js";
3
- import { isContinuousAxis as n, isNumericScale as r } from "../utils/isNumericScale.js";
4
- import { useEffect as i, useState as a } from "react";
5
- import { jsx as o, jsxs as s } from "react/jsx-runtime";
6
- var c = 1;
7
- function l(e, t) {
8
- return r(e) ? e.ticks().filter((e) => !t.includes(e)) : e.domain();
2
+ import { numberFormat as t } from "../../utils/numberFormat.js";
3
+ import { getLineShape as n } from "../../utils/getLineShape.js";
4
+ import { resolveSignificantLinesStyle as r } from "../../utils/significantLinesStyle.js";
5
+ import { isContinuousAxis as i, isNumericScale as a } from "../utils/isNumericScale.js";
6
+ import { useEffect as o, useState as s } from "react";
7
+ import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
8
+ var d = 11, f = 1;
9
+ function p(e, t) {
10
+ return a(e) ? e.ticks().filter((e) => !t.includes(e)) : e.domain();
9
11
  }
10
- function u({ scaleX: u, scaleY: d, width: f, height: p, axisX: m, axisY: h, frameType: g, updatingKey: _ = "" }) {
11
- let { significantLines: v = [] } = m, { significantLines: y = [] } = h, [b, x] = a(() => l(u, v)), [S, C] = a(() => l(d, y));
12
- return i(() => {
13
- let e = l(u, v), t = l(d, y);
14
- x(e), C(t);
12
+ function m({ scaleX: m, scaleY: h, width: g, height: _, axisX: v, axisY: y, frameType: b, updatingKey: x = "" }) {
13
+ let { significantLines: S = [] } = v, { significantLines: C = [] } = y, [w, T] = s(() => p(m, S)), [E, D] = s(() => p(h, C));
14
+ return o(() => {
15
+ let e = p(m, S), t = p(h, C);
16
+ T(e), D(t);
15
17
  }, [
16
- u,
17
- d,
18
- _
19
- ]), /* @__PURE__ */ s("g", {
18
+ m,
19
+ h,
20
+ x
21
+ ]), /* @__PURE__ */ u("g", {
20
22
  stroke: e,
21
23
  children: [
22
- m.showGrid && b.map((e) => {
23
- let t = u(e);
24
- return /* @__PURE__ */ o("line", {
24
+ v.showGrid && w.map((e) => {
25
+ let t = m(e);
26
+ return /* @__PURE__ */ l("line", {
25
27
  x1: t,
26
28
  x2: t,
27
29
  y1: 0,
28
- y2: p
29
- }, `x_${t}_${p}`);
30
+ y2: _
31
+ }, `x_${t}_${_}`);
30
32
  }),
31
- h.showGrid && S.map((e) => {
32
- let t = d(e);
33
- return /* @__PURE__ */ o("line", {
33
+ y.showGrid && E.map((e) => {
34
+ let t = h(e);
35
+ return /* @__PURE__ */ l("line", {
34
36
  x1: 0,
35
- x2: f,
37
+ x2: g,
36
38
  y1: t,
37
39
  y2: t
38
- }, `y_${t}_${f}`);
40
+ }, `y_${t}_${g}`);
39
41
  }),
40
- r(u) && n(m) && /* @__PURE__ */ o("g", {
41
- strokeDasharray: t(m.significantLinesStyle),
42
- stroke: "#110529",
43
- children: v.map((e) => {
44
- let t = u(e);
45
- return /* @__PURE__ */ o("line", {
46
- x1: t,
47
- x2: t,
48
- y1: 0,
49
- y2: p
50
- }, `significant_${t}_${p}`);
51
- })
52
- }),
53
- r(d) && n(h) && /* @__PURE__ */ o("g", {
54
- strokeDasharray: t(h.significantLinesStyle),
55
- stroke: "#110529",
56
- children: y.map((e) => {
57
- let t = d(e);
58
- return /* @__PURE__ */ o("line", {
59
- x1: 0,
60
- x2: f,
61
- y1: t,
62
- y2: t
63
- }, `significant_${t}_${f}`);
64
- })
65
- }),
66
- g !== "empty" && /* @__PURE__ */ s("g", {
67
- strokeWidth: c,
42
+ a(m) && i(v) && (() => {
43
+ let e = r(v.significantLinesStyle, "x");
44
+ return /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l("g", {
45
+ strokeDasharray: n(e.shape),
46
+ stroke: "#110529",
47
+ children: S.map((e) => {
48
+ let t = m(e);
49
+ return /* @__PURE__ */ l("line", {
50
+ x1: t,
51
+ x2: t,
52
+ y1: 0,
53
+ y2: _
54
+ }, `significant_${t}_${_}`);
55
+ })
56
+ }), e.showLabel && /* @__PURE__ */ l("g", {
57
+ fill: "#110529",
58
+ fontSize: 10,
59
+ stroke: "none",
60
+ children: S.map((n) => {
61
+ let r = m(n);
62
+ if (r < 0 || r > g) return null;
63
+ let i = r < 24 ? "start" : r > g - 24 ? "end" : "middle", a = i === "start" ? 3 : i === "end" ? -3 : 0, o = e.labelPosition === "bottom" ? _ - 3 : d;
64
+ return /* @__PURE__ */ l("text", {
65
+ x: r + a,
66
+ y: o,
67
+ textAnchor: i,
68
+ children: t(n)
69
+ }, `significant_label_${r}`);
70
+ })
71
+ })] });
72
+ })(),
73
+ a(h) && i(y) && (() => {
74
+ let e = r(y.significantLinesStyle, "y");
75
+ return /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l("g", {
76
+ strokeDasharray: n(e.shape),
77
+ stroke: "#110529",
78
+ children: C.map((e) => {
79
+ let t = h(e);
80
+ return /* @__PURE__ */ l("line", {
81
+ x1: 0,
82
+ x2: g,
83
+ y1: t,
84
+ y2: t
85
+ }, `significant_${t}_${g}`);
86
+ })
87
+ }), e.showLabel && /* @__PURE__ */ l("g", {
88
+ fill: "#110529",
89
+ fontSize: 10,
90
+ stroke: "none",
91
+ children: C.map((n) => {
92
+ let r = h(n);
93
+ if (r < 0 || r > _) return null;
94
+ let i = r < d + 3 ? r + d : r - 3, a = e.labelPosition === "right";
95
+ return /* @__PURE__ */ l("text", {
96
+ x: a ? g - 4 : 4,
97
+ y: i,
98
+ textAnchor: a ? "end" : "start",
99
+ children: t(n)
100
+ }, `significant_label_${r}`);
101
+ })
102
+ })] });
103
+ })(),
104
+ b !== "empty" && /* @__PURE__ */ u("g", {
105
+ strokeWidth: f,
68
106
  children: [
69
- (m.showGrid || g !== "left") && /* @__PURE__ */ o("line", {
70
- stroke: g === "left" ? "#E1E3EB" : "#110529",
107
+ (v.showGrid || b !== "left") && /* @__PURE__ */ l("line", {
108
+ stroke: b === "left" ? "#E1E3EB" : "#110529",
71
109
  x1: "0",
72
- x2: f,
73
- y1: p,
74
- y2: p
110
+ x2: g,
111
+ y1: _,
112
+ y2: _
75
113
  }),
76
- (m.showGrid || g !== "bottom") && /* @__PURE__ */ o("line", {
77
- stroke: g === "bottom" ? "#E1E3EB" : "#110529",
114
+ (v.showGrid || b !== "bottom") && /* @__PURE__ */ l("line", {
115
+ stroke: b === "bottom" ? "#E1E3EB" : "#110529",
78
116
  x1: "0",
79
117
  x2: "0",
80
118
  y1: "0",
81
- y2: p
119
+ y2: _
82
120
  }),
83
- (m.showGrid || g === "full") && /* @__PURE__ */ o("line", {
84
- stroke: g === "full" ? "#110529" : "#E1E3EB",
85
- x1: f,
86
- x2: f,
121
+ (v.showGrid || b === "full") && /* @__PURE__ */ l("line", {
122
+ stroke: b === "full" ? "#110529" : "#E1E3EB",
123
+ x1: g,
124
+ x2: g,
87
125
  y1: "0",
88
- y2: p
126
+ y2: _
89
127
  }),
90
- (h.showGrid || g === "full") && /* @__PURE__ */ o("line", {
91
- stroke: g === "full" ? "#110529" : "#E1E3EB",
128
+ (y.showGrid || b === "full") && /* @__PURE__ */ l("line", {
129
+ stroke: b === "full" ? "#110529" : "#E1E3EB",
92
130
  x1: "0",
93
- x2: f,
131
+ x2: g,
94
132
  y1: "0",
95
133
  y2: "0"
96
134
  })
@@ -99,6 +137,6 @@ function u({ scaleX: u, scaleY: d, width: f, height: p, axisX: m, axisY: h, fram
99
137
  ]
100
138
  });
101
139
  }
102
- export { u as Grid };
140
+ export { m as Grid };
103
141
 
104
142
  //# sourceMappingURL=Grid.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Grid.js","names":[],"sources":["../../../src/scatterplot/components/Grid.tsx"],"sourcesContent":["import { BLACK, GRID_GRAY } from '../../constants';\nimport type { AxisSettings, AxisSettingsContinuous, FrameType } from '../../types';\nimport { getLineShape } from '../../utils/getLineShape';\nimport React from 'react';\nimport { useEffect, useState } from 'react';\nimport type { ChartScales } from './types';\nimport { isContinuousAxis, isNumericScale } from '../utils/isNumericScale';\n\ntype PointValue = { valueOf(): number; } & string;\n\nconst GRID_FRAME_WIDTH = 1;\n\ninterface GridProps {\n scaleY: ChartScales['y'];\n scaleX: ChartScales['x'];\n width: number;\n height: number;\n axisX: AxisSettings;\n axisY: AxisSettings;\n frameType: FrameType;\n updatingKey?: string;\n}\n\nfunction getTicks(scale: ChartScales['x' | 'y'], significantLines: number[]): (string | number)[] {\n if (isNumericScale(scale)) {\n return scale.ticks().filter(t => !significantLines.includes(t));\n }\n return scale.domain();\n}\n\nexport function Grid({ scaleX, scaleY, width, height, axisX, axisY, frameType, updatingKey = '' }: GridProps) {\n const { significantLines: significantLinesX = [] } = axisX as AxisSettingsContinuous;\n const { significantLines: significantLinesY = [] } = axisY as AxisSettingsContinuous;\n\n const [ticksX, setTicksX] = useState<(string | number)[]>(() => getTicks(scaleX, significantLinesX));\n const [ticksY, setTicksY] = useState<(string | number)[]>(() => getTicks(scaleY, significantLinesY));\n\n useEffect(() => {\n const ticksX = getTicks(scaleX, significantLinesX);\n const ticksY = getTicks(scaleY, significantLinesY);\n setTicksX(ticksX);\n setTicksY(ticksY);\n }, [scaleX, scaleY, updatingKey]);\n\n return (\n <g stroke={GRID_GRAY}>\n {axisX.showGrid &&\n ticksX.map((tick) => {\n const x = scaleX(tick as PointValue);\n return (\n <line key={`x_${x}_${height}`} x1={x} x2={x} y1={0} y2={height} />\n );\n })}\n {axisY.showGrid &&\n ticksY.map(tick => {\n const y = scaleY(tick as PointValue);\n return (\n <line key={`y_${y}_${width}`} x1={0} x2={width} y1={y} y2={y} />\n );\n })}\n {isNumericScale(scaleX) && isContinuousAxis(axisX) && (\n <g strokeDasharray={getLineShape(axisX.significantLinesStyle)} stroke={BLACK}>\n {significantLinesX.map(v => {\n const x = scaleX(v);\n return (\n <line key={`significant_${x}_${height}`} x1={x} x2={x} y1={0} y2={height} />\n );\n })}\n </g>\n )}\n {isNumericScale(scaleY) && isContinuousAxis(axisY) && (\n <g strokeDasharray={getLineShape(axisY.significantLinesStyle)} stroke={BLACK}>\n {significantLinesY.map(v => {\n const y = scaleY(v);\n return (\n <line key={`significant_${y}_${width}`} x1={0} x2={width} y1={y} y2={y} />\n );\n })}\n </g>\n )}\n {frameType !== 'empty' && (\n <g strokeWidth={GRID_FRAME_WIDTH}>\n {(axisX.showGrid || frameType !== 'left') && <line stroke={frameType === 'left' ? GRID_GRAY : BLACK} x1=\"0\" x2={width} y1={height} y2={height} />}\n {(axisX.showGrid || frameType !== 'bottom') && <line stroke={frameType === 'bottom' ? GRID_GRAY : BLACK} x1=\"0\" x2=\"0\" y1=\"0\" y2={height} />}\n {(axisX.showGrid || frameType === 'full') && <line stroke={frameType === 'full' ? BLACK : GRID_GRAY} x1={width} x2={width} y1=\"0\" y2={height} />}\n {(axisY.showGrid || frameType === 'full') && <line stroke={frameType === 'full' ? BLACK : GRID_GRAY} x1=\"0\" x2={width} y1=\"0\" y2=\"0\" />}\n </g>\n )}\n </g>\n );\n}\n"],"mappings":";;;;;AAUA,IAAM,IAAmB;AAazB,SAAS,EAAS,GAA+B,GAAiD;AAI9F,QAHI,EAAe,EAAM,GACd,EAAM,OAAO,CAAC,QAAO,MAAK,CAAC,EAAiB,SAAS,EAAE,CAAC,GAE5D,EAAM,QAAQ;;AAGzB,SAAgB,EAAK,EAAE,WAAQ,WAAQ,UAAO,WAAQ,UAAO,UAAO,cAAW,iBAAc,MAAiB;CAC1G,IAAM,EAAE,kBAAkB,IAAoB,EAAE,KAAK,GAC/C,EAAE,kBAAkB,IAAoB,EAAE,KAAK,GAE/C,CAAC,GAAQ,KAAa,QAAoC,EAAS,GAAQ,EAAkB,CAAC,EAC9F,CAAC,GAAQ,KAAa,QAAoC,EAAS,GAAQ,EAAkB,CAAC;AASpG,QAPA,QAAgB;EACZ,IAAM,IAAS,EAAS,GAAQ,EAAkB,EAC5C,IAAS,EAAS,GAAQ,EAAkB;AAElD,EADA,EAAU,EAAO,EACjB,EAAU,EAAO;IAClB;EAAC;EAAQ;EAAQ;EAAY,CAAC,EAG7B,kBAAC,KAAD;EAAG,QAAQ;YAAX;GACK,EAAM,YACH,EAAO,KAAK,MAAS;IACjB,IAAM,IAAI,EAAO,EAAmB;AACpC,WACI,kBAAC,QAAD;KAA+B,IAAI;KAAG,IAAI;KAAG,IAAI;KAAG,IAAI;KAAU,EAAvD,KAAK,EAAE,GAAG,IAA6C;KAExE;GACL,EAAM,YACH,EAAO,KAAI,MAAQ;IACf,IAAM,IAAI,EAAO,EAAmB;AACpC,WACI,kBAAC,QAAD;KAA8B,IAAI;KAAG,IAAI;KAAO,IAAI;KAAG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I;;GAER"}
1
+ {"version":3,"file":"Grid.js","names":[],"sources":["../../../src/scatterplot/components/Grid.tsx"],"sourcesContent":["import { BLACK, GRID_GRAY } from '../../constants';\nimport type { AxisSettings, AxisSettingsContinuous, FrameType } from '../../types';\nimport { getLineShape } from '../../utils/getLineShape';\nimport { numberFormat } from '../../utils/numberFormat';\nimport { resolveSignificantLinesStyle } from '../../utils/significantLinesStyle';\nimport React from 'react';\nimport { useEffect, useState } from 'react';\nimport type { ChartScales } from './types';\nimport { isContinuousAxis, isNumericScale } from '../utils/isNumericScale';\n\nconst LABEL_EDGE_OFFSET = 11;\n\ntype PointValue = { valueOf(): number; } & string;\n\nconst GRID_FRAME_WIDTH = 1;\n\ninterface GridProps {\n scaleY: ChartScales['y'];\n scaleX: ChartScales['x'];\n width: number;\n height: number;\n axisX: AxisSettings;\n axisY: AxisSettings;\n frameType: FrameType;\n updatingKey?: string;\n}\n\nfunction getTicks(scale: ChartScales['x' | 'y'], significantLines: number[]): (string | number)[] {\n if (isNumericScale(scale)) {\n return scale.ticks().filter(t => !significantLines.includes(t));\n }\n return scale.domain();\n}\n\nexport function Grid({ scaleX, scaleY, width, height, axisX, axisY, frameType, updatingKey = '' }: GridProps) {\n const { significantLines: significantLinesX = [] } = axisX as AxisSettingsContinuous;\n const { significantLines: significantLinesY = [] } = axisY as AxisSettingsContinuous;\n\n const [ticksX, setTicksX] = useState<(string | number)[]>(() => getTicks(scaleX, significantLinesX));\n const [ticksY, setTicksY] = useState<(string | number)[]>(() => getTicks(scaleY, significantLinesY));\n\n useEffect(() => {\n const ticksX = getTicks(scaleX, significantLinesX);\n const ticksY = getTicks(scaleY, significantLinesY);\n setTicksX(ticksX);\n setTicksY(ticksY);\n }, [scaleX, scaleY, updatingKey]);\n\n return (\n <g stroke={GRID_GRAY}>\n {axisX.showGrid &&\n ticksX.map((tick) => {\n const x = scaleX(tick as PointValue);\n return (\n <line key={`x_${x}_${height}`} x1={x} x2={x} y1={0} y2={height} />\n );\n })}\n {axisY.showGrid &&\n ticksY.map(tick => {\n const y = scaleY(tick as PointValue);\n return (\n <line key={`y_${y}_${width}`} x1={0} x2={width} y1={y} y2={y} />\n );\n })}\n {isNumericScale(scaleX) && isContinuousAxis(axisX) && (() => {\n const xStyle = resolveSignificantLinesStyle(axisX.significantLinesStyle, 'x');\n return (\n <>\n <g strokeDasharray={getLineShape(xStyle.shape)} stroke={BLACK}>\n {significantLinesX.map(v => {\n const x = scaleX(v);\n return (\n <line key={`significant_${x}_${height}`} x1={x} x2={x} y1={0} y2={height} />\n );\n })}\n </g>\n {xStyle.showLabel && (\n <g fill={BLACK} fontSize={10} stroke=\"none\">\n {significantLinesX.map(v => {\n const x = scaleX(v);\n if (x < 0 || x > width) return null;\n const anchor = x < 24 ? 'start' : x > width - 24 ? 'end' : 'middle';\n const dx = anchor === 'start' ? 3 : anchor === 'end' ? -3 : 0;\n const y = xStyle.labelPosition === 'bottom'\n ? height - 3\n : LABEL_EDGE_OFFSET;\n return (\n <text key={`significant_label_${x}`} x={x + dx} y={y} textAnchor={anchor}>\n {numberFormat(v)}\n </text>\n );\n })}\n </g>\n )}\n </>\n );\n })()}\n {isNumericScale(scaleY) && isContinuousAxis(axisY) && (() => {\n const yStyle = resolveSignificantLinesStyle(axisY.significantLinesStyle, 'y');\n return (\n <>\n <g strokeDasharray={getLineShape(yStyle.shape)} stroke={BLACK}>\n {significantLinesY.map(v => {\n const y = scaleY(v);\n return (\n <line key={`significant_${y}_${width}`} x1={0} x2={width} y1={y} y2={y} />\n );\n })}\n </g>\n {yStyle.showLabel && (\n <g fill={BLACK} fontSize={10} stroke=\"none\">\n {significantLinesY.map(v => {\n const y = scaleY(v);\n if (y < 0 || y > height) return null;\n const labelY = y < LABEL_EDGE_OFFSET + 3\n ? y + LABEL_EDGE_OFFSET\n : y - 3;\n const onRight = yStyle.labelPosition === 'right';\n const x = onRight ? width - 4 : 4;\n return (\n <text key={`significant_label_${y}`} x={x} y={labelY} textAnchor={onRight ? 'end' : 'start'}>\n {numberFormat(v)}\n </text>\n );\n })}\n </g>\n )}\n </>\n );\n })()}\n {frameType !== 'empty' && (\n <g strokeWidth={GRID_FRAME_WIDTH}>\n {(axisX.showGrid || frameType !== 'left') && <line stroke={frameType === 'left' ? GRID_GRAY : BLACK} x1=\"0\" x2={width} y1={height} y2={height} />}\n {(axisX.showGrid || frameType !== 'bottom') && <line stroke={frameType === 'bottom' ? GRID_GRAY : BLACK} x1=\"0\" x2=\"0\" y1=\"0\" y2={height} />}\n {(axisX.showGrid || frameType === 'full') && <line stroke={frameType === 'full' ? BLACK : GRID_GRAY} x1={width} x2={width} y1=\"0\" y2={height} />}\n {(axisY.showGrid || frameType === 'full') && <line stroke={frameType === 'full' ? BLACK : GRID_GRAY} x1=\"0\" x2={width} y1=\"0\" y2=\"0\" />}\n </g>\n )}\n </g>\n );\n}\n"],"mappings":";;;;;;;AAUA,IAAM,IAAoB,IAIpB,IAAmB;AAazB,SAAS,EAAS,GAA+B,GAAiD;AAI9F,QAHI,EAAe,EAAM,GACd,EAAM,OAAO,CAAC,QAAO,MAAK,CAAC,EAAiB,SAAS,EAAE,CAAC,GAE5D,EAAM,QAAQ;;AAGzB,SAAgB,EAAK,EAAE,WAAQ,WAAQ,UAAO,WAAQ,UAAO,UAAO,cAAW,iBAAc,MAAiB;CAC1G,IAAM,EAAE,kBAAkB,IAAoB,EAAE,KAAK,GAC/C,EAAE,kBAAkB,IAAoB,EAAE,KAAK,GAE/C,CAAC,GAAQ,KAAa,QAAoC,EAAS,GAAQ,EAAkB,CAAC,EAC9F,CAAC,GAAQ,KAAa,QAAoC,EAAS,GAAQ,EAAkB,CAAC;AASpG,QAPA,QAAgB;EACZ,IAAM,IAAS,EAAS,GAAQ,EAAkB,EAC5C,IAAS,EAAS,GAAQ,EAAkB;AAElD,EADA,EAAU,EAAO,EACjB,EAAU,EAAO;IAClB;EAAC;EAAQ;EAAQ;EAAY,CAAC,EAG7B,kBAAC,KAAD;EAAG,QAAQ;YAAX;G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= class {
108
108
  this.solidColor = n ? i : t;
109
109
  }
110
110
  createAxisLabels(e) {
111
- let n = new t("500 14px Manrope"), i = this.orderedFaceted.facetKeys, o = i.map((e) => this.orderedFaceted.byFacet[e]?.stages.length ?? 0).reduce((e, t) => Math.max(e, t), 0), s = 0;
112
- for (let e of i) for (let t of this.orderedFaceted.byFacet[e]?.stages ?? []) s = Math.max(s, n.getTextWidth(t.label));
113
- this.maxLabelPx = s;
114
- let c = o > 0 ? this.cellPlotWidth / o : this.cellPlotWidth;
115
- this.xLabelsPosition = e.labelsPosition ?? (s > c * .65 ? "90deg" : "center");
116
- let l = this.xLabelsPosition !== "center";
111
+ let n = new t("500 14px Manrope"), i = this.orderedFaceted.facetKeys, o = 0;
112
+ for (let e of i) for (let t of this.orderedFaceted.byFacet[e]?.filterNames ?? []) o = Math.max(o, n.getTextWidth(t));
113
+ this.maxLabelPx = o, this.xLabelsPosition = e.labelsPosition ?? "45deg";
114
+ let s = this.xLabelsPosition !== "center";
117
115
  this.xLabelsByFacet = {}, this.xCountsByFacet = {}, this.maxLabelLines = 1;
118
116
  for (let e of i) {
119
- let t = this.orderedFaceted.byFacet[e]?.stages ?? [], n = {}, i = {};
120
- for (let [e, o] of t.entries()) {
121
- let t = l ? [o.label] : r(o.label, 120, 14);
122
- n[String(e)] = t, i[String(e)] = a(o.total), this.maxLabelLines = Math.max(this.maxLabelLines, t.length);
117
+ let t = this.orderedFaceted.byFacet[e], n = {}, i = {};
118
+ for (let [e, i] of (t?.filterNames ?? []).entries()) {
119
+ let t = s ? [i] : r(i, 120, 14);
120
+ n[String(e)] = t, this.maxLabelLines = Math.max(this.maxLabelLines, t.length);
123
121
  }
122
+ for (let [e, n] of (t?.stages ?? []).entries()) i[String(e)] = a(n.total);
124
123
  this.xLabelsByFacet[e] = n, this.xCountsByFacet[e] = i;
125
124
  }
126
125
  }
@@ -215,7 +214,6 @@ var f = class {
215
214
  countsByFacet: this.xCountsByFacet,
216
215
  countsFontSize: 14,
217
216
  labelsPosition: this.xLabelsPosition,
218
- showGrid: f.showGrid,
219
217
  showTicks: f.showTicks,
220
218
  hiddenLabels: f.hiddenLabels,
221
219
  title: f.title
@@ -1 +1 @@
1
- {"version":3,"file":"ChartRenderer.js","names":[],"sources":["../../src/selection/ChartRenderer.tsx"],"sourcesContent":["import { scaleOrdinal } from 'd3-scale';\nimport type { ReactElement } from 'react';\nimport type { Root } from 'react-dom/client';\nimport { createRoot } from 'react-dom/client';\n\nimport { Error } from '../common/Error';\nimport type { LegendData, LegendItem } from '../common/types';\nimport { TITLE_LINE_HEIGHT, TITLE_MARGIN } from '../constants';\nimport { splitTextByWidth } from '../discrete/utils';\nimport type { ColumnName, FrameType, TitlePosition } from '../types';\nimport { arrangeLegendParts } from '../utils/arrangeLegendParts';\nimport { TextMeasurer } from '../utils/TextMeasurer/TextMeasurer';\nimport { ChartsGroup } from './components/ChartsGroup';\nimport type { Margins } from './components/types';\nimport {\n AGGREGATE_RIBBON_COLOR,\n AXIS_LABEL_LINE_HEIGHT,\n COUNT_LINE_HEIGHT,\n FACET_TITLE_FONT_PX,\n FACET_TITLE_LINE,\n FACET_TITLE_LINE_HEIGHT,\n LABEL_LINE_HEIGHT_PX,\n LABEL_ROTATION_THRESHOLD,\n LABEL_WRAP_WIDTH_PX,\n MIN_MARGIN,\n MIN_PADDING,\n X_COUNT_BOTTOM_PAD,\n X_LABEL_TOP_PAD,\n Y_TICK_RESERVE,\n} from './constants';\nimport type { FacetedSelectionData } from './createSelectionData';\nimport type {\n SelectionFillColor,\n SelectionSettingsImpl,\n SelectionXAxisSettings,\n SelectionYAxisSettings,\n} from './SelectionSettingsImpl';\nimport { formatCount, formatPercent } from './utils';\n\ntype GroupingSettings = NonNullable<SelectionSettingsImpl['grouping']>;\n\nclass ChartRenderer {\n reactRoot: Root | null = null;\n parentNode: HTMLElement | null = null;\n rootNode: HTMLElement | null = null;\n component: ReactElement = <></>;\n\n // Single-cell plot dimensions (inputs to the grid layout).\n cellPlotWidth = 0;\n cellPlotHeight = 0;\n\n // Grid shape.\n nCols = 1;\n nRows = 1;\n isFaceted = false;\n cellLabelHeight = 0;\n orderedFaceted: FacetedSelectionData = { facetKeys: [], byFacet: {}, groupNames: [] };\n facetLabels: Record<string, string[]> = {};\n // Pre-wrapped per-facet title lines, sized to fit `cellPlotWidth`.\n facetTitles: Record<string, string[]> = {};\n\n // Grouping/color resolution.\n grouped = false;\n groupNames: string[] = [];\n colorMap: Map<string, string> = new Map();\n solidColor = '';\n\n // Axis labels (per-facet, multiline support) + auto-rotation decision.\n xLabelsByFacet: Record<string, Record<string, string[]>> = {};\n xCountsByFacet: Record<string, Record<string, string>> = {};\n xLabelsPosition: 'center' | '45deg' | '90deg' = 'center';\n maxLabelLines = 1;\n maxLabelPx = 0;\n\n // Caption-derived padding pieces.\n yTickWidth = 0;\n labelBlock = 0;\n xTitleHeight = 0;\n yTitleWidth = 0;\n // Tick-area reserves: full when labels are shown (room for tick mark + offset\n // + axis title clearance), shrunk to the tick-mark width alone when labels\n // are hidden so the chart can reclaim the freed space.\n yTickReserve = 0;\n xLabelTopReserve = 0;\n\n // Per-cell paddings + grid offsets.\n topPad = 0;\n rightPad = MIN_PADDING;\n fullLeftPad = 0;\n fullBottomPad = 0;\n colLeftPads: number[] = [];\n rowBottomPads: number[] = [];\n colXOffsets: number[] = [0];\n rowYOffsets: number[] = [0];\n gridWidth = 0;\n gridHeight = 0;\n\n // Outer layout.\n legend: LegendData = { width: 0, height: 0, items: [] };\n mainTitle: string[] = [];\n margins: Margins = { top: MIN_MARGIN, bottom: MIN_MARGIN, left: MIN_MARGIN, right: MIN_MARGIN };\n totalWidth = 0;\n totalHeight = 0;\n\n clear() {\n if (this.parentNode && this.rootNode) {\n this.parentNode.removeChild(this.rootNode);\n this.parentNode = null;\n this.rootNode = null;\n }\n setTimeout(() => {\n this.reactRoot?.unmount();\n this.reactRoot = null;\n });\n }\n\n init(node: HTMLElement) {\n if (this.parentNode === null) {\n this.parentNode = node;\n this.rootNode = document.createElement('div');\n this.parentNode.appendChild(this.rootNode);\n this.reactRoot = createRoot(this.rootNode);\n }\n }\n\n updateChartSizes(width: number, height: number) {\n this.cellPlotWidth = width;\n this.cellPlotHeight = height;\n }\n\n updateGrid({\n faceted,\n facetLabels,\n facetBy,\n facetSettings,\n }: {\n faceted: FacetedSelectionData;\n facetLabels: Record<string, string[]>;\n facetBy: ColumnName[];\n facetSettings: SelectionSettingsImpl['facetSettings'];\n }) {\n const orderedFacetKeys = facetSettings.order?.length\n ? facetSettings.order.filter((k) => faceted.facetKeys.includes(k))\n : faceted.facetKeys;\n this.orderedFaceted = { ...faceted, facetKeys: orderedFacetKeys };\n this.facetLabels = facetLabels;\n this.isFaceted = facetBy.length > 0;\n\n if (this.isFaceted) {\n const wrapWidth = Math.max(this.cellPlotWidth, 40);\n this.facetTitles = {};\n let maxLines = 1;\n for (const fk of orderedFacetKeys) {\n const text = (facetLabels[fk] ?? []).join(' / ');\n const lines = text ? splitTextByWidth(text, wrapWidth, FACET_TITLE_FONT_PX) : [];\n this.facetTitles[fk] = lines;\n if (lines.length > maxLines) maxLines = lines.length;\n }\n this.cellLabelHeight = FACET_TITLE_LINE + (maxLines - 1) * FACET_TITLE_LINE_HEIGHT;\n } else {\n this.facetTitles = {};\n this.cellLabelHeight = 0;\n }\n\n const n = orderedFacetKeys.length;\n this.nCols = Math.min(n, facetSettings.nCols ?? Math.max(1, Math.ceil(Math.sqrt(n))));\n this.nRows = facetSettings.nRows ?? Math.max(1, Math.ceil(n / this.nCols));\n }\n\n updateGroupingMaps(grouping: GroupingSettings | undefined, fillColor: SelectionFillColor) {\n // fillColor's shape is the \"fixed vs grouping\" signal (mirrors scatterplot\n // dotFill). When a MappingLink, render grouped/stacked using\n // `grouping.inheritedAes`. When a string, render solid bars in that color.\n const isMappedFill = typeof fillColor === 'object' && fillColor !== null;\n this.grouped = isMappedFill && Boolean(grouping);\n\n const orderedGroupNames = grouping?.order\n ? grouping.order.map(String).filter((n) => this.orderedFaceted.groupNames.includes(n))\n : this.orderedFaceted.groupNames;\n this.groupNames = [\n ...orderedGroupNames,\n ...this.orderedFaceted.groupNames.filter((n) => !orderedGroupNames.includes(n)),\n ];\n\n // colorMap is only consulted on the grouped path (Chart.tsx ungrouped/\n // active-group paths use solidColor instead). Compose populates\n // grouping.inheritedAes whenever fillColor is a MappingLink; missing\n // entries fall back to the solid bar color downstream so the chart still\n // renders if a group key drops out.\n const inheritedAes = grouping?.inheritedAes;\n this.colorMap = new Map<string, string>();\n if (this.grouped && inheritedAes) {\n for (const name of this.groupNames) {\n const c = inheritedAes[name]?.fillColor;\n if (c) this.colorMap.set(name, c);\n }\n }\n\n // Concrete bar color for the ungrouped path. When fillColor is a\n // MappingLink (grouped), Chart.tsx routes the unified ribbon through\n // AGGREGATE_RIBBON_COLOR instead, so this value is only consulted as a\n // (rare) colorMap-miss fallback in the active-group branch.\n this.solidColor = isMappedFill ? AGGREGATE_RIBBON_COLOR : fillColor;\n }\n\n createAxisLabels(xAxis: SelectionXAxisSettings) {\n const tm = new TextMeasurer('500 14px Manrope');\n const facetKeys = this.orderedFaceted.facetKeys;\n\n // Auto-rotate decision: the same `cellPlotWidth` drives every cell, so one\n // decision applies to all. Rotate when any label is >65% of its band\n // width — below that threshold a centered (possibly two-line) label still\n // fits.\n const nStages = facetKeys\n .map((fk) => this.orderedFaceted.byFacet[fk]?.stages.length ?? 0)\n .reduce((a, b) => Math.max(a, b), 0);\n let maxLabelPx = 0;\n for (const fk of facetKeys) {\n for (const stage of this.orderedFaceted.byFacet[fk]?.stages ?? []) {\n maxLabelPx = Math.max(maxLabelPx, tm.getTextWidth(stage.label));\n }\n }\n this.maxLabelPx = maxLabelPx;\n const bandWidth = nStages > 0 ? this.cellPlotWidth / nStages : this.cellPlotWidth;\n // User override (form-set rotation) wins over the auto-decision.\n this.xLabelsPosition =\n xAxis.labelsPosition ??\n (maxLabelPx > bandWidth * LABEL_ROTATION_THRESHOLD ? '90deg' : 'center');\n const rotateLabels = this.xLabelsPosition !== 'center';\n\n // Per-facet stage labels + counts. Centered → wrap to two lines at 120px;\n // rotated 90° → one line per stage.\n this.xLabelsByFacet = {};\n this.xCountsByFacet = {};\n this.maxLabelLines = 1;\n for (const fk of facetKeys) {\n const stages = this.orderedFaceted.byFacet[fk]?.stages ?? [];\n const labels: Record<string, string[]> = {};\n const counts: Record<string, string> = {};\n for (const [i, stage] of stages.entries()) {\n const lines = rotateLabels\n ? [stage.label]\n : splitTextByWidth(stage.label, LABEL_WRAP_WIDTH_PX, LABEL_LINE_HEIGHT_PX);\n labels[String(i)] = lines;\n counts[String(i)] = formatCount(stage.total);\n this.maxLabelLines = Math.max(this.maxLabelLines, lines.length);\n }\n this.xLabelsByFacet[fk] = labels;\n this.xCountsByFacet[fk] = counts;\n }\n }\n\n updateCaptionsSize(xAxis: SelectionXAxisSettings, yAxis: SelectionYAxisSettings) {\n const tm = new TextMeasurer('500 14px Manrope');\n\n // Y axis: when labels are hidden, drop tick-label width AND most of the\n // tick reserve (room for tick mark + offset + axis-title clearance).\n // Histogram pattern: hidden → just tick-mark size, no offset.\n if (yAxis.hiddenLabels) {\n this.yTickWidth = 0;\n this.yTickReserve = yAxis.showTicks ? 4 : 0;\n } else {\n // \"100%\" is the widest formatPercent output for selection's [0, 100]\n // Y scale, regardless of d3's tick count choice.\n this.yTickWidth = tm.getTextWidth(formatPercent(100));\n this.yTickReserve = Y_TICK_RESERVE;\n }\n\n // X axis: same gating for label height block + the gap above the label.\n if (xAxis.hiddenLabels) {\n this.labelBlock = 0;\n this.xLabelTopReserve = xAxis.showTicks ? 4 : 0;\n } else {\n const rotateLabels = this.xLabelsPosition !== 'center';\n this.labelBlock = !rotateLabels\n ? this.maxLabelLines * AXIS_LABEL_LINE_HEIGHT\n : this.xLabelsPosition === '45deg'\n ? Math.ceil(this.maxLabelPx * 0.71) + 10\n : Math.ceil(this.maxLabelPx) + 10;\n this.xLabelTopReserve = X_LABEL_TOP_PAD;\n }\n\n this.xTitleHeight = xAxis.title ? AXIS_LABEL_LINE_HEIGHT + 6 : 0;\n this.yTitleWidth = yAxis.title ? AXIS_LABEL_LINE_HEIGHT + 4 : 0;\n }\n\n updateChartDimensions() {\n // Axis paddings: full = reserve space for labels/title; slim = MIN_PADDING.\n // Selection always uses edge-only axes when faceted (stages and Y range\n // are structurally identical across cells), mirroring histogram's layout.\n this.fullLeftPad = this.yTitleWidth + this.yTickWidth + this.yTickReserve;\n this.fullBottomPad = this.xLabelTopReserve + this.labelBlock + this.xTitleHeight;\n // topPad reserves only the count-label strip above each bar — vertical\n // breathing room between rows comes from `cellLabelHeight` (facet title)\n // + the previous row's `bottomPad`. Adding MIN_MARGIN here would\n // double-count that gap and the stacked padding looks too loose\n // compared to histogram/discrete.\n this.topPad = COUNT_LINE_HEIGHT + X_COUNT_BOTTOM_PAD;\n this.rightPad = MIN_PADDING;\n\n // Per-column / per-row paddings. When faceted, only col 0 reserves the\n // full Y-axis space and only the row(s) hosting bottom-edge cells reserve\n // full X-axis-label space; other cells use MIN_PADDING. Non-faceted (a\n // single cell) reserves both axes for that one cell.\n this.colLeftPads = Array.from({ length: this.nCols }, (_, c) =>\n !this.isFaceted || c === 0 ? this.fullLeftPad : MIN_PADDING,\n );\n // A row is \"bottom-edge\" if it's the last row, or it's nRows-2 in a\n // ragged grid (some columns have only nRows-1 cells, so their last cell\n // sits in row nRows-2 and needs the X-axis label space).\n const n = this.orderedFaceted.facetKeys.length;\n const isRagged = n % this.nCols !== 0;\n this.rowBottomPads = Array.from({ length: this.nRows }, (_, r) => {\n const isBottomRow = r === this.nRows - 1 || (r === this.nRows - 2 && isRagged);\n return !this.isFaceted || isBottomRow ? this.fullBottomPad : MIN_PADDING;\n });\n\n this.colXOffsets = [0];\n for (const [c, leftPad] of this.colLeftPads.entries()) {\n this.colXOffsets.push(this.colXOffsets[c] + leftPad + this.cellPlotWidth + this.rightPad);\n }\n this.rowYOffsets = [0];\n for (const [r, bottomPad] of this.rowBottomPads.entries()) {\n this.rowYOffsets.push(\n this.rowYOffsets[r] + this.topPad + this.cellLabelHeight + this.cellPlotHeight + bottomPad,\n );\n }\n this.gridWidth = this.colXOffsets[this.nCols];\n this.gridHeight = this.rowYOffsets[this.nRows];\n }\n\n updateLegendSize(showLegend: boolean, grouping: GroupingSettings | undefined) {\n if (!showLegend || !this.grouped || this.groupNames.length === 0) {\n this.legend = { width: 0, height: 0, items: [] };\n return;\n }\n const legendItems: LegendItem[] = [\n {\n id: 'selection-group',\n type: 'discreteColor',\n title: grouping?.columnName.label ?? grouping?.columnName.value ?? '',\n width: 0,\n height: 0,\n left: 0,\n top: 0,\n values: this.groupNames,\n scale: scaleOrdinal<string, string>()\n .domain(this.groupNames)\n .range(this.groupNames.map((n) => this.colorMap.get(n) ?? '')),\n labels: Object.fromEntries(\n this.groupNames.map((n) => [\n n,\n n === 'null' ? (grouping?.columnName.nullValueLabel ?? 'N/A') : n,\n ]),\n ),\n },\n ];\n // Legend height matches the grid's plot-body strip, like discrete.\n const arranged = arrangeLegendParts(legendItems, this.cellPlotHeight);\n const maxRight = arranged.reduce((m, it) => Math.max(m, it.left + it.width), 0);\n this.legend = { width: maxRight + MIN_MARGIN, height: this.cellPlotHeight, items: arranged };\n }\n\n createMainTitle(title: string, showTitle: boolean) {\n this.mainTitle =\n showTitle && title ? splitTextByWidth(title, Math.max(this.cellPlotWidth, 40), 20) : [];\n }\n\n updateMargins() {\n const titleBlock =\n this.mainTitle.length > 0 ? this.mainTitle.length * TITLE_LINE_HEIGHT + TITLE_MARGIN * 2 : 0;\n this.margins = {\n top: Math.max(titleBlock, MIN_MARGIN),\n bottom: MIN_MARGIN,\n left: MIN_MARGIN,\n right: MIN_MARGIN + this.legend.width,\n };\n this.totalWidth = this.margins.left + this.gridWidth + this.margins.right;\n this.totalHeight = this.margins.top + this.gridHeight + this.margins.bottom;\n }\n\n render({\n faceted,\n facetLabels,\n width,\n height,\n title,\n showTitle,\n grouping,\n showLegend,\n facetBy,\n facetSettings,\n xAxis,\n yAxis,\n frame,\n titlePosition,\n fillColor,\n opacity,\n }: {\n faceted: FacetedSelectionData;\n facetLabels: Record<string, string[]>;\n width: number;\n height: number;\n title: string;\n showTitle: boolean;\n grouping: GroupingSettings | undefined;\n showLegend: boolean;\n facetBy: ColumnName[];\n facetSettings: SelectionSettingsImpl['facetSettings'];\n xAxis: SelectionXAxisSettings;\n yAxis: SelectionYAxisSettings;\n frame: FrameType;\n titlePosition: TitlePosition;\n fillColor: SelectionFillColor;\n opacity: number;\n }) {\n this.updateChartSizes(width, height);\n this.updateGrid({ faceted, facetLabels, facetBy, facetSettings });\n this.updateGroupingMaps(grouping, fillColor);\n this.createAxisLabels(xAxis);\n this.updateCaptionsSize(xAxis, yAxis);\n this.updateChartDimensions();\n this.updateLegendSize(showLegend, grouping);\n this.createMainTitle(title, showTitle);\n this.updateMargins();\n\n const component = (\n <ChartsGroup\n facetData={{\n faceted: this.orderedFaceted,\n facetLabels: this.facetLabels,\n facetTitles: this.facetTitles,\n }}\n gridLayout={{\n nRows: this.nRows,\n nCols: this.nCols,\n totalWidth: this.totalWidth,\n totalHeight: this.totalHeight,\n margins: this.margins,\n cellPlotWidth: this.cellPlotWidth,\n cellPlotHeight: this.cellPlotHeight,\n cellLabelHeight: this.cellLabelHeight,\n topPad: this.topPad,\n rightPad: this.rightPad,\n colLeftPads: this.colLeftPads,\n rowBottomPads: this.rowBottomPads,\n colXOffsets: this.colXOffsets,\n rowYOffsets: this.rowYOffsets,\n sharedX: this.isFaceted,\n sharedY: this.isFaceted,\n }}\n xAxis={{\n labelsByFacet: this.xLabelsByFacet,\n countsByFacet: this.xCountsByFacet,\n countsFontSize: 14,\n labelsPosition: this.xLabelsPosition,\n showGrid: xAxis.showGrid,\n showTicks: xAxis.showTicks,\n hiddenLabels: xAxis.hiddenLabels,\n title: xAxis.title,\n }}\n yAxis={{\n showGrid: yAxis.showGrid,\n showTicks: yAxis.showTicks,\n hiddenLabels: yAxis.hiddenLabels,\n title: yAxis.title,\n }}\n style={{\n frameType: this.isFaceted ? 'full' : frame,\n barColor: this.solidColor,\n opacity,\n colorMap: this.colorMap,\n nullValueLabel: grouping?.columnName.nullValueLabel,\n }}\n title={{\n text: this.mainTitle,\n show: this.mainTitle.length > 0,\n position: titlePosition,\n }}\n legend={this.legend}\n showFacetLabels={this.isFaceted}\n grouped={this.grouped}\n orderedGroupNames={this.groupNames}\n />\n );\n this.component = component;\n this.reactRoot?.render(component);\n }\n\n renderError(message: string) {\n this.reactRoot?.render(<Error message={message} />);\n }\n}\n\nexport default ChartRenderer;\n"],"mappings":";;;;;;;;;;;AAyCA,IAAM,IAAN,MAAoB;CAClB,YAAyB;CACzB,aAAiC;CACjC,WAA+B;CAC/B,YAA0B,kBAAA,GAAA,EAAK,CAAA;CAG/B,gBAAgB;CAChB,iBAAiB;CAGjB,QAAQ;CACR,QAAQ;CACR,YAAY;CACZ,kBAAkB;CAClB,iBAAuC;EAAE,WAAW,EAAE;EAAE,SAAS,EAAE;EAAE,YAAY,EAAE;EAAE;CACrF,cAAwC,EAAE;CAE1C,cAAwC,EAAE;CAG1C,UAAU;CACV,aAAuB,EAAE;CACzB,2BAAgC,IAAI,KAAK;CACzC,aAAa;CAGb,iBAA2D,EAAE;CAC7D,iBAAyD,EAAE;CAC3D,kBAAgD;CAChD,gBAAgB;CAChB,aAAa;CAGb,aAAa;CACb,aAAa;CACb,eAAe;CACf,cAAc;CAId,eAAe;CACf,mBAAmB;CAGnB,SAAS;CACT,WAAA;CACA,cAAc;CACd,gBAAgB;CAChB,cAAwB,EAAE;CAC1B,gBAA0B,EAAE;CAC5B,cAAwB,CAAC,EAAE;CAC3B,cAAwB,CAAC,EAAE;CAC3B,YAAY;CACZ,aAAa;CAGb,SAAqB;EAAE,OAAO;EAAG,QAAQ;EAAG,OAAO,EAAE;EAAE;CACvD,YAAsB,EAAE;CACxB,UAAmB;EAAE,KAAA;EAAiB,QAAA;EAAoB,MAAA;EAAkB,OAAA;EAAmB;CAC/F,aAAa;CACb,cA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a,KAAK;IAClB,aAAa,KAAK;IACnB;GACD,YAAY;IACV,OAAO,KAAK;IACZ,OAAO,KAAK;IACZ,YAAY,KAAK;IACjB,aAAa,KAAK;IAClB,SAAS,KAAK;IACd,eAAe,KAAK;IACpB,gBAAgB,KAAK;IACrB,iBAAiB,KAAK;IACtB,QAAQ,KAAK;IACb,UAAU,KAAK;IACf,aAAa,KAAK;IAClB,eAAe,KAAK;IACpB,aAAa,KAAK;IAClB,aAAa,KAAK;IAClB,SAAS,KAAK;IACd,SAAS,KAAK;IACf;GACD,OAAO;IACL,eAAe,KAAK;IACpB,eAAe,KAAK;IACpB,gBAAgB;IAChB,gBAAgB,KAAK;IACrB,UAAU,EAAM;IAChB,WAAW,EAAM;IACjB,cAAc,EAAM;IACpB,OAAO,EAAM;IACd;GACD,OAAO;IACL,UAAU,EAAM;IAChB,WAAW,EAAM;IACjB,cAAc,EAAM;IACpB,OAAO,EAAM;IACd;GACD,OAAO;IACL,WAAW,KAAK,YAAY,SAAS;IACrC,UAAU,KAAK;IACf;IACA,UAAU,KAAK;IACf,gBAAgB,GAAU,WAAW;IACtC;GACD,OAAO;IACL,MAAM,KAAK;IACX,MAAM,KAAK,UAAU,SAAS;IAC9B,UAAU;IACX;GACD,QAAQ,KAAK;GACb,iBAAiB,KAAK;GACtB,SAAS,KAAK;GACd,mBAAmB,KAAK;GACxB,CAAA;AAGJ,EADA,KAAK,YAAY,GACjB,KAAK,WAAW,OAAO,EAAU;;CAGnC,YAAY,GAAiB;AAC3B,OAAK,WAAW,OAAO,kBAAC,GAAD,EAAgB,YAAW,CAAA,CAAC"}
1
+ {"version":3,"file":"ChartRenderer.js","names":[],"sources":["../../src/selection/ChartRenderer.tsx"],"sourcesContent":["import { scaleOrdinal } from 'd3-scale';\nimport type { ReactElement } from 'react';\nimport type { Root } from 'react-dom/client';\nimport { createRoot } from 'react-dom/client';\n\nimport { Error } from '../common/Error';\nimport type { LegendData, LegendItem } from '../common/types';\nimport { TITLE_LINE_HEIGHT, TITLE_MARGIN } from '../constants';\nimport { splitTextByWidth } from '../discrete/utils';\nimport type { ColumnName, FrameType, TitlePosition } from '../types';\nimport { arrangeLegendParts } from '../utils/arrangeLegendParts';\nimport { TextMeasurer } from '../utils/TextMeasurer/TextMeasurer';\nimport { ChartsGroup } from './components/ChartsGroup';\nimport type { Margins } from './components/types';\nimport {\n AGGREGATE_RIBBON_COLOR,\n AXIS_LABEL_LINE_HEIGHT,\n COUNT_LINE_HEIGHT,\n FACET_TITLE_FONT_PX,\n FACET_TITLE_LINE,\n FACET_TITLE_LINE_HEIGHT,\n LABEL_LINE_HEIGHT_PX,\n LABEL_WRAP_WIDTH_PX,\n MIN_MARGIN,\n MIN_PADDING,\n X_COUNT_BOTTOM_PAD,\n X_LABEL_TOP_PAD,\n Y_TICK_RESERVE,\n} from './constants';\nimport type { FacetedSelectionData } from './createSelectionData';\nimport type {\n SelectionFillColor,\n SelectionSettingsImpl,\n SelectionXAxisSettings,\n SelectionYAxisSettings,\n} from './SelectionSettingsImpl';\nimport { formatCount, formatPercent } from './utils';\n\ntype GroupingSettings = NonNullable<SelectionSettingsImpl['grouping']>;\n\nclass ChartRenderer {\n reactRoot: Root | null = null;\n parentNode: HTMLElement | null = null;\n rootNode: HTMLElement | null = null;\n component: ReactElement = <></>;\n\n // Single-cell plot dimensions (inputs to the grid layout).\n cellPlotWidth = 0;\n cellPlotHeight = 0;\n\n // Grid shape.\n nCols = 1;\n nRows = 1;\n isFaceted = false;\n cellLabelHeight = 0;\n orderedFaceted: FacetedSelectionData = { facetKeys: [], byFacet: {}, groupNames: [] };\n facetLabels: Record<string, string[]> = {};\n // Pre-wrapped per-facet title lines, sized to fit `cellPlotWidth`.\n facetTitles: Record<string, string[]> = {};\n\n // Grouping/color resolution.\n grouped = false;\n groupNames: string[] = [];\n colorMap: Map<string, string> = new Map();\n solidColor = '';\n\n // Axis labels (per-facet, multiline support) + auto-rotation decision.\n xLabelsByFacet: Record<string, Record<string, string[]>> = {};\n xCountsByFacet: Record<string, Record<string, string>> = {};\n xLabelsPosition: 'center' | '45deg' | '90deg' = 'center';\n maxLabelLines = 1;\n maxLabelPx = 0;\n\n // Caption-derived padding pieces.\n yTickWidth = 0;\n labelBlock = 0;\n xTitleHeight = 0;\n yTitleWidth = 0;\n // Tick-area reserves: full when labels are shown (room for tick mark + offset\n // + axis title clearance), shrunk to the tick-mark width alone when labels\n // are hidden so the chart can reclaim the freed space.\n yTickReserve = 0;\n xLabelTopReserve = 0;\n\n // Per-cell paddings + grid offsets.\n topPad = 0;\n rightPad = MIN_PADDING;\n fullLeftPad = 0;\n fullBottomPad = 0;\n colLeftPads: number[] = [];\n rowBottomPads: number[] = [];\n colXOffsets: number[] = [0];\n rowYOffsets: number[] = [0];\n gridWidth = 0;\n gridHeight = 0;\n\n // Outer layout.\n legend: LegendData = { width: 0, height: 0, items: [] };\n mainTitle: string[] = [];\n margins: Margins = { top: MIN_MARGIN, bottom: MIN_MARGIN, left: MIN_MARGIN, right: MIN_MARGIN };\n totalWidth = 0;\n totalHeight = 0;\n\n clear() {\n if (this.parentNode && this.rootNode) {\n this.parentNode.removeChild(this.rootNode);\n this.parentNode = null;\n this.rootNode = null;\n }\n setTimeout(() => {\n this.reactRoot?.unmount();\n this.reactRoot = null;\n });\n }\n\n init(node: HTMLElement) {\n if (this.parentNode === null) {\n this.parentNode = node;\n this.rootNode = document.createElement('div');\n this.parentNode.appendChild(this.rootNode);\n this.reactRoot = createRoot(this.rootNode);\n }\n }\n\n updateChartSizes(width: number, height: number) {\n this.cellPlotWidth = width;\n this.cellPlotHeight = height;\n }\n\n updateGrid({\n faceted,\n facetLabels,\n facetBy,\n facetSettings,\n }: {\n faceted: FacetedSelectionData;\n facetLabels: Record<string, string[]>;\n facetBy: ColumnName[];\n facetSettings: SelectionSettingsImpl['facetSettings'];\n }) {\n const orderedFacetKeys = facetSettings.order?.length\n ? facetSettings.order.filter((k) => faceted.facetKeys.includes(k))\n : faceted.facetKeys;\n this.orderedFaceted = { ...faceted, facetKeys: orderedFacetKeys };\n this.facetLabels = facetLabels;\n this.isFaceted = facetBy.length > 0;\n\n if (this.isFaceted) {\n const wrapWidth = Math.max(this.cellPlotWidth, 40);\n this.facetTitles = {};\n let maxLines = 1;\n for (const fk of orderedFacetKeys) {\n const text = (facetLabels[fk] ?? []).join(' / ');\n const lines = text ? splitTextByWidth(text, wrapWidth, FACET_TITLE_FONT_PX) : [];\n this.facetTitles[fk] = lines;\n if (lines.length > maxLines) maxLines = lines.length;\n }\n this.cellLabelHeight = FACET_TITLE_LINE + (maxLines - 1) * FACET_TITLE_LINE_HEIGHT;\n } else {\n this.facetTitles = {};\n this.cellLabelHeight = 0;\n }\n\n const n = orderedFacetKeys.length;\n this.nCols = Math.min(n, facetSettings.nCols ?? Math.max(1, Math.ceil(Math.sqrt(n))));\n this.nRows = facetSettings.nRows ?? Math.max(1, Math.ceil(n / this.nCols));\n }\n\n updateGroupingMaps(grouping: GroupingSettings | undefined, fillColor: SelectionFillColor) {\n // fillColor's shape is the \"fixed vs grouping\" signal (mirrors scatterplot\n // dotFill). When a MappingLink, render grouped/stacked using\n // `grouping.inheritedAes`. When a string, render solid bars in that color.\n const isMappedFill = typeof fillColor === 'object' && fillColor !== null;\n this.grouped = isMappedFill && Boolean(grouping);\n\n const orderedGroupNames = grouping?.order\n ? grouping.order.map(String).filter((n) => this.orderedFaceted.groupNames.includes(n))\n : this.orderedFaceted.groupNames;\n this.groupNames = [\n ...orderedGroupNames,\n ...this.orderedFaceted.groupNames.filter((n) => !orderedGroupNames.includes(n)),\n ];\n\n // colorMap is only consulted on the grouped path (Chart.tsx ungrouped/\n // active-group paths use solidColor instead). Compose populates\n // grouping.inheritedAes whenever fillColor is a MappingLink; missing\n // entries fall back to the solid bar color downstream so the chart still\n // renders if a group key drops out.\n const inheritedAes = grouping?.inheritedAes;\n this.colorMap = new Map<string, string>();\n if (this.grouped && inheritedAes) {\n for (const name of this.groupNames) {\n const c = inheritedAes[name]?.fillColor;\n if (c) this.colorMap.set(name, c);\n }\n }\n\n // Concrete bar color for the ungrouped path. When fillColor is a\n // MappingLink (grouped), Chart.tsx routes the unified ribbon through\n // AGGREGATE_RIBBON_COLOR instead, so this value is only consulted as a\n // (rare) colorMap-miss fallback in the active-group branch.\n this.solidColor = isMappedFill ? AGGREGATE_RIBBON_COLOR : fillColor;\n }\n\n createAxisLabels(xAxis: SelectionXAxisSettings) {\n const tm = new TextMeasurer('500 14px Manrope');\n const facetKeys = this.orderedFaceted.facetKeys;\n\n let maxLabelPx = 0;\n for (const fk of facetKeys) {\n for (const name of this.orderedFaceted.byFacet[fk]?.filterNames ?? []) {\n maxLabelPx = Math.max(maxLabelPx, tm.getTextWidth(name));\n }\n }\n this.maxLabelPx = maxLabelPx;\n this.xLabelsPosition = xAxis.labelsPosition ?? '45deg';\n const rotateLabels = this.xLabelsPosition !== 'center';\n\n // labels = filter name per gap (N); counts = population total per bar (N+1).\n // Centered labels wrap to two lines; rotated stay on one.\n this.xLabelsByFacet = {};\n this.xCountsByFacet = {};\n this.maxLabelLines = 1;\n for (const fk of facetKeys) {\n const facetData = this.orderedFaceted.byFacet[fk];\n const labels: Record<string, string[]> = {};\n const counts: Record<string, string> = {};\n for (const [gapIndex, name] of (facetData?.filterNames ?? []).entries()) {\n const lines = rotateLabels\n ? [name]\n : splitTextByWidth(name, LABEL_WRAP_WIDTH_PX, LABEL_LINE_HEIGHT_PX);\n labels[String(gapIndex)] = lines;\n this.maxLabelLines = Math.max(this.maxLabelLines, lines.length);\n }\n for (const [barIndex, stage] of (facetData?.stages ?? []).entries()) {\n counts[String(barIndex)] = formatCount(stage.total);\n }\n this.xLabelsByFacet[fk] = labels;\n this.xCountsByFacet[fk] = counts;\n }\n }\n\n updateCaptionsSize(xAxis: SelectionXAxisSettings, yAxis: SelectionYAxisSettings) {\n const tm = new TextMeasurer('500 14px Manrope');\n\n // Y axis: when labels are hidden, drop tick-label width AND most of the\n // tick reserve (room for tick mark + offset + axis-title clearance).\n // Histogram pattern: hidden → just tick-mark size, no offset.\n if (yAxis.hiddenLabels) {\n this.yTickWidth = 0;\n this.yTickReserve = yAxis.showTicks ? 4 : 0;\n } else {\n // \"100%\" is the widest formatPercent output for selection's [0, 100]\n // Y scale, regardless of d3's tick count choice.\n this.yTickWidth = tm.getTextWidth(formatPercent(100));\n this.yTickReserve = Y_TICK_RESERVE;\n }\n\n // X axis: same gating for label height block + the gap above the label.\n if (xAxis.hiddenLabels) {\n this.labelBlock = 0;\n this.xLabelTopReserve = xAxis.showTicks ? 4 : 0;\n } else {\n const rotateLabels = this.xLabelsPosition !== 'center';\n this.labelBlock = !rotateLabels\n ? this.maxLabelLines * AXIS_LABEL_LINE_HEIGHT\n : this.xLabelsPosition === '45deg'\n ? Math.ceil(this.maxLabelPx * 0.71) + 10\n : Math.ceil(this.maxLabelPx) + 10;\n this.xLabelTopReserve = X_LABEL_TOP_PAD;\n }\n\n this.xTitleHeight = xAxis.title ? AXIS_LABEL_LINE_HEIGHT + 6 : 0;\n this.yTitleWidth = yAxis.title ? AXIS_LABEL_LINE_HEIGHT + 4 : 0;\n }\n\n updateChartDimensions() {\n // Axis paddings: full = reserve space for labels/title; slim = MIN_PADDING.\n // Selection always uses edge-only axes when faceted (stages and Y range\n // are structurally identical across cells), mirroring histogram's layout.\n this.fullLeftPad = this.yTitleWidth + this.yTickWidth + this.yTickReserve;\n this.fullBottomPad = this.xLabelTopReserve + this.labelBlock + this.xTitleHeight;\n // topPad reserves only the count-label strip above each bar — vertical\n // breathing room between rows comes from `cellLabelHeight` (facet title)\n // + the previous row's `bottomPad`. Adding MIN_MARGIN here would\n // double-count that gap and the stacked padding looks too loose\n // compared to histogram/discrete.\n this.topPad = COUNT_LINE_HEIGHT + X_COUNT_BOTTOM_PAD;\n this.rightPad = MIN_PADDING;\n\n // Per-column / per-row paddings. When faceted, only col 0 reserves the\n // full Y-axis space and only the row(s) hosting bottom-edge cells reserve\n // full X-axis-label space; other cells use MIN_PADDING. Non-faceted (a\n // single cell) reserves both axes for that one cell.\n this.colLeftPads = Array.from({ length: this.nCols }, (_, c) =>\n !this.isFaceted || c === 0 ? this.fullLeftPad : MIN_PADDING,\n );\n // A row is \"bottom-edge\" if it's the last row, or it's nRows-2 in a\n // ragged grid (some columns have only nRows-1 cells, so their last cell\n // sits in row nRows-2 and needs the X-axis label space).\n const n = this.orderedFaceted.facetKeys.length;\n const isRagged = n % this.nCols !== 0;\n this.rowBottomPads = Array.from({ length: this.nRows }, (_, r) => {\n const isBottomRow = r === this.nRows - 1 || (r === this.nRows - 2 && isRagged);\n return !this.isFaceted || isBottomRow ? this.fullBottomPad : MIN_PADDING;\n });\n\n this.colXOffsets = [0];\n for (const [c, leftPad] of this.colLeftPads.entries()) {\n this.colXOffsets.push(this.colXOffsets[c] + leftPad + this.cellPlotWidth + this.rightPad);\n }\n this.rowYOffsets = [0];\n for (const [r, bottomPad] of this.rowBottomPads.entries()) {\n this.rowYOffsets.push(\n this.rowYOffsets[r] + this.topPad + this.cellLabelHeight + this.cellPlotHeight + bottomPad,\n );\n }\n this.gridWidth = this.colXOffsets[this.nCols];\n this.gridHeight = this.rowYOffsets[this.nRows];\n }\n\n updateLegendSize(showLegend: boolean, grouping: GroupingSettings | undefined) {\n if (!showLegend || !this.grouped || this.groupNames.length === 0) {\n this.legend = { width: 0, height: 0, items: [] };\n return;\n }\n const legendItems: LegendItem[] = [\n {\n id: 'selection-group',\n type: 'discreteColor',\n title: grouping?.columnName.label ?? grouping?.columnName.value ?? '',\n width: 0,\n height: 0,\n left: 0,\n top: 0,\n values: this.groupNames,\n scale: scaleOrdinal<string, string>()\n .domain(this.groupNames)\n .range(this.groupNames.map((n) => this.colorMap.get(n) ?? '')),\n labels: Object.fromEntries(\n this.groupNames.map((n) => [\n n,\n n === 'null' ? (grouping?.columnName.nullValueLabel ?? 'N/A') : n,\n ]),\n ),\n },\n ];\n // Legend height matches the grid's plot-body strip, like discrete.\n const arranged = arrangeLegendParts(legendItems, this.cellPlotHeight);\n const maxRight = arranged.reduce((m, it) => Math.max(m, it.left + it.width), 0);\n this.legend = { width: maxRight + MIN_MARGIN, height: this.cellPlotHeight, items: arranged };\n }\n\n createMainTitle(title: string, showTitle: boolean) {\n this.mainTitle =\n showTitle && title ? splitTextByWidth(title, Math.max(this.cellPlotWidth, 40), 20) : [];\n }\n\n updateMargins() {\n const titleBlock =\n this.mainTitle.length > 0 ? this.mainTitle.length * TITLE_LINE_HEIGHT + TITLE_MARGIN * 2 : 0;\n this.margins = {\n top: Math.max(titleBlock, MIN_MARGIN),\n bottom: MIN_MARGIN,\n left: MIN_MARGIN,\n right: MIN_MARGIN + this.legend.width,\n };\n this.totalWidth = this.margins.left + this.gridWidth + this.margins.right;\n this.totalHeight = this.margins.top + this.gridHeight + this.margins.bottom;\n }\n\n render({\n faceted,\n facetLabels,\n width,\n height,\n title,\n showTitle,\n grouping,\n showLegend,\n facetBy,\n facetSettings,\n xAxis,\n yAxis,\n frame,\n titlePosition,\n fillColor,\n opacity,\n }: {\n faceted: FacetedSelectionData;\n facetLabels: Record<string, string[]>;\n width: number;\n height: number;\n title: string;\n showTitle: boolean;\n grouping: GroupingSettings | undefined;\n showLegend: boolean;\n facetBy: ColumnName[];\n facetSettings: SelectionSettingsImpl['facetSettings'];\n xAxis: SelectionXAxisSettings;\n yAxis: SelectionYAxisSettings;\n frame: FrameType;\n titlePosition: TitlePosition;\n fillColor: SelectionFillColor;\n opacity: number;\n }) {\n this.updateChartSizes(width, height);\n this.updateGrid({ faceted, facetLabels, facetBy, facetSettings });\n this.updateGroupingMaps(grouping, fillColor);\n this.createAxisLabels(xAxis);\n this.updateCaptionsSize(xAxis, yAxis);\n this.updateChartDimensions();\n this.updateLegendSize(showLegend, grouping);\n this.createMainTitle(title, showTitle);\n this.updateMargins();\n\n const component = (\n <ChartsGroup\n facetData={{\n faceted: this.orderedFaceted,\n facetLabels: this.facetLabels,\n facetTitles: this.facetTitles,\n }}\n gridLayout={{\n nRows: this.nRows,\n nCols: this.nCols,\n totalWidth: this.totalWidth,\n totalHeight: this.totalHeight,\n margins: this.margins,\n cellPlotWidth: this.cellPlotWidth,\n cellPlotHeight: this.cellPlotHeight,\n cellLabelHeight: this.cellLabelHeight,\n topPad: this.topPad,\n rightPad: this.rightPad,\n colLeftPads: this.colLeftPads,\n rowBottomPads: this.rowBottomPads,\n colXOffsets: this.colXOffsets,\n rowYOffsets: this.rowYOffsets,\n sharedX: this.isFaceted,\n sharedY: this.isFaceted,\n }}\n xAxis={{\n labelsByFacet: this.xLabelsByFacet,\n countsByFacet: this.xCountsByFacet,\n countsFontSize: 14,\n labelsPosition: this.xLabelsPosition,\n showTicks: xAxis.showTicks,\n hiddenLabels: xAxis.hiddenLabels,\n title: xAxis.title,\n }}\n yAxis={{\n showGrid: yAxis.showGrid,\n showTicks: yAxis.showTicks,\n hiddenLabels: yAxis.hiddenLabels,\n title: yAxis.title,\n }}\n style={{\n frameType: this.isFaceted ? 'full' : frame,\n barColor: this.solidColor,\n opacity,\n colorMap: this.colorMap,\n nullValueLabel: grouping?.columnName.nullValueLabel,\n }}\n title={{\n text: this.mainTitle,\n show: this.mainTitle.length > 0,\n position: titlePosition,\n }}\n legend={this.legend}\n showFacetLabels={this.isFaceted}\n grouped={this.grouped}\n orderedGroupNames={this.groupNames}\n />\n );\n this.component = component;\n this.reactRoot?.render(component);\n }\n\n renderError(message: string) {\n this.reactRoot?.render(<Error message={message} />);\n }\n}\n\nexport default ChartRenderer;\n"],"mappings":";;;;;;;;;;;AAwCA,IAAM,IAAN,MAAoB;CAClB,YAAyB;CACzB,aAAiC;CACjC,WAA+B;CAC/B,YAA0B,kBAAA,GAAA,EAAK,CAAA;CAG/B,gBAAgB;CAChB,iBAAiB;CAGjB,QAAQ;CACR,QAAQ;CACR,YAAY;CACZ,kBAAkB;CAClB,iBAAuC;EAAE,WAAW,EAAE;EAAE,SAAS,EAAE;EAAE,YAAY,EAAE;EAAE;CACrF,cAAwC,EAAE;CAE1C,cAAwC,EAAE;CAG1C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;AAGJ,EADA,KAAK,YAAY,GACjB,KAAK,WAAW,OAAO,EAAU;;CAGnC,YAAY,GAAiB;AAC3B,OAAK,WAAW,OAAO,kBAAC,GAAD,EAAgB,YAAW,CAAA,CAAC"}
@@ -6,7 +6,6 @@ export type SelectionFillColor = string | {
6
6
  };
7
7
  export type SelectionXAxisSettings = {
8
8
  title: string;
9
- showGrid: boolean;
10
9
  showTicks: boolean;
11
10
  hiddenLabels: boolean;
12
11
  labelsPosition: 'center' | '45deg' | '90deg' | null;
@@ -1 +1 @@
1
- {"version":3,"file":"SelectionSettingsImpl.d.ts","sourceRoot":"","sources":["../../src/selection/SelectionSettingsImpl.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,SAAS,EACT,UAAU,EACV,SAAS,EACT,SAAS,EACT,iBAAiB,EACjB,aAAa,EACd,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3E,MAAM,MAAM,sBAAsB,GAAG;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;IACtB,cAAc,EAAE,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,IAAI,CAAC;CACrD,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,qBAAa,qBAAsB,YAAW,iBAAiB;IAC7D,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,eAAe;IA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EAAE,OAAO,CAAC;QAAC,QAAQ,EAAE,aAAa,CAAA;KAAE,CAAC;IACzE,QAAQ,CAAC,KAAK,EAAE,sBAAsB,CAAC;IACvC,QAAQ,CAAC,KAAK,EAAE,sBAAsB,CAAC;IACvC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAE1B,QAAQ,CAAC,SAAS,EAAE,kBAAkB,CAAC;IACvC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;gBAErC,QAAQ,EAAE,iBAAiB;CA2CxC"}
@@ -27,7 +27,6 @@ var n = class {
27
27
  position: n.title.position ?? "center"
28
28
  }, this.xAxis = {
29
29
  title: n.xAxis?.title ?? "",
30
- showGrid: n.xAxis?.showGrid ?? !1,
31
30
  showTicks: n.xAxis?.showTicks ?? !0,
32
31
  hiddenLabels: n.xAxis?.hiddenLabels ?? !1,
33
32
  labelsPosition: n.xAxis?.labelsPosition ?? null
@@ -1 +1 @@
1
- {"version":3,"file":"SelectionSettingsImpl.js","names":[],"sources":["../../src/selection/SelectionSettingsImpl.ts"],"sourcesContent":["import lodash from 'lodash';\n\nimport type {\n AesRecord,\n ColumnName,\n DataValue,\n FrameType,\n SettingsInterface,\n TitlePosition,\n} from '../types';\nimport { SelectionSettingsSchema } from '../types/selection';\nimport type { SelectionSettings } from '../types/selection';\n\nexport type SelectionFillColor = string | { type: string; value?: string };\n\nexport type SelectionXAxisSettings = {\n title: string;\n showGrid: boolean;\n showTicks: boolean;\n hiddenLabels: boolean;\n labelsPosition: 'center' | '45deg' | '90deg' | null;\n};\n\nexport type SelectionYAxisSettings = {\n title: string;\n showGrid: boolean;\n showTicks: boolean;\n hiddenLabels: boolean;\n};\n\nexport class SelectionSettingsImpl implements SettingsInterface {\n readonly id: string;\n readonly type = 'selection';\n\n readonly selectionStage: ColumnName;\n readonly weight: ColumnName | undefined;\n\n readonly grouping:\n | {\n columnName: ColumnName;\n order?: DataValue[];\n inheritedAes?: AesRecord;\n }\n | undefined;\n readonly showLegend: boolean;\n\n readonly facetBy: ColumnName[];\n readonly facetSettings: {\n order?: string[];\n nRows?: number;\n nCols?: number;\n };\n\n readonly title: { name: string; show: boolean; position: TitlePosition };\n readonly xAxis: SelectionXAxisSettings;\n readonly yAxis: SelectionYAxisSettings;\n readonly frame: FrameType;\n\n readonly fillColor: SelectionFillColor;\n readonly opacity: number;\n readonly size: { width: number; height: number };\n\n constructor(settings: SelectionSettings) {\n SelectionSettingsSchema.parse(settings);\n this.id = lodash.uniqueId('settings');\n\n this.selectionStage = settings.selectionStage;\n this.weight = settings.weight;\n this.grouping = settings.grouping;\n this.showLegend = settings.legend?.show ?? true;\n\n this.facetBy = settings.facetBy ?? [];\n this.facetSettings = {\n order: settings.facetSettings?.order,\n nRows: settings.facetSettings?.nRows,\n nCols: settings.facetSettings?.nCols,\n };\n\n this.title = {\n name: settings.title.name,\n show: settings.title.show ?? true,\n position: settings.title.position ?? 'center',\n };\n\n this.xAxis = {\n title: settings.xAxis?.title ?? '',\n showGrid: settings.xAxis?.showGrid ?? false,\n showTicks: settings.xAxis?.showTicks ?? true,\n hiddenLabels: settings.xAxis?.hiddenLabels ?? false,\n labelsPosition: settings.xAxis?.labelsPosition ?? null,\n };\n this.yAxis = {\n title: settings.yAxis?.title ?? '',\n showGrid: settings.yAxis?.showGrid ?? true,\n showTicks: settings.yAxis?.showTicks ?? true,\n hiddenLabels: settings.yAxis?.hiddenLabels ?? false,\n };\n this.frame = settings.frame?.type ?? 'left-bottom';\n this.fillColor = settings.fillColor;\n this.opacity = settings.opacity ?? 1;\n\n this.size = {\n width: settings.size?.width ?? 800,\n height: settings.size?.height ?? 500,\n };\n }\n}\n"],"mappings":";;AA8BA,IAAa,IAAb,MAAgE;CAC9D;CACA,OAAgB;CAEhB;CACA;CAEA;CAOA;CAEA;CACA;CAMA;CACA;CACA;CACA;CAEA;CACA;CACA;CAEA,YAAY,GAA6B;AAuCvC,EAtCA,EAAwB,MAAM,EAAS,EACvC,KAAK,KAAK,EAAO,SAAS,WAAW,EAErC,KAAK,iBAAiB,EAAS,gBAC/B,KAAK,SAAS,EAAS,QACvB,KAAK,WAAW,EAAS,UACzB,KAAK,aAAa,EAAS,QAAQ,QAAQ,IAE3C,KAAK,UAAU,EAAS,WAAW,EAAE,EACrC,KAAK,gBAAgB;GACnB,OAAO,EAAS,eAAe;GAC/B,OAAO,EAAS,eAAe;GAC/B,OAAO,EAAS,eAAe;GAChC,EAED,KAAK,QAAQ;GACX,MAAM,EAAS,MAAM;GACrB,MAAM,EAAS,MAAM,QAAQ;GAC7B,UAAU,EAAS,MAAM,YAAY;GACtC,EAED,KAAK,QAAQ;GACX,OAAO,EAAS,OAAO,SAAS;GAChC,UAAU,EAAS,OAAO,YAAY;GACtC,WAAW,EAAS,OAAO,aAAa;GACxC,cAAc,EAAS,OAAO,gBAAgB;GAC9C,gBAAgB,EAAS,OAAO,kBAAkB;GACnD,EACD,KAAK,QAAQ;GACX,OAAO,EAAS,OAAO,SAAS;GAChC,UAAU,EAAS,OAAO,YAAY;GACtC,WAAW,EAAS,OAAO,aAAa;GACxC,cAAc,EAAS,OAAO,gBAAgB;GAC/C,EACD,KAAK,QAAQ,EAAS,OAAO,QAAQ,eACrC,KAAK,YAAY,EAAS,WAC1B,KAAK,UAAU,EAAS,WAAW,GAEnC,KAAK,OAAO;GACV,OAAO,EAAS,MAAM,SAAS;GAC/B,QAAQ,EAAS,MAAM,UAAU;GAClC"}
1
+ {"version":3,"file":"SelectionSettingsImpl.js","names":[],"sources":["../../src/selection/SelectionSettingsImpl.ts"],"sourcesContent":["import lodash from 'lodash';\n\nimport type {\n AesRecord,\n ColumnName,\n DataValue,\n FrameType,\n SettingsInterface,\n TitlePosition,\n} from '../types';\nimport { SelectionSettingsSchema } from '../types/selection';\nimport type { SelectionSettings } from '../types/selection';\n\nexport type SelectionFillColor = string | { type: string; value?: string };\n\nexport type SelectionXAxisSettings = {\n title: string;\n showTicks: boolean;\n hiddenLabels: boolean;\n labelsPosition: 'center' | '45deg' | '90deg' | null;\n};\n\nexport type SelectionYAxisSettings = {\n title: string;\n showGrid: boolean;\n showTicks: boolean;\n hiddenLabels: boolean;\n};\n\nexport class SelectionSettingsImpl implements SettingsInterface {\n readonly id: string;\n readonly type = 'selection';\n\n readonly selectionStage: ColumnName;\n readonly weight: ColumnName | undefined;\n\n readonly grouping:\n | {\n columnName: ColumnName;\n order?: DataValue[];\n inheritedAes?: AesRecord;\n }\n | undefined;\n readonly showLegend: boolean;\n\n readonly facetBy: ColumnName[];\n readonly facetSettings: {\n order?: string[];\n nRows?: number;\n nCols?: number;\n };\n\n readonly title: { name: string; show: boolean; position: TitlePosition };\n readonly xAxis: SelectionXAxisSettings;\n readonly yAxis: SelectionYAxisSettings;\n readonly frame: FrameType;\n\n readonly fillColor: SelectionFillColor;\n readonly opacity: number;\n readonly size: { width: number; height: number };\n\n constructor(settings: SelectionSettings) {\n SelectionSettingsSchema.parse(settings);\n this.id = lodash.uniqueId('settings');\n\n this.selectionStage = settings.selectionStage;\n this.weight = settings.weight;\n this.grouping = settings.grouping;\n this.showLegend = settings.legend?.show ?? true;\n\n this.facetBy = settings.facetBy ?? [];\n this.facetSettings = {\n order: settings.facetSettings?.order,\n nRows: settings.facetSettings?.nRows,\n nCols: settings.facetSettings?.nCols,\n };\n\n this.title = {\n name: settings.title.name,\n show: settings.title.show ?? true,\n position: settings.title.position ?? 'center',\n };\n\n this.xAxis = {\n title: settings.xAxis?.title ?? '',\n showTicks: settings.xAxis?.showTicks ?? true,\n hiddenLabels: settings.xAxis?.hiddenLabels ?? false,\n labelsPosition: settings.xAxis?.labelsPosition ?? null,\n };\n this.yAxis = {\n title: settings.yAxis?.title ?? '',\n showGrid: settings.yAxis?.showGrid ?? true,\n showTicks: settings.yAxis?.showTicks ?? true,\n hiddenLabels: settings.yAxis?.hiddenLabels ?? false,\n };\n this.frame = settings.frame?.type ?? 'left-bottom';\n this.fillColor = settings.fillColor;\n this.opacity = settings.opacity ?? 1;\n\n this.size = {\n width: settings.size?.width ?? 800,\n height: settings.size?.height ?? 500,\n };\n }\n}\n"],"mappings":";;AA6BA,IAAa,IAAb,MAAgE;CAC9D;CACA,OAAgB;CAEhB;CACA;CAEA;CAOA;CAEA;CACA;CAMA;CACA;CACA;CACA;CAEA;CACA;CACA;CAEA,YAAY,GAA6B;AAsCvC,EArCA,EAAwB,MAAM,EAAS,EACvC,KAAK,KAAK,EAAO,SAAS,WAAW,EAErC,KAAK,iBAAiB,EAAS,gBAC/B,KAAK,SAAS,EAAS,QACvB,KAAK,WAAW,EAAS,UACzB,KAAK,aAAa,EAAS,QAAQ,QAAQ,IAE3C,KAAK,UAAU,EAAS,WAAW,EAAE,EACrC,KAAK,gBAAgB;GACnB,OAAO,EAAS,eAAe;GAC/B,OAAO,EAAS,eAAe;GAC/B,OAAO,EAAS,eAAe;GAChC,EAED,KAAK,QAAQ;GACX,MAAM,EAAS,MAAM;GACrB,MAAM,EAAS,MAAM,QAAQ;GAC7B,UAAU,EAAS,MAAM,YAAY;GACtC,EAED,KAAK,QAAQ;GACX,OAAO,EAAS,OAAO,SAAS;GAChC,WAAW,EAAS,OAAO,aAAa;GACxC,cAAc,EAAS,OAAO,gBAAgB;GAC9C,gBAAgB,EAAS,OAAO,kBAAkB;GACnD,EACD,KAAK,QAAQ;GACX,OAAO,EAAS,OAAO,SAAS;GAChC,UAAU,EAAS,OAAO,YAAY;GACtC,WAAW,EAAS,OAAO,aAAa;GACxC,cAAc,EAAS,OAAO,gBAAgB;GAC/C,EACD,KAAK,QAAQ,EAAS,OAAO,QAAQ,eACrC,KAAK,YAAY,EAAS,WAC1B,KAAK,UAAU,EAAS,WAAW,GAEnC,KAAK,OAAO;GACV,OAAO,EAAS,MAAM,SAAS;GAC/B,QAAQ,EAAS,MAAM,UAAU;GAClC"}
@@ -4,7 +4,7 @@ import { toPercent as t } from "../../../utils.js";
4
4
  import { memo as n } from "react";
5
5
  import { Fragment as r, jsx as i, jsxs as a } from "react/jsx-runtime";
6
6
  const o = n(function({ common: n, facetActiveGroup: o, color: s, onGroupClick: c }) {
7
- let { stageIndex: l, stage: u, geometry: d, layerOpacity: f, tooltip: p } = n, { left: m, width: h, centerX: g, height: _, yScale: v } = d, y = u.groups.find((e) => e.name === o), b = y?.surviving ?? 0, x = b + (y?.discarded ?? 0);
7
+ let { stageIndex: l, stage: u, geometry: d, layerOpacity: f, tooltip: p } = n, { left: m, width: h, centerX: g, height: _, yScale: v } = d, y = u.groups.get(o), b = y?.surviving ?? 0, x = b + (y?.discarded ?? 0);
8
8
  if (x <= 0) return null;
9
9
  let S = v(t(x / u.total)), C = v(t(b / u.total)), w = C - S, T = _ - C, E = e((e, t) => {
10
10
  p.onEnter({
@@ -1 +1 @@
1
- {"version":3,"file":"GroupSelectedBars.js","names":[],"sources":["../../../../../src/selection/components/Chart/Bars/GroupSelectedBars.tsx"],"sourcesContent":["import { memo } from 'react';\n\nimport { useFunction } from '../../../../utils/hooks/useFunction';\nimport { DESATURATE_ALPHA, DIVIDER_STROKE } from '../../../constants';\nimport { toPercent } from '../../../utils';\nimport type { BarsCommon } from '../types';\n\n// Group-selected bars: only the active group is drawn, with its preserved /\n// discarded segments at actual heights and a dashed divider between them.\nexport const GroupSelectedBars = memo(function GroupSelectedBars({\n common,\n facetActiveGroup,\n color,\n onGroupClick,\n}: {\n common: BarsCommon;\n facetActiveGroup: string;\n color: string;\n onGroupClick: (name: string) => void;\n}) {\n const { stageIndex, stage, geometry, layerOpacity, tooltip } = common;\n const { left, width, centerX, height, yScale } = geometry;\n\n const groupData = stage.groups.find((g) => g.name === facetActiveGroup);\n const gSurviving = groupData?.surviving ?? 0;\n const gDiscarded = groupData?.discarded ?? 0;\n const gTotal = gSurviving + gDiscarded;\n if (gTotal <= 0) return null;\n\n const yOverlayTop = yScale(toPercent(gTotal / stage.total));\n const ySurvivingTop = yScale(toPercent(gSurviving / stage.total));\n const discardedHeight = ySurvivingTop - yOverlayTop;\n const preservedHeight = height - ySurvivingTop;\n\n const handleEnter = useFunction((section: 'preserved' | 'discarded', anchorY: number) => {\n tooltip.onEnter({\n stageIndex,\n section,\n stage,\n anchorX: centerX,\n anchorY,\n groupName: facetActiveGroup,\n });\n });\n const handleClick = useFunction(() => onGroupClick(facetActiveGroup));\n\n return (\n <>\n {discardedHeight > 0 && (\n <rect\n x={left}\n y={yOverlayTop}\n width={width}\n height={discardedHeight}\n fill={color}\n opacity={DESATURATE_ALPHA * layerOpacity}\n onMouseEnter={() => handleEnter('discarded', yOverlayTop + discardedHeight / 2)}\n onMouseLeave={tooltip.onLeave}\n onClick={handleClick}\n style={{ cursor: 'pointer' }}\n />\n )}\n {preservedHeight > 0 && (\n <rect\n x={left}\n y={ySurvivingTop}\n width={width}\n height={preservedHeight}\n fill={color}\n opacity={layerOpacity}\n onMouseEnter={() => handleEnter('preserved', ySurvivingTop + preservedHeight / 2)}\n onMouseLeave={tooltip.onLeave}\n onClick={handleClick}\n style={{ cursor: 'pointer' }}\n />\n )}\n {discardedHeight > 0 && preservedHeight > 0 && (\n <line\n x1={left}\n y1={ySurvivingTop}\n x2={left + width}\n y2={ySurvivingTop}\n stroke={DIVIDER_STROKE}\n strokeWidth={1}\n strokeDasharray=\"4,3\"\n />\n )}\n </>\n );\n});\n"],"mappings":";;;;;AASA,MAAa,IAAoB,EAAK,SAA2B,EAC/D,WACA,qBACA,UACA,mBAMC;CACD,IAAM,EAAE,eAAY,UAAO,aAAU,iBAAc,eAAY,GACzD,EAAE,SAAM,UAAO,YAAS,WAAQ,cAAW,GAE3C,IAAY,EAAM,OAAO,MAAM,MAAM,EAAE,SAAS,EAAiB,EACjE,IAAa,GAAW,aAAa,GAErC,IAAS,KADI,GAAW,aAAa;AAE3C,KAAI,KAAU,EAAG,QAAO;CAExB,IAAM,IAAc,EAAO,EAAU,IAAS,EAAM,MAAM,CAAC,EACrD,IAAgB,EAAO,EAAU,IAAa,EAAM,MAAM,CAAC,EAC3D,IAAkB,IAAgB,GAClC,IAAkB,IAAS,GAE3B,IAAc,GAAa,GAAoC,MAAoB;AACvF,IAAQ,QAAQ;GACd;GACA;GACA;GACA,SAAS;GACT;GACA,WAAW;GACZ,CAAC;GACF,EACI,IAAc,QAAkB,EAAa,EAAiB,CAAC;AAErE,QACE,kBAAA,GAAA,EAAA,UAAA;EACG,IAAkB,KACjB,kBAAC,QAAD;GACE,GAAG;GACH,GAAG;GACI;GACP,QAAQ;GACR,MAAM;GACN,SAAA,KAA4B;GAC5B,oBAAoB,EAAY,aAAa,IAAc,IAAkB,EAAE;GAC/E,cAAc,EAAQ;GACtB,SAAS;GACT,OAAO,EAAE,QAAQ,WAAW;GAC5B,CAAA;EAEH,IAAkB,KACjB,kBAAC,QAAD;GACE,GAAG;GACH,GAAG;GACI;GACP,QAAQ;GACR,MAAM;GACN,SAAS;GACT,oBAAoB,EAAY,aAAa,IAAgB,IAAkB,EAAE;GACjF,cAAc,EAAQ;GACtB,SAAS;GACT,OAAO,EAAE,QAAQ,WAAW;GAC5B,CAAA;EAEH,IAAkB,KAAK,IAAkB,KACxC,kBAAC,QAAD;GACE,IAAI;GACJ,IAAI;GACJ,IAAI,IAAO;GACX,IAAI;GACJ,QAAA;GACA,aAAa;GACb,iBAAgB;GAChB,CAAA;EAEH,EAAA,CAAA;EAEL"}
1
+ {"version":3,"file":"GroupSelectedBars.js","names":[],"sources":["../../../../../src/selection/components/Chart/Bars/GroupSelectedBars.tsx"],"sourcesContent":["import { memo } from 'react';\n\nimport { useFunction } from '../../../../utils/hooks/useFunction';\nimport { DESATURATE_ALPHA, DIVIDER_STROKE } from '../../../constants';\nimport { toPercent } from '../../../utils';\nimport type { BarsCommon } from '../types';\n\n// Group-selected bars: only the active group is drawn, with its preserved /\n// discarded segments at actual heights and a dashed divider between them.\nexport const GroupSelectedBars = memo(function GroupSelectedBars({\n common,\n facetActiveGroup,\n color,\n onGroupClick,\n}: {\n common: BarsCommon;\n facetActiveGroup: string;\n color: string;\n onGroupClick: (name: string) => void;\n}) {\n const { stageIndex, stage, geometry, layerOpacity, tooltip } = common;\n const { left, width, centerX, height, yScale } = geometry;\n\n const groupData = stage.groups.get(facetActiveGroup);\n const gSurviving = groupData?.surviving ?? 0;\n const gDiscarded = groupData?.discarded ?? 0;\n const gTotal = gSurviving + gDiscarded;\n if (gTotal <= 0) return null;\n\n const yOverlayTop = yScale(toPercent(gTotal / stage.total));\n const ySurvivingTop = yScale(toPercent(gSurviving / stage.total));\n const discardedHeight = ySurvivingTop - yOverlayTop;\n const preservedHeight = height - ySurvivingTop;\n\n const handleEnter = useFunction((section: 'preserved' | 'discarded', anchorY: number) => {\n tooltip.onEnter({\n stageIndex,\n section,\n stage,\n anchorX: centerX,\n anchorY,\n groupName: facetActiveGroup,\n });\n });\n const handleClick = useFunction(() => onGroupClick(facetActiveGroup));\n\n return (\n <>\n {discardedHeight > 0 && (\n <rect\n x={left}\n y={yOverlayTop}\n width={width}\n height={discardedHeight}\n fill={color}\n opacity={DESATURATE_ALPHA * layerOpacity}\n onMouseEnter={() => handleEnter('discarded', yOverlayTop + discardedHeight / 2)}\n onMouseLeave={tooltip.onLeave}\n onClick={handleClick}\n style={{ cursor: 'pointer' }}\n />\n )}\n {preservedHeight > 0 && (\n <rect\n x={left}\n y={ySurvivingTop}\n width={width}\n height={preservedHeight}\n fill={color}\n opacity={layerOpacity}\n onMouseEnter={() => handleEnter('preserved', ySurvivingTop + preservedHeight / 2)}\n onMouseLeave={tooltip.onLeave}\n onClick={handleClick}\n style={{ cursor: 'pointer' }}\n />\n )}\n {discardedHeight > 0 && preservedHeight > 0 && (\n <line\n x1={left}\n y1={ySurvivingTop}\n x2={left + width}\n y2={ySurvivingTop}\n stroke={DIVIDER_STROKE}\n strokeWidth={1}\n strokeDasharray=\"4,3\"\n />\n )}\n </>\n );\n});\n"],"mappings":";;;;;AASA,MAAa,IAAoB,EAAK,SAA2B,EAC/D,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["../../../../../src/selection/components/Chart/Bars/StackedBars.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAe,MAAM,OAAO,CAAC;AAKpC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAI3C,eAAO,MAAM,WAAW;YASd,UAAU;gBACN,MAAM,EAAE;cACV,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;mBACd,MAAM;kBACP,MAAM,GAAG,IAAI;kBACb,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI;kBAC7B,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI;EA+EpC,CAAC"}
1
+ {"version":3,"file":"StackedBars.d.ts","sourceRoot":"","sources":["../../../../../src/selection/components/Chart/Bars/StackedBars.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAe,MAAM,OAAO,CAAC;AAKpC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAI3C,eAAO,MAAM,WAAW;YASd,UAAU;gBACN,MAAM,EAAE;cACV,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;mBACd,MAAM;kBACP,MAAM,GAAG,IAAI;kBACb,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI;kBAC7B,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI;EA8EpC,CAAC"}
@@ -15,16 +15,16 @@ const c = i(function({ common: i, stackOrder: c, colorMap: l, fallbackColor: u,
15
15
  });
16
16
  }), T = e(() => {
17
17
  f(null), v.onLeave();
18
- }), E = e((e) => p(e)), D = new Map(h.groups.map((e) => [e.name, e])), O = h.total > 0 ? C(r(h.surviving / h.total)) : S, k = [], A = [], j = O, M = 0;
18
+ }), E = e((e) => p(e)), D = h.total > 0 ? C(r(h.surviving / h.total)) : S, O = [], k = [], A = D, j = 0;
19
19
  for (let e of c) {
20
- let r = D.get(e);
20
+ let r = h.groups.get(e);
21
21
  if (!r) continue;
22
22
  let i = r.surviving / h.total * S, a = r.discarded / h.total * S, s = d && d !== e;
23
23
  if (i > 0) {
24
- let t = j + i / 2;
25
- k.push(/* @__PURE__ */ o("rect", {
24
+ let t = A + i / 2;
25
+ O.push(/* @__PURE__ */ o("rect", {
26
26
  x: y,
27
- y: j,
27
+ y: A,
28
28
  width: b,
29
29
  height: i,
30
30
  fill: l.get(e) ?? u,
@@ -33,13 +33,13 @@ const c = i(function({ common: i, stackOrder: c, colorMap: l, fallbackColor: u,
33
33
  onMouseLeave: T,
34
34
  onClick: () => E(e),
35
35
  style: { cursor: "pointer" }
36
- }, `bar-p-${m}-${e}`)), j += i;
36
+ }, `bar-p-${m}-${e}`)), A += i;
37
37
  }
38
38
  if (a > 0) {
39
- let r = M + a / 2;
40
- A.push(/* @__PURE__ */ o("rect", {
39
+ let r = j + a / 2;
40
+ k.push(/* @__PURE__ */ o("rect", {
41
41
  x: y,
42
- y: M,
42
+ y: j,
43
43
  width: b,
44
44
  height: a,
45
45
  fill: l.get(e) ?? u,
@@ -48,10 +48,10 @@ const c = i(function({ common: i, stackOrder: c, colorMap: l, fallbackColor: u,
48
48
  onMouseLeave: T,
49
49
  onClick: () => E(e),
50
50
  style: { cursor: "pointer" }
51
- }, `bar-d-${m}-${e}`)), M += a;
51
+ }, `bar-d-${m}-${e}`)), j += a;
52
52
  }
53
53
  }
54
- return /* @__PURE__ */ s(a, { children: [k, A] });
54
+ return /* @__PURE__ */ s(a, { children: [O, k] });
55
55
  });
56
56
  export { c as StackedBars };
57
57
 
@@ -1 +1 @@
1
- {"version":3,"file":"StackedBars.js","names":[],"sources":["../../../../../src/selection/components/Chart/Bars/StackedBars.tsx"],"sourcesContent":["import React, { memo } from 'react';\n\nimport { useFunction } from '../../../../utils/hooks/useFunction';\nimport { DESATURATE_ALPHA, DIM_OPACITY } from '../../../constants';\nimport { toPercent } from '../../../utils';\nimport type { BarsCommon } from '../types';\n\n// Stacked-grouped bars: per-group rects above and below the divider, stacked\n// in caller-provided order. Hover dims non-hovered groups.\nexport const StackedBars = memo(function StackedBars({\n common,\n stackOrder,\n colorMap,\n fallbackColor,\n hoveredGroup,\n onGroupHover,\n onGroupClick,\n}: {\n common: BarsCommon;\n stackOrder: string[];\n colorMap: Map<string, string>;\n fallbackColor: string;\n hoveredGroup: string | null;\n onGroupHover: (name: string | null) => void;\n onGroupClick: (name: string) => void;\n}) {\n const { stageIndex, stage, geometry, layerOpacity, tooltip } = common;\n const { left, width, centerX, height, yScale } = geometry;\n\n const handleEnter = useFunction(\n (groupName: string, section: 'preserved' | 'discarded', anchorY: number) => {\n onGroupHover(groupName);\n tooltip.onEnter({ stageIndex, section, stage, anchorX: centerX, anchorY, groupName });\n },\n );\n const handleLeave = useFunction(() => {\n onGroupHover(null);\n tooltip.onLeave();\n });\n const handleClick = useFunction((groupName: string) => onGroupClick(groupName));\n\n const groupByName = new Map(stage.groups.map((g) => [g.name, g]));\n const dividerY = stage.total > 0 ? yScale(toPercent(stage.surviving / stage.total)) : height;\n const preserved: React.JSX.Element[] = [];\n const discarded: React.JSX.Element[] = [];\n // Both halves stack top-to-bottom in stackOrder so a given group appears at\n // the same vertical reading order in preserved and discarded — without this\n // the two halves are mirrored around the divider and the same group ends up\n // adjacent to the divider on both sides.\n let yP = dividerY;\n let yD = 0;\n for (const groupName of stackOrder) {\n const groupData = groupByName.get(groupName);\n if (!groupData) continue;\n const survivingHeight = (groupData.surviving / stage.total) * height;\n const discardedHeight = (groupData.discarded / stage.total) * height;\n const dimmed = hoveredGroup && hoveredGroup !== groupName;\n\n if (survivingHeight > 0) {\n const anchorY = yP + survivingHeight / 2;\n preserved.push(\n <rect\n key={`bar-p-${stageIndex}-${groupName}`}\n x={left}\n y={yP}\n width={width}\n height={survivingHeight}\n fill={colorMap.get(groupName) ?? fallbackColor}\n opacity={(dimmed ? DIM_OPACITY : 1) * layerOpacity}\n onMouseEnter={() => handleEnter(groupName, 'preserved', anchorY)}\n onMouseLeave={handleLeave}\n onClick={() => handleClick(groupName)}\n style={{ cursor: 'pointer' }}\n />,\n );\n yP += survivingHeight;\n }\n if (discardedHeight > 0) {\n const anchorY = yD + discardedHeight / 2;\n discarded.push(\n <rect\n key={`bar-d-${stageIndex}-${groupName}`}\n x={left}\n y={yD}\n width={width}\n height={discardedHeight}\n fill={colorMap.get(groupName) ?? fallbackColor}\n opacity={(dimmed ? DIM_OPACITY : DESATURATE_ALPHA) * layerOpacity}\n onMouseEnter={() => handleEnter(groupName, 'discarded', anchorY)}\n onMouseLeave={handleLeave}\n onClick={() => handleClick(groupName)}\n style={{ cursor: 'pointer' }}\n />,\n );\n yD += discardedHeight;\n }\n }\n return (\n <>\n {preserved}\n {discarded}\n </>\n );\n});\n"],"mappings":";;;;;AASA,MAAa,IAAc,EAAK,SAAqB,EACnD,WACA,eACA,aACA,kBACA,iBACA,iBACA,mBASC;CACD,IAAM,EAAE,eAAY,UAAO,aAAU,iBAAc,eAAY,GACzD,EAAE,SAAM,UAAO,YAAS,WAAQ,cAAW,GAE3C,IAAc,GACjB,GAAmB,GAAoC,MAAoB;AAE1E,EADA,EAAa,EAAU,EACvB,EAAQ,QAAQ;GAAE;GAAY;GAAS;GAAO,SAAS;GAAS;GAAS;GAAW,CAAC;GAExF,EACK,IAAc,QAAkB;AAEpC,EADA,EAAa,KAAK,EAClB,EAAQ,SAAS;GACjB,EACI,IAAc,GAAa,MAAsB,EAAa,EAAU,CAAC,EAEzE,IAAc,IAAI,IAAI,EAAM,OAAO,KAAK,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAC3D,IAAW,EAAM,QAAQ,IAAI,EAAO,EAAU,EAAM,YAAY,EAAM,MAAM,CAAC,GAAG,GAChF,IAAiC,EAAE,EACnC,IAAiC,EAAE,EAKrC,IAAK,GACL,IAAK;AACT,MAAK,IAAM,KAAa,GAAY;EAClC,IAAM,IAAY,EAAY,IAAI,EAAU;AAC5C,MAAI,CAAC,EAAW;EAChB,IAAM,IAAmB,EAAU,YAAY,EAAM,QAAS,GACxD,IAAmB,EAAU,YAAY,EAAM,QAAS,GACxD,IAAS,KAAgB,MAAiB;AAEhD,MAAI,IAAkB,GAAG;GACvB,IAAM,IAAU,IAAK,IAAkB;AAgBvC,GAfA,EAAU,KACR,kBAAC,QAAD;IAEE,GAAG;IACH,GAAG;IACI;IACP,QAAQ;IACR,MAAM,EAAS,IAAI,EAAU,IAAI;IACjC,UAAU,IAAS,IAAc,KAAK;IACtC,oBAAoB,EAAY,GAAW,aAAa,EAAQ;IAChE,cAAc;IACd,eAAe,EAAY,EAAU;IACrC,OAAO,EAAE,QAAQ,WAAW;IAC5B,EAXK,SAAS,EAAW,GAAG,IAW5B,CACH,EACD,KAAM;;AAER,MAAI,IAAkB,GAAG;GACvB,IAAM,IAAU,IAAK,IAAkB;AAgBvC,GAfA,EAAU,KACR,kBAAC,QAAD;IAEE,GAAG;IACH,GAAG;IACI;IACP,QAAQ;IACR,MAAM,EAAS,IAAI,EAAU,IAAI;IACjC,UAAU,IAAS,IAAc,KAAoB;IACrD,oBAAoB,EAAY,GAAW,aAAa,EAAQ;IAChE,cAAc;IACd,eAAe,EAAY,EAAU;IACrC,OAAO,EAAE,QAAQ,WAAW;IAC5B,EAXK,SAAS,EAAW,GAAG,IAW5B,CACH,EACD,KAAM;;;AAGV,QACE,kBAAA,GAAA,EAAA,UAAA,CACG,GACA,EACA,EAAA,CAAA;EAEL"}
1
+ {"version":3,"file":"StackedBars.js","names":[],"sources":["../../../../../src/selection/components/Chart/Bars/StackedBars.tsx"],"sourcesContent":["import React, { memo } from 'react';\n\nimport { useFunction } from '../../../../utils/hooks/useFunction';\nimport { DESATURATE_ALPHA, DIM_OPACITY } from '../../../constants';\nimport { toPercent } from '../../../utils';\nimport type { BarsCommon } from '../types';\n\n// Stacked-grouped bars: per-group rects above and below the divider, stacked\n// in caller-provided order. Hover dims non-hovered groups.\nexport const StackedBars = memo(function StackedBars({\n common,\n stackOrder,\n colorMap,\n fallbackColor,\n hoveredGroup,\n onGroupHover,\n onGroupClick,\n}: {\n common: BarsCommon;\n stackOrder: string[];\n colorMap: Map<string, string>;\n fallbackColor: string;\n hoveredGroup: string | null;\n onGroupHover: (name: string | null) => void;\n onGroupClick: (name: string) => void;\n}) {\n const { stageIndex, stage, geometry, layerOpacity, tooltip } = common;\n const { left, width, centerX, height, yScale } = geometry;\n\n const handleEnter = useFunction(\n (groupName: string, section: 'preserved' | 'discarded', anchorY: number) => {\n onGroupHover(groupName);\n tooltip.onEnter({ stageIndex, section, stage, anchorX: centerX, anchorY, groupName });\n },\n );\n const handleLeave = useFunction(() => {\n onGroupHover(null);\n tooltip.onLeave();\n });\n const handleClick = useFunction((groupName: string) => onGroupClick(groupName));\n\n const dividerY = stage.total > 0 ? yScale(toPercent(stage.surviving / stage.total)) : height;\n const preserved: React.JSX.Element[] = [];\n const discarded: React.JSX.Element[] = [];\n // Both halves stack top-to-bottom in stackOrder so a given group appears at\n // the same vertical reading order in preserved and discarded — without this\n // the two halves are mirrored around the divider and the same group ends up\n // adjacent to the divider on both sides.\n let yP = dividerY;\n let yD = 0;\n for (const groupName of stackOrder) {\n const groupData = stage.groups.get(groupName);\n if (!groupData) continue;\n const survivingHeight = (groupData.surviving / stage.total) * height;\n const discardedHeight = (groupData.discarded / stage.total) * height;\n const dimmed = hoveredGroup && hoveredGroup !== groupName;\n\n if (survivingHeight > 0) {\n const anchorY = yP + survivingHeight / 2;\n preserved.push(\n <rect\n key={`bar-p-${stageIndex}-${groupName}`}\n x={left}\n y={yP}\n width={width}\n height={survivingHeight}\n fill={colorMap.get(groupName) ?? fallbackColor}\n opacity={(dimmed ? DIM_OPACITY : 1) * layerOpacity}\n onMouseEnter={() => handleEnter(groupName, 'preserved', anchorY)}\n onMouseLeave={handleLeave}\n onClick={() => handleClick(groupName)}\n style={{ cursor: 'pointer' }}\n />,\n );\n yP += survivingHeight;\n }\n if (discardedHeight > 0) {\n const anchorY = yD + discardedHeight / 2;\n discarded.push(\n <rect\n key={`bar-d-${stageIndex}-${groupName}`}\n x={left}\n y={yD}\n width={width}\n height={discardedHeight}\n fill={colorMap.get(groupName) ?? fallbackColor}\n opacity={(dimmed ? DIM_OPACITY : DESATURATE_ALPHA) * layerOpacity}\n onMouseEnter={() => handleEnter(groupName, 'discarded', anchorY)}\n onMouseLeave={handleLeave}\n onClick={() => handleClick(groupName)}\n style={{ cursor: 'pointer' }}\n />,\n );\n yD += discardedHeight;\n }\n }\n return (\n <>\n {preserved}\n {discarded}\n </>\n );\n});\n"],"mappings":";;;;;AASA,MAAa,IAAc,EAAK,SAAqB,EACnD,WACA,eACA,aACA,kBACA,iBACA,iBACA,mBASC;CACD,IAAM,EAAE,eAAY,UAAO,aAAU,iBAAc,eAAY,GACzD,EAAE,SAAM,UAAO,YAAS,WAAQ,cAAW,GAE3C,IAAc,GACjB,GAAmB,GAAoC,MAAoB;AAE1E,EADA,EAAa,EAAU,EACvB,EAAQ,QAAQ;GAAE;GAAY;GAAS;GAAO,SAAS;GAAS;GAAS;GAAW,CAAC;GAExF,EACK,IAAc,QAAkB;AAEpC,EADA,EAAa,KAAK,EAClB,EAAQ,SAAS;GACjB,EACI,IAAc,GAAa,MAAsB,EAAa,EAAU,CAAC,EAEzE,IAAW,EAAM,QAAQ,IAAI,EAAO,EAAU,EAAM,YAAY,EAAM,MAAM,CAAC,GAAG,GAChF,IAAiC,EAAE,EACnC,IAAiC,EAAE,EAKrC,IAAK,GACL,IAAK;AACT,MAAK,IAAM,KAAa,GAAY;EAClC,IAAM,IAAY,EAAM,OAAO,IAAI,EAAU;AAC7C,MAAI,CAAC,EAAW;EAChB,IAAM,IAAmB,EAAU,YAAY,EAAM,QAAS,GACxD,IAAmB,EAAU,YAAY,EAAM,QAAS,GACxD,IAAS,KAAgB,MAAiB;AAEhD,MAAI,IAAkB,GAAG;GACvB,IAAM,IAAU,IAAK,IAAkB;AAgBvC,GAfA,EAAU,KACR,kBAAC,QAAD;IAEE,GAAG;IACH,GAAG;IACI;IACP,QAAQ;IACR,MAAM,EAAS,IAAI,EAAU,IAAI;IACjC,UAAU,IAAS,IA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