@ggterm/core 0.2.0 → 0.2.7
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/README.md +102 -0
- package/dist/canvas/canvas.d.ts.map +1 -1
- package/dist/cli-plot.d.ts +1 -1
- package/dist/cli-plot.js +11423 -0
- package/dist/cli.js +1265 -855
- package/dist/export/vega-lite.d.ts.map +1 -1
- package/dist/geoms/bin2d.d.ts +47 -0
- package/dist/geoms/bin2d.d.ts.map +1 -0
- package/dist/geoms/index.d.ts +1 -0
- package/dist/geoms/index.d.ts.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3347 -2511
- package/dist/init.d.ts +8 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/pipeline/pipeline.d.ts.map +1 -1
- package/dist/pipeline/render-geoms.d.ts.map +1 -1
- package/dist/pipeline/scales.d.ts.map +1 -1
- package/dist/stats/bin2d.d.ts +34 -0
- package/dist/stats/bin2d.d.ts.map +1 -0
- package/dist/stats/index.d.ts +2 -0
- package/dist/stats/index.d.ts.map +1 -1
- package/package.json +7 -6
package/README.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# @ggterm/core
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@ggterm/core)
|
|
4
|
+
[](https://www.npmjs.com/package/@ggterm/core)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
|
|
7
|
+
A Grammar of Graphics for Terminal User Interfaces.
|
|
8
|
+
|
|
9
|
+
**ggterm** is a TypeScript library implementing Leland Wilkinson's Grammar of Graphics for terminal-based rendering. Create publication-quality data visualizations directly in your terminal.
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @ggterm/core
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Quick Example
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import { gg, geom_point, geom_line } from '@ggterm/core'
|
|
21
|
+
|
|
22
|
+
const data = [
|
|
23
|
+
{ x: 1, y: 10 },
|
|
24
|
+
{ x: 2, y: 25 },
|
|
25
|
+
{ x: 3, y: 18 },
|
|
26
|
+
{ x: 4, y: 30 }
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
const plot = gg(data)
|
|
30
|
+
.aes({ x: 'x', y: 'y' })
|
|
31
|
+
.geom(geom_point())
|
|
32
|
+
.geom(geom_line())
|
|
33
|
+
.labs({ title: 'My Plot', x: 'Time', y: 'Value' })
|
|
34
|
+
|
|
35
|
+
console.log(plot.render({ width: 60, height: 20 }))
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Features
|
|
39
|
+
|
|
40
|
+
- **20+ Geometry Types**: point, line, bar, histogram, boxplot, violin, area, heatmap, contour, and more
|
|
41
|
+
- **50+ Scales**: Continuous, discrete, color (viridis, brewer), date/time
|
|
42
|
+
- **Faceting**: `facet_wrap()` and `facet_grid()` for multi-panel plots
|
|
43
|
+
- **Themes**: Customizable themes for different visual styles
|
|
44
|
+
- **Export**: Convert to Vega-Lite for publication-quality PNG/SVG output
|
|
45
|
+
|
|
46
|
+
## Available Geoms
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
// Points and Lines
|
|
50
|
+
geom_point(), geom_line(), geom_path(), geom_step(), geom_smooth()
|
|
51
|
+
|
|
52
|
+
// Bars and Areas
|
|
53
|
+
geom_bar(), geom_col(), geom_histogram(), geom_area(), geom_ribbon()
|
|
54
|
+
|
|
55
|
+
// Distributions
|
|
56
|
+
geom_boxplot(), geom_violin(), geom_density_2d(), geom_qq()
|
|
57
|
+
|
|
58
|
+
// 2D Plots
|
|
59
|
+
geom_tile(), geom_raster(), geom_contour(), geom_contour_filled()
|
|
60
|
+
|
|
61
|
+
// Annotations
|
|
62
|
+
geom_text(), geom_label(), geom_hline(), geom_vline(), geom_abline()
|
|
63
|
+
|
|
64
|
+
// Uncertainty
|
|
65
|
+
geom_errorbar(), geom_errorbarh(), geom_crossbar(), geom_linerange(), geom_pointrange()
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Color Support
|
|
69
|
+
|
|
70
|
+
Works in terminals with truecolor, 256-color, and 16-color support:
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
plot.render({
|
|
74
|
+
width: 80,
|
|
75
|
+
height: 24,
|
|
76
|
+
colorMode: 'truecolor' // or '256', '16', 'none'
|
|
77
|
+
})
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Export to Vega-Lite
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
import { plotSpecToVegaLite } from '@ggterm/core'
|
|
84
|
+
|
|
85
|
+
const vegaSpec = plotSpecToVegaLite(plot.spec())
|
|
86
|
+
// Use with Vega-Embed to render PNG/SVG in browsers
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Framework Integrations
|
|
90
|
+
|
|
91
|
+
- **React**: `@ggterm/opentui`
|
|
92
|
+
- **Vue**: `@ggterm/vue`
|
|
93
|
+
- **Svelte**: `@ggterm/svelte`
|
|
94
|
+
- **Solid**: `@ggterm/solid`
|
|
95
|
+
|
|
96
|
+
## Documentation
|
|
97
|
+
|
|
98
|
+
Full documentation and examples: [github.com/shandley/ggterm](https://github.com/shandley/ggterm)
|
|
99
|
+
|
|
100
|
+
## License
|
|
101
|
+
|
|
102
|
+
MIT
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canvas.d.ts","sourceRoot":"","sources":["../../src/canvas/canvas.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAExD;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,IAAuC,CAAA;AAChE,eAAO,MAAM,UAAU,EAAE,IAAiC,CAAA;AAa1D;;GAEG;AACH,qBAAa,cAAe,YAAW,MAAM;I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