@ggterm/core 0.2.11 → 0.2.15
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/cli-plot.js +1683 -45
- package/dist/cli.js +1611 -45
- package/dist/geoms/braille.d.ts +39 -0
- package/dist/geoms/braille.d.ts.map +1 -0
- package/dist/geoms/bullet.d.ts +37 -0
- package/dist/geoms/bullet.d.ts.map +1 -0
- package/dist/geoms/calendar.d.ts +48 -0
- package/dist/geoms/calendar.d.ts.map +1 -0
- package/dist/geoms/corrmat.d.ts +59 -0
- package/dist/geoms/corrmat.d.ts.map +1 -0
- package/dist/geoms/density.d.ts +60 -0
- package/dist/geoms/density.d.ts.map +1 -0
- package/dist/geoms/dumbbell.d.ts +36 -0
- package/dist/geoms/dumbbell.d.ts.map +1 -0
- package/dist/geoms/flame.d.ts +50 -0
- package/dist/geoms/flame.d.ts.map +1 -0
- package/dist/geoms/index.d.ts +12 -0
- package/dist/geoms/index.d.ts.map +1 -1
- package/dist/geoms/lollipop.d.ts +35 -0
- package/dist/geoms/lollipop.d.ts.map +1 -0
- package/dist/geoms/sankey.d.ts +57 -0
- package/dist/geoms/sankey.d.ts.map +1 -0
- package/dist/geoms/sparkline.d.ts +36 -0
- package/dist/geoms/sparkline.d.ts.map +1 -0
- package/dist/geoms/treemap.d.ts +70 -0
- package/dist/geoms/treemap.d.ts.map +1 -0
- package/dist/geoms/waffle.d.ts +36 -0
- package/dist/geoms/waffle.d.ts.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1650 -50
- package/dist/pipeline/render-geoms.d.ts +60 -0
- package/dist/pipeline/render-geoms.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Braille Geom
|
|
3
|
+
*
|
|
4
|
+
* Creates high-resolution plots using Unicode Braille patterns.
|
|
5
|
+
* Each character cell contains a 2x4 grid of dots, allowing
|
|
6
|
+
* 8x the resolution of regular character plots.
|
|
7
|
+
*
|
|
8
|
+
* Braille patterns: U+2800 to U+28FF (256 patterns)
|
|
9
|
+
* Each pattern is a 2-column x 4-row grid:
|
|
10
|
+
* ⠁⠂ (1,4)
|
|
11
|
+
* ⠄⠈ (2,5)
|
|
12
|
+
* ⠐⠠ (3,6)
|
|
13
|
+
* ⡀⢀ (7,8)
|
|
14
|
+
*
|
|
15
|
+
* Required aesthetics:
|
|
16
|
+
* - x: x-axis variable
|
|
17
|
+
* - y: y-axis variable
|
|
18
|
+
*
|
|
19
|
+
* Optional aesthetics:
|
|
20
|
+
* - color: point color
|
|
21
|
+
* - group: for multiple series
|
|
22
|
+
*/
|
|
23
|
+
import type { Geom } from '../types.js';
|
|
24
|
+
export interface BrailleOptions {
|
|
25
|
+
/** Type of braille plot: 'point' (default), 'line' */
|
|
26
|
+
type?: 'point' | 'line';
|
|
27
|
+
/** Color for the dots/lines */
|
|
28
|
+
color?: string;
|
|
29
|
+
/** Fill the area under the line (for line type) */
|
|
30
|
+
fill?: boolean;
|
|
31
|
+
/** Opacity (0-1) */
|
|
32
|
+
alpha?: number;
|
|
33
|
+
/** Dot size - how many braille dots per data point (1-4) */
|
|
34
|
+
dot_size?: number;
|
|
35
|
+
}
|
|
36
|
+
export declare const BRAILLE_BASE = 10240;
|
|
37
|
+
export declare const BRAILLE_DOTS: number[][];
|
|
38
|
+
export declare function geom_braille(options?: BrailleOptions): Geom;
|
|
39
|
+
//# sourceMappingURL=braille.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"braille.d.ts","sourceRoot":"","sources":["../../src/geoms/braille.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAEvC,MAAM,WAAW,cAAc;IAC7B,sDAAsD;IACtD,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;IACvB,+BAA+B;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,mDAAmD;IACnD,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,oBAAoB;IACpB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAOD,eAAO,MAAM,YAAY,QAAS,CAAA;AAGlC,eAAO,MAAM,YAAY,EAAE,MAAM,EAAE,EAGlC,CAAA;AAED,wBAAgB,YAAY,CAAC,OAAO,GAAE,cAAmB,GAAG,IAAI,CAa/D"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bullet Geom
|
|
3
|
+
*
|
|
4
|
+
* Creates bullet charts - compact progress bars with target markers.
|
|
5
|
+
* Stephen Few's alternative to gauges and meters.
|
|
6
|
+
*
|
|
7
|
+
* Required aesthetics:
|
|
8
|
+
* - x: category/label
|
|
9
|
+
* - y: actual value
|
|
10
|
+
*
|
|
11
|
+
* Optional aesthetics:
|
|
12
|
+
* - target: target value (shown as marker)
|
|
13
|
+
* - ranges: background ranges (poor/satisfactory/good)
|
|
14
|
+
*/
|
|
15
|
+
import type { Geom } from '../types.js';
|
|
16
|
+
export interface BulletOptions {
|
|
17
|
+
/** Width of the bullet chart in characters (default: 40) */
|
|
18
|
+
width?: number;
|
|
19
|
+
/** Height of each bullet in characters (default: 1) */
|
|
20
|
+
height?: number;
|
|
21
|
+
/** Target marker character */
|
|
22
|
+
target_char?: string;
|
|
23
|
+
/** Bar character for actual value */
|
|
24
|
+
bar_char?: string;
|
|
25
|
+
/** Background characters for ranges (3 levels) */
|
|
26
|
+
range_chars?: [string, string, string];
|
|
27
|
+
/** Show value labels (default: true) */
|
|
28
|
+
show_values?: boolean;
|
|
29
|
+
/** Color for the actual value bar */
|
|
30
|
+
color?: string;
|
|
31
|
+
/** Color for the target marker */
|
|
32
|
+
target_color?: string;
|
|
33
|
+
/** Orientation: 'horizontal' (default) or 'vertical' */
|
|
34
|
+
orientation?: 'horizontal' | 'vertical';
|
|
35
|
+
}
|
|
36
|
+
export declare function geom_bullet(options?: BulletOptions): Geom;
|
|
37
|
+
//# sourceMappingURL=bullet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bullet.d.ts","sourceRoot":"","sources":["../../src/geoms/bullet.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAEvC,MAAM,WAAW,aAAa;IAC5B,4DAA4D;IAC5D,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,uDAAuD;IACvD,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,8BAA8B;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,qCAAqC;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,kDAAkD;IAClD,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;IACtC,wCAAwC;IACxC,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,qCAAqC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,kCAAkC;IAClC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,wDAAwD;IACxD,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAA;CACxC;AAED,wBAAgB,WAAW,CAAC,OAAO,GAAE,aAAkB,GAAG,IAAI,CAiB7D"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* geom_calendar - GitHub-style calendar heatmap
|
|
3
|
+
*
|
|
4
|
+
* Displays data as a grid of days organized by week, with color intensity
|
|
5
|
+
* representing the value. Perfect for showing activity over time, habits,
|
|
6
|
+
* contributions, etc.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* // Basic calendar heatmap
|
|
11
|
+
* gg(data)
|
|
12
|
+
* .aes({ x: 'date', fill: 'count' })
|
|
13
|
+
* .geom(geom_calendar())
|
|
14
|
+
*
|
|
15
|
+
* // With custom colors
|
|
16
|
+
* gg(data)
|
|
17
|
+
* .aes({ x: 'date', fill: 'commits' })
|
|
18
|
+
* .geom(geom_calendar({ empty_color: '#161b22', fill_color: '#39d353' }))
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
import type { Geom } from '../types';
|
|
22
|
+
export interface CalendarOptions {
|
|
23
|
+
/** Character for filled cells (default: '█') */
|
|
24
|
+
cell_char?: string;
|
|
25
|
+
/** Character for empty cells (default: '░') */
|
|
26
|
+
empty_char?: string;
|
|
27
|
+
/** Base color for empty/low values (default: '#161b22' - GitHub dark) */
|
|
28
|
+
empty_color?: string;
|
|
29
|
+
/** Color for high values (default: '#39d353' - GitHub green) */
|
|
30
|
+
fill_color?: string;
|
|
31
|
+
/** Show month labels (default: true) */
|
|
32
|
+
show_months?: boolean;
|
|
33
|
+
/** Show day labels (default: true) */
|
|
34
|
+
show_days?: boolean;
|
|
35
|
+
/** Week starts on (default: 0 = Sunday) */
|
|
36
|
+
week_start?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
37
|
+
/** Number of intensity levels (default: 5) */
|
|
38
|
+
levels?: number;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Create a calendar heatmap (GitHub contribution graph style)
|
|
42
|
+
*
|
|
43
|
+
* Data should have:
|
|
44
|
+
* - x/date: Date values (string or Date)
|
|
45
|
+
* - fill/value: Numeric value for color intensity
|
|
46
|
+
*/
|
|
47
|
+
export declare function geom_calendar(options?: CalendarOptions): Geom;
|
|
48
|
+
//# sourceMappingURL=calendar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../src/geoms/calendar.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAEpC,MAAM,WAAW,eAAe;IAC9B,gDAAgD;IAChD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,+CAA+C;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,yEAAyE;IACzE,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,gEAAgE;IAChE,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,wCAAwC;IACxC,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,sCAAsC;IACtC,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,2CAA2C;IAC3C,UAAU,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IACtC,8CAA8C;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,OAAO,GAAE,eAAoB,GAAG,IAAI,CAgBjE"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* geom_corrmat - Correlation matrix heatmap
|
|
3
|
+
*
|
|
4
|
+
* Displays pairwise correlations between numeric variables as a heatmap.
|
|
5
|
+
* Color intensity represents correlation strength, with diverging colors
|
|
6
|
+
* for positive (blue) vs negative (red) correlations.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* // From raw data - computes correlations automatically
|
|
11
|
+
* gg(data)
|
|
12
|
+
* .aes({ x: 'var1', y: 'var2', fill: 'correlation' })
|
|
13
|
+
* .geom(geom_corrmat())
|
|
14
|
+
*
|
|
15
|
+
* // From pre-computed correlation matrix
|
|
16
|
+
* gg(corrMatrix)
|
|
17
|
+
* .aes({ x: 'var1', y: 'var2', fill: 'r' })
|
|
18
|
+
* .geom(geom_corrmat({ show_values: true, show_significance: true }))
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
import type { Geom } from '../types';
|
|
22
|
+
export interface CorrmatOptions {
|
|
23
|
+
/** Show correlation values in cells (default: true) */
|
|
24
|
+
show_values?: boolean;
|
|
25
|
+
/** Number of decimal places for values (default: 2) */
|
|
26
|
+
decimals?: number;
|
|
27
|
+
/** Show significance markers (default: false) */
|
|
28
|
+
show_significance?: boolean;
|
|
29
|
+
/** Significance threshold for markers (default: 0.05) */
|
|
30
|
+
sig_threshold?: number;
|
|
31
|
+
/** Significance marker character (default: '*') */
|
|
32
|
+
sig_marker?: string;
|
|
33
|
+
/** Color for positive correlations (default: '#2166ac' - blue) */
|
|
34
|
+
positive_color?: string;
|
|
35
|
+
/** Color for negative correlations (default: '#b2182b' - red) */
|
|
36
|
+
negative_color?: string;
|
|
37
|
+
/** Color for zero/neutral (default: '#f7f7f7' - white) */
|
|
38
|
+
neutral_color?: string;
|
|
39
|
+
/** Show only lower triangle (default: false) */
|
|
40
|
+
lower_triangle?: boolean;
|
|
41
|
+
/** Show only upper triangle (default: false) */
|
|
42
|
+
upper_triangle?: boolean;
|
|
43
|
+
/** Show diagonal (default: true) */
|
|
44
|
+
show_diagonal?: boolean;
|
|
45
|
+
/** Method for computing correlation: 'pearson' | 'spearman' (default: 'pearson') */
|
|
46
|
+
method?: 'pearson' | 'spearman';
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Create a correlation matrix heatmap
|
|
50
|
+
*
|
|
51
|
+
* Data can be:
|
|
52
|
+
* 1. Pre-computed: rows with var1, var2, correlation (and optionally p_value)
|
|
53
|
+
* 2. Raw data: will compute pairwise correlations for numeric columns
|
|
54
|
+
*
|
|
55
|
+
* Uses a diverging color scale from negative (red) through zero (white)
|
|
56
|
+
* to positive (blue) correlations.
|
|
57
|
+
*/
|
|
58
|
+
export declare function geom_corrmat(options?: CorrmatOptions): Geom;
|
|
59
|
+
//# sourceMappingURL=corrmat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"corrmat.d.ts","sourceRoot":"","sources":["../../src/geoms/corrmat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAEpC,MAAM,WAAW,cAAc;IAC7B,uDAAuD;IACvD,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,uDAAuD;IACvD,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,iDAAiD;IACjD,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,yDAAyD;IACzD,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,mDAAmD;IACnD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,kEAAkE;IAClE,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,iEAAiE;IACjE,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,0DAA0D;IAC1D,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,gDAAgD;IAChD,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,gDAAgD;IAChD,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,oCAAoC;IACpC,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,oFAAoF;IACpF,MAAM,CAAC,EAAE,SAAS,GAAG,UAAU,CAAA;CAChC;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,OAAO,GAAE,cAAmB,GAAG,IAAI,CAoB/D"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* geom_density - 1D Kernel Density Estimation
|
|
3
|
+
*
|
|
4
|
+
* Computes and displays a smooth density estimate of the data.
|
|
5
|
+
* This is a smoothed version of the histogram, useful for showing
|
|
6
|
+
* the probability distribution of a continuous variable.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* // Basic density plot
|
|
11
|
+
* gg(data)
|
|
12
|
+
* .aes({ x: 'value' })
|
|
13
|
+
* .geom(geom_density())
|
|
14
|
+
*
|
|
15
|
+
* // Compare multiple distributions
|
|
16
|
+
* gg(data)
|
|
17
|
+
* .aes({ x: 'value', color: 'group', fill: 'group' })
|
|
18
|
+
* .geom(geom_density({ alpha: 0.3 }))
|
|
19
|
+
*
|
|
20
|
+
* // Adjust bandwidth for smoother/rougher curves
|
|
21
|
+
* gg(data)
|
|
22
|
+
* .aes({ x: 'value' })
|
|
23
|
+
* .geom(geom_density({ adjust: 0.5 })) // More detailed
|
|
24
|
+
* .geom(geom_density({ adjust: 2 })) // Smoother
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
import type { Geom } from '../types';
|
|
28
|
+
export interface DensityOptions {
|
|
29
|
+
/** Number of points to evaluate density at (default: 512) */
|
|
30
|
+
n?: number;
|
|
31
|
+
/** Bandwidth for kernel density estimation (default: auto via Silverman's rule) */
|
|
32
|
+
bw?: number;
|
|
33
|
+
/** Kernel function (default: 'gaussian') */
|
|
34
|
+
kernel?: 'gaussian' | 'epanechnikov' | 'rectangular';
|
|
35
|
+
/** Adjustment factor for bandwidth (default: 1) */
|
|
36
|
+
adjust?: number;
|
|
37
|
+
/** Alpha transparency (default: 0.3) */
|
|
38
|
+
alpha?: number;
|
|
39
|
+
/** Line color (outline) */
|
|
40
|
+
color?: string;
|
|
41
|
+
/** Fill color */
|
|
42
|
+
fill?: string;
|
|
43
|
+
/** Line width for outline */
|
|
44
|
+
linewidth?: number;
|
|
45
|
+
/** Line type for outline */
|
|
46
|
+
linetype?: 'solid' | 'dashed' | 'dotted';
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Create a density plot (kernel density estimation)
|
|
50
|
+
*
|
|
51
|
+
* The density geom computes and displays a kernel density estimate,
|
|
52
|
+
* which is a smoothed version of the histogram. It's useful for
|
|
53
|
+
* displaying the probability distribution of a continuous variable.
|
|
54
|
+
*
|
|
55
|
+
* The y-axis shows density values which integrate to 1 over the
|
|
56
|
+
* full range, making it easy to compare distributions with different
|
|
57
|
+
* sample sizes.
|
|
58
|
+
*/
|
|
59
|
+
export declare function geom_density(options?: DensityOptions): Geom;
|
|
60
|
+
//# sourceMappingURL=density.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"density.d.ts","sourceRoot":"","sources":["../../src/geoms/density.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAEpC,MAAM,WAAW,cAAc;IAC7B,6DAA6D;IAC7D,CAAC,CAAC,EAAE,MAAM,CAAA;IACV,mFAAmF;IACnF,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,4CAA4C;IAC5C,MAAM,CAAC,EAAE,UAAU,GAAG,cAAc,GAAG,aAAa,CAAA;IACpD,mDAAmD;IACnD,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,wCAAwC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,2BAA2B;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,iBAAiB;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,4BAA4B;IAC5B,QAAQ,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAA;CACzC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,OAAO,GAAE,cAAmB,GAAG,IAAI,CAiB/D"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dumbbell Geom
|
|
3
|
+
*
|
|
4
|
+
* Creates dumbbell charts showing two points connected by a line.
|
|
5
|
+
* Perfect for before/after comparisons, paired data, or showing ranges.
|
|
6
|
+
*
|
|
7
|
+
* Required aesthetics:
|
|
8
|
+
* - x: start value (numeric)
|
|
9
|
+
* - xend: end value (numeric)
|
|
10
|
+
* - y: category (categorical)
|
|
11
|
+
*
|
|
12
|
+
* Optional aesthetics:
|
|
13
|
+
* - color: point/line color
|
|
14
|
+
* - size: point size
|
|
15
|
+
*/
|
|
16
|
+
import type { Geom } from '../types.js';
|
|
17
|
+
export interface DumbbellOptions {
|
|
18
|
+
/** Size of points (default: 2) */
|
|
19
|
+
size?: number;
|
|
20
|
+
/** Size of end points, if different from start (default: same as size) */
|
|
21
|
+
sizeEnd?: number;
|
|
22
|
+
/** Color of start points */
|
|
23
|
+
color?: string;
|
|
24
|
+
/** Color of end points (default: same as color) */
|
|
25
|
+
colorEnd?: string;
|
|
26
|
+
/** Line color (default: gray) */
|
|
27
|
+
lineColor?: string;
|
|
28
|
+
/** Line width (default: 1) */
|
|
29
|
+
lineWidth?: number;
|
|
30
|
+
/** Opacity (0-1) */
|
|
31
|
+
alpha?: number;
|
|
32
|
+
/** Point shape: 'circle' | 'square' | 'diamond' */
|
|
33
|
+
shape?: 'circle' | 'square' | 'diamond';
|
|
34
|
+
}
|
|
35
|
+
export declare function geom_dumbbell(options?: DumbbellOptions): Geom;
|
|
36
|
+
//# sourceMappingURL=dumbbell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dumbbell.d.ts","sourceRoot":"","sources":["../../src/geoms/dumbbell.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAEvC,MAAM,WAAW,eAAe;IAC9B,kCAAkC;IAClC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,0EAA0E;IAC1E,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,4BAA4B;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,mDAAmD;IACnD,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,iCAAiC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,8BAA8B;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,oBAAoB;IACpB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,mDAAmD;IACnD,KAAK,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAA;CACxC;AAED,wBAAgB,aAAa,CAAC,OAAO,GAAE,eAAoB,GAAG,IAAI,CAgBjE"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* geom_flame - Flame graph for performance profiling
|
|
3
|
+
*
|
|
4
|
+
* Displays hierarchical stack data as horizontal bars where width represents
|
|
5
|
+
* time/samples. Used for visualizing CPU profiles, call stacks, etc.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* // Basic flame graph
|
|
10
|
+
* gg(stackData)
|
|
11
|
+
* .aes({ x: 'name', y: 'depth', fill: 'value' })
|
|
12
|
+
* .geom(geom_flame())
|
|
13
|
+
*
|
|
14
|
+
* // With custom colors (icicle style - inverted)
|
|
15
|
+
* gg(stackData)
|
|
16
|
+
* .aes({ x: 'name', y: 'depth', fill: 'self_time' })
|
|
17
|
+
* .geom(geom_flame({ style: 'icicle', palette: 'cool' }))
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
import type { Geom } from '../types';
|
|
21
|
+
export interface FlameOptions {
|
|
22
|
+
/** Style: 'flame' (bottom-up) or 'icicle' (top-down) (default: 'flame') */
|
|
23
|
+
style?: 'flame' | 'icicle';
|
|
24
|
+
/** Color palette: 'warm' (reds/oranges), 'cool' (blues), 'hot' (red-yellow) */
|
|
25
|
+
palette?: 'warm' | 'cool' | 'hot';
|
|
26
|
+
/** Show value labels in bars (default: true for wide bars) */
|
|
27
|
+
show_labels?: boolean;
|
|
28
|
+
/** Minimum width to show label (default: 10) */
|
|
29
|
+
min_label_width?: number;
|
|
30
|
+
/** Sort frames within level: 'alpha', 'value', 'none' (default: 'alpha') */
|
|
31
|
+
sort?: 'alpha' | 'value' | 'none';
|
|
32
|
+
/** Character for filled bars (default: '█') */
|
|
33
|
+
bar_char?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Create a flame graph visualization
|
|
37
|
+
*
|
|
38
|
+
* Data should have:
|
|
39
|
+
* - name/label: Frame/function name
|
|
40
|
+
* - value/width: Time or sample count (determines width)
|
|
41
|
+
* - depth/level: Stack depth (0 = root)
|
|
42
|
+
* - start: Optional start position (for pre-computed layouts)
|
|
43
|
+
* - parent: Optional parent name for hierarchy building
|
|
44
|
+
*/
|
|
45
|
+
export declare function geom_flame(options?: FlameOptions): Geom;
|
|
46
|
+
/**
|
|
47
|
+
* Alias for icicle chart (top-down flame graph)
|
|
48
|
+
*/
|
|
49
|
+
export declare function geom_icicle(options?: FlameOptions): Geom;
|
|
50
|
+
//# sourceMappingURL=flame.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flame.d.ts","sourceRoot":"","sources":["../../src/geoms/flame.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAEpC,MAAM,WAAW,YAAY;IAC3B,2EAA2E;IAC3E,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAA;IAC1B,+EAA+E;IAC/E,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,CAAA;IACjC,8DAA8D;IAC9D,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,gDAAgD;IAChD,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,4EAA4E;IAC5E,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,CAAA;IACjC,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,OAAO,GAAE,YAAiB,GAAG,IAAI,CAc3D;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,GAAE,YAAiB,GAAG,IAAI,CAE5D"}
|
package/dist/geoms/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export { geom_bar, geom_col, type BarOptions } from './bar';
|
|
|
8
8
|
export { geom_text, geom_label, type TextOptions } from './text';
|
|
9
9
|
export { geom_area, geom_ribbon, type AreaOptions } from './area';
|
|
10
10
|
export { geom_histogram, geom_freqpoly, type HistogramOptions, type FreqpolyOptions } from './histogram';
|
|
11
|
+
export { geom_density, type DensityOptions } from './density';
|
|
11
12
|
export { geom_boxplot, type BoxplotOptions } from './boxplot';
|
|
12
13
|
export { geom_segment, geom_curve, type SegmentOptions } from './segment';
|
|
13
14
|
export { geom_smooth, type SmoothOptions } from './smooth';
|
|
@@ -22,4 +23,15 @@ export { geom_rect, geom_abline, type RectOptions, type AblineOptions } from './
|
|
|
22
23
|
export { geom_qq, geom_qq_line, type QQOptions, type QQLineOptions } from './qq';
|
|
23
24
|
export { geom_ridgeline, geom_joy, type RidgelineOptions } from './ridgeline';
|
|
24
25
|
export { geom_beeswarm, geom_quasirandom, type BeeswarmOptions } from './beeswarm';
|
|
26
|
+
export { geom_dumbbell, type DumbbellOptions } from './dumbbell';
|
|
27
|
+
export { geom_lollipop, type LollipopOptions } from './lollipop';
|
|
28
|
+
export { geom_waffle, type WaffleOptions } from './waffle';
|
|
29
|
+
export { geom_sparkline, type SparklineOptions, SPARK_BARS, SPARK_DOTS } from './sparkline';
|
|
30
|
+
export { geom_bullet, type BulletOptions } from './bullet';
|
|
31
|
+
export { geom_braille, type BrailleOptions, BRAILLE_BASE, BRAILLE_DOTS } from './braille';
|
|
32
|
+
export { geom_calendar, type CalendarOptions } from './calendar';
|
|
33
|
+
export { geom_flame, geom_icicle, type FlameOptions } from './flame';
|
|
34
|
+
export { geom_corrmat, type CorrmatOptions } from './corrmat';
|
|
35
|
+
export { geom_sankey, type SankeyOptions } from './sankey';
|
|
36
|
+
export { geom_treemap, type TreemapOptions } from './treemap';
|
|
25
37
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
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Aa,EAAE,KAAK,eAAe,EAAE,MAAM,YAAY,CAAA;AAChE,OAAO,EAAE,WAAW,EAAE,KAAK,aAAa,EAAE,MAAM,UAAU,CAAA;AAC1D,OAAO,EAAE,cAAc,EAAE,KAAK,gBAAgB,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC3F,OAAO,EAAE,WAAW,EAAE,KAAK,aAAa,EAAE,MAAM,UAAU,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,KAAK,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAGzF,OAAO,EAAE,aAAa,EAAE,KAAK,eAAe,EAAE,MAAM,YAAY,CAAA;AAChE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,SAAS,CAAA;AACpE,OAAO,EAAE,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,WAAW,CAAA;AAC7D,OAAO,EAAE,WAAW,EAAE,KAAK,aAAa,EAAE,MAAM,UAAU,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,WAAW,CAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lollipop Geom
|
|
3
|
+
*
|
|
4
|
+
* Creates lollipop charts - a line from baseline to a point with a dot at the end.
|
|
5
|
+
* A cleaner alternative to bar charts, especially for sparse data.
|
|
6
|
+
*
|
|
7
|
+
* Required aesthetics:
|
|
8
|
+
* - x: category (categorical) or value (numeric)
|
|
9
|
+
* - y: value (numeric) or category (categorical)
|
|
10
|
+
*
|
|
11
|
+
* Optional aesthetics:
|
|
12
|
+
* - color: point/line color
|
|
13
|
+
* - size: point size
|
|
14
|
+
*/
|
|
15
|
+
import type { Geom } from '../types.js';
|
|
16
|
+
export interface LollipopOptions {
|
|
17
|
+
/** Size of the point (default: 2) */
|
|
18
|
+
size?: number;
|
|
19
|
+
/** Color of the point */
|
|
20
|
+
color?: string;
|
|
21
|
+
/** Line color (default: same as point color or gray) */
|
|
22
|
+
lineColor?: string;
|
|
23
|
+
/** Line width (default: 1) */
|
|
24
|
+
lineWidth?: number;
|
|
25
|
+
/** Opacity (0-1) */
|
|
26
|
+
alpha?: number;
|
|
27
|
+
/** Point shape: 'circle' | 'square' | 'diamond' */
|
|
28
|
+
shape?: 'circle' | 'square' | 'diamond';
|
|
29
|
+
/** Direction: 'vertical' (default) or 'horizontal' */
|
|
30
|
+
direction?: 'vertical' | 'horizontal';
|
|
31
|
+
/** Baseline value (default: 0) */
|
|
32
|
+
baseline?: number;
|
|
33
|
+
}
|
|
34
|
+
export declare function geom_lollipop(options?: LollipopOptions): Geom;
|
|
35
|
+
//# sourceMappingURL=lollipop.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lollipop.d.ts","sourceRoot":"","sources":["../../src/geoms/lollipop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAEvC,MAAM,WAAW,eAAe;IAC9B,qCAAqC;IACrC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,yBAAyB;IACzB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,wDAAwD;IACxD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,8BAA8B;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,oBAAoB;IACpB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,mDAAmD;IACnD,KAAK,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAA;IACvC,sDAAsD;IACtD,SAAS,CAAC,EAAE,UAAU,GAAG,YAAY,CAAA;IACrC,kCAAkC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,wBAAgB,aAAa,CAAC,OAAO,GAAE,eAAoB,GAAG,IAAI,CAgBjE"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* geom_sankey - Sankey flow diagram
|
|
3
|
+
*
|
|
4
|
+
* Visualizes flows between nodes with proportional-width connections.
|
|
5
|
+
* Shows how quantities flow from sources to targets.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* // Basic Sankey diagram
|
|
10
|
+
* const flows = [
|
|
11
|
+
* { source: 'A', target: 'X', value: 10 },
|
|
12
|
+
* { source: 'A', target: 'Y', value: 5 },
|
|
13
|
+
* { source: 'B', target: 'X', value: 8 },
|
|
14
|
+
* { source: 'B', target: 'Y', value: 12 },
|
|
15
|
+
* ]
|
|
16
|
+
*
|
|
17
|
+
* gg(flows)
|
|
18
|
+
* .aes({ source: 'source', target: 'target', value: 'value' })
|
|
19
|
+
* .geom(geom_sankey())
|
|
20
|
+
* .labs({ title: 'Flow Diagram' })
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
import type { Geom } from '../types';
|
|
24
|
+
export interface SankeyOptions {
|
|
25
|
+
/** Node width in characters (default: 3) */
|
|
26
|
+
node_width?: number;
|
|
27
|
+
/** Padding between nodes (default: 2) */
|
|
28
|
+
node_padding?: number;
|
|
29
|
+
/** Character for node blocks (default: '█') */
|
|
30
|
+
node_char?: string;
|
|
31
|
+
/** Character for flow lines (default: '─') */
|
|
32
|
+
flow_char?: string;
|
|
33
|
+
/** Show node labels (default: true) */
|
|
34
|
+
show_labels?: boolean;
|
|
35
|
+
/** Show flow values (default: false) */
|
|
36
|
+
show_values?: boolean;
|
|
37
|
+
/** Node alignment: 'left', 'right', 'center', 'justify' (default: 'justify') */
|
|
38
|
+
align?: 'left' | 'right' | 'center' | 'justify';
|
|
39
|
+
/** Color scheme for nodes: 'auto', 'source', 'target' (default: 'auto') */
|
|
40
|
+
color_by?: 'auto' | 'source' | 'target';
|
|
41
|
+
/** Minimum flow width in characters (default: 1) */
|
|
42
|
+
min_flow_width?: number;
|
|
43
|
+
/** Gap between flow lines (default: 0) */
|
|
44
|
+
flow_gap?: number;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Create a Sankey flow diagram
|
|
48
|
+
*
|
|
49
|
+
* Data should have:
|
|
50
|
+
* - source: Source node name
|
|
51
|
+
* - target: Target node name
|
|
52
|
+
* - value: Flow amount (determines connection width)
|
|
53
|
+
*
|
|
54
|
+
* Nodes are automatically positioned in columns based on flow direction.
|
|
55
|
+
*/
|
|
56
|
+
export declare function geom_sankey(options?: SankeyOptions): Geom;
|
|
57
|
+
//# sourceMappingURL=sankey.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sankey.d.ts","sourceRoot":"","sources":["../../src/geoms/sankey.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAEpC,MAAM,WAAW,aAAa;IAC5B,4CAA4C;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,yCAAyC;IACzC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,uCAAuC;IACvC,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,wCAAwC;IACxC,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,gFAAgF;IAChF,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAA;IAC/C,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAA;IACvC,oDAAoD;IACpD,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,OAAO,GAAE,aAAkB,GAAG,IAAI,CAkB7D"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sparkline Geom
|
|
3
|
+
*
|
|
4
|
+
* Creates sparklines - word-sized inline graphics showing trends.
|
|
5
|
+
* Uses Unicode block characters for compact visualization.
|
|
6
|
+
*
|
|
7
|
+
* Required aesthetics:
|
|
8
|
+
* - x: sequence/time variable (or index)
|
|
9
|
+
* - y: values to plot
|
|
10
|
+
*
|
|
11
|
+
* Optional aesthetics:
|
|
12
|
+
* - group: for multiple sparklines
|
|
13
|
+
*/
|
|
14
|
+
import type { Geom } from '../types.js';
|
|
15
|
+
export interface SparklineOptions {
|
|
16
|
+
/** Type of sparkline: 'line' (default), 'bar', 'dot' */
|
|
17
|
+
type?: 'line' | 'bar' | 'dot';
|
|
18
|
+
/** Width in characters (default: 20) */
|
|
19
|
+
width?: number;
|
|
20
|
+
/** Height in characters - for 'line' type (default: 1) */
|
|
21
|
+
height?: number;
|
|
22
|
+
/** Show min/max markers */
|
|
23
|
+
show_minmax?: boolean;
|
|
24
|
+
/** Color for the sparkline */
|
|
25
|
+
color?: string;
|
|
26
|
+
/** Color for minimum point */
|
|
27
|
+
min_color?: string;
|
|
28
|
+
/** Color for maximum point */
|
|
29
|
+
max_color?: string;
|
|
30
|
+
/** Normalize values to 0-1 range (default: true) */
|
|
31
|
+
normalize?: boolean;
|
|
32
|
+
}
|
|
33
|
+
export declare const SPARK_BARS: string[];
|
|
34
|
+
export declare const SPARK_DOTS: string[];
|
|
35
|
+
export declare function geom_sparkline(options?: SparklineOptions): Geom;
|
|
36
|
+
//# sourceMappingURL=sparkline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sparkline.d.ts","sourceRoot":"","sources":["../../src/geoms/sparkline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAEvC,MAAM,WAAW,gBAAgB;IAC/B,wDAAwD;IACxD,IAAI,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,KAAK,CAAA;IAC7B,wCAAwC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,2BAA2B;IAC3B,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,8BAA8B;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,8BAA8B;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,8BAA8B;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,oDAAoD;IACpD,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAGD,eAAO,MAAM,UAAU,UAA2C,CAAA;AAGlE,eAAO,MAAM,UAAU,UAA2C,CAAA;AAElE,wBAAgB,cAAc,CAAC,OAAO,GAAE,gBAAqB,GAAG,IAAI,CAgBnE"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* geom_treemap - Treemap visualization
|
|
3
|
+
*
|
|
4
|
+
* Displays hierarchical data as nested rectangles where area represents value.
|
|
5
|
+
* Great for file sizes, market caps, budgets, or any hierarchical categorical data.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* // Flat treemap (no hierarchy)
|
|
10
|
+
* const data = [
|
|
11
|
+
* { name: 'A', value: 100 },
|
|
12
|
+
* { name: 'B', value: 80 },
|
|
13
|
+
* { name: 'C', value: 60 },
|
|
14
|
+
* ]
|
|
15
|
+
*
|
|
16
|
+
* gg(data)
|
|
17
|
+
* .aes({ label: 'name', value: 'value' })
|
|
18
|
+
* .geom(geom_treemap())
|
|
19
|
+
*
|
|
20
|
+
* // Hierarchical treemap
|
|
21
|
+
* const hierarchical = [
|
|
22
|
+
* { id: 'root', parent: null, value: 0 },
|
|
23
|
+
* { id: 'A', parent: 'root', value: 100 },
|
|
24
|
+
* { id: 'B', parent: 'root', value: 80 },
|
|
25
|
+
* { id: 'A1', parent: 'A', value: 60 },
|
|
26
|
+
* { id: 'A2', parent: 'A', value: 40 },
|
|
27
|
+
* ]
|
|
28
|
+
*
|
|
29
|
+
* gg(hierarchical)
|
|
30
|
+
* .aes({ id: 'id', parent: 'parent', value: 'value' })
|
|
31
|
+
* .geom(geom_treemap())
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
import type { Geom } from '../types';
|
|
35
|
+
export interface TreemapOptions {
|
|
36
|
+
/** Tiling algorithm: 'squarify', 'binary', 'slice', 'dice' (default: 'squarify') */
|
|
37
|
+
algorithm?: 'squarify' | 'binary' | 'slice' | 'dice';
|
|
38
|
+
/** Show labels in rectangles (default: true) */
|
|
39
|
+
show_labels?: boolean;
|
|
40
|
+
/** Show values in rectangles (default: false) */
|
|
41
|
+
show_values?: boolean;
|
|
42
|
+
/** Border character (default: '│' and '─') */
|
|
43
|
+
border?: boolean;
|
|
44
|
+
/** Padding between nested rectangles (default: 0) */
|
|
45
|
+
padding?: number;
|
|
46
|
+
/** Minimum rectangle size to show label (default: 4) */
|
|
47
|
+
min_label_size?: number;
|
|
48
|
+
/** Color by: 'value', 'depth', 'parent' (default: 'value') */
|
|
49
|
+
color_by?: 'value' | 'depth' | 'parent';
|
|
50
|
+
/** Fill character (default: '█') */
|
|
51
|
+
fill_char?: string;
|
|
52
|
+
/** Maximum depth to show (default: unlimited) */
|
|
53
|
+
max_depth?: number;
|
|
54
|
+
/** Aspect ratio target for squarify (default: 1.618 golden ratio) */
|
|
55
|
+
aspect_ratio?: number;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Create a treemap visualization
|
|
59
|
+
*
|
|
60
|
+
* Data can be:
|
|
61
|
+
* 1. Flat: rows with name/label and value
|
|
62
|
+
* 2. Hierarchical: rows with id, parent, and value
|
|
63
|
+
*
|
|
64
|
+
* For hierarchical data:
|
|
65
|
+
* - Root node should have parent = null or undefined
|
|
66
|
+
* - Leaf nodes should have non-zero values
|
|
67
|
+
* - Branch nodes can have value = 0 (sum of children used)
|
|
68
|
+
*/
|
|
69
|
+
export declare function geom_treemap(options?: TreemapOptions): Geom;
|
|
70
|
+
//# sourceMappingURL=treemap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"treemap.d.ts","sourceRoot":"","sources":["../../src/geoms/treemap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAEpC,MAAM,WAAW,cAAc;IAC7B,oFAAoF;IACpF,SAAS,CAAC,EAAE,UAAU,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAA;IACpD,gDAAgD;IAChD,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,iDAAiD;IACjD,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,8CAA8C;IAC9C,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,qDAAqD;IACrD,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,wDAAwD;IACxD,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,QAAQ,CAAA;IACvC,oCAAoC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,iDAAiD;IACjD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,qEAAqE;IACrE,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,OAAO,GAAE,cAAmB,GAAG,IAAI,CAkB/D"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Waffle Geom
|
|
3
|
+
*
|
|
4
|
+
* Creates waffle charts - grid-based part-of-whole visualizations.
|
|
5
|
+
* A more readable alternative to pie charts, perfect for terminal display.
|
|
6
|
+
*
|
|
7
|
+
* Required aesthetics:
|
|
8
|
+
* - fill: category variable
|
|
9
|
+
* - values: numeric values or counts (from data)
|
|
10
|
+
*
|
|
11
|
+
* Optional aesthetics:
|
|
12
|
+
* - label: category labels
|
|
13
|
+
*/
|
|
14
|
+
import type { Geom } from '../types.js';
|
|
15
|
+
export interface WaffleOptions {
|
|
16
|
+
/** Number of rows in the waffle grid (default: 10) */
|
|
17
|
+
rows?: number;
|
|
18
|
+
/** Number of columns in the waffle grid (default: 10) */
|
|
19
|
+
cols?: number;
|
|
20
|
+
/** Total units to represent (default: 100 for percentages) */
|
|
21
|
+
n_total?: number;
|
|
22
|
+
/** Character for filled cells */
|
|
23
|
+
fill_char?: string;
|
|
24
|
+
/** Character for empty cells */
|
|
25
|
+
empty_char?: string;
|
|
26
|
+
/** Opacity (0-1) */
|
|
27
|
+
alpha?: number;
|
|
28
|
+
/** Show legend (default: true) */
|
|
29
|
+
show_legend?: boolean;
|
|
30
|
+
/** Flip direction - fill by row instead of column */
|
|
31
|
+
flip?: boolean;
|
|
32
|
+
/** Gap between cells (0 or 1) */
|
|
33
|
+
gap?: number;
|
|
34
|
+
}
|
|
35
|
+
export declare function geom_waffle(options?: WaffleOptions): Geom;
|
|
36
|
+
//# sourceMappingURL=waffle.d.ts.map
|