@reltio/components 1.4.1998 → 1.4.1999
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/cjs/UpSetChart/UpSetChart.d.ts +5 -8
- package/cjs/UpSetChart/UpSetChart.js +61 -5
- package/cjs/UpSetChart/UpSetChart.test.d.ts +1 -0
- package/cjs/UpSetChart/UpSetChart.test.js +198 -0
- package/cjs/UpSetChart/components/IntersectionsChart/IntersectionsChart.d.ts +15 -0
- package/cjs/UpSetChart/components/IntersectionsChart/IntersectionsChart.js +66 -0
- package/cjs/UpSetChart/components/IntersectionsChart/index.d.ts +1 -0
- package/cjs/UpSetChart/components/IntersectionsChart/index.js +5 -0
- package/cjs/UpSetChart/components/IntersectionsChart/styles.d.ts +1 -0
- package/cjs/UpSetChart/components/IntersectionsChart/styles.js +32 -0
- package/cjs/UpSetChart/components/IntersectionsChartAxis/IntersectionsChartAxis.d.ts +10 -0
- package/cjs/UpSetChart/components/IntersectionsChartAxis/IntersectionsChartAxis.js +64 -0
- package/cjs/UpSetChart/components/IntersectionsChartAxis/index.d.ts +1 -0
- package/cjs/UpSetChart/components/IntersectionsChartAxis/index.js +5 -0
- package/cjs/UpSetChart/components/IntersectionsChartAxis/styles.d.ts +1 -0
- package/cjs/UpSetChart/components/IntersectionsChartAxis/styles.js +32 -0
- package/cjs/UpSetChart/components/IntersectionsMatrix/IntersectionsMatrix.d.ts +13 -0
- package/cjs/UpSetChart/components/IntersectionsMatrix/IntersectionsMatrix.js +56 -0
- package/cjs/UpSetChart/components/IntersectionsMatrix/index.d.ts +1 -0
- package/cjs/UpSetChart/components/IntersectionsMatrix/index.js +5 -0
- package/cjs/UpSetChart/components/IntersectionsMatrix/styles.d.ts +1 -0
- package/cjs/UpSetChart/components/IntersectionsMatrix/styles.js +27 -0
- package/cjs/UpSetChart/components/SetsChart/SetsChart.d.ts +15 -0
- package/cjs/UpSetChart/components/SetsChart/SetsChart.js +58 -0
- package/cjs/UpSetChart/components/SetsChart/index.d.ts +1 -0
- package/cjs/UpSetChart/components/SetsChart/index.js +5 -0
- package/cjs/UpSetChart/components/SetsChart/styles.d.ts +1 -0
- package/cjs/UpSetChart/components/SetsChart/styles.js +43 -0
- package/cjs/UpSetChart/components/SetsChartAxis/SetsChartAxis.d.ts +6 -0
- package/cjs/UpSetChart/components/SetsChartAxis/SetsChartAxis.js +20 -0
- package/cjs/UpSetChart/components/SetsChartAxis/index.d.ts +1 -0
- package/cjs/UpSetChart/components/SetsChartAxis/index.js +5 -0
- package/cjs/UpSetChart/components/SetsChartAxis/styles.d.ts +1 -0
- package/cjs/UpSetChart/components/SetsChartAxis/styles.js +17 -0
- package/cjs/UpSetChart/constants.d.ts +16 -3
- package/cjs/UpSetChart/constants.js +20 -4
- package/cjs/UpSetChart/gameOfThrones.test-data.d.ts +4 -0
- package/cjs/UpSetChart/gameOfThrones.test-data.js +26 -0
- package/cjs/UpSetChart/helpers.d.ts +20 -0
- package/cjs/UpSetChart/helpers.js +127 -0
- package/cjs/UpSetChart/styles.d.ts +4 -1
- package/cjs/UpSetChart/styles.js +11 -12
- package/cjs/UpSetChart/types.d.ts +16 -0
- package/cjs/UpSetChart/types.js +2 -0
- package/cjs/UpSetChart/useUpSetChartSizes.d.ts +20 -0
- package/cjs/UpSetChart/useUpSetChartSizes.js +34 -0
- package/esm/UpSetChart/UpSetChart.d.ts +5 -8
- package/esm/UpSetChart/UpSetChart.js +38 -5
- package/esm/UpSetChart/UpSetChart.test.d.ts +1 -0
- package/esm/UpSetChart/UpSetChart.test.js +193 -0
- package/esm/UpSetChart/components/IntersectionsChart/IntersectionsChart.d.ts +15 -0
- package/esm/UpSetChart/components/IntersectionsChart/IntersectionsChart.js +39 -0
- package/esm/UpSetChart/components/IntersectionsChart/index.d.ts +1 -0
- package/esm/UpSetChart/components/IntersectionsChart/index.js +1 -0
- package/esm/UpSetChart/components/IntersectionsChart/styles.d.ts +1 -0
- package/esm/UpSetChart/components/IntersectionsChart/styles.js +29 -0
- package/esm/UpSetChart/components/IntersectionsChartAxis/IntersectionsChartAxis.d.ts +10 -0
- package/esm/UpSetChart/components/IntersectionsChartAxis/IntersectionsChartAxis.js +34 -0
- package/esm/UpSetChart/components/IntersectionsChartAxis/index.d.ts +1 -0
- package/esm/UpSetChart/components/IntersectionsChartAxis/index.js +1 -0
- package/esm/UpSetChart/components/IntersectionsChartAxis/styles.d.ts +1 -0
- package/esm/UpSetChart/components/IntersectionsChartAxis/styles.js +29 -0
- package/esm/UpSetChart/components/IntersectionsMatrix/IntersectionsMatrix.d.ts +13 -0
- package/esm/UpSetChart/components/IntersectionsMatrix/IntersectionsMatrix.js +26 -0
- package/esm/UpSetChart/components/IntersectionsMatrix/index.d.ts +1 -0
- package/esm/UpSetChart/components/IntersectionsMatrix/index.js +1 -0
- package/esm/UpSetChart/components/IntersectionsMatrix/styles.d.ts +1 -0
- package/esm/UpSetChart/components/IntersectionsMatrix/styles.js +24 -0
- package/esm/UpSetChart/components/SetsChart/SetsChart.d.ts +15 -0
- package/esm/UpSetChart/components/SetsChart/SetsChart.js +31 -0
- package/esm/UpSetChart/components/SetsChart/index.d.ts +1 -0
- package/esm/UpSetChart/components/SetsChart/index.js +1 -0
- package/esm/UpSetChart/components/SetsChart/styles.d.ts +1 -0
- package/esm/UpSetChart/components/SetsChart/styles.js +40 -0
- package/esm/UpSetChart/components/SetsChartAxis/SetsChartAxis.d.ts +6 -0
- package/esm/UpSetChart/components/SetsChartAxis/SetsChartAxis.js +13 -0
- package/esm/UpSetChart/components/SetsChartAxis/index.d.ts +1 -0
- package/esm/UpSetChart/components/SetsChartAxis/index.js +1 -0
- package/esm/UpSetChart/components/SetsChartAxis/styles.d.ts +1 -0
- package/esm/UpSetChart/components/SetsChartAxis/styles.js +14 -0
- package/esm/UpSetChart/constants.d.ts +16 -3
- package/esm/UpSetChart/constants.js +19 -3
- package/esm/UpSetChart/gameOfThrones.test-data.d.ts +4 -0
- package/esm/UpSetChart/gameOfThrones.test-data.js +23 -0
- package/esm/UpSetChart/helpers.d.ts +20 -0
- package/esm/UpSetChart/helpers.js +120 -0
- package/esm/UpSetChart/styles.d.ts +4 -1
- package/esm/UpSetChart/styles.js +11 -12
- package/esm/UpSetChart/types.d.ts +16 -0
- package/esm/UpSetChart/types.js +1 -0
- package/esm/UpSetChart/useUpSetChartSizes.d.ts +20 -0
- package/esm/UpSetChart/useUpSetChartSizes.js +30 -0
- package/package.json +1 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useStyles = void 0;
|
|
4
|
+
var styles_1 = require("@mui/styles");
|
|
5
|
+
var constants_1 = require("../../constants");
|
|
6
|
+
exports.useStyles = (0, styles_1.makeStyles)(function () { return ({
|
|
7
|
+
circle: {
|
|
8
|
+
strokeWidth: '2px',
|
|
9
|
+
fill: '#EEEEEE',
|
|
10
|
+
stroke: '#EEEEEE',
|
|
11
|
+
transition: 'fill ease-in-out 0.3s'
|
|
12
|
+
},
|
|
13
|
+
activeCircle: {
|
|
14
|
+
fill: constants_1.PRIMARY_COLOR
|
|
15
|
+
},
|
|
16
|
+
dimmedCircle: {
|
|
17
|
+
fill: constants_1.DIMMED_COLOR
|
|
18
|
+
},
|
|
19
|
+
link: {
|
|
20
|
+
stroke: constants_1.PRIMARY_COLOR,
|
|
21
|
+
strokeWidth: '2px',
|
|
22
|
+
transition: 'stroke ease-in-out 0.3s'
|
|
23
|
+
},
|
|
24
|
+
dimmedLine: {
|
|
25
|
+
stroke: constants_1.DIMMED_COLOR
|
|
26
|
+
}
|
|
27
|
+
}); });
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ScaleBand } from 'd3-scale';
|
|
3
|
+
import { DataSet } from '../../types';
|
|
4
|
+
type Props = {
|
|
5
|
+
sets: DataSet[];
|
|
6
|
+
width: number;
|
|
7
|
+
yScale: ScaleBand<string>;
|
|
8
|
+
labels: string[];
|
|
9
|
+
transform?: string;
|
|
10
|
+
hoverAreaWidth: number;
|
|
11
|
+
hoveredElements?: string[];
|
|
12
|
+
onSetHover: (set: DataSet) => void;
|
|
13
|
+
};
|
|
14
|
+
export declare const SetsChart: ({ sets, width, yScale, transform, labels, hoveredElements, hoverAreaWidth, onSetHover }: Props) => React.JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.SetsChart = void 0;
|
|
27
|
+
var react_1 = __importStar(require("react"));
|
|
28
|
+
var d3_scale_1 = require("d3-scale");
|
|
29
|
+
var SetsChartAxis_1 = require("../SetsChartAxis");
|
|
30
|
+
var constants_1 = require("../../constants");
|
|
31
|
+
var styles_1 = require("./styles");
|
|
32
|
+
var SetsChart = function (_a) {
|
|
33
|
+
var sets = _a.sets, width = _a.width, yScale = _a.yScale, transform = _a.transform, labels = _a.labels, hoveredElements = _a.hoveredElements, hoverAreaWidth = _a.hoverAreaWidth, onSetHover = _a.onSetHover;
|
|
34
|
+
var styles = (0, styles_1.useStyles)();
|
|
35
|
+
var containerRef = react_1.default.useRef(null);
|
|
36
|
+
var xScale = (0, react_1.useMemo)(function () {
|
|
37
|
+
var maxSetSize = sets.length > 0 ? Math.max.apply(Math, sets.map(function (set) { return set.size; })) : 0;
|
|
38
|
+
return (0, d3_scale_1.scaleLinear)().domain([0, maxSetSize]).range([0, width]);
|
|
39
|
+
}, [width, sets]);
|
|
40
|
+
return (react_1.default.createElement("g", { ref: containerRef, transform: transform },
|
|
41
|
+
react_1.default.createElement(SetsChartAxis_1.SetsChartAxis, { width: width }),
|
|
42
|
+
sets.map(function (set, i) {
|
|
43
|
+
var name = set.name, size = set.size, elements = set.elements;
|
|
44
|
+
var label = labels[i];
|
|
45
|
+
var height = yScale.bandwidth();
|
|
46
|
+
var y = yScale(name) + height / 2 - constants_1.SET_BAR_HEIGHT / 2;
|
|
47
|
+
var lineY = yScale(name) + height;
|
|
48
|
+
var barSize = hoveredElements ? elements.filter(function (el) { return hoveredElements.includes(el); }).length : size;
|
|
49
|
+
return (react_1.default.createElement("g", { key: "set-group-".concat(i) },
|
|
50
|
+
react_1.default.createElement("rect", { className: styles.setsBarBackground, x: 0, y: y, width: width, height: constants_1.SET_BAR_HEIGHT }),
|
|
51
|
+
react_1.default.createElement("rect", { className: styles.setsBarDimmed, x: width - xScale(size), y: y, width: xScale(size), height: constants_1.SET_BAR_HEIGHT }),
|
|
52
|
+
react_1.default.createElement("rect", { className: styles.setsBar, x: width - xScale(barSize), y: y, width: xScale(barSize), height: constants_1.SET_BAR_HEIGHT }),
|
|
53
|
+
i !== sets.length - 1 && (react_1.default.createElement("line", { className: styles.gridLine, x1: 0, x2: hoverAreaWidth, y1: lineY, y2: lineY })),
|
|
54
|
+
react_1.default.createElement("text", { className: styles.setsLabel, x: width + constants_1.TEXT_GAP, y: yScale(name) + height / 2 }, label),
|
|
55
|
+
react_1.default.createElement("rect", { className: styles.hoverBar, "data-reltio-id": "set-hover-area", x: -constants_1.GAP_BEFORE_LEFT_BAR + 1, y: yScale(name), width: hoverAreaWidth - 2, height: height, onMouseEnter: function () { return onSetHover(set); }, onMouseLeave: function () { return onSetHover(null); } })));
|
|
56
|
+
})));
|
|
57
|
+
};
|
|
58
|
+
exports.SetsChart = SetsChart;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SetsChart } from './SetsChart';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SetsChart = void 0;
|
|
4
|
+
var SetsChart_1 = require("./SetsChart");
|
|
5
|
+
Object.defineProperty(exports, "SetsChart", { enumerable: true, get: function () { return SetsChart_1.SetsChart; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"setsBarBackground" | "setsBarDimmed" | "setsBar" | "hoverBar" | "setsLabel" | "gridLine">;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useStyles = void 0;
|
|
4
|
+
var styles_1 = require("@mui/styles");
|
|
5
|
+
var constants_1 = require("../../constants");
|
|
6
|
+
exports.useStyles = (0, styles_1.makeStyles)(function () { return ({
|
|
7
|
+
setsBarBackground: {
|
|
8
|
+
fill: constants_1.PRIMARY_COLOR,
|
|
9
|
+
opacity: 0.08,
|
|
10
|
+
transition: 'x ease-in-out 0.3s, width ease-in-out 0.3s'
|
|
11
|
+
},
|
|
12
|
+
setsBarDimmed: {
|
|
13
|
+
fill: constants_1.DIMMED_COLOR,
|
|
14
|
+
transition: 'x ease-in-out 0.3s, width ease-in-out 0.3s'
|
|
15
|
+
},
|
|
16
|
+
setsBar: {
|
|
17
|
+
fill: constants_1.PRIMARY_COLOR,
|
|
18
|
+
transition: 'x ease-in-out 0.3s, width ease-in-out 0.3s'
|
|
19
|
+
},
|
|
20
|
+
hoverBar: {
|
|
21
|
+
fill: 'transparent',
|
|
22
|
+
strokeWidth: '1px',
|
|
23
|
+
cursor: 'pointer',
|
|
24
|
+
stroke: constants_1.PRIMARY_COLOR,
|
|
25
|
+
opacity: 0,
|
|
26
|
+
transition: 'opacity ease-in-out 0.3s',
|
|
27
|
+
'&:hover': {
|
|
28
|
+
opacity: 1
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
setsLabel: {
|
|
32
|
+
fontSize: constants_1.SET_LABEL_SIZE,
|
|
33
|
+
fill: constants_1.TEXT_COLOR,
|
|
34
|
+
textAnchor: 'start',
|
|
35
|
+
dominantBaseline: 'middle',
|
|
36
|
+
transition: 'all ease-in-out 0.3s'
|
|
37
|
+
},
|
|
38
|
+
gridLine: {
|
|
39
|
+
stroke: '#000000',
|
|
40
|
+
opacity: 0.04,
|
|
41
|
+
strokeWidth: '1px'
|
|
42
|
+
}
|
|
43
|
+
}); });
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.SetsChartAxis = void 0;
|
|
7
|
+
var react_1 = __importDefault(require("react"));
|
|
8
|
+
var styles_1 = require("./styles");
|
|
9
|
+
var SetsChartAxis = function (_a) {
|
|
10
|
+
var width = _a.width;
|
|
11
|
+
var styles = (0, styles_1.useStyles)();
|
|
12
|
+
return (react_1.default.createElement("g", null,
|
|
13
|
+
react_1.default.createElement("g", { transform: "translate(0,0)" },
|
|
14
|
+
react_1.default.createElement("line", { y2: -6, className: styles.axisTick }),
|
|
15
|
+
react_1.default.createElement("text", { x: 0, y: -9, className: styles.axisTickLabel }, "100%")),
|
|
16
|
+
react_1.default.createElement("g", { transform: "translate(".concat(width, ",0)") },
|
|
17
|
+
react_1.default.createElement("line", { y2: -6, className: styles.axisTick }),
|
|
18
|
+
react_1.default.createElement("text", { x: 0, y: -9, className: styles.axisTickLabel }, "0%"))));
|
|
19
|
+
};
|
|
20
|
+
exports.SetsChartAxis = SetsChartAxis;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SetsChartAxis } from './SetsChartAxis';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SetsChartAxis = void 0;
|
|
4
|
+
var SetsChartAxis_1 = require("./SetsChartAxis");
|
|
5
|
+
Object.defineProperty(exports, "SetsChartAxis", { enumerable: true, get: function () { return SetsChartAxis_1.SetsChartAxis; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"axisTick" | "axisTickLabel">;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useStyles = void 0;
|
|
4
|
+
var styles_1 = require("@mui/styles");
|
|
5
|
+
exports.useStyles = (0, styles_1.makeStyles)(function () { return ({
|
|
6
|
+
axisTick: {
|
|
7
|
+
stroke: '#000000',
|
|
8
|
+
strokeWidth: '1px',
|
|
9
|
+
opacity: 0.54
|
|
10
|
+
},
|
|
11
|
+
axisTickLabel: {
|
|
12
|
+
fontSize: '10px',
|
|
13
|
+
fill: '#000000',
|
|
14
|
+
opacity: 0.54,
|
|
15
|
+
textAnchor: 'middle'
|
|
16
|
+
}
|
|
17
|
+
}); });
|
|
@@ -1,4 +1,17 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const SECONDARY_COLOR = "rgba(0, 0, 102, 0.2)";
|
|
1
|
+
export declare const PRIMARY_COLOR = "#000066";
|
|
2
|
+
export declare const DIMMED_COLOR = "#CCCCE0";
|
|
4
3
|
export declare const TEXT_COLOR = "rgba(0, 0, 0, 0.87)";
|
|
4
|
+
export declare const TOP_GAP = 24;
|
|
5
|
+
export declare const TEXT_GAP = 16;
|
|
6
|
+
export declare const GAP_BETWEEN_TABLE_AND_CHART = 8;
|
|
7
|
+
export declare const GAP_BEFORE_LEFT_BAR = 12;
|
|
8
|
+
export declare const AXIS_TICK_LABEL_SIZE = "12px";
|
|
9
|
+
export declare const SET_LABEL_SIZE = "13px";
|
|
10
|
+
export declare const SET_BAR_HEIGHT = 12;
|
|
11
|
+
export declare const MATRIX_ROW_HEIGHT = 29;
|
|
12
|
+
export declare const MIN_MATRIX_COLUMN_WIDTH = 28;
|
|
13
|
+
export declare const MIN_INTERSECTION_CHART_HEIGHT = 120;
|
|
14
|
+
export declare const MIN_SETS_CHART_WIDTH = 100;
|
|
15
|
+
export declare const MAX_SETS_CHART_WIDTH = 200;
|
|
16
|
+
export declare const MAX_CHARACTERS = 20;
|
|
17
|
+
export declare const MIN_CHARACTERS = 8;
|
|
@@ -1,7 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
exports.PRIMARY_COLOR = '
|
|
6
|
-
exports.
|
|
3
|
+
exports.MIN_CHARACTERS = exports.MAX_CHARACTERS = exports.MAX_SETS_CHART_WIDTH = exports.MIN_SETS_CHART_WIDTH = exports.MIN_INTERSECTION_CHART_HEIGHT = exports.MIN_MATRIX_COLUMN_WIDTH = exports.MATRIX_ROW_HEIGHT = exports.SET_BAR_HEIGHT = exports.SET_LABEL_SIZE = exports.AXIS_TICK_LABEL_SIZE = exports.GAP_BEFORE_LEFT_BAR = exports.GAP_BETWEEN_TABLE_AND_CHART = exports.TEXT_GAP = exports.TOP_GAP = exports.TEXT_COLOR = exports.DIMMED_COLOR = exports.PRIMARY_COLOR = void 0;
|
|
4
|
+
// Colors
|
|
5
|
+
exports.PRIMARY_COLOR = '#000066';
|
|
6
|
+
exports.DIMMED_COLOR = '#CCCCE0';
|
|
7
7
|
exports.TEXT_COLOR = 'rgba(0, 0, 0, 0.87)';
|
|
8
|
+
// Gaps
|
|
9
|
+
exports.TOP_GAP = 24;
|
|
10
|
+
exports.TEXT_GAP = 16;
|
|
11
|
+
exports.GAP_BETWEEN_TABLE_AND_CHART = 8;
|
|
12
|
+
exports.GAP_BEFORE_LEFT_BAR = 12;
|
|
13
|
+
// Sizes
|
|
14
|
+
exports.AXIS_TICK_LABEL_SIZE = '12px';
|
|
15
|
+
exports.SET_LABEL_SIZE = '13px';
|
|
16
|
+
exports.SET_BAR_HEIGHT = 12;
|
|
17
|
+
exports.MATRIX_ROW_HEIGHT = 29;
|
|
18
|
+
exports.MIN_MATRIX_COLUMN_WIDTH = 28;
|
|
19
|
+
exports.MIN_INTERSECTION_CHART_HEIGHT = 120;
|
|
20
|
+
exports.MIN_SETS_CHART_WIDTH = 100;
|
|
21
|
+
exports.MAX_SETS_CHART_WIDTH = 200;
|
|
22
|
+
exports.MAX_CHARACTERS = 20;
|
|
23
|
+
exports.MIN_CHARACTERS = 8;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.gameOfThronesData = void 0;
|
|
4
|
+
exports.gameOfThronesData = [
|
|
5
|
+
{ name: 'Alton Lannister', sets: ['was killed', 'Lannister', 'male'] },
|
|
6
|
+
{ name: 'Arya Stark', sets: ['Stark', 'female'] },
|
|
7
|
+
{ name: 'Bran Stark', sets: ['royal', 'Stark', 'male'] },
|
|
8
|
+
{ name: 'Benjen Stark', sets: ['was killed', 'Stark', 'male'] },
|
|
9
|
+
{ name: 'Brandon Stark', sets: ['was killed', 'Stark'] },
|
|
10
|
+
{ name: 'Catelyn Stark', sets: ['was killed', 'Stark', 'female'] },
|
|
11
|
+
{ name: 'Cersei Lannister', sets: ['royal', 'was killed', 'Lannister', 'female'] },
|
|
12
|
+
{ name: 'Eddard Stark', sets: ['was killed', 'Stark', 'male'] },
|
|
13
|
+
{ name: 'Jaime Lannister', sets: ['was killed', 'Lannister', 'male'] },
|
|
14
|
+
{ name: 'Jon Snow', sets: ['royal', 'was killed', 'Stark', 'male'] },
|
|
15
|
+
{ name: 'Kevan Lannister', sets: ['was killed', 'Lannister', 'male'] },
|
|
16
|
+
{ name: 'Lancel Lannister', sets: ['was killed', 'Lannister', 'male'] },
|
|
17
|
+
{ name: 'Lyanna Stark', sets: ['was killed', 'Stark', 'female'] },
|
|
18
|
+
{ name: 'Martyn Lannister', sets: ['was killed', 'Lannister', 'male'] },
|
|
19
|
+
{ name: 'Rickard Stark', sets: ['was killed', 'Stark', 'male'] },
|
|
20
|
+
{ name: 'Rickon Stark', sets: ['was killed', 'Stark', 'male'] },
|
|
21
|
+
{ name: 'Robb Stark', sets: ['royal', 'was killed', 'Stark', 'male'] },
|
|
22
|
+
{ name: 'Sansa Stark', sets: ['royal', 'Stark', 'female'] },
|
|
23
|
+
{ name: 'Tyrion Lannister', sets: ['Lannister', 'male'] },
|
|
24
|
+
{ name: 'Tywin Lannister', sets: ['was killed', 'Lannister', 'male'] },
|
|
25
|
+
{ name: 'Willem Lannister', sets: ['was killed', 'Lannister', 'male'] }
|
|
26
|
+
];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ScaleBand } from 'd3-scale';
|
|
2
|
+
import { DataSet, Intersection, UpSetChartData } from './types';
|
|
3
|
+
export declare const findIntersections: (data: UpSetChartData) => {
|
|
4
|
+
intersections: Intersection[];
|
|
5
|
+
sets: DataSet[];
|
|
6
|
+
};
|
|
7
|
+
export declare const getMatrixData: (xScale: ScaleBand<string>, yScale: ScaleBand<string>, intersections: Intersection[], sets: DataSet[]) => {
|
|
8
|
+
circles: {
|
|
9
|
+
cx: number;
|
|
10
|
+
cy: number;
|
|
11
|
+
isPresent: boolean;
|
|
12
|
+
intersectionIndex: number;
|
|
13
|
+
}[];
|
|
14
|
+
lines: any[];
|
|
15
|
+
};
|
|
16
|
+
export declare const truncateLabels: (sets: DataSet[], maxLabelsWidth: number) => {
|
|
17
|
+
labels: string[];
|
|
18
|
+
maxWidth: number;
|
|
19
|
+
};
|
|
20
|
+
export declare const calculateTicksWidth: (ticks: number[]) => number;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
+
if (ar || !(i in from)) {
|
|
5
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
+
ar[i] = from[i];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.calculateTicksWidth = exports.truncateLabels = exports.getMatrixData = exports.findIntersections = void 0;
|
|
13
|
+
var constants_1 = require("./constants");
|
|
14
|
+
var findIntersections = function (data) {
|
|
15
|
+
var setsCombinations = {};
|
|
16
|
+
var individualSets = {};
|
|
17
|
+
data.forEach(function (_a) {
|
|
18
|
+
var name = _a.name, sets = _a.sets;
|
|
19
|
+
sets.forEach(function (set) {
|
|
20
|
+
if (!individualSets[set]) {
|
|
21
|
+
individualSets[set] = [];
|
|
22
|
+
}
|
|
23
|
+
individualSets[set].push(name);
|
|
24
|
+
});
|
|
25
|
+
var generateCombinations = function (subset, index) {
|
|
26
|
+
if (index === sets.length) {
|
|
27
|
+
if (subset.length > 0) {
|
|
28
|
+
var key = subset.sort().join(',');
|
|
29
|
+
if (!setsCombinations[key]) {
|
|
30
|
+
setsCombinations[key] = [];
|
|
31
|
+
}
|
|
32
|
+
setsCombinations[key].push(name);
|
|
33
|
+
}
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
generateCombinations(subset, index + 1);
|
|
37
|
+
generateCombinations(__spreadArray(__spreadArray([], subset, true), [sets[index]], false), index + 1);
|
|
38
|
+
};
|
|
39
|
+
generateCombinations([], 0);
|
|
40
|
+
});
|
|
41
|
+
var intersections = Object.entries(setsCombinations)
|
|
42
|
+
.map(function (_a, index) {
|
|
43
|
+
var key = _a[0], elements = _a[1];
|
|
44
|
+
return ({
|
|
45
|
+
index: index,
|
|
46
|
+
sets: key.split(','),
|
|
47
|
+
size: elements.length,
|
|
48
|
+
elements: elements
|
|
49
|
+
});
|
|
50
|
+
})
|
|
51
|
+
.sort(function (a, b) { return b.size - a.size; });
|
|
52
|
+
var sets = Object.entries(individualSets).map(function (_a, index) {
|
|
53
|
+
var name = _a[0], elements = _a[1];
|
|
54
|
+
return ({
|
|
55
|
+
index: index,
|
|
56
|
+
name: name,
|
|
57
|
+
size: elements.length,
|
|
58
|
+
elements: elements
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
return { intersections: intersections, sets: sets };
|
|
62
|
+
};
|
|
63
|
+
exports.findIntersections = findIntersections;
|
|
64
|
+
var getMatrixData = function (xScale, yScale, intersections, sets) {
|
|
65
|
+
var circles = intersections.flatMap(function (intersection, i) {
|
|
66
|
+
return sets.map(function (set) { return ({
|
|
67
|
+
cx: xScale(String(i)) + xScale.bandwidth() / 2,
|
|
68
|
+
cy: yScale(set.name) + yScale.bandwidth() / 2,
|
|
69
|
+
isPresent: intersection.sets.includes(set.name),
|
|
70
|
+
intersectionIndex: intersection.index
|
|
71
|
+
}); });
|
|
72
|
+
});
|
|
73
|
+
var lines = intersections.reduce(function (acc, intersection, i) {
|
|
74
|
+
var activeSetIndices = intersection.sets
|
|
75
|
+
.map(function (name) { return sets.findIndex(function (set) { return set.name === name; }); })
|
|
76
|
+
.filter(function (i) { return i >= 0; })
|
|
77
|
+
.sort(function (a, b) { return a - b; });
|
|
78
|
+
if (activeSetIndices.length > 1) {
|
|
79
|
+
var firstIdx = activeSetIndices[0];
|
|
80
|
+
var lastIdx = activeSetIndices[activeSetIndices.length - 1];
|
|
81
|
+
var x = xScale(String(i)) + xScale.bandwidth() / 2;
|
|
82
|
+
var y1 = yScale(sets[firstIdx].name) + yScale.bandwidth() / 2;
|
|
83
|
+
var y2 = yScale(sets[lastIdx].name) + yScale.bandwidth() / 2;
|
|
84
|
+
return __spreadArray(__spreadArray([], acc, true), [{ x: x, y1: y1, y2: y2, intersectionIndex: intersection.index }], false);
|
|
85
|
+
}
|
|
86
|
+
return acc;
|
|
87
|
+
}, []);
|
|
88
|
+
return { circles: circles, lines: lines };
|
|
89
|
+
};
|
|
90
|
+
exports.getMatrixData = getMatrixData;
|
|
91
|
+
var truncateLabels = function (sets, maxLabelsWidth) {
|
|
92
|
+
var newTruncatedLabels = [];
|
|
93
|
+
var maxWidth = 0;
|
|
94
|
+
var tempSvgElement = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
95
|
+
document.body.appendChild(tempSvgElement);
|
|
96
|
+
var tempTextElement = document.createElementNS('http://www.w3.org/2000/svg', 'text');
|
|
97
|
+
tempTextElement.setAttribute('font-size', constants_1.SET_LABEL_SIZE);
|
|
98
|
+
tempSvgElement.appendChild(tempTextElement);
|
|
99
|
+
sets.forEach(function (_a) {
|
|
100
|
+
var name = _a.name;
|
|
101
|
+
var truncatedText = name.length > constants_1.MAX_CHARACTERS ? name.slice(0, constants_1.MAX_CHARACTERS) + '...' : name;
|
|
102
|
+
tempTextElement.textContent = truncatedText;
|
|
103
|
+
while (tempTextElement.getBBox().width > maxLabelsWidth && truncatedText.length > constants_1.MIN_CHARACTERS) {
|
|
104
|
+
truncatedText = truncatedText.slice(0, -4) + '...';
|
|
105
|
+
tempTextElement.textContent = truncatedText;
|
|
106
|
+
}
|
|
107
|
+
newTruncatedLabels.push(truncatedText);
|
|
108
|
+
maxWidth = Math.max(maxWidth, tempTextElement.getBBox().width);
|
|
109
|
+
});
|
|
110
|
+
document.body.removeChild(tempSvgElement);
|
|
111
|
+
return { labels: newTruncatedLabels, maxWidth: maxWidth };
|
|
112
|
+
};
|
|
113
|
+
exports.truncateLabels = truncateLabels;
|
|
114
|
+
var calculateTicksWidth = function (ticks) {
|
|
115
|
+
var tempSvgElement = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
116
|
+
var tempTextElement = document.createElementNS('http://www.w3.org/2000/svg', 'text');
|
|
117
|
+
tempTextElement.setAttribute('font-size', constants_1.AXIS_TICK_LABEL_SIZE);
|
|
118
|
+
tempSvgElement.appendChild(tempTextElement);
|
|
119
|
+
document.body.appendChild(tempSvgElement);
|
|
120
|
+
var maxWidth = ticks.reduce(function (maxWidth, tick) {
|
|
121
|
+
tempTextElement.textContent = String(tick);
|
|
122
|
+
return Math.max(maxWidth, tempTextElement.getBBox().width);
|
|
123
|
+
}, 0);
|
|
124
|
+
document.body.removeChild(tempSvgElement);
|
|
125
|
+
return maxWidth;
|
|
126
|
+
};
|
|
127
|
+
exports.calculateTicksWidth = calculateTicksWidth;
|
|
@@ -1 +1,4 @@
|
|
|
1
|
-
export declare const useStyles: (props
|
|
1
|
+
export declare const useStyles: (props: {
|
|
2
|
+
width: number;
|
|
3
|
+
height: number;
|
|
4
|
+
}) => import("@mui/styles").ClassNameMap<"svg" | "wrapper">;
|
package/cjs/UpSetChart/styles.js
CHANGED
|
@@ -2,18 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useStyles = void 0;
|
|
4
4
|
var styles_1 = require("@mui/styles");
|
|
5
|
-
exports.useStyles = (0, styles_1.makeStyles)(function (
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
exports.useStyles = (0, styles_1.makeStyles)(function () { return ({
|
|
6
|
+
wrapper: function (_a) {
|
|
7
|
+
var width = _a.width, height = _a.height;
|
|
8
|
+
return ({
|
|
9
|
+
width: width,
|
|
10
|
+
height: height,
|
|
11
|
+
display: 'flex',
|
|
12
|
+
overflow: 'auto'
|
|
13
|
+
});
|
|
8
14
|
},
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
},
|
|
12
|
-
axisTick: {
|
|
13
|
-
fontSize: '12px !important'
|
|
14
|
-
},
|
|
15
|
-
chartLabel: {
|
|
16
|
-
fill: "".concat(theme.palette.text.secondary, " !important"),
|
|
17
|
-
fontSize: '10px !important'
|
|
15
|
+
svg: {
|
|
16
|
+
flexShrink: '0'
|
|
18
17
|
}
|
|
19
18
|
}); });
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type UpSetChartData = {
|
|
2
|
+
name: string;
|
|
3
|
+
sets: string[];
|
|
4
|
+
}[];
|
|
5
|
+
export type Intersection = {
|
|
6
|
+
index: number;
|
|
7
|
+
sets: string[];
|
|
8
|
+
size: number;
|
|
9
|
+
elements: string[];
|
|
10
|
+
};
|
|
11
|
+
export type DataSet = {
|
|
12
|
+
index: number;
|
|
13
|
+
name: string;
|
|
14
|
+
size: number;
|
|
15
|
+
elements: string[];
|
|
16
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { DataSet, Intersection } from './types';
|
|
2
|
+
type Props = {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
intersections: Intersection[];
|
|
6
|
+
sets: DataSet[];
|
|
7
|
+
};
|
|
8
|
+
export declare const useUpSetChartSizes: ({ width, height, intersections, sets }: Props) => {
|
|
9
|
+
labels: string[];
|
|
10
|
+
svgWidth: number;
|
|
11
|
+
svgHeight: number;
|
|
12
|
+
intersectionsChartWidth: number;
|
|
13
|
+
intersectionsChartHeight: number;
|
|
14
|
+
matrixY: number;
|
|
15
|
+
matrixHeight: number;
|
|
16
|
+
maxLabelsWidth: number;
|
|
17
|
+
leftPadding: number;
|
|
18
|
+
setsChartWidth: number;
|
|
19
|
+
};
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useUpSetChartSizes = void 0;
|
|
4
|
+
var constants_1 = require("./constants");
|
|
5
|
+
var helpers_1 = require("./helpers");
|
|
6
|
+
var useUpSetChartSizes = function (_a) {
|
|
7
|
+
var width = _a.width, height = _a.height, intersections = _a.intersections, sets = _a.sets;
|
|
8
|
+
var minMatrixWidth = intersections.length * constants_1.MIN_MATRIX_COLUMN_WIDTH * 1.2;
|
|
9
|
+
var matrixHeight = sets.length * constants_1.MATRIX_ROW_HEIGHT;
|
|
10
|
+
var availableLabelsWidth = width - minMatrixWidth - constants_1.TEXT_GAP * 2 - constants_1.GAP_BEFORE_LEFT_BAR - constants_1.MIN_SETS_CHART_WIDTH;
|
|
11
|
+
var _b = (0, helpers_1.truncateLabels)(sets, availableLabelsWidth), labels = _b.labels, labelsWidth = _b.maxWidth;
|
|
12
|
+
var availableSetsChartWidth = width - minMatrixWidth - constants_1.TEXT_GAP * 2 - constants_1.GAP_BEFORE_LEFT_BAR - labelsWidth;
|
|
13
|
+
var setsChartWidth = Math.min(Math.max(availableSetsChartWidth, constants_1.MIN_SETS_CHART_WIDTH), constants_1.MAX_SETS_CHART_WIDTH);
|
|
14
|
+
var maxLabelsWidth = width - minMatrixWidth - constants_1.TEXT_GAP * 2 - constants_1.GAP_BEFORE_LEFT_BAR - setsChartWidth;
|
|
15
|
+
var leftPadding = setsChartWidth + labelsWidth + constants_1.TEXT_GAP * 2 + constants_1.GAP_BEFORE_LEFT_BAR;
|
|
16
|
+
var intersectionsChartWidth = Math.max(minMatrixWidth, width - leftPadding);
|
|
17
|
+
var intersectionsChartHeight = Math.max(constants_1.MIN_INTERSECTION_CHART_HEIGHT, height - constants_1.TOP_GAP - matrixHeight - constants_1.GAP_BETWEEN_TABLE_AND_CHART);
|
|
18
|
+
var svgWidth = leftPadding + intersectionsChartWidth;
|
|
19
|
+
var svgHeight = intersectionsChartHeight + matrixHeight + constants_1.TOP_GAP + constants_1.GAP_BETWEEN_TABLE_AND_CHART;
|
|
20
|
+
var matrixY = svgHeight - matrixHeight - 1;
|
|
21
|
+
return {
|
|
22
|
+
labels: labels,
|
|
23
|
+
svgWidth: svgWidth,
|
|
24
|
+
svgHeight: svgHeight,
|
|
25
|
+
intersectionsChartWidth: intersectionsChartWidth,
|
|
26
|
+
intersectionsChartHeight: intersectionsChartHeight,
|
|
27
|
+
matrixY: matrixY,
|
|
28
|
+
matrixHeight: matrixHeight,
|
|
29
|
+
maxLabelsWidth: maxLabelsWidth,
|
|
30
|
+
leftPadding: leftPadding,
|
|
31
|
+
setsChartWidth: setsChartWidth
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
exports.useUpSetChartSizes = useUpSetChartSizes;
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
name: string;
|
|
4
|
-
sets: string[];
|
|
5
|
-
};
|
|
2
|
+
import { UpSetChartData } from './types';
|
|
6
3
|
type Props = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
data: UpSetChartData;
|
|
5
|
+
width?: number;
|
|
6
|
+
height?: number;
|
|
10
7
|
};
|
|
11
|
-
export declare const UpSetChart: ({ width, height
|
|
8
|
+
export declare const UpSetChart: ({ data, width, height }: Props) => React.JSX.Element;
|
|
12
9
|
export {};
|
|
@@ -1,7 +1,40 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
+
import { scaleBand } from 'd3-scale';
|
|
3
|
+
import Tooltip from '@mui/material/Tooltip';
|
|
4
|
+
import { SetsChart } from './components/SetsChart';
|
|
5
|
+
import { IntersectionsMatrix } from './components/IntersectionsMatrix';
|
|
6
|
+
import { IntersectionsChart } from './components/IntersectionsChart';
|
|
7
|
+
import { useUpSetChartSizes } from './useUpSetChartSizes';
|
|
8
|
+
import { GAP_BEFORE_LEFT_BAR, TOP_GAP } from './constants';
|
|
9
|
+
import { findIntersections } from './helpers';
|
|
10
|
+
import { useStyles } from './styles';
|
|
2
11
|
export var UpSetChart = function (_a) {
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
12
|
+
var data = _a.data, width = _a.width, height = _a.height;
|
|
13
|
+
var styles = useStyles({ width: width, height: height });
|
|
14
|
+
var containerRef = useRef(null);
|
|
15
|
+
var _b = useState(null), hoveredSet = _b[0], setHoveredSet = _b[1];
|
|
16
|
+
var _c = useState(null), hoveredIntersection = _c[0], setHoveredIntersection = _c[1];
|
|
17
|
+
var _d = useState([width, height]), _e = _d[0], availableWidth = _e[0], availableHeight = _e[1], setAvailableSize = _d[1];
|
|
18
|
+
var _f = useMemo(function () { return findIntersections(data); }, [data]), intersections = _f.intersections, sets = _f.sets;
|
|
19
|
+
var hoveredElements = (hoveredIntersection === null || hoveredIntersection === void 0 ? void 0 : hoveredIntersection.elements) || (hoveredSet === null || hoveredSet === void 0 ? void 0 : hoveredSet.elements);
|
|
20
|
+
var tooltipTitle = hoveredIntersection === null || hoveredIntersection === void 0 ? void 0 : hoveredIntersection.sets.join(' ∩ ');
|
|
21
|
+
var _g = useUpSetChartSizes({ width: availableWidth, height: availableHeight, intersections: intersections, sets: sets }), labels = _g.labels, svgWidth = _g.svgWidth, svgHeight = _g.svgHeight, intersectionsChartWidth = _g.intersectionsChartWidth, intersectionsChartHeight = _g.intersectionsChartHeight, matrixY = _g.matrixY, matrixHeight = _g.matrixHeight, setsChartWidth = _g.setsChartWidth, leftPadding = _g.leftPadding;
|
|
22
|
+
var matrixXScale = useMemo(function () {
|
|
23
|
+
var domain = intersections.map(function (_, i) { return String(i); });
|
|
24
|
+
return scaleBand([0, intersectionsChartWidth]).domain(domain).paddingInner(0.2);
|
|
25
|
+
}, [intersections, intersectionsChartWidth]);
|
|
26
|
+
var matrixYScale = useMemo(function () {
|
|
27
|
+
var domain = sets.map(function (set) { return set.name; });
|
|
28
|
+
return scaleBand([0, matrixHeight]).domain(domain);
|
|
29
|
+
}, [sets, matrixHeight]);
|
|
30
|
+
useEffect(function () {
|
|
31
|
+
var _a = containerRef.current || {}, clientWidth = _a.clientWidth, clientHeight = _a.clientHeight;
|
|
32
|
+
setAvailableSize([clientWidth || width, clientHeight || height]);
|
|
33
|
+
}, [width, height]);
|
|
34
|
+
return (React.createElement("div", { ref: containerRef, className: styles.wrapper },
|
|
35
|
+
React.createElement(Tooltip, { title: tooltipTitle, followCursor: true },
|
|
36
|
+
React.createElement("svg", { className: styles.svg, width: svgWidth, height: svgHeight },
|
|
37
|
+
React.createElement(IntersectionsMatrix, { xScale: matrixXScale, yScale: matrixYScale, intersections: intersections, sets: sets, transform: "translate(".concat(leftPadding, ",").concat(matrixY, ")"), hoveredIntersection: hoveredIntersection }),
|
|
38
|
+
React.createElement(SetsChart, { yScale: matrixYScale, width: setsChartWidth, sets: sets, labels: labels, hoveredElements: hoveredElements, hoverAreaWidth: svgWidth, transform: "translate(".concat(GAP_BEFORE_LEFT_BAR, ",").concat(matrixY, ")"), onSetHover: setHoveredSet }),
|
|
39
|
+
React.createElement(IntersectionsChart, { xScale: matrixXScale, width: intersectionsChartWidth, height: intersectionsChartHeight, intersections: intersections, highlightedElements: hoveredElements, transform: "translate(".concat(leftPadding, ",").concat(TOP_GAP, ")"), matrixHeight: matrixHeight, onIntersectionHover: setHoveredIntersection })))));
|
|
7
40
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|