@ggterm/core 0.2.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/annotations.d.ts +79 -0
- package/dist/annotations.d.ts.map +1 -0
- package/dist/canvas/canvas.d.ts.map +1 -0
- package/dist/canvas/index.d.ts.map +1 -0
- package/dist/cli-plot.d.ts +14 -0
- package/dist/cli-plot.d.ts.map +1 -0
- package/dist/cli.d.ts +13 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +6485 -0
- package/dist/coords/cartesian.d.ts +96 -0
- package/dist/coords/cartesian.d.ts.map +1 -0
- package/dist/demo.d.ts +6 -0
- package/dist/demo.d.ts.map +1 -0
- package/dist/export/index.d.ts +6 -0
- package/dist/export/index.d.ts.map +1 -0
- package/dist/export/vega-lite.d.ts +87 -0
- package/dist/export/vega-lite.d.ts.map +1 -0
- package/dist/facets/index.d.ts +168 -0
- package/dist/facets/index.d.ts.map +1 -0
- package/dist/geoms/area.d.ts.map +1 -0
- package/dist/geoms/bar.d.ts +38 -0
- package/dist/geoms/bar.d.ts.map +1 -0
- package/dist/geoms/boxplot.d.ts.map +1 -0
- package/dist/geoms/contour.d.ts +33 -0
- package/dist/geoms/contour.d.ts.map +1 -0
- package/dist/geoms/errorbar.d.ts +41 -0
- package/dist/geoms/errorbar.d.ts.map +1 -0
- package/dist/geoms/histogram.d.ts +62 -0
- package/dist/geoms/histogram.d.ts.map +1 -0
- package/dist/geoms/index.d.ts +22 -0
- package/dist/geoms/index.d.ts.map +1 -0
- package/dist/geoms/line.d.ts.map +1 -0
- package/dist/geoms/path.d.ts +59 -0
- package/dist/geoms/path.d.ts.map +1 -0
- package/dist/geoms/point.d.ts +30 -0
- package/dist/geoms/point.d.ts.map +1 -0
- package/dist/geoms/qq.d.ts +75 -0
- package/dist/geoms/qq.d.ts.map +1 -0
- package/dist/geoms/rect.d.ts +37 -0
- package/dist/geoms/rect.d.ts.map +1 -0
- package/dist/geoms/rug.d.ts +65 -0
- package/dist/geoms/rug.d.ts.map +1 -0
- package/dist/geoms/segment.d.ts.map +1 -0
- package/dist/geoms/smooth.d.ts +51 -0
- package/dist/geoms/smooth.d.ts.map +1 -0
- package/dist/geoms/step.d.ts +43 -0
- package/dist/geoms/step.d.ts.map +1 -0
- package/dist/geoms/text.d.ts +23 -0
- package/dist/geoms/text.d.ts.map +1 -0
- package/dist/geoms/tile.d.ts +27 -0
- package/dist/geoms/tile.d.ts.map +1 -0
- package/dist/geoms/violin.d.ts +29 -0
- package/dist/geoms/violin.d.ts.map +1 -0
- package/dist/grammar.d.ts +81 -0
- package/dist/grammar.d.ts.map +1 -0
- package/dist/history/index.d.ts +75 -0
- package/dist/history/index.d.ts.map +1 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9168 -0
- package/dist/performance/binning.d.ts +112 -0
- package/dist/performance/binning.d.ts.map +1 -0
- package/dist/performance/canvas-diff.d.ts +107 -0
- package/dist/performance/canvas-diff.d.ts.map +1 -0
- package/dist/performance/index.d.ts +14 -0
- package/dist/performance/index.d.ts.map +1 -0
- package/dist/performance/level-of-detail.d.ts +98 -0
- package/dist/performance/level-of-detail.d.ts.map +1 -0
- package/dist/performance/sampling.d.ts +86 -0
- package/dist/performance/sampling.d.ts.map +1 -0
- package/dist/pipeline/index.d.ts +11 -0
- package/dist/pipeline/index.d.ts.map +1 -0
- package/dist/pipeline/pipeline.d.ts.map +1 -0
- package/dist/pipeline/render-axes.d.ts +94 -0
- package/dist/pipeline/render-axes.d.ts.map +1 -0
- package/dist/pipeline/render-geoms.d.ts +121 -0
- package/dist/pipeline/render-geoms.d.ts.map +1 -0
- package/dist/pipeline/scales.d.ts +151 -0
- package/dist/pipeline/scales.d.ts.map +1 -0
- package/dist/positions/index.d.ts +141 -0
- package/dist/positions/index.d.ts.map +1 -0
- package/dist/repl/index.d.ts +6 -0
- package/dist/repl/index.d.ts.map +1 -0
- package/dist/repl/repl.d.ts +161 -0
- package/dist/repl/repl.d.ts.map +1 -0
- package/dist/scales/alpha.d.ts +57 -0
- package/dist/scales/alpha.d.ts.map +1 -0
- package/dist/scales/color.d.ts +260 -0
- package/dist/scales/color.d.ts.map +1 -0
- package/dist/scales/continuous.d.ts +60 -0
- package/dist/scales/continuous.d.ts.map +1 -0
- package/dist/scales/datetime.d.ts +60 -0
- package/dist/scales/datetime.d.ts.map +1 -0
- package/dist/scales/discrete.d.ts +36 -0
- package/dist/scales/discrete.d.ts.map +1 -0
- package/dist/scales/index.d.ts +11 -0
- package/dist/scales/index.d.ts.map +1 -0
- package/dist/scales/shape.d.ts +43 -0
- package/dist/scales/shape.d.ts.map +1 -0
- package/dist/scales/size.d.ts +43 -0
- package/dist/scales/size.d.ts.map +1 -0
- package/dist/stats/bin.d.ts.map +1 -0
- package/dist/stats/boxplot.d.ts.map +1 -0
- package/dist/stats/count.d.ts +21 -0
- package/dist/stats/count.d.ts.map +1 -0
- package/dist/stats/density.d.ts +36 -0
- package/dist/stats/density.d.ts.map +1 -0
- package/dist/stats/index.d.ts +18 -0
- package/dist/stats/index.d.ts.map +1 -0
- package/dist/stats/qq.d.ts +47 -0
- package/dist/stats/qq.d.ts.map +1 -0
- package/dist/stats/smooth.d.ts.map +1 -0
- package/dist/stats/summary.d.ts.map +1 -0
- package/dist/streaming/data-buffer.d.ts +121 -0
- package/dist/streaming/data-buffer.d.ts.map +1 -0
- package/dist/streaming/data-window.d.ts +133 -0
- package/dist/streaming/data-window.d.ts.map +1 -0
- package/dist/streaming/index.d.ts +14 -0
- package/dist/streaming/index.d.ts.map +1 -0
- package/dist/streaming/rolling-aggregator.d.ts +116 -0
- package/dist/streaming/rolling-aggregator.d.ts.map +1 -0
- package/dist/streaming/streaming-plot.d.ts +194 -0
- package/dist/streaming/streaming-plot.d.ts.map +1 -0
- package/dist/terminal/capabilities.d.ts +89 -0
- package/dist/terminal/capabilities.d.ts.map +1 -0
- package/dist/terminal/colors.d.ts +82 -0
- package/dist/terminal/colors.d.ts.map +1 -0
- package/dist/terminal/index.d.ts +12 -0
- package/dist/terminal/index.d.ts.map +1 -0
- package/dist/terminal/renderer-chain.d.ts +110 -0
- package/dist/terminal/renderer-chain.d.ts.map +1 -0
- package/dist/themes/default.d.ts.map +1 -0
- package/dist/types.d.ts +198 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +50 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Geometry rendering to canvas
|
|
3
|
+
*
|
|
4
|
+
* Each geometry renderer takes data, scales, and canvas, and draws the visual marks.
|
|
5
|
+
*/
|
|
6
|
+
import type { TerminalCanvas } from '../canvas/canvas';
|
|
7
|
+
import type { AestheticMapping, DataSource, Geom } from '../types';
|
|
8
|
+
import type { ScaleContext } from './scales';
|
|
9
|
+
/**
|
|
10
|
+
* Render geom_point
|
|
11
|
+
*/
|
|
12
|
+
export declare function renderGeomPoint(data: DataSource, geom: Geom, aes: AestheticMapping, scales: ScaleContext, canvas: TerminalCanvas): void;
|
|
13
|
+
/**
|
|
14
|
+
* Render geom_line
|
|
15
|
+
*/
|
|
16
|
+
export declare function renderGeomLine(data: DataSource, _geom: Geom, aes: AestheticMapping, scales: ScaleContext, canvas: TerminalCanvas): void;
|
|
17
|
+
/**
|
|
18
|
+
* Render geom_path (ordered path, not sorted by x)
|
|
19
|
+
*
|
|
20
|
+
* Unlike geom_line which sorts by x, geom_path connects points
|
|
21
|
+
* in the order they appear in the data. Useful for trajectories,
|
|
22
|
+
* drawing shapes, and non-monotonic sequences.
|
|
23
|
+
*/
|
|
24
|
+
export declare function renderGeomPath(data: DataSource, _geom: Geom, aes: AestheticMapping, scales: ScaleContext, canvas: TerminalCanvas): void;
|
|
25
|
+
/**
|
|
26
|
+
* Render geom_rug (marginal rug marks along axes)
|
|
27
|
+
*
|
|
28
|
+
* Draws tick marks at data positions along the plot edges to show
|
|
29
|
+
* marginal distributions.
|
|
30
|
+
*/
|
|
31
|
+
export declare function renderGeomRug(data: DataSource, geom: Geom, aes: AestheticMapping, scales: ScaleContext, canvas: TerminalCanvas): void;
|
|
32
|
+
/**
|
|
33
|
+
* Render geom_step (stairstep lines)
|
|
34
|
+
*
|
|
35
|
+
* Draws lines that only move horizontally or vertically, creating
|
|
36
|
+
* a stairstep pattern. Useful for time series with discrete changes.
|
|
37
|
+
*/
|
|
38
|
+
export declare function renderGeomStep(data: DataSource, geom: Geom, aes: AestheticMapping, scales: ScaleContext, canvas: TerminalCanvas): void;
|
|
39
|
+
/**
|
|
40
|
+
* Render geom_area (filled area under line)
|
|
41
|
+
*/
|
|
42
|
+
export declare function renderGeomArea(data: DataSource, geom: Geom, aes: AestheticMapping, scales: ScaleContext, canvas: TerminalCanvas): void;
|
|
43
|
+
/**
|
|
44
|
+
* Render geom_bar (vertical bars, or horizontal when coord_flip)
|
|
45
|
+
*/
|
|
46
|
+
export declare function renderGeomBar(data: DataSource, geom: Geom, aes: AestheticMapping, scales: ScaleContext, canvas: TerminalCanvas, coordType?: string): void;
|
|
47
|
+
/**
|
|
48
|
+
* Render geom_text
|
|
49
|
+
*/
|
|
50
|
+
export declare function renderGeomText(data: DataSource, _geom: Geom, aes: AestheticMapping, scales: ScaleContext, canvas: TerminalCanvas): void;
|
|
51
|
+
/**
|
|
52
|
+
* Render geom_hline (horizontal reference line)
|
|
53
|
+
*/
|
|
54
|
+
export declare function renderGeomHLine(_data: DataSource, geom: Geom, _aes: AestheticMapping, scales: ScaleContext, canvas: TerminalCanvas): void;
|
|
55
|
+
/**
|
|
56
|
+
* Render geom_vline (vertical reference line)
|
|
57
|
+
*/
|
|
58
|
+
export declare function renderGeomVLine(_data: DataSource, geom: Geom, _aes: AestheticMapping, scales: ScaleContext, canvas: TerminalCanvas): void;
|
|
59
|
+
/**
|
|
60
|
+
* Render geom_histogram (binned bar chart)
|
|
61
|
+
* Data should be pre-transformed by stat_bin
|
|
62
|
+
*/
|
|
63
|
+
export declare function renderGeomHistogram(data: DataSource, _geom: Geom, _aes: AestheticMapping, scales: ScaleContext, canvas: TerminalCanvas): void;
|
|
64
|
+
/**
|
|
65
|
+
* Render geom_freqpoly (frequency polygon)
|
|
66
|
+
* Like histogram but connects bin midpoints with lines
|
|
67
|
+
* Data should be pre-transformed by stat_bin
|
|
68
|
+
*/
|
|
69
|
+
export declare function renderGeomFreqpoly(data: DataSource, _geom: Geom, aes: AestheticMapping, scales: ScaleContext, canvas: TerminalCanvas): void;
|
|
70
|
+
/**
|
|
71
|
+
* Render geom_boxplot
|
|
72
|
+
* Data should be pre-transformed by stat_boxplot
|
|
73
|
+
*/
|
|
74
|
+
export declare function renderGeomBoxplot(data: DataSource, geom: Geom, _aes: AestheticMapping, scales: ScaleContext, canvas: TerminalCanvas): void;
|
|
75
|
+
/**
|
|
76
|
+
* Render geom_segment (line segments from x,y to xend,yend)
|
|
77
|
+
*/
|
|
78
|
+
export declare function renderGeomSegment(data: DataSource, geom: Geom, aes: AestheticMapping, scales: ScaleContext, canvas: TerminalCanvas): void;
|
|
79
|
+
/**
|
|
80
|
+
* Render geom_violin (violin plot)
|
|
81
|
+
* Data should be density curves grouped by x
|
|
82
|
+
*/
|
|
83
|
+
export declare function renderGeomViolin(data: DataSource, geom: Geom, _aes: AestheticMapping, scales: ScaleContext, canvas: TerminalCanvas): void;
|
|
84
|
+
/**
|
|
85
|
+
* Render geom_tile (heatmap)
|
|
86
|
+
*/
|
|
87
|
+
export declare function renderGeomTile(data: DataSource, geom: Geom, aes: AestheticMapping, scales: ScaleContext, canvas: TerminalCanvas): void;
|
|
88
|
+
/**
|
|
89
|
+
* Render geom_contour (contour lines)
|
|
90
|
+
* Uses marching squares algorithm for contour extraction
|
|
91
|
+
*/
|
|
92
|
+
export declare function renderGeomContour(data: DataSource, geom: Geom, aes: AestheticMapping, scales: ScaleContext, canvas: TerminalCanvas): void;
|
|
93
|
+
/**
|
|
94
|
+
* Render geom_errorbar (vertical error bars)
|
|
95
|
+
*/
|
|
96
|
+
export declare function renderGeomErrorbar(data: DataSource, geom: Geom, aes: AestheticMapping, scales: ScaleContext, canvas: TerminalCanvas): void;
|
|
97
|
+
/**
|
|
98
|
+
* Render geom_rect (rectangles)
|
|
99
|
+
*/
|
|
100
|
+
export declare function renderGeomRect(data: DataSource, geom: Geom, aes: AestheticMapping, scales: ScaleContext, canvas: TerminalCanvas): void;
|
|
101
|
+
/**
|
|
102
|
+
* Render geom_abline (arbitrary lines y = slope * x + intercept)
|
|
103
|
+
*/
|
|
104
|
+
export declare function renderGeomAbline(_data: DataSource, geom: Geom, _aes: AestheticMapping, scales: ScaleContext, canvas: TerminalCanvas): void;
|
|
105
|
+
/**
|
|
106
|
+
* Render geom_linerange (vertical line from ymin to ymax)
|
|
107
|
+
*/
|
|
108
|
+
export declare function renderGeomLinerange(data: DataSource, geom: Geom, aes: AestheticMapping, scales: ScaleContext, canvas: TerminalCanvas): void;
|
|
109
|
+
/**
|
|
110
|
+
* Render geom_pointrange (point with vertical line from ymin to ymax)
|
|
111
|
+
*/
|
|
112
|
+
export declare function renderGeomPointrange(data: DataSource, geom: Geom, aes: AestheticMapping, scales: ScaleContext, canvas: TerminalCanvas): void;
|
|
113
|
+
/**
|
|
114
|
+
* Render geom_smooth (smoothed line with optional confidence band)
|
|
115
|
+
*/
|
|
116
|
+
export declare function renderGeomSmooth(data: DataSource, geom: Geom, _aes: AestheticMapping, scales: ScaleContext, canvas: TerminalCanvas): void;
|
|
117
|
+
/**
|
|
118
|
+
* Geometry renderer dispatch
|
|
119
|
+
*/
|
|
120
|
+
export declare function renderGeom(data: DataSource, geom: Geom, aes: AestheticMapping, scales: ScaleContext, canvas: TerminalCanvas, coordType?: string): void;
|
|
121
|
+
//# sourceMappingURL=render-geoms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-geoms.d.ts","sourceRoot":"","sources":["../../src/pipeline/render-geoms.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kB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;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,gBAAgB,EACrB,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,cAAc,GACrB,IAAI,CAkCN;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,gBAAgB,EACrB,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,cAAc,GACrB,IAAI,CA4BN;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,gBAAgB,EACtB,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,cAAc,GACrB,IAAI,CAwFN;AA6BD;;GAEG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,gBAAgB,EACrB,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,cAAc,EACtB,SAAS,CAAC,EAAE,MAAM,GACjB,IAAI,CAiFN"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scale utilities for the rendering pipeline
|
|
3
|
+
*
|
|
4
|
+
* Handles domain inference, normalization, and mapping to canvas coordinates.
|
|
5
|
+
*/
|
|
6
|
+
import type { AestheticMapping, DataSource, RGBA, Scale, ScaleTransform } from '../types';
|
|
7
|
+
/**
|
|
8
|
+
* Infer the domain (min/max) for a continuous aesthetic from data
|
|
9
|
+
*/
|
|
10
|
+
export declare function inferContinuousDomain(data: DataSource, field: string): [number, number];
|
|
11
|
+
/**
|
|
12
|
+
* Ordering strategy for discrete scales
|
|
13
|
+
*/
|
|
14
|
+
export type DiscreteOrder = 'alphabetical' | 'data' | 'frequency' | 'reverse';
|
|
15
|
+
/**
|
|
16
|
+
* Options for inferring discrete domain
|
|
17
|
+
*/
|
|
18
|
+
export interface InferDiscreteOptions {
|
|
19
|
+
/** Explicit order of categories (overrides order option) */
|
|
20
|
+
limits?: string[];
|
|
21
|
+
/** Ordering strategy when limits not provided */
|
|
22
|
+
order?: DiscreteOrder;
|
|
23
|
+
/** Reverse the order (applied after order/limits) */
|
|
24
|
+
reverse?: boolean;
|
|
25
|
+
/** Exclude specific categories */
|
|
26
|
+
exclude?: string[];
|
|
27
|
+
/** Whether to drop categories not in data (default: true) */
|
|
28
|
+
drop?: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Infer discrete domain (unique values) for a categorical aesthetic
|
|
32
|
+
* Supports various ordering strategies
|
|
33
|
+
*/
|
|
34
|
+
export declare function inferDiscreteDomain(data: DataSource, field: string, options?: InferDiscreteOptions): string[];
|
|
35
|
+
/**
|
|
36
|
+
* Expand domain by a percentage (adds padding)
|
|
37
|
+
*/
|
|
38
|
+
export declare function expandDomain(domain: [number, number], expand?: number): [number, number];
|
|
39
|
+
/**
|
|
40
|
+
* Expand domain to nice round numbers that include all data
|
|
41
|
+
* This creates visually appealing axis limits with round tick values
|
|
42
|
+
*/
|
|
43
|
+
export declare function niceDomain(domain: [number, number], targetTicks?: number): [number, number];
|
|
44
|
+
/**
|
|
45
|
+
* Resolved scale with concrete domain and mapping functions
|
|
46
|
+
*/
|
|
47
|
+
export interface ResolvedScale {
|
|
48
|
+
aesthetic: string;
|
|
49
|
+
type: 'continuous' | 'discrete';
|
|
50
|
+
domain: [number, number] | string[];
|
|
51
|
+
range: [number, number];
|
|
52
|
+
/** Custom tick positions (if specified by user) */
|
|
53
|
+
breaks?: number[];
|
|
54
|
+
/** Custom tick labels (if specified by user) */
|
|
55
|
+
labels?: string[];
|
|
56
|
+
/** Scale transformation type */
|
|
57
|
+
trans?: ScaleTransform;
|
|
58
|
+
/** Transform function (data space -> transformed space) */
|
|
59
|
+
transform?: (value: number) => number;
|
|
60
|
+
/** Inverse transform function (transformed space -> data space) */
|
|
61
|
+
invert?: (value: number) => number;
|
|
62
|
+
/** Map data value to normalized 0-1 position */
|
|
63
|
+
normalize(value: unknown): number;
|
|
64
|
+
/** Map normalized position to canvas coordinate */
|
|
65
|
+
toCanvas(normalized: number): number;
|
|
66
|
+
/** Convenience: map data value directly to canvas coordinate */
|
|
67
|
+
map(value: unknown): number;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Transform configuration
|
|
71
|
+
*/
|
|
72
|
+
export interface TransformConfig {
|
|
73
|
+
type: ScaleTransform;
|
|
74
|
+
transform: (v: number) => number;
|
|
75
|
+
invert: (v: number) => number;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Get transform functions for a given transform type
|
|
79
|
+
*/
|
|
80
|
+
export declare function getTransformFunctions(trans?: ScaleTransform): TransformConfig;
|
|
81
|
+
/**
|
|
82
|
+
* Create a resolved continuous scale
|
|
83
|
+
*/
|
|
84
|
+
export declare function createResolvedContinuousScale(aesthetic: string, domain: [number, number], range: [number, number], trans?: ScaleTransform): ResolvedScale;
|
|
85
|
+
/**
|
|
86
|
+
* Create a resolved discrete scale
|
|
87
|
+
*/
|
|
88
|
+
export declare function createResolvedDiscreteScale(aesthetic: string, domain: string[], range: [number, number]): ResolvedScale;
|
|
89
|
+
/**
|
|
90
|
+
* Scale context holding all resolved scales for a plot
|
|
91
|
+
*/
|
|
92
|
+
export interface ScaleContext {
|
|
93
|
+
x: ResolvedScale;
|
|
94
|
+
y: ResolvedScale;
|
|
95
|
+
/** Secondary y-axis scale */
|
|
96
|
+
y2?: ResolvedScale;
|
|
97
|
+
color?: ResolvedColorScale;
|
|
98
|
+
size?: ResolvedSizeScale;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Resolved color scale
|
|
102
|
+
*/
|
|
103
|
+
export interface ResolvedColorScale {
|
|
104
|
+
aesthetic: string;
|
|
105
|
+
type: 'continuous' | 'discrete';
|
|
106
|
+
domain: [number, number] | string[];
|
|
107
|
+
map(value: unknown): RGBA;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Default color for points (when no color aesthetic)
|
|
111
|
+
*/
|
|
112
|
+
export declare const DEFAULT_POINT_COLOR: RGBA;
|
|
113
|
+
/**
|
|
114
|
+
* Create a resolved discrete color scale
|
|
115
|
+
*/
|
|
116
|
+
export declare function createResolvedDiscreteColorScale(domain: string[], palette?: RGBA[]): ResolvedColorScale;
|
|
117
|
+
/**
|
|
118
|
+
* Create a resolved continuous color scale (blue to red gradient)
|
|
119
|
+
*/
|
|
120
|
+
export declare function createResolvedContinuousColorScale(domain: [number, number], lowColor?: RGBA, // viridis low
|
|
121
|
+
highColor?: RGBA): ResolvedColorScale;
|
|
122
|
+
/**
|
|
123
|
+
* Resolved size scale - maps values to size indices (0-3)
|
|
124
|
+
*/
|
|
125
|
+
export interface ResolvedSizeScale {
|
|
126
|
+
aesthetic: string;
|
|
127
|
+
type: 'continuous';
|
|
128
|
+
domain: [number, number];
|
|
129
|
+
map(value: unknown): number;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Create a resolved continuous size scale
|
|
133
|
+
*/
|
|
134
|
+
export declare function createResolvedSizeScale(domain: [number, number]): ResolvedSizeScale;
|
|
135
|
+
/**
|
|
136
|
+
* Coordinate limits for zooming/clipping
|
|
137
|
+
*/
|
|
138
|
+
export interface CoordLimits {
|
|
139
|
+
xlim?: [number, number];
|
|
140
|
+
ylim?: [number, number];
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Build scale context from data and aesthetic mapping
|
|
144
|
+
*/
|
|
145
|
+
export declare function buildScaleContext(data: DataSource, aes: AestheticMapping, plotArea: {
|
|
146
|
+
x: number;
|
|
147
|
+
y: number;
|
|
148
|
+
width: number;
|
|
149
|
+
height: number;
|
|
150
|
+
}, userScales?: Scale[], coordLimits?: CoordLimits): ScaleContext;
|
|
151
|
+
//# sourceMappingURL=scales.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"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AEG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACvB,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACxB;AAgCD;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,UAAU,EAChB,GAAG,EAAE,gBAAgB,EACrB,QAAQ,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EACjE,UAAU,GAAE,KAAK,EAAO,EACxB,WAAW,CAAC,EAAE,WAAW,GACxB,YAAY,CAgKd"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Position adjustments
|
|
3
|
+
*
|
|
4
|
+
* Position adjustments modify the placement of geoms to handle
|
|
5
|
+
* overlapping data:
|
|
6
|
+
* - identity: No adjustment (default)
|
|
7
|
+
* - dodge: Place overlapping objects side-by-side
|
|
8
|
+
* - stack: Stack overlapping objects on top of each other
|
|
9
|
+
* - fill: Stack and normalize to 100%
|
|
10
|
+
* - jitter: Add random noise to avoid overplotting
|
|
11
|
+
*/
|
|
12
|
+
import type { AestheticMapping, DataSource } from '../types';
|
|
13
|
+
/**
|
|
14
|
+
* Position configuration object
|
|
15
|
+
*/
|
|
16
|
+
export interface Position {
|
|
17
|
+
type: 'identity' | 'dodge' | 'stack' | 'fill' | 'jitter';
|
|
18
|
+
/** Width for dodge (0-1, fraction of bar width) */
|
|
19
|
+
width?: number;
|
|
20
|
+
/** Height for jitter */
|
|
21
|
+
height?: number;
|
|
22
|
+
/** Preserve total for fill (unused, always normalizes to 1) */
|
|
23
|
+
preserve?: 'total' | 'single';
|
|
24
|
+
/** Random seed for jitter (for reproducibility) */
|
|
25
|
+
seed?: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Adjusted data point with computed position
|
|
29
|
+
*/
|
|
30
|
+
export interface AdjustedPoint {
|
|
31
|
+
/** Original row data */
|
|
32
|
+
row: Record<string, unknown>;
|
|
33
|
+
/** Adjusted x position (in data space) - can be numeric or categorical */
|
|
34
|
+
x: number | string;
|
|
35
|
+
/** Adjusted y position (in data space) */
|
|
36
|
+
y: number;
|
|
37
|
+
/** For stacked/filled: bottom y value */
|
|
38
|
+
ymin?: number;
|
|
39
|
+
/** For stacked/filled: top y value */
|
|
40
|
+
ymax?: number;
|
|
41
|
+
/** Original x value before adjustment - can be numeric or categorical */
|
|
42
|
+
xOriginal: number | string;
|
|
43
|
+
/** Original y value before adjustment */
|
|
44
|
+
yOriginal: number;
|
|
45
|
+
/** Group identifier */
|
|
46
|
+
group?: string;
|
|
47
|
+
/** Width for bar-like geoms */
|
|
48
|
+
width?: number;
|
|
49
|
+
}
|
|
50
|
+
export interface DodgeOptions {
|
|
51
|
+
/** Width of the total dodge area (0-1) */
|
|
52
|
+
width?: number;
|
|
53
|
+
/** Preserve total or single items */
|
|
54
|
+
preserve?: 'total' | 'single';
|
|
55
|
+
}
|
|
56
|
+
export interface JitterOptions {
|
|
57
|
+
/** Amount of jitter in x direction */
|
|
58
|
+
width?: number;
|
|
59
|
+
/** Amount of jitter in y direction */
|
|
60
|
+
height?: number;
|
|
61
|
+
/** Random seed for reproducibility */
|
|
62
|
+
seed?: number;
|
|
63
|
+
}
|
|
64
|
+
export interface StackOptions {
|
|
65
|
+
/** Reverse stack order */
|
|
66
|
+
reverse?: boolean;
|
|
67
|
+
}
|
|
68
|
+
export interface FillOptions {
|
|
69
|
+
/** Reverse stack order */
|
|
70
|
+
reverse?: boolean;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* No position adjustment (identity)
|
|
74
|
+
*/
|
|
75
|
+
export declare function position_identity(): Position;
|
|
76
|
+
/**
|
|
77
|
+
* Dodge overlapping objects side-by-side
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* // Grouped bar chart
|
|
82
|
+
* gg(data).geom(geom_bar({ position: position_dodge() }))
|
|
83
|
+
*
|
|
84
|
+
* // With narrower bars
|
|
85
|
+
* gg(data).geom(geom_bar({ position: position_dodge({ width: 0.7 }) }))
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
export declare function position_dodge(options?: DodgeOptions): Position;
|
|
89
|
+
/**
|
|
90
|
+
* Stack overlapping objects on top of each other
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```ts
|
|
94
|
+
* // Stacked bar chart
|
|
95
|
+
* gg(data).geom(geom_bar({ position: position_stack() }))
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
export declare function position_stack(_options?: StackOptions): Position;
|
|
99
|
+
/**
|
|
100
|
+
* Stack and normalize to fill the panel (0-100%)
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* ```ts
|
|
104
|
+
* // 100% stacked bar chart
|
|
105
|
+
* gg(data).geom(geom_bar({ position: position_fill() }))
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
export declare function position_fill(_options?: FillOptions): Position;
|
|
109
|
+
/**
|
|
110
|
+
* Add random noise to avoid overplotting
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* ```ts
|
|
114
|
+
* // Jittered scatter plot
|
|
115
|
+
* gg(data).geom(geom_point({ position: position_jitter() }))
|
|
116
|
+
*
|
|
117
|
+
* // With custom jitter amount
|
|
118
|
+
* gg(data).geom(geom_point({ position: position_jitter({ width: 0.2, height: 0.1 }) }))
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
export declare function position_jitter(options?: JitterOptions): Position;
|
|
122
|
+
/**
|
|
123
|
+
* Apply position adjustment to data
|
|
124
|
+
*
|
|
125
|
+
* This is the main function that computes adjusted positions for each data point
|
|
126
|
+
* based on the position type and grouping.
|
|
127
|
+
*/
|
|
128
|
+
export declare function applyPositionAdjustment(data: DataSource, aes: AestheticMapping, position: Position | string, barWidth?: number): AdjustedPoint[];
|
|
129
|
+
/**
|
|
130
|
+
* Check if a position type requires stacking (stack or fill)
|
|
131
|
+
*/
|
|
132
|
+
export declare function isStackPosition(position: Position | string): boolean;
|
|
133
|
+
/**
|
|
134
|
+
* Check if a position type requires dodging
|
|
135
|
+
*/
|
|
136
|
+
export declare function isDodgePosition(position: Position | string): boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Get the position type string from a Position object or string
|
|
139
|
+
*/
|
|
140
|
+
export declare function getPositionType(position: Position | string | undefined): string;
|
|
141
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/positions/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAE5D;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,UAAU,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAA;IACxD,mDAAmD;IACnD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,wBAAwB;IACxB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAA;IAC7B,mDAAmD;IACnD,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,wBAAwB;IACxB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC5B,0EAA0E;IAC1E,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAClB,0CAA0C;IAC1C,CAAC,EAAE,MAAM,CAAA;IACT,yCAAyC;IACzC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,sCAAsC;IACtC,IAAI,C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Q,GAAG,MAAM,EAC3B,QAAQ,GAAE,MAAY,GACrB,aAAa,EAAE,CA2BjB;AA2KD;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,CAGpE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,CAGpE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,CAG/E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/repl/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAC9C,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ggterm REPL - Interactive plotting environment
|
|
3
|
+
*
|
|
4
|
+
* Provides an interactive shell for building and exploring plots.
|
|
5
|
+
*/
|
|
6
|
+
import { GGPlot } from '../grammar';
|
|
7
|
+
import type { DataSource } from '../types';
|
|
8
|
+
export interface REPLOptions {
|
|
9
|
+
/** Terminal width */
|
|
10
|
+
width?: number;
|
|
11
|
+
/** Terminal height */
|
|
12
|
+
height?: number;
|
|
13
|
+
/** Show welcome message */
|
|
14
|
+
showWelcome?: boolean;
|
|
15
|
+
/** Enable colors */
|
|
16
|
+
colors?: boolean;
|
|
17
|
+
/** Auto-render on changes */
|
|
18
|
+
autoRender?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface REPLState {
|
|
21
|
+
data: DataSource;
|
|
22
|
+
plot: GGPlot | null;
|
|
23
|
+
history: string[];
|
|
24
|
+
lastResult: string;
|
|
25
|
+
variables: Record<string, unknown>;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Interactive REPL for ggterm
|
|
29
|
+
*/
|
|
30
|
+
export declare class GGTermREPL {
|
|
31
|
+
private rl;
|
|
32
|
+
private state;
|
|
33
|
+
private options;
|
|
34
|
+
private running;
|
|
35
|
+
constructor(options?: REPLOptions);
|
|
36
|
+
/**
|
|
37
|
+
* Start the REPL
|
|
38
|
+
*/
|
|
39
|
+
start(): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* Stop the REPL
|
|
42
|
+
*/
|
|
43
|
+
stop(): void;
|
|
44
|
+
/**
|
|
45
|
+
* Process a line of input
|
|
46
|
+
*/
|
|
47
|
+
processLine(line: string): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* Process a dot command
|
|
50
|
+
*/
|
|
51
|
+
private processCommand;
|
|
52
|
+
/**
|
|
53
|
+
* Evaluate JavaScript expression in REPL context
|
|
54
|
+
*/
|
|
55
|
+
private evaluate;
|
|
56
|
+
/**
|
|
57
|
+
* Create evaluation context with ggterm functions
|
|
58
|
+
*/
|
|
59
|
+
private createEvalContext;
|
|
60
|
+
/**
|
|
61
|
+
* Evaluate code in context
|
|
62
|
+
*/
|
|
63
|
+
private evalInContext;
|
|
64
|
+
/**
|
|
65
|
+
* Render the current plot
|
|
66
|
+
*/
|
|
67
|
+
private renderCurrentPlot;
|
|
68
|
+
/**
|
|
69
|
+
* Handle .data command
|
|
70
|
+
*/
|
|
71
|
+
private handleDataCommand;
|
|
72
|
+
/**
|
|
73
|
+
* Generate sample data
|
|
74
|
+
*/
|
|
75
|
+
private generateSampleData;
|
|
76
|
+
/**
|
|
77
|
+
* Load Iris dataset
|
|
78
|
+
*/
|
|
79
|
+
private loadIrisData;
|
|
80
|
+
/**
|
|
81
|
+
* Load mtcars dataset
|
|
82
|
+
*/
|
|
83
|
+
private loadMtcarsData;
|
|
84
|
+
/**
|
|
85
|
+
* Handle .size command
|
|
86
|
+
*/
|
|
87
|
+
private handleSizeCommand;
|
|
88
|
+
/**
|
|
89
|
+
* Handle .theme command
|
|
90
|
+
*/
|
|
91
|
+
private handleThemeCommand;
|
|
92
|
+
/**
|
|
93
|
+
* Handle .save command
|
|
94
|
+
*/
|
|
95
|
+
private handleSaveCommand;
|
|
96
|
+
/**
|
|
97
|
+
* Handle .load command
|
|
98
|
+
*/
|
|
99
|
+
private handleLoadCommand;
|
|
100
|
+
/**
|
|
101
|
+
* Tab completion
|
|
102
|
+
*/
|
|
103
|
+
private completer;
|
|
104
|
+
/**
|
|
105
|
+
* Print welcome message
|
|
106
|
+
*/
|
|
107
|
+
private printWelcome;
|
|
108
|
+
/**
|
|
109
|
+
* Print help
|
|
110
|
+
*/
|
|
111
|
+
private printHelp;
|
|
112
|
+
/**
|
|
113
|
+
* Print topic-specific help
|
|
114
|
+
*/
|
|
115
|
+
private printTopicHelp;
|
|
116
|
+
/**
|
|
117
|
+
* Print examples
|
|
118
|
+
*/
|
|
119
|
+
private printExamples;
|
|
120
|
+
/**
|
|
121
|
+
* Print command history
|
|
122
|
+
*/
|
|
123
|
+
private printHistory;
|
|
124
|
+
/**
|
|
125
|
+
* Print variables
|
|
126
|
+
*/
|
|
127
|
+
private printVariables;
|
|
128
|
+
/**
|
|
129
|
+
* Reset state
|
|
130
|
+
*/
|
|
131
|
+
private resetState;
|
|
132
|
+
/**
|
|
133
|
+
* Clear screen
|
|
134
|
+
*/
|
|
135
|
+
private clearScreen;
|
|
136
|
+
/**
|
|
137
|
+
* Print prompt
|
|
138
|
+
*/
|
|
139
|
+
private prompt;
|
|
140
|
+
/**
|
|
141
|
+
* Print message
|
|
142
|
+
*/
|
|
143
|
+
private print;
|
|
144
|
+
/**
|
|
145
|
+
* Print error
|
|
146
|
+
*/
|
|
147
|
+
private printError;
|
|
148
|
+
/**
|
|
149
|
+
* Color text
|
|
150
|
+
*/
|
|
151
|
+
private color;
|
|
152
|
+
/**
|
|
153
|
+
* Format value for display
|
|
154
|
+
*/
|
|
155
|
+
private formatValue;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Create and start a REPL instance
|
|
159
|
+
*/
|
|
160
|
+
export declare function startREPL(options?: REPLOptions): GGTermREPL;
|
|
161
|
+
//# sourceMappingURL=repl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repl.d.ts","sourceRoot":"","sources":["../../src/repl/repl.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAM,MAAM,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AA0B1C,MAAM,WAAW,WAAW;IAC1B,qBAAqB;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,sBAAsB;IACtB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,2BAA2B;IAC3B,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,oBAAoB;IACpB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,6BAA6B;IAC7B,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,UAAU,CAAA;IAChB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACnC;AAED;;GAEG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,EAAE,CAAkC;IAC5C,OAAO,CAAC,KAAK,CAAW;IACxB,OAAO,CAAC,OAAO,CAAuB;IACtC,OAAO,CAAC,OAAO,CAAQ;gBAEX,OAAO,GAAE,WAAgB;IAkBrC;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IA8B5B;;OAEG;IACH,IAAI,IAAI,IAAI;IAOZ;;OAEG;IACG,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAmB9C;;OAE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{ Scale } from '../types';
|
|
7
|
+
export interface AlphaScaleOptions {
|
|
8
|
+
/** Alpha range [min, max] from 0 to 1 */
|
|
9
|
+
range?: [number, number];
|
|
10
|
+
/** Domain [min, max] */
|
|
11
|
+
domain?: [number, number];
|
|
12
|
+
/** Guide title */
|
|
13
|
+
name?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Continuous alpha scale
|
|
17
|
+
*/
|
|
18
|
+
export declare function scale_alpha_continuous(options?: AlphaScaleOptions): Scale;
|
|
19
|
+
/**
|
|
20
|
+
* Alias for scale_alpha_continuous
|
|
21
|
+
*/
|
|
22
|
+
export declare function scale_alpha(options?: AlphaScaleOptions): Scale;
|
|
23
|
+
/**
|
|
24
|
+
* Identity alpha scale (use data values directly)
|
|
25
|
+
*/
|
|
26
|
+
export declare function scale_alpha_identity(): Scale;
|
|
27
|
+
/**
|
|
28
|
+
* Discrete alpha scale
|
|
29
|
+
*/
|
|
30
|
+
export interface DiscreteAlphaOptions {
|
|
31
|
+
/** Alpha values for each level */
|
|
32
|
+
values?: number[];
|
|
33
|
+
/** Guide title */
|
|
34
|
+
name?: string;
|
|
35
|
+
}
|
|
36
|
+
export declare function scale_alpha_discrete(options?: DiscreteAlphaOptions): Scale;
|
|
37
|
+
/**
|
|
38
|
+
* Manual alpha scale (explicit mapping)
|
|
39
|
+
*/
|
|
40
|
+
export interface ManualAlphaOptions {
|
|
41
|
+
/** Mapping from data values to alpha values */
|
|
42
|
+
values: Record<string, number>;
|
|
43
|
+
/** Guide title */
|
|
44
|
+
name?: string;
|
|
45
|
+
}
|
|
46
|
+
export declare function scale_alpha_manual(options: ManualAlphaOptions): Scale;
|
|
47
|
+
/**
|
|
48
|
+
* Binned alpha scale
|
|
49
|
+
*/
|
|
50
|
+
export interface BinnedAlphaOptions extends AlphaScaleOptions {
|
|
51
|
+
/** Number of bins */
|
|
52
|
+
n_breaks?: number;
|
|
53
|
+
/** Explicit break points */
|
|
54
|
+
breaks?: number[];
|
|
55
|
+
}
|
|
56
|
+
export declare function scale_alpha_binned(options?: BinnedAlphaOptions): Scale;
|
|
57
|
+
//# sourceMappingURL=alpha.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alpha.d.ts","sourceRoot":"","sources":["../../src/scales/alpha.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAErC,MAAM,WAAW,iBAAiB;IAChC,yCAAyC;IACzC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACxB,wBAAwB;IACxB,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACzB,kBAAkB;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,GAAE,iBAAsB,GAAG,KAAK,CAmB7E;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,GAAE,iBAAsB,GAAG,KAAK,CAElE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,KAAK,CAU5C;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,kCAAkC;IAClC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,kBAAkB;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,wBAAgB,oBAAoB,CAAC,OAAO,GAAE,oBAAyB,GAAG,KAAK,CAsB9E;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,+CAA+C;IAC/C,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC9B,kBAAkB;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,kBAAkB,GAAG,KAAK,CAarE;AAED;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,iBAAiB;IAC3D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