zengeld-canvas 0.1.6 → 0.1.9
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 +49 -23
- package/package.json +1 -1
- package/zengeld_canvas_wasm.d.ts +1068 -1
- package/zengeld_canvas_wasm.js +2587 -67
- package/zengeld_canvas_wasm_bg.wasm +0 -0
package/README.md
CHANGED
|
@@ -13,6 +13,7 @@ WebAssembly bindings for the zengeld-canvas chart rendering engine. Built in Rus
|
|
|
13
13
|
- **12 Series Types** - Candlestick, HeikinAshi, Line, Area, Histogram, Baseline, and more
|
|
14
14
|
- **14 Multi-Chart Layouts** - Grid, split, and custom layouts for dashboards
|
|
15
15
|
- **High Performance** - Native Rust speed via WebAssembly
|
|
16
|
+
- **Theme System** - 4 built-in presets (dark, light, high_contrast, cyberpunk) + runtime customization
|
|
16
17
|
|
|
17
18
|
## Installation
|
|
18
19
|
|
|
@@ -23,40 +24,65 @@ npm install zengeld-canvas
|
|
|
23
24
|
## Quick Start
|
|
24
25
|
|
|
25
26
|
```javascript
|
|
26
|
-
import init, { Chart, JsBar } from 'zengeld-canvas';
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
27
|
+
import init, { Chart, JsBar, JsUITheme, JsRuntimeTheme } from 'zengeld-canvas';
|
|
28
|
+
|
|
29
|
+
await init();
|
|
30
|
+
|
|
31
|
+
// Create chart
|
|
32
|
+
const chart = new Chart(800, 600);
|
|
33
|
+
chart.setBars(bars);
|
|
34
|
+
chart.candlesticks();
|
|
35
|
+
chart.sma(20, "#2196F3");
|
|
36
|
+
const svg = chart.renderSvg();
|
|
37
|
+
|
|
38
|
+
// With theme preset
|
|
39
|
+
const theme = JsUITheme.cyberpunk();
|
|
40
|
+
const chart2 = new Chart(800, 600);
|
|
41
|
+
chart2.setBars(bars);
|
|
42
|
+
chart2.candlesticks();
|
|
43
|
+
chart2.background(theme.background);
|
|
44
|
+
chart2.colors(theme.candle_up_body, theme.candle_down_body);
|
|
45
|
+
|
|
46
|
+
// Runtime theme (modifiable)
|
|
47
|
+
const runtime = JsRuntimeTheme.fromPreset("dark");
|
|
48
|
+
runtime.background = "#1a0a2e"; // Custom background
|
|
49
|
+
runtime.candle_up_body = "#00ffff"; // Cyan
|
|
50
|
+
const json = runtime.toJson();
|
|
45
51
|
```
|
|
46
52
|
|
|
47
53
|
## Examples
|
|
48
54
|
|
|
49
55
|
<table>
|
|
50
56
|
<tr>
|
|
51
|
-
<td align="center"><img src="https://raw.githubusercontent.com/zengeld/zengeld-canvas/main/crates/canvas/chart_output/
|
|
52
|
-
<td align="center"><img src="https://raw.githubusercontent.com/zengeld/zengeld-canvas/main/crates/canvas/chart_output/
|
|
57
|
+
<td align="center"><img src="https://raw.githubusercontent.com/zengeld/zengeld-canvas/main/crates/canvas/chart_output/09_light_theme.svg" width="400"/><br/><b>Light Theme</b></td>
|
|
58
|
+
<td align="center"><img src="https://raw.githubusercontent.com/zengeld/zengeld-canvas/main/crates/canvas/chart_output/09b_high_contrast_theme.svg" width="400"/><br/><b>High Contrast Theme</b></td>
|
|
53
59
|
</tr>
|
|
54
60
|
<tr>
|
|
55
|
-
<td align="center"><img src="https://raw.githubusercontent.com/zengeld/zengeld-canvas/main/crates/canvas/chart_output/
|
|
56
|
-
<td align="center"><img src="https://raw.githubusercontent.com/zengeld/zengeld-canvas/main/crates/canvas/chart_output/
|
|
61
|
+
<td align="center"><img src="https://raw.githubusercontent.com/zengeld/zengeld-canvas/main/crates/canvas/chart_output/09c_cyberpunk_theme.svg" width="400"/><br/><b>Cyberpunk Theme</b></td>
|
|
62
|
+
<td align="center"><img src="https://raw.githubusercontent.com/zengeld/zengeld-canvas/main/crates/canvas/chart_output/09d_runtime_theme.svg" width="400"/><br/><b>Runtime Custom Theme</b></td>
|
|
57
63
|
</tr>
|
|
58
64
|
</table>
|
|
59
65
|
|
|
66
|
+
## Theme System
|
|
67
|
+
|
|
68
|
+
Built-in presets: `dark()`, `light()`, `highContrast()`, `cyberpunk()`
|
|
69
|
+
|
|
70
|
+
```javascript
|
|
71
|
+
import { JsUITheme, JsRuntimeTheme } from 'zengeld-canvas';
|
|
72
|
+
|
|
73
|
+
// Static themes
|
|
74
|
+
const dark = JsUITheme.dark();
|
|
75
|
+
const light = JsUITheme.light();
|
|
76
|
+
|
|
77
|
+
// Runtime themes (modifiable, JSON support)
|
|
78
|
+
const runtime = JsRuntimeTheme.fromPreset("dark");
|
|
79
|
+
runtime.background = "#1a0a2e";
|
|
80
|
+
const json = runtime.toJson();
|
|
81
|
+
|
|
82
|
+
// Available presets
|
|
83
|
+
const presets = JsRuntimeTheme.presets(); // ["dark", "light", "high_contrast", "cyberpunk"]
|
|
84
|
+
```
|
|
85
|
+
|
|
60
86
|
## Drawing Primitives
|
|
61
87
|
|
|
62
88
|
| Category | Count | Examples |
|
package/package.json
CHANGED