@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.
- package/dist/DataFrame.d.ts.map +1 -1
- package/dist/DataFrame.js +2 -1
- package/dist/DataFrame.js.map +1 -1
- package/dist/common/ContinuousGrid.d.ts.map +1 -1
- package/dist/common/ContinuousGrid.js +90 -56
- package/dist/common/ContinuousGrid.js.map +1 -1
- package/dist/histogram/ChartRenderer.d.ts.map +1 -1
- package/dist/histogram/ChartRenderer.js +6 -0
- package/dist/histogram/ChartRenderer.js.map +1 -1
- package/dist/histogram/HistogramSettingsImpl.d.ts +5 -1
- package/dist/histogram/HistogramSettingsImpl.d.ts.map +1 -1
- package/dist/histogram/HistogramSettingsImpl.js.map +1 -1
- package/dist/scatterplot/components/Grid.d.ts.map +1 -1
- package/dist/scatterplot/components/Grid.js +109 -71
- package/dist/scatterplot/components/Grid.js.map +1 -1
- package/dist/selection/ChartRenderer.d.ts.map +1 -1
- package/dist/selection/ChartRenderer.js +9 -11
- package/dist/selection/ChartRenderer.js.map +1 -1
- package/dist/selection/SelectionSettingsImpl.d.ts +0 -1
- package/dist/selection/SelectionSettingsImpl.d.ts.map +1 -1
- package/dist/selection/SelectionSettingsImpl.js +0 -1
- package/dist/selection/SelectionSettingsImpl.js.map +1 -1
- package/dist/selection/components/Chart/Bars/GroupSelectedBars.js +1 -1
- package/dist/selection/components/Chart/Bars/GroupSelectedBars.js.map +1 -1
- package/dist/selection/components/Chart/Bars/StackedBars.d.ts.map +1 -1
- package/dist/selection/components/Chart/Bars/StackedBars.js +11 -11
- package/dist/selection/components/Chart/Bars/StackedBars.js.map +1 -1
- package/dist/selection/components/Chart/ChartAxes.d.ts.map +1 -1
- package/dist/selection/components/Chart/ChartAxes.js +7 -8
- package/dist/selection/components/Chart/ChartAxes.js.map +1 -1
- package/dist/selection/components/Chart/ChartFrame.d.ts +1 -2
- package/dist/selection/components/Chart/ChartFrame.d.ts.map +1 -1
- package/dist/selection/components/Chart/ChartFrame.js +8 -8
- package/dist/selection/components/Chart/ChartFrame.js.map +1 -1
- package/dist/selection/components/Chart/Gridlines.d.ts +2 -6
- package/dist/selection/components/Chart/Gridlines.d.ts.map +1 -1
- package/dist/selection/components/Chart/Gridlines.js +14 -26
- package/dist/selection/components/Chart/Gridlines.js.map +1 -1
- package/dist/selection/components/Chart/Ribbons/GroupFlowRibbon.js +1 -1
- package/dist/selection/components/Chart/Ribbons/GroupFlowRibbon.js.map +1 -1
- package/dist/selection/components/Chart/Ribbons/StackedGroupFlowRibbon.d.ts.map +1 -1
- package/dist/selection/components/Chart/Ribbons/StackedGroupFlowRibbon.js +27 -27
- package/dist/selection/components/Chart/Ribbons/StackedGroupFlowRibbon.js.map +1 -1
- package/dist/selection/components/Chart/SelectionXAxis.d.ts +18 -0
- package/dist/selection/components/Chart/SelectionXAxis.d.ts.map +1 -0
- package/dist/selection/components/Chart/SelectionXAxis.js +47 -0
- package/dist/selection/components/Chart/SelectionXAxis.js.map +1 -0
- package/dist/selection/components/Chart/types.d.ts +0 -1
- package/dist/selection/components/Chart/types.d.ts.map +1 -1
- package/dist/selection/components/Chart.d.ts.map +1 -1
- package/dist/selection/components/Chart.js +7 -12
- package/dist/selection/components/Chart.js.map +1 -1
- package/dist/selection/components/ChartsGroup.d.ts.map +1 -1
- package/dist/selection/components/ChartsGroup.js +73 -72
- package/dist/selection/components/ChartsGroup.js.map +1 -1
- package/dist/selection/components/types.d.ts +0 -1
- package/dist/selection/components/types.d.ts.map +1 -1
- package/dist/selection/constants.d.ts +1 -2
- package/dist/selection/constants.d.ts.map +1 -1
- package/dist/selection/constants.js +2 -2
- package/dist/selection/constants.js.map +1 -1
- package/dist/selection/createSelectionData.d.ts +2 -6
- package/dist/selection/createSelectionData.d.ts.map +1 -1
- package/dist/selection/createSelectionData.js +45 -59
- package/dist/selection/createSelectionData.js.map +1 -1
- package/dist/types/bubble.d.ts +8 -8
- package/dist/types/common.d.ts +62 -6
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types/common.js +15 -6
- package/dist/types/common.js.map +1 -1
- package/dist/types/dendro.d.ts +6 -6
- package/dist/types/discrete.d.ts +41 -13
- package/dist/types/discrete.d.ts.map +1 -1
- package/dist/types/heatmap.d.ts +4 -4
- package/dist/types/histogram.d.ts +59 -10
- package/dist/types/histogram.d.ts.map +1 -1
- package/dist/types/histogram.js +60 -66
- package/dist/types/histogram.js.map +1 -1
- package/dist/types/scatterplot-umap.d.ts +74 -18
- package/dist/types/scatterplot-umap.d.ts.map +1 -1
- package/dist/types/scatterplot.d.ts +74 -18
- package/dist/types/scatterplot.d.ts.map +1 -1
- package/dist/types/selection.d.ts +8 -13
- package/dist/types/selection.d.ts.map +1 -1
- package/dist/types/selection.js +0 -1
- package/dist/types/selection.js.map +1 -1
- package/dist/utils/getChartEdgeSides.d.ts +1 -1
- package/dist/utils/significantLinesStyle.d.ts +8 -0
- package/dist/utils/significantLinesStyle.d.ts.map +1 -0
- package/dist/utils/significantLinesStyle.js +12 -0
- package/dist/utils/significantLinesStyle.js.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartAxes.d.ts","sourceRoot":"","sources":["../../../../src/selection/components/Chart/ChartAxes.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAKlE,eAAO,MAAM,SAAS;YAKZ,UAAU;WACX,UAAU;WACV,UAAU;
|
|
1
|
+
{"version":3,"file":"ChartAxes.d.ts","sourceRoot":"","sources":["../../../../src/selection/components/Chart/ChartAxes.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAKlE,eAAO,MAAM,SAAS;YAKZ,UAAU;WACX,UAAU;WACV,UAAU;EAiEjB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "../../../constants.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { ContinuousAxis as e } from "../../../common/ContinuousAxis.js";
|
|
3
|
+
import { formatPercent as t } from "../../utils.js";
|
|
4
|
+
import { SelectionXAxis as n } from "./SelectionXAxis.js";
|
|
5
5
|
import { memo as r } from "react";
|
|
6
6
|
import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
7
7
|
const s = r(function({ layout: r, xAxis: s, yAxis: c }) {
|
|
@@ -9,20 +9,19 @@ const s = r(function({ layout: r, xAxis: s, yAxis: c }) {
|
|
|
9
9
|
return /* @__PURE__ */ o(i, { children: [
|
|
10
10
|
h && /* @__PURE__ */ a("g", {
|
|
11
11
|
transform: `translate(0,${f})`,
|
|
12
|
-
children: /* @__PURE__ */ a(
|
|
12
|
+
children: /* @__PURE__ */ a(n, {
|
|
13
13
|
scale: l,
|
|
14
|
-
orient: "bottom",
|
|
15
14
|
labels: s.labels,
|
|
16
15
|
labelsPosition: _,
|
|
17
|
-
|
|
16
|
+
showTicks: v,
|
|
18
17
|
hiddenLabels: y
|
|
19
18
|
})
|
|
20
19
|
}),
|
|
21
|
-
g && /* @__PURE__ */ a(
|
|
20
|
+
g && /* @__PURE__ */ a(e, {
|
|
22
21
|
scale: u,
|
|
23
22
|
orient: "left",
|
|
24
23
|
tickSize: x ? 4 : 0,
|
|
25
|
-
tickFormat:
|
|
24
|
+
tickFormat: t,
|
|
26
25
|
hiddenLabels: S
|
|
27
26
|
}),
|
|
28
27
|
b && /* @__PURE__ */ a("text", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartAxes.js","names":[],"sources":["../../../../src/selection/components/Chart/ChartAxes.tsx"],"sourcesContent":["import { memo } from 'react';\n\nimport {
|
|
1
|
+
{"version":3,"file":"ChartAxes.js","names":[],"sources":["../../../../src/selection/components/Chart/ChartAxes.tsx"],"sourcesContent":["import { memo } from 'react';\n\nimport { ContinuousAxis } from '../../../common/ContinuousAxis';\nimport { SelectionXAxis } from './SelectionXAxis';\nimport { BLACK } from '../../../constants';\nimport { formatPercent } from '../../utils';\nimport type { CellLayout, ChartXAxis, ChartYAxis } from './types';\n\n// X (band) axis at the bottom + Y (continuous, percent) axis on the left.\n// Each is gated by show flag; titles render as separate <text> nodes outside\n// the axis components for layout independence.\nexport const ChartAxes = memo(function ChartAxes({\n layout,\n xAxis,\n yAxis,\n}: {\n layout: CellLayout;\n xAxis: ChartXAxis;\n yAxis: ChartYAxis;\n}) {\n const { xScale, yScale, width, height, paddingLeft, paddingBottom, showXAxis, showYAxis } =\n layout;\n const {\n labelsPosition: xLabelsPosition = 'center',\n showTicks: xShowTicks = true,\n hiddenLabels: xHiddenLabels = false,\n title: xAxisTitle = '',\n } = xAxis;\n const {\n showTicks: yShowTicks = true,\n hiddenLabels: yHiddenLabels = false,\n title: yAxisTitle = '',\n } = yAxis;\n\n return (\n <>\n {showXAxis && (\n <g transform={`translate(0,${height})`}>\n <SelectionXAxis\n scale={xScale}\n labels={xAxis.labels}\n labelsPosition={xLabelsPosition}\n showTicks={xShowTicks}\n hiddenLabels={xHiddenLabels}\n />\n </g>\n )}\n {showYAxis && (\n <ContinuousAxis\n scale={yScale}\n orient=\"left\"\n tickSize={yShowTicks ? 4 : 0}\n tickFormat={formatPercent}\n hiddenLabels={yHiddenLabels}\n />\n )}\n {xAxisTitle && (\n <text\n x={width / 2}\n y={height + paddingBottom - 6}\n textAnchor=\"middle\"\n fontSize=\"14px\"\n fontWeight=\"500\"\n fontFamily=\"Manrope\"\n fill={BLACK}\n >\n {xAxisTitle}\n </text>\n )}\n {yAxisTitle && (\n <text\n transform={`translate(${-paddingLeft + 14},${height / 2}) rotate(-90)`}\n textAnchor=\"middle\"\n fontSize=\"14px\"\n fontWeight=\"500\"\n fontFamily=\"Manrope\"\n fill={BLACK}\n >\n {yAxisTitle}\n </text>\n )}\n </>\n );\n});\n"],"mappings":";;;;;;AAWA,MAAa,IAAY,EAAK,SAAmB,EAC/C,WACA,UACA,YAKC;CACD,IAAM,EAAE,WAAQ,WAAQ,UAAO,WAAQ,gBAAa,kBAAe,cAAW,iBAC5E,GACI,EACJ,gBAAgB,IAAkB,UAClC,WAAW,IAAa,IACxB,cAAc,IAAgB,IAC9B,OAAO,IAAa,OAClB,GACE,EACJ,WAAW,IAAa,IACxB,cAAc,IAAgB,IAC9B,OAAO,IAAa,OAClB;AAEJ,QACE,kBAAA,GAAA,EAAA,UAAA;EACG,KACC,kBAAC,KAAD;GAAG,WAAW,eAAe,EAAO;aAClC,kBAAC,GAAD;IACE,OAAO;IACP,QAAQ,EAAM;IACd,gBAAgB;IAChB,WAAW;IACX,cAAc;IACd,CAAA;GACA,CAAA;EAEL,KACC,kBAAC,GAAD;GACE,OAAO;GACP,QAAO;GACP,UAAU,IAAa,IAAI;GAC3B,YAAY;GACZ,cAAc;GACd,CAAA;EAEH,KACC,kBAAC,QAAD;GACE,GAAG,IAAQ;GACX,GAAG,IAAS,IAAgB;GAC5B,YAAW;GACX,UAAS;GACT,YAAW;GACX,YAAW;GACX,MAAA;aAEC;GACI,CAAA;EAER,KACC,kBAAC,QAAD;GACE,WAAW,aAAa,CAAC,IAAc,GAAG,GAAG,IAAS,EAAE;GACxD,YAAW;GACX,UAAS;GACT,YAAW;GACX,YAAW;GACX,MAAA;aAEC;GACI,CAAA;EAER,EAAA,CAAA;EAEL"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartFrame.d.ts","sourceRoot":"","sources":["../../../../src/selection/components/Chart/ChartFrame.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"ChartFrame.d.ts","sourceRoot":"","sources":["../../../../src/selection/components/Chart/ChartFrame.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAMhD,eAAO,MAAM,UAAU;WAMd,MAAM;YACL,MAAM;eACH,SAAS;cACV,OAAO;EAmBjB,CAAC"}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import "../../../constants.js";
|
|
2
2
|
import { memo as e } from "react";
|
|
3
3
|
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
4
|
-
const r = e(function({ width: e, height: r, frameType: i,
|
|
4
|
+
const r = e(function({ width: e, height: r, frameType: i, showGrid: a }) {
|
|
5
5
|
return i === "empty" ? null : /* @__PURE__ */ n("g", {
|
|
6
6
|
strokeWidth: 1,
|
|
7
7
|
children: [
|
|
8
|
-
|
|
9
|
-
stroke:
|
|
8
|
+
i !== "left" && /* @__PURE__ */ t("line", {
|
|
9
|
+
stroke: "#110529",
|
|
10
10
|
x1: "0",
|
|
11
11
|
x2: e,
|
|
12
12
|
y1: r,
|
|
13
13
|
y2: r
|
|
14
14
|
}),
|
|
15
|
-
|
|
16
|
-
stroke:
|
|
15
|
+
i !== "bottom" && /* @__PURE__ */ t("line", {
|
|
16
|
+
stroke: "#110529",
|
|
17
17
|
x1: "0",
|
|
18
18
|
x2: "0",
|
|
19
19
|
y1: "0",
|
|
20
20
|
y2: r
|
|
21
21
|
}),
|
|
22
|
-
|
|
23
|
-
stroke:
|
|
22
|
+
i === "full" && /* @__PURE__ */ t("line", {
|
|
23
|
+
stroke: "#110529",
|
|
24
24
|
x1: e,
|
|
25
25
|
x2: e,
|
|
26
26
|
y1: "0",
|
|
27
27
|
y2: r
|
|
28
28
|
}),
|
|
29
|
-
(
|
|
29
|
+
(a || i === "full") && /* @__PURE__ */ t("line", {
|
|
30
30
|
stroke: i === "full" ? "#110529" : "#E1E3EB",
|
|
31
31
|
x1: "0",
|
|
32
32
|
x2: e,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartFrame.js","names":[],"sources":["../../../../src/selection/components/Chart/ChartFrame.tsx"],"sourcesContent":["import { memo } from 'react';\n\nimport { BLACK, GRID_GRAY } from '../../../constants';\nimport type { FrameType } from '../../../types';\n\n// Border lines around the plot body. `frameType` picks which sides are BLACK\n// (drawn as the prominent axis line) vs GRID_GRAY (drawn for visual closure\n// only when the
|
|
1
|
+
{"version":3,"file":"ChartFrame.js","names":[],"sources":["../../../../src/selection/components/Chart/ChartFrame.tsx"],"sourcesContent":["import { memo } from 'react';\n\nimport { BLACK, GRID_GRAY } from '../../../constants';\nimport type { FrameType } from '../../../types';\n\n// Border lines around the plot body. `frameType` picks which sides are BLACK\n// (drawn as the prominent axis line) vs GRID_GRAY (drawn for visual closure\n// only when `frameType === 'full'`). The Selection Plot has no X gridlines, so\n// the vertical/right borders depend on `frameType` alone.\nexport const ChartFrame = memo(function ChartFrame({\n width,\n height,\n frameType,\n showGrid,\n}: {\n width: number;\n height: number;\n frameType: FrameType;\n showGrid: boolean;\n}) {\n if (frameType === 'empty') return null;\n return (\n <g strokeWidth={1}>\n {frameType !== 'left' && (\n <line stroke={BLACK} x1=\"0\" x2={width} y1={height} y2={height} />\n )}\n {frameType !== 'bottom' && (\n <line stroke={BLACK} x1=\"0\" x2=\"0\" y1=\"0\" y2={height} />\n )}\n {frameType === 'full' && (\n <line stroke={BLACK} x1={width} x2={width} y1=\"0\" y2={height} />\n )}\n {(showGrid || frameType === 'full') && (\n <line stroke={frameType === 'full' ? BLACK : GRID_GRAY} x1=\"0\" x2={width} y1=\"0\" y2=\"0\" />\n )}\n </g>\n );\n});\n"],"mappings":";;;AASA,MAAa,IAAa,EAAK,SAAoB,EACjD,UACA,WACA,cACA,eAMC;AAED,QADI,MAAc,UAAgB,OAEhC,kBAAC,KAAD;EAAG,aAAa;YAAhB;GACG,MAAc,UACb,kBAAC,QAAD;IAAM,QAAA;IAAe,IAAG;IAAI,IAAI;IAAO,IAAI;IAAQ,IAAI;IAAU,CAAA;GAElE,MAAc,YACb,kBAAC,QAAD;IAAM,QAAA;IAAe,IAAG;IAAI,IAAG;IAAI,IAAG;IAAI,IAAI;IAAU,CAAA;GAEzD,MAAc,UACb,kBAAC,QAAD;IAAM,QAAA;IAAe,IAAI;IAAO,IAAI;IAAO,IAAG;IAAI,IAAI;IAAU,CAAA;IAEhE,KAAY,MAAc,WAC1B,kBAAC,QAAD;IAAM,QAAQ,MAAc,SAAA,YAAA;IAA4B,IAAG;IAAI,IAAI;IAAO,IAAG;IAAI,IAAG;IAAM,CAAA;GAE1F;;EAEN"}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ScaleLinear } from 'd3-scale';
|
|
2
2
|
export declare const Gridlines: import('react').NamedExoticComponent<{
|
|
3
|
-
|
|
4
|
-
yScale: ScaleLinear<number, number>;
|
|
3
|
+
scale: ScaleLinear<number, number>;
|
|
5
4
|
width: number;
|
|
6
|
-
height: number;
|
|
7
|
-
xShow: boolean;
|
|
8
|
-
yShow: boolean;
|
|
9
5
|
}>;
|
|
10
6
|
//# sourceMappingURL=Gridlines.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Gridlines.d.ts","sourceRoot":"","sources":["../../../../src/selection/components/Chart/Gridlines.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"Gridlines.d.ts","sourceRoot":"","sources":["../../../../src/selection/components/Chart/Gridlines.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAM5C,eAAO,MAAM,SAAS;WAIb,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC;WAC3B,MAAM;EAUb,CAAC"}
|
|
@@ -1,32 +1,20 @@
|
|
|
1
|
-
import "../../../constants.js";
|
|
2
|
-
import { memo as
|
|
3
|
-
import {
|
|
4
|
-
const
|
|
5
|
-
return /* @__PURE__ */
|
|
6
|
-
stroke:
|
|
7
|
-
children:
|
|
8
|
-
let
|
|
1
|
+
import { GRID_GRAY as e } from "../../../constants.js";
|
|
2
|
+
import { memo as t } from "react";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
const r = t(function({ scale: t, width: r }) {
|
|
5
|
+
return /* @__PURE__ */ n("g", {
|
|
6
|
+
stroke: e,
|
|
7
|
+
children: t.ticks().map((e) => {
|
|
8
|
+
let i = t(e);
|
|
9
9
|
return /* @__PURE__ */ n("line", {
|
|
10
10
|
x1: 0,
|
|
11
|
-
x2:
|
|
12
|
-
y1:
|
|
13
|
-
y2:
|
|
14
|
-
}, `yg-${
|
|
11
|
+
x2: r,
|
|
12
|
+
y1: i,
|
|
13
|
+
y2: i
|
|
14
|
+
}, `yg-${i}`);
|
|
15
15
|
})
|
|
16
|
-
})
|
|
17
|
-
stroke: "#E1E3EB",
|
|
18
|
-
strokeWidth: 1,
|
|
19
|
-
children: e.domain().slice(0, -1).map((t, r) => {
|
|
20
|
-
let i = e.domain()[r + 1], a = ((e(t) ?? 0) + (e(i) ?? 0) + e.bandwidth()) / 2;
|
|
21
|
-
return /* @__PURE__ */ n("line", {
|
|
22
|
-
x1: a,
|
|
23
|
-
x2: a,
|
|
24
|
-
y1: 0,
|
|
25
|
-
y2: o
|
|
26
|
-
}, `xg-${t}`);
|
|
27
|
-
})
|
|
28
|
-
})] });
|
|
16
|
+
});
|
|
29
17
|
});
|
|
30
|
-
export {
|
|
18
|
+
export { r as Gridlines };
|
|
31
19
|
|
|
32
20
|
//# sourceMappingURL=Gridlines.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Gridlines.js","names":[],"sources":["../../../../src/selection/components/Chart/Gridlines.tsx"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"Gridlines.js","names":[],"sources":["../../../../src/selection/components/Chart/Gridlines.tsx"],"sourcesContent":["import type { ScaleLinear } from 'd3-scale';\nimport { memo } from 'react';\n\nimport { GRID_GRAY } from '../../../constants';\n\n// Y gridlines at every tick. The Selection Plot has no X gridlines.\nexport const Gridlines = memo(function Gridlines({\n scale,\n width,\n}: {\n scale: ScaleLinear<number, number>;\n width: number;\n}) {\n return (\n <g stroke={GRID_GRAY}>\n {scale.ticks().map((tick) => {\n const y = scale(tick);\n return <line key={`yg-${y}`} x1={0} x2={width} y1={y} y2={y} />;\n })}\n </g>\n );\n});\n"],"mappings":";;;AAMA,MAAa,IAAY,EAAK,SAAmB,EAC/C,UACA,YAIC;AACD,QACE,kBAAC,KAAD;EAAG,QAAQ;YACR,EAAM,OAAO,CAAC,KAAK,MAAS;GAC3B,IAAM,IAAI,EAAM,EAAK;AACrB,UAAO,kBAAC,QAAD;IAAsB,IAAI;IAAG,IAAI;IAAO,IAAI;IAAG,IAAI;IAAK,EAA7C,MAAM,IAAuC;IAC/D;EACA,CAAA;EAEN"}
|
|
@@ -4,7 +4,7 @@ import { ribbonPath as r } from "./ribbonPath.js";
|
|
|
4
4
|
import { memo as i } from "react";
|
|
5
5
|
import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
6
6
|
const c = i(function({ context: i, yScale: c, stages: l, groupName: u, color: d }) {
|
|
7
|
-
let { x0: f, x1: p, height: m, layerOpacity: h } = i, { current: g, next: _ } = l, v = g.groups.
|
|
7
|
+
let { x0: f, x1: p, height: m, layerOpacity: h } = i, { current: g, next: _ } = l, v = g.groups.get(u), y = _.groups.get(u), b = (y?.surviving ?? 0) + (y?.discarded ?? 0), x = v?.surviving ?? 0;
|
|
8
8
|
if (x <= 0 || b <= 0) return null;
|
|
9
9
|
let S = (y?.surviving ?? 0) / b, C = c(n(x / g.total)), w = c(n(b / _.total)), T = w + (m - w) * (1 - S), E = C + (m - C) * (1 - S);
|
|
10
10
|
return /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("path", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupFlowRibbon.js","names":[],"sources":["../../../../../src/selection/components/Chart/Ribbons/GroupFlowRibbon.tsx"],"sourcesContent":["import { memo } from 'react';\n\nimport { DESATURATE_ALPHA, RIBBON_OPACITY } from '../../../constants';\nimport { toPercent } from '../../../utils';\nimport type { RibbonContext, StagePair } from '../types';\nimport { ribbonPath } from './ribbonPath';\n\n// Single-group flow (used both for click-selected groups and hover-highlighted\n// groups). Two sub-bands in the group color: top sub-band is destined to be\n// discarded next stage (DESATURATE_ALPHA), bottom sub-band carries forward.\nexport const GroupFlowRibbon = memo(function GroupFlowRibbon({\n context,\n yScale,\n stages,\n groupName,\n color,\n}: {\n context: RibbonContext;\n yScale: (v: number) => number;\n stages: StagePair;\n groupName: string;\n color: string;\n}) {\n const { x0, x1, height, layerOpacity } = context;\n const { current: stage, next: nextStage } = stages;\n\n const groupData = stage.groups.
|
|
1
|
+
{"version":3,"file":"GroupFlowRibbon.js","names":[],"sources":["../../../../../src/selection/components/Chart/Ribbons/GroupFlowRibbon.tsx"],"sourcesContent":["import { memo } from 'react';\n\nimport { DESATURATE_ALPHA, RIBBON_OPACITY } from '../../../constants';\nimport { toPercent } from '../../../utils';\nimport type { RibbonContext, StagePair } from '../types';\nimport { ribbonPath } from './ribbonPath';\n\n// Single-group flow (used both for click-selected groups and hover-highlighted\n// groups). Two sub-bands in the group color: top sub-band is destined to be\n// discarded next stage (DESATURATE_ALPHA), bottom sub-band carries forward.\nexport const GroupFlowRibbon = memo(function GroupFlowRibbon({\n context,\n yScale,\n stages,\n groupName,\n color,\n}: {\n context: RibbonContext;\n yScale: (v: number) => number;\n stages: StagePair;\n groupName: string;\n color: string;\n}) {\n const { x0, x1, height, layerOpacity } = context;\n const { current: stage, next: nextStage } = stages;\n\n const groupData = stage.groups.get(groupName);\n const nextGroupData = nextStage.groups.get(groupName);\n const nextGroupTotal = (nextGroupData?.surviving ?? 0) + (nextGroupData?.discarded ?? 0);\n const surviving = groupData?.surviving ?? 0;\n if (surviving <= 0 || nextGroupTotal <= 0) return null;\n\n const nextSurvivingFrac = (nextGroupData?.surviving ?? 0) / nextGroupTotal;\n\n const survivingFrac = surviving / stage.total;\n const yTopSurviving = yScale(toPercent(survivingFrac));\n\n const nextGroupFrac = nextGroupTotal / nextStage.total;\n const yTopNextOverlay = yScale(toPercent(nextGroupFrac));\n const yNextDivider = yTopNextOverlay + (height - yTopNextOverlay) * (1 - nextSurvivingFrac);\n\n const splitY = yTopSurviving + (height - yTopSurviving) * (1 - nextSurvivingFrac);\n\n return (\n <>\n <path\n d={ribbonPath({\n leftX: x0,\n leftYTop: yTopSurviving,\n leftYBottom: splitY,\n rightX: x1,\n rightYTop: yTopNextOverlay,\n rightYBottom: yNextDivider,\n })}\n fill={color}\n opacity={RIBBON_OPACITY * DESATURATE_ALPHA * layerOpacity}\n />\n <path\n d={ribbonPath({\n leftX: x0,\n leftYTop: splitY,\n leftYBottom: height,\n rightX: x1,\n rightYTop: yNextDivider,\n rightYBottom: height,\n })}\n fill={color}\n opacity={RIBBON_OPACITY * layerOpacity}\n />\n </>\n );\n});\n"],"mappings":";;;;;AAUA,MAAa,IAAkB,EAAK,SAAyB,EAC3D,YACA,WACA,WACA,cACA,YAOC;CACD,IAAM,EAAE,OAAI,OAAI,WAAQ,oBAAiB,GACnC,EAAE,SAAS,GAAO,MAAM,MAAc,GAEtC,IAAY,EAAM,OAAO,IAAI,EAAU,EACvC,IAAgB,EAAU,OAAO,IAAI,EAAU,EAC/C,KAAkB,GAAe,aAAa,MAAM,GAAe,aAAa,IAChF,IAAY,GAAW,aAAa;AAC1C,KAAI,KAAa,KAAK,KAAkB,EAAG,QAAO;CAElD,IAAM,KAAqB,GAAe,aAAa,KAAK,GAGtD,IAAgB,EAAO,EADP,IAAY,EAAM,MACa,CAAC,EAGhD,IAAkB,EAAO,EADT,IAAiB,EAAU,MACM,CAAC,EAClD,IAAe,KAAmB,IAAS,MAAoB,IAAI,IAEnE,IAAS,KAAiB,IAAS,MAAkB,IAAI;AAE/D,QACE,kBAAA,GAAA,EAAA,UAAA,CACE,kBAAC,QAAD;EACE,GAAG,EAAW;GACZ,OAAO;GACP,UAAU;GACV,aAAa;GACb,QAAQ;GACR,WAAW;GACX,cAAc;GACf,CAAC;EACF,MAAM;EACN,SAAS,IAAiB,IAAmB;EAC7C,CAAA,EACF,kBAAC,QAAD;EACE,GAAG,EAAW;GACZ,OAAO;GACP,UAAU;GACV,aAAa;GACb,QAAQ;GACR,WAAW;GACX,cAAc;GACf,CAAC;EACF,MAAM;EACN,SAAS,IAAiB;EAC1B,CAAA,CACD,EAAA,CAAA;EAEL"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StackedGroupFlowRibbon.d.ts","sourceRoot":"","sources":["../../../../../src/selection/components/Chart/Ribbons/StackedGroupFlowRibbon.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAQzD,eAAO,MAAM,sBAAsB;aAQxB,aAAa;YACd,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM;YACrB,SAAS;gBACL,MAAM,EAAE;eACT,MAAM;WACV,MAAM;
|
|
1
|
+
{"version":3,"file":"StackedGroupFlowRibbon.d.ts","sourceRoot":"","sources":["../../../../../src/selection/components/Chart/Ribbons/StackedGroupFlowRibbon.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAQzD,eAAO,MAAM,sBAAsB;aAQxB,aAAa;YACd,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM;YACrB,SAAS;gBACL,MAAM,EAAE;eACT,MAAM;WACV,MAAM;EA8Fb,CAAC"}
|
|
@@ -4,57 +4,57 @@ import { ribbonPath as t } from "./ribbonPath.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({ context: n, yScale: o, stages: s, stackOrder: c, groupName: l, color: u }) {
|
|
7
|
-
let { x0: d, x1: f, height: p, layerOpacity: m } = n, { current: h, next: g } = s, _ =
|
|
7
|
+
let { x0: d, x1: f, height: p, layerOpacity: m } = n, { current: h, next: g } = s, _ = h.total > 0 ? o(e(h.surviving / h.total)) : p, v = 0;
|
|
8
8
|
for (let e of c) {
|
|
9
|
-
let t =
|
|
9
|
+
let t = h.groups.get(e);
|
|
10
10
|
if (!t) continue;
|
|
11
11
|
let n = t.surviving / h.total * p;
|
|
12
12
|
if (e === l) {
|
|
13
|
-
|
|
13
|
+
v = n;
|
|
14
14
|
break;
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
_ += n;
|
|
17
17
|
}
|
|
18
|
-
if (
|
|
19
|
-
let
|
|
18
|
+
if (v <= 0) return null;
|
|
19
|
+
let y = _, b = _ + v, x = g.total > 0 ? o(e(g.surviving / g.total)) : p, S = 0, C = null, w = null;
|
|
20
20
|
for (let e of c) {
|
|
21
|
-
let t =
|
|
21
|
+
let t = g.groups.get(e);
|
|
22
22
|
if (!t) continue;
|
|
23
23
|
let n = t.surviving / g.total * p, r = t.discarded / g.total * p;
|
|
24
24
|
if (e === l) {
|
|
25
|
-
|
|
26
|
-
top:
|
|
27
|
-
bottom:
|
|
28
|
-
} : null,
|
|
29
|
-
top:
|
|
30
|
-
bottom:
|
|
25
|
+
C = n > 0 ? {
|
|
26
|
+
top: x,
|
|
27
|
+
bottom: x + n
|
|
28
|
+
} : null, w = r > 0 ? {
|
|
29
|
+
top: S,
|
|
30
|
+
bottom: S + r
|
|
31
31
|
} : null;
|
|
32
32
|
break;
|
|
33
33
|
}
|
|
34
|
-
|
|
34
|
+
x += n, S += r;
|
|
35
35
|
}
|
|
36
|
-
let
|
|
37
|
-
if (
|
|
38
|
-
let
|
|
39
|
-
return /* @__PURE__ */ a(r, { children: [
|
|
36
|
+
let T = g.groups.get(l), E = T?.surviving ?? 0, D = T?.discarded ?? 0, O = E + D;
|
|
37
|
+
if (O <= 0) return null;
|
|
38
|
+
let k = y + D / O * v;
|
|
39
|
+
return /* @__PURE__ */ a(r, { children: [w && D > 0 && /* @__PURE__ */ i("path", {
|
|
40
40
|
d: t({
|
|
41
41
|
leftX: d,
|
|
42
|
-
leftYTop:
|
|
43
|
-
leftYBottom:
|
|
42
|
+
leftYTop: y,
|
|
43
|
+
leftYBottom: k,
|
|
44
44
|
rightX: f,
|
|
45
|
-
rightYTop:
|
|
46
|
-
rightYBottom:
|
|
45
|
+
rightYTop: w.top,
|
|
46
|
+
rightYBottom: w.bottom
|
|
47
47
|
}),
|
|
48
48
|
fill: u,
|
|
49
49
|
opacity: .25 * .4 * m
|
|
50
|
-
}),
|
|
50
|
+
}), C && E > 0 && /* @__PURE__ */ i("path", {
|
|
51
51
|
d: t({
|
|
52
52
|
leftX: d,
|
|
53
|
-
leftYTop:
|
|
54
|
-
leftYBottom:
|
|
53
|
+
leftYTop: k,
|
|
54
|
+
leftYBottom: b,
|
|
55
55
|
rightX: f,
|
|
56
|
-
rightYTop:
|
|
57
|
-
rightYBottom:
|
|
56
|
+
rightYTop: C.top,
|
|
57
|
+
rightYBottom: C.bottom
|
|
58
58
|
}),
|
|
59
59
|
fill: u,
|
|
60
60
|
opacity: .25 * m
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StackedGroupFlowRibbon.js","names":[],"sources":["../../../../../src/selection/components/Chart/Ribbons/StackedGroupFlowRibbon.tsx"],"sourcesContent":["import { memo } from 'react';\n\nimport { DESATURATE_ALPHA, RIBBON_OPACITY } from '../../../constants';\nimport { toPercent } from '../../../utils';\nimport type { RibbonContext, StagePair } from '../types';\nimport { ribbonPath } from './ribbonPath';\n\n// Hover-highlight ribbon for a single group in stacked layout. Connects the\n// group's preserved chunk in stage i (at its stacked Y position) to its\n// preserved+discarded chunks in stage i+1 (each at their own stacked Y\n// positions). Two sub-bands: top portion → discarded next (dimmer), bottom\n// portion → preserved next (vivid). Replaces the unified ribbon on hover.\nexport const StackedGroupFlowRibbon = memo(function StackedGroupFlowRibbon({\n context,\n yScale,\n stages,\n stackOrder,\n groupName,\n color,\n}: {\n context: RibbonContext;\n yScale: (v: number) => number;\n stages: StagePair;\n stackOrder: string[];\n groupName: string;\n color: string;\n}) {\n const { x0, x1, height, layerOpacity } = context;\n const { current: stage, next: nextStage } = stages;\n\n // Stage i: walk stackOrder until we find the hovered group; track the\n // running yP cursor (top of preserved area accumulating downward).\n const
|
|
1
|
+
{"version":3,"file":"StackedGroupFlowRibbon.js","names":[],"sources":["../../../../../src/selection/components/Chart/Ribbons/StackedGroupFlowRibbon.tsx"],"sourcesContent":["import { memo } from 'react';\n\nimport { DESATURATE_ALPHA, RIBBON_OPACITY } from '../../../constants';\nimport { toPercent } from '../../../utils';\nimport type { RibbonContext, StagePair } from '../types';\nimport { ribbonPath } from './ribbonPath';\n\n// Hover-highlight ribbon for a single group in stacked layout. Connects the\n// group's preserved chunk in stage i (at its stacked Y position) to its\n// preserved+discarded chunks in stage i+1 (each at their own stacked Y\n// positions). Two sub-bands: top portion → discarded next (dimmer), bottom\n// portion → preserved next (vivid). Replaces the unified ribbon on hover.\nexport const StackedGroupFlowRibbon = memo(function StackedGroupFlowRibbon({\n context,\n yScale,\n stages,\n stackOrder,\n groupName,\n color,\n}: {\n context: RibbonContext;\n yScale: (v: number) => number;\n stages: StagePair;\n stackOrder: string[];\n groupName: string;\n color: string;\n}) {\n const { x0, x1, height, layerOpacity } = context;\n const { current: stage, next: nextStage } = stages;\n\n // Stage i: walk stackOrder until we find the hovered group; track the\n // running yP cursor (top of preserved area accumulating downward).\n const dividerY = stage.total > 0 ? yScale(toPercent(stage.surviving / stage.total)) : height;\n let yPreserved = dividerY;\n let groupSurvivingHeight = 0;\n for (const name of stackOrder) {\n const g = stage.groups.get(name);\n if (!g) continue;\n const h = (g.surviving / stage.total) * height;\n if (name === groupName) {\n groupSurvivingHeight = h;\n break;\n }\n yPreserved += h;\n }\n if (groupSurvivingHeight <= 0) return null;\n const yTop = yPreserved;\n const yBottom = yPreserved + groupSurvivingHeight;\n\n // Stage i+1: walk stackOrder for both preserved (yNextPreserved) and\n // discarded (yNextDiscarded) accumulators in parallel; capture the hovered\n // group's chunks.\n const nextDividerY =\n nextStage.total > 0 ? yScale(toPercent(nextStage.surviving / nextStage.total)) : height;\n let yNextPreserved = nextDividerY;\n let yNextDiscarded = 0;\n let nextPreservedRect: { top: number; bottom: number } | null = null;\n let nextDiscardedRect: { top: number; bottom: number } | null = null;\n for (const name of stackOrder) {\n const g = nextStage.groups.get(name);\n if (!g) continue;\n const preservedHeight = (g.surviving / nextStage.total) * height;\n const discardedHeight = (g.discarded / nextStage.total) * height;\n if (name === groupName) {\n nextPreservedRect =\n preservedHeight > 0\n ? { top: yNextPreserved, bottom: yNextPreserved + preservedHeight }\n : null;\n nextDiscardedRect =\n discardedHeight > 0\n ? { top: yNextDiscarded, bottom: yNextDiscarded + discardedHeight }\n : null;\n break;\n }\n yNextPreserved += preservedHeight;\n yNextDiscarded += discardedHeight;\n }\n\n const nextGroupData = nextStage.groups.get(groupName);\n const nextSurviving = nextGroupData?.surviving ?? 0;\n const nextDiscarded = nextGroupData?.discarded ?? 0;\n const nextGroupTotal = nextSurviving + nextDiscarded;\n if (nextGroupTotal <= 0) return null;\n\n // Split source proportionally: top portion → discarded next, bottom → preserved next.\n const splitY = yTop + groupSurvivingHeight * (nextDiscarded / nextGroupTotal);\n\n return (\n <>\n {nextDiscardedRect && nextDiscarded > 0 && (\n <path\n d={ribbonPath({\n leftX: x0,\n leftYTop: yTop,\n leftYBottom: splitY,\n rightX: x1,\n rightYTop: nextDiscardedRect.top,\n rightYBottom: nextDiscardedRect.bottom,\n })}\n fill={color}\n opacity={RIBBON_OPACITY * DESATURATE_ALPHA * layerOpacity}\n />\n )}\n {nextPreservedRect && nextSurviving > 0 && (\n <path\n d={ribbonPath({\n leftX: x0,\n leftYTop: splitY,\n leftYBottom: yBottom,\n rightX: x1,\n rightYTop: nextPreservedRect.top,\n rightYBottom: nextPreservedRect.bottom,\n })}\n fill={color}\n opacity={RIBBON_OPACITY * layerOpacity}\n />\n )}\n </>\n );\n});\n"],"mappings":";;;;;AAYA,MAAa,IAAyB,EAAK,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IAAgB,KACpC,kBAAC,QAAD;EACE,GAAG,EAAW;GACZ,OAAO;GACP,UAAU;GACV,aAAa;GACb,QAAQ;GACR,WAAW,EAAkB;GAC7B,cAAc,EAAkB;GACjC,CAAC;EACF,MAAM;EACN,SAAA,MAAA,KAA6C;EAC7C,CAAA,EAEH,KAAqB,IAAgB,KACpC,kBAAC,QAAD;EACE,GAAG,EAAW;GACZ,OAAO;GACP,UAAU;GACV,aAAa;GACb,QAAQ;GACR,WAAW,EAAkB;GAC7B,cAAc,EAAkB;GACjC,CAAC;EACF,MAAM;EACN,SAAA,MAA0B;EAC1B,CAAA,CAEH,EAAA,CAAA;EAEL"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ScaleBand } from 'd3-scale';
|
|
2
|
+
type LabelsPosition = 'center' | '45deg' | '90deg';
|
|
3
|
+
/**
|
|
4
|
+
* X-axis for the Selection Plot. Unlike the shared {@link BandAxis}, category
|
|
5
|
+
* labels (and their tick marks) are placed in the gaps BETWEEN bars — so they
|
|
6
|
+
* label the funnels (transitions) rather than the populations, and the terminal
|
|
7
|
+
* bar carries no tick/label. Rendered inside a `translate(0, height)` group
|
|
8
|
+
* (the axis baseline), so the ticks and labels hang below it.
|
|
9
|
+
*/
|
|
10
|
+
export declare const SelectionXAxis: ({ scale, labels, labelsPosition, hiddenLabels, showTicks, }: {
|
|
11
|
+
scale: ScaleBand<string>;
|
|
12
|
+
labels?: Record<string, string[]>;
|
|
13
|
+
labelsPosition?: LabelsPosition;
|
|
14
|
+
hiddenLabels?: boolean;
|
|
15
|
+
showTicks?: boolean;
|
|
16
|
+
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=SelectionXAxis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectionXAxis.d.ts","sourceRoot":"","sources":["../../../../src/selection/components/Chart/SelectionXAxis.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAI1C,KAAK,cAAc,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC;AAwBnD;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,GAAI,6DAM5B;IACD,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAClC,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,mDAuCA,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import "../../../constants.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
4
|
+
var n = 21;
|
|
5
|
+
function r(e) {
|
|
6
|
+
return e === "45deg" ? `translate(0,${n / 2}) rotate(-45)` : e === "90deg" ? `translate(${-n / 2},${4 + n / 2}) rotate(-90)` : "translate(0,4)";
|
|
7
|
+
}
|
|
8
|
+
function i(e) {
|
|
9
|
+
return e === "90deg" ? "central" : e === "center" ? "hanging" : "auto";
|
|
10
|
+
}
|
|
11
|
+
function a(e) {
|
|
12
|
+
return e === "center" ? "middle" : "end";
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* X-axis for the Selection Plot. Unlike the shared {@link BandAxis}, category
|
|
16
|
+
* labels (and their tick marks) are placed in the gaps BETWEEN bars — so they
|
|
17
|
+
* label the funnels (transitions) rather than the populations, and the terminal
|
|
18
|
+
* bar carries no tick/label. Rendered inside a `translate(0, height)` group
|
|
19
|
+
* (the axis baseline), so the ticks and labels hang below it.
|
|
20
|
+
*/
|
|
21
|
+
const o = ({ scale: n, labels: o = {}, labelsPosition: s = "center", hiddenLabels: c = !1, showTicks: l = !0 }) => {
|
|
22
|
+
if (c && !l) return null;
|
|
23
|
+
let u = n.domain(), d = n.bandwidth(), f = (e) => n(e) ?? 0, p = (e) => (f(u[e]) + f(u[e + 1]) + d) / 2;
|
|
24
|
+
return /* @__PURE__ */ e("g", { children: u.slice(0, -1).map((n, u) => /* @__PURE__ */ t("g", {
|
|
25
|
+
transform: `translate(${p(u)},0)`,
|
|
26
|
+
children: [l && /* @__PURE__ */ e("line", {
|
|
27
|
+
y2: 4,
|
|
28
|
+
stroke: "#110529"
|
|
29
|
+
}), !c && /* @__PURE__ */ e("g", {
|
|
30
|
+
transform: r(s),
|
|
31
|
+
children: (o[n] ?? []).map((t, n) => /* @__PURE__ */ e("text", {
|
|
32
|
+
y: 4,
|
|
33
|
+
fill: "#110529",
|
|
34
|
+
fontSize: "14px",
|
|
35
|
+
fontWeight: "500",
|
|
36
|
+
fontFamily: "Manrope",
|
|
37
|
+
dominantBaseline: i(s),
|
|
38
|
+
textAnchor: a(s),
|
|
39
|
+
dy: 20 * n,
|
|
40
|
+
children: t
|
|
41
|
+
}, `${t}_${n}`))
|
|
42
|
+
})]
|
|
43
|
+
}, `xlabel_${u}`)) });
|
|
44
|
+
};
|
|
45
|
+
export { o as SelectionXAxis };
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=SelectionXAxis.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectionXAxis.js","names":[],"sources":["../../../../src/selection/components/Chart/SelectionXAxis.tsx"],"sourcesContent":["import React from 'react';\nimport type { ScaleBand } from 'd3-scale';\nimport { BLACK } from '../../../constants';\nimport { DEFAULT_TICKS_SIZE, TICK_OFFSET } from '../../../discrete/constants';\n\ntype LabelsPosition = 'center' | '45deg' | '90deg';\n\nconst FONT_HEIGHT = 21;\n\nfunction getRotationTransform(labelsPosition: LabelsPosition) {\n if (labelsPosition === '45deg') {\n return `translate(0,${FONT_HEIGHT / 2}) rotate(-45)`;\n }\n if (labelsPosition === '90deg') {\n return `translate(${-FONT_HEIGHT / 2},${TICK_OFFSET + FONT_HEIGHT / 2}) rotate(-90)`;\n }\n return `translate(0,${TICK_OFFSET})`;\n}\n\nfunction getDominantBaseline(labelsPosition: LabelsPosition) {\n if (labelsPosition === '90deg') return 'central';\n if (labelsPosition === 'center') return 'hanging';\n return 'auto';\n}\n\nfunction getTextAnchor(labelsPosition: LabelsPosition) {\n return labelsPosition === 'center' ? 'middle' : 'end';\n}\n\n/**\n * X-axis for the Selection Plot. Unlike the shared {@link BandAxis}, category\n * labels (and their tick marks) are placed in the gaps BETWEEN bars — so they\n * label the funnels (transitions) rather than the populations, and the terminal\n * bar carries no tick/label. Rendered inside a `translate(0, height)` group\n * (the axis baseline), so the ticks and labels hang below it.\n */\nexport const SelectionXAxis = ({\n scale,\n labels = {},\n labelsPosition = 'center',\n hiddenLabels = false,\n showTicks = true,\n}: {\n scale: ScaleBand<string>;\n labels?: Record<string, string[]>;\n labelsPosition?: LabelsPosition;\n hiddenLabels?: boolean;\n showTicks?: boolean;\n}) => {\n if (hiddenLabels && !showTicks) return null;\n\n const values = scale.domain();\n const bandwidth = scale.bandwidth();\n const bandStart = (tick: string) => scale(tick) ?? 0;\n // Midpoint between consecutive band starts — the gap between bar i and i+1,\n // matching the between-band gridline positions.\n const gapMidpoint = (i: number) =>\n (bandStart(values[i]) + bandStart(values[i + 1]) + bandwidth) / 2;\n\n return (\n <g>\n {values.slice(0, -1).map((tick, i) => (\n <g key={`xlabel_${i}`} transform={`translate(${gapMidpoint(i)},0)`}>\n {showTicks && <line y2={DEFAULT_TICKS_SIZE} stroke={BLACK} />}\n {!hiddenLabels && (\n <g transform={getRotationTransform(labelsPosition)}>\n {(labels[tick] ?? []).map((line, idx) => (\n <text\n key={`${line}_${idx}`}\n y={TICK_OFFSET}\n fill={BLACK}\n fontSize=\"14px\"\n fontWeight=\"500\"\n fontFamily=\"Manrope\"\n dominantBaseline={getDominantBaseline(labelsPosition)}\n textAnchor={getTextAnchor(labelsPosition)}\n dy={20 * idx}\n >\n {line}\n </text>\n ))}\n </g>\n )}\n </g>\n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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,
|
|
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,6CA2FhB,CAAC"}
|
|
@@ -14,7 +14,7 @@ const d = c(function({ data: c, grouped: d, orderedGroupNames: f, layout: p, xAx
|
|
|
14
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
15
|
let o = n.total, s = t === "preserved" ? n.surviving : n.discarded;
|
|
16
16
|
if (a) {
|
|
17
|
-
let e = n.groups.
|
|
17
|
+
let e = n.groups.get(a);
|
|
18
18
|
s = t === "preserved" ? e?.surviving ?? 0 : e?.discarded ?? 0;
|
|
19
19
|
}
|
|
20
20
|
M.onMouseEnter({
|
|
@@ -42,17 +42,13 @@ const d = c(function({ data: c, grouped: d, orderedGroupNames: f, layout: p, xAx
|
|
|
42
42
|
onGroupHover: j,
|
|
43
43
|
onTooltipEnter: L,
|
|
44
44
|
onTooltipLeave: R
|
|
45
|
-
}, H =
|
|
45
|
+
}, H = h.showGrid ?? !0, U = g.frameType ?? "left-bottom";
|
|
46
46
|
return /* @__PURE__ */ u("g", {
|
|
47
47
|
transform: `translate(${S + w},${C + T})`,
|
|
48
48
|
children: [
|
|
49
|
-
/* @__PURE__ */ l(a, {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
width: b,
|
|
53
|
-
height: x,
|
|
54
|
-
xShow: H,
|
|
55
|
-
yShow: U
|
|
49
|
+
H && /* @__PURE__ */ l(a, {
|
|
50
|
+
scale: D,
|
|
51
|
+
width: b
|
|
56
52
|
}),
|
|
57
53
|
/* @__PURE__ */ l(o, {
|
|
58
54
|
stages: v,
|
|
@@ -75,9 +71,8 @@ const d = c(function({ data: c, grouped: d, orderedGroupNames: f, layout: p, xAx
|
|
|
75
71
|
/* @__PURE__ */ l(r, {
|
|
76
72
|
width: b,
|
|
77
73
|
height: x,
|
|
78
|
-
frameType:
|
|
79
|
-
|
|
80
|
-
yShowGrid: U
|
|
74
|
+
frameType: U,
|
|
75
|
+
showGrid: H
|
|
81
76
|
}),
|
|
82
77
|
/* @__PURE__ */ l(s, {
|
|
83
78
|
xScale: E,
|
|
@@ -1 +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.
|
|
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.get(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 showGrid = yAxis.showGrid ?? true;\n const frameType = style.frameType ?? 'left-bottom';\n\n return (\n <g transform={`translate(${dimensionsLeft + paddingLeft},${dimensionsTop + paddingTop})`}>\n {showGrid && <Gridlines scale={yScale} width={width} />}\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 showGrid={showGrid}\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,IAAI,EAAU;AACrC,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,IAAW,EAAM,YAAY,IAC7B,IAAY,EAAM,aAAa;AAErC,QACE,kBAAC,KAAD;EAAG,WAAW,aAAa,IAAiB,EAAY,GAAG,IAAgB,EAAW;YAAtF;GACG,KAAY,kBAAC,GAAD;IAAW,OAAO;IAAe;IAAS,CAAA;GACvD,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;IACD;IACV,CAAA;GACF,kBAAC,GAAD;IAAqB;IAAQ,QAAQ,EAAM;IAAQ,UAAU,EAAM;IAAkB,CAAA;GACrF,kBAAC,GAAD;IAAmB;IAAe;IAAc;IAAS,CAAA;GACvD;;EAEN"}
|
|
@@ -1 +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,
|
|
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,2CAqOP"}
|