@weng-lab/visualization 1.0.11 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/components/TreeMap/SingleNode.d.ts +4 -0
- package/dist/src/components/TreeMap/SingleNode.d.ts.map +1 -0
- package/dist/src/components/TreeMap/TreeMap.d.ts +4 -0
- package/dist/src/components/TreeMap/TreeMap.d.ts.map +1 -0
- package/dist/src/components/TreeMap/ValueOval.d.ts +4 -0
- package/dist/src/components/TreeMap/ValueOval.d.ts.map +1 -0
- package/dist/src/components/TreeMap/helpers.d.ts +88 -0
- package/dist/src/components/TreeMap/helpers.d.ts.map +1 -0
- package/dist/src/components/TreeMap/index.d.ts +4 -0
- package/dist/src/components/TreeMap/index.d.ts.map +1 -0
- package/dist/src/components/TreeMap/types.d.ts +56 -0
- package/dist/src/components/TreeMap/types.d.ts.map +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/visualization.es.js +23389 -18197
- package/dist/visualization.es.js.map +1 -1
- package/package.json +5 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SingleNode.d.ts","sourceRoot":"","sources":["../../../../src/components/TreeMap/SingleNode.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAO1C,QAAA,MAAM,UAAU,GAAI,CAAC,EACjB,OAAO,eAAe,CAAC,CAAC,CAAC,4CAwG5B,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TreeMap.d.ts","sourceRoot":"","sources":["../../../../src/components/TreeMap/TreeMap.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAe,YAAY,EAAE,MAAM,SAAS,CAAC;AAQpD,QAAA,MAAM,OAAO,GAAI,CAAC,SAAS,MAAM,EAC7B,OAAO,YAAY,CAAC,CAAC,CAAC,4CAuFzB,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ValueOval.d.ts","sourceRoot":"","sources":["../../../../src/components/TreeMap/ValueOval.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGzC,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAmCvC,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { HierarchyRectangularNode } from '@visx/hierarchy/lib/types';
|
|
2
|
+
import { AnimationType, TreemapNode, TreemapProps } from './types';
|
|
3
|
+
import { Transition } from 'framer-motion';
|
|
4
|
+
export declare function getLabelPlacement(node: HierarchyRectangularNode<TreemapNode<any>>, placement: TreemapProps<any>["labelPlacement"], showValue?: boolean): {
|
|
5
|
+
textX: number;
|
|
6
|
+
textY: number;
|
|
7
|
+
valueY: number;
|
|
8
|
+
anchor: string;
|
|
9
|
+
baseline: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function measureTextWidth(text: string, fontSize: number, fontFamily: string): number;
|
|
12
|
+
export declare function truncateTextToWidth(text: string, maxWidth: number, fontSize: number, fontFamily: string): string;
|
|
13
|
+
export declare const getAnimationProps: (type: AnimationType | undefined, index: number) => {
|
|
14
|
+
initial?: undefined;
|
|
15
|
+
animate?: undefined;
|
|
16
|
+
transition?: undefined;
|
|
17
|
+
} | {
|
|
18
|
+
transition: Transition;
|
|
19
|
+
initial: {
|
|
20
|
+
opacity: number;
|
|
21
|
+
scale?: undefined;
|
|
22
|
+
y?: undefined;
|
|
23
|
+
x?: undefined;
|
|
24
|
+
};
|
|
25
|
+
animate: {
|
|
26
|
+
opacity: number;
|
|
27
|
+
scale?: undefined;
|
|
28
|
+
y?: undefined;
|
|
29
|
+
x?: undefined;
|
|
30
|
+
};
|
|
31
|
+
} | {
|
|
32
|
+
transition: Transition;
|
|
33
|
+
initial: {
|
|
34
|
+
opacity: number;
|
|
35
|
+
scale: number;
|
|
36
|
+
y?: undefined;
|
|
37
|
+
x?: undefined;
|
|
38
|
+
};
|
|
39
|
+
animate: {
|
|
40
|
+
opacity: number;
|
|
41
|
+
scale: number;
|
|
42
|
+
y?: undefined;
|
|
43
|
+
x?: undefined;
|
|
44
|
+
};
|
|
45
|
+
} | {
|
|
46
|
+
transition: Transition;
|
|
47
|
+
initial: {
|
|
48
|
+
opacity: number;
|
|
49
|
+
y: number;
|
|
50
|
+
scale?: undefined;
|
|
51
|
+
x?: undefined;
|
|
52
|
+
};
|
|
53
|
+
animate: {
|
|
54
|
+
opacity: number;
|
|
55
|
+
y: number;
|
|
56
|
+
scale?: undefined;
|
|
57
|
+
x?: undefined;
|
|
58
|
+
};
|
|
59
|
+
} | {
|
|
60
|
+
transition: Transition;
|
|
61
|
+
initial: {
|
|
62
|
+
opacity: number;
|
|
63
|
+
x: number;
|
|
64
|
+
scale?: undefined;
|
|
65
|
+
y?: undefined;
|
|
66
|
+
};
|
|
67
|
+
animate: {
|
|
68
|
+
opacity: number;
|
|
69
|
+
x: number;
|
|
70
|
+
scale?: undefined;
|
|
71
|
+
y?: undefined;
|
|
72
|
+
};
|
|
73
|
+
} | {
|
|
74
|
+
initial: {
|
|
75
|
+
scale: number;
|
|
76
|
+
opacity?: undefined;
|
|
77
|
+
y?: undefined;
|
|
78
|
+
x?: undefined;
|
|
79
|
+
};
|
|
80
|
+
animate: {
|
|
81
|
+
scale: number;
|
|
82
|
+
opacity?: undefined;
|
|
83
|
+
y?: undefined;
|
|
84
|
+
x?: undefined;
|
|
85
|
+
};
|
|
86
|
+
transition: Transition;
|
|
87
|
+
};
|
|
88
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../src/components/TreeMap/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnE,OAAO,EAAW,UAAU,EAAE,MAAM,eAAe,CAAC;AAGpD,wBAAgB,iBAAiB,CAC7B,IAAI,EAAE,wBAAwB,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,EAChD,SAAS,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,gBAAgB,CAAC,EAC9C,SAAS,CAAC,EAAE,OAAO;;;;;;EAiDtB;AAGD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,UAMlF;AAGD,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GACjB,MAAM,CAgBR;AAED,eAAO,MAAM,iBAAiB,GAAI,MAAM,aAAa,GAAG,SAAS,EAAE,OAAO,MAAM;;;;;gBAMhD,UAAU;;;;;;;;;;;;;;gBAAV,UAAU;;;;;;;;;;;;;;gBAAV,UAAU;;;;;;;;;;;;;;gBAAV,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BzC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/TreeMap/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,WAAW,CAAA;AAC/B,OAAO,EAAE,OAAO,EAAE,CAAA;AAClB,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { HierarchyRectangularNode } from '@visx/hierarchy/lib/types';
|
|
2
|
+
import { ReactElement } from 'react';
|
|
3
|
+
import { DownloadPlotHandle } from '../../utility';
|
|
4
|
+
export type Methods = "treemapSquarify" | "treemapBinary" | "treemapDice" | "treemapResquarify" | "treemapSlice" | "treemapSliceDice";
|
|
5
|
+
export type AnimationType = "fade" | "scale" | "slideUp" | "slideRight" | "pop";
|
|
6
|
+
export type TreemapNode<T> = {
|
|
7
|
+
label: string;
|
|
8
|
+
value: number;
|
|
9
|
+
color?: string;
|
|
10
|
+
children?: TreemapNode<T>[];
|
|
11
|
+
metaData?: T;
|
|
12
|
+
};
|
|
13
|
+
export type TreemapProps<T> = {
|
|
14
|
+
data: TreemapNode<T>[];
|
|
15
|
+
treemapStyle?: {
|
|
16
|
+
/**
|
|
17
|
+
* padding will apply to both inner and outer but
|
|
18
|
+
* specifying inner/outer will override that specific padding
|
|
19
|
+
*/
|
|
20
|
+
padding?: number;
|
|
21
|
+
paddingInner?: number;
|
|
22
|
+
paddingOuter?: number;
|
|
23
|
+
borderRadius?: number;
|
|
24
|
+
strokeWidth?: number;
|
|
25
|
+
fontSize?: number;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Visx has a few built in tiling methods that can be changed here
|
|
29
|
+
*/
|
|
30
|
+
tileMethod?: Methods;
|
|
31
|
+
labelPlacement?: "middle" | "topRight" | "topLeft" | "bottomLeft" | "bottomRight";
|
|
32
|
+
tooltipBody?: (node: TreemapNode<T>) => ReactElement;
|
|
33
|
+
onNodeClicked?: (point: TreemapNode<T>) => void;
|
|
34
|
+
animation?: AnimationType;
|
|
35
|
+
ref?: React.Ref<DownloadPlotHandle>;
|
|
36
|
+
downloadFileName?: string;
|
|
37
|
+
};
|
|
38
|
+
export type SingleNodeProps<T> = {
|
|
39
|
+
node: HierarchyRectangularNode<TreemapNode<T>>;
|
|
40
|
+
isHovered: boolean;
|
|
41
|
+
onHover: (hovered: boolean) => void;
|
|
42
|
+
strokeWidth: number;
|
|
43
|
+
borderRadius: number;
|
|
44
|
+
fontSize: number;
|
|
45
|
+
labelPlacement: "middle" | "topRight" | "topLeft" | "bottomLeft" | "bottomRight";
|
|
46
|
+
tooltipBody?: (node: TreemapNode<T>) => ReactElement;
|
|
47
|
+
onNodeClicked?: (point: TreemapNode<T>) => void;
|
|
48
|
+
};
|
|
49
|
+
export type ValueOvalProps = {
|
|
50
|
+
cx: number;
|
|
51
|
+
cy: number;
|
|
52
|
+
value: number | string;
|
|
53
|
+
color: string;
|
|
54
|
+
align: string;
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/TreeMap/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,MAAM,MAAM,OAAO,GAAG,iBAAiB,GAAG,eAAe,GAAG,aAAa,GAAG,mBAAmB,GAAG,cAAc,GAAG,kBAAkB,CAAA;AAErI,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,YAAY,GAAG,KAAK,CAAC;AAEhF,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;IAC5B,QAAQ,CAAC,EAAE,CAAC,CAAC;CACd,CAAA;AAED,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI;IAC1B,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;IAEvB,YAAY,CAAC,EAAE;QACb;;;WAGG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,YAAY,CAAC,EAAE,MAAM,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IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACjB,CAAA"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -6,5 +6,7 @@ export { ViolinPlot } from './components/ViolinPlot';
|
|
|
6
6
|
export type { Distribution, ViolinPlotProps, ViolinPoint } from './components/ViolinPlot';
|
|
7
7
|
export { BarPlot } from './components/BarPlot';
|
|
8
8
|
export type { BarPlotProps, BarData } from './components/BarPlot';
|
|
9
|
+
export { Treemap } from './components/TreeMap';
|
|
10
|
+
export type { TreemapNode, TreemapProps } from './components/TreeMap';
|
|
9
11
|
export type { DownloadPlotHandle } from './utility';
|
|
10
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAEhF,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE1F,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAElE,YAAY,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,YAAY,EAAE,YAAY,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