bamtigraph 0.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/LICENSE ADDED
@@ -0,0 +1,28 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2026, GoSuda
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ 3. Neither the name of the copyright holder nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md ADDED
@@ -0,0 +1,97 @@
1
+ # BamtiGraph
2
+
3
+ Turn traffic, CPU, memory, and other measurements into clear time-series charts. Use BamtiGraph in a browser, from TypeScript, or from Go.
4
+
5
+ ## What you can do
6
+
7
+ - Draw line and area charts from your own data.
8
+ - Show daily, weekly, monthly, or yearly views.
9
+ - Import CSV files and save charts as PNG images.
10
+ - Choose your colors, labels, and time zone.
11
+ - Keep charts unbranded or add your own text.
12
+
13
+ ## Try the demo
14
+
15
+ From the project folder:
16
+
17
+ ```sh
18
+ npm ci
19
+ npm run build
20
+ npm run serve
21
+ ```
22
+
23
+ Open **http://127.0.0.1:8080**. You can change the chart settings, add a custom label, and export an image. The demo uses sample data, not live measurements.
24
+
25
+ ## Use TypeScript
26
+
27
+ Install the npm package:
28
+
29
+ ```sh
30
+ npm install bamtigraph
31
+ ```
32
+
33
+ The Deno package name is `jsr:@safe/bantigraph`; JSR releases are published separately.
34
+
35
+ This Node.js example creates a chart and saves it as `traffic.png`:
36
+
37
+ ```ts
38
+ import { writeFile } from "node:fs/promises";
39
+ import { traffic } from "bamtigraph";
40
+
41
+ const chart = traffic(
42
+ [0, 300, 600],
43
+ [180e6, 195e6, 188e6],
44
+ [42e6, 45e6, 43e6],
45
+ {
46
+ title: "My network",
47
+ fonts: { mode: "bitmap" },
48
+ },
49
+ );
50
+
51
+ await writeFile("traffic.png", chart.toPNG());
52
+ ```
53
+
54
+ Replace the arrays with your timestamps, incoming values, and outgoing values. Numeric timestamps are Unix seconds. Use `null` for a missing reading.
55
+
56
+ For charts on a web page, follow the [browser integration guide](docs/index.html#typescript).
57
+
58
+ ## Use Go
59
+
60
+ Try the included example from the project folder:
61
+
62
+ ```sh
63
+ go run ./examples/quickstart -o traffic.png
64
+ ```
65
+
66
+ To create a chart from a CSV file:
67
+
68
+ ```sh
69
+ go run ./cmd/bamtigraph -input examples/traffic.csv -o traffic.png
70
+ ```
71
+
72
+ The Go package is `github.com/gosuda/BamtiGraph`. See the [Go quickstart source](examples/quickstart/main.go) to use it in your application. If Go cannot find a suitable font, add `-font /path/to/font.ttf`.
73
+
74
+ ## Make it yours
75
+
76
+ No watermark is drawn by default. To add your own text along the right edge:
77
+
78
+ ```ts
79
+ const branded = chart.with({ watermark: "My network" });
80
+ await writeFile("branded.png", branded.toPNG());
81
+ ```
82
+
83
+ In Go, set `graph.Watermark = "My network"`, or pass `-watermark "My network"` to the command-line example. Use `BAMTIGRAPH` if you want the library name, or an empty string to remove the text.
84
+
85
+ In the demo, use **Custom edge text**. You can also change the surrounding page labels in `assets/brand.js`.
86
+
87
+ ## Explore more
88
+
89
+ - [Browser examples](docs/index.html#examples)
90
+ - [TypeScript options and API](docs/API.md)
91
+ - [Go usage guide](docs/index.html#go)
92
+ - [Release setup](docs/index.html#publishing)
93
+ - [Security notes](docs/SECURITY.md)
94
+
95
+ ## License
96
+
97
+ BSD-3-Clause. See [LICENSE](LICENSE).