@chartts/arrow 0.1.3 → 0.1.4
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 +74 -0
- package/package.json +5 -4
package/README.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://www.npmjs.com/package/@chartts/arrow"><img src="https://img.shields.io/npm/v/@chartts/arrow?color=06B6D4&label=npm" alt="npm version" /></a>
|
|
3
|
+
<a href="https://github.com/chartts/chartts/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-06B6D4" alt="MIT License" /></a>
|
|
4
|
+
<a href="https://chartts.com"><img src="https://img.shields.io/badge/docs-chartts.com-06B6D4" alt="Documentation" /></a>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
# @chartts/arrow
|
|
8
|
+
|
|
9
|
+
Apache Arrow adapter for Chartts. Import Arrow tables as chart data.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @chartts/arrow @chartts/core
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Uses [apache-arrow](https://arrow.apache.org/docs/js/) for Arrow serialization.
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import { fromArrow, toArrow, toArrowIPC } from "@chartts/arrow"
|
|
23
|
+
|
|
24
|
+
// From IPC buffer
|
|
25
|
+
const response = await fetch("/data/metrics.arrow")
|
|
26
|
+
const buffer = await response.arrayBuffer()
|
|
27
|
+
const data = fromArrow(buffer)
|
|
28
|
+
|
|
29
|
+
// From an existing Arrow Table
|
|
30
|
+
import { tableFromIPC } from "apache-arrow"
|
|
31
|
+
const table = tableFromIPC(buffer)
|
|
32
|
+
const data2 = fromArrow(table)
|
|
33
|
+
|
|
34
|
+
// Export ChartData to Arrow Table
|
|
35
|
+
const arrowTable = toArrow(chart.data)
|
|
36
|
+
|
|
37
|
+
// Export to IPC bytes
|
|
38
|
+
const ipcBytes = toArrowIPC(chart.data)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## API
|
|
42
|
+
|
|
43
|
+
### `fromArrow(input, options?)`
|
|
44
|
+
|
|
45
|
+
Converts an Arrow `Table`, `ArrayBuffer`, or `Uint8Array` into `ChartData`.
|
|
46
|
+
|
|
47
|
+
| Option | Type | Default | Description |
|
|
48
|
+
|--------|------|---------|-------------|
|
|
49
|
+
| `labelColumn` | `string` | first non-numeric | Column to use as labels |
|
|
50
|
+
| `seriesColumns` | `string[]` | all numeric | Columns to use as series |
|
|
51
|
+
|
|
52
|
+
### `toArrow(data, options?)`
|
|
53
|
+
|
|
54
|
+
Converts `ChartData` to an Arrow `Table`.
|
|
55
|
+
|
|
56
|
+
### `toArrowIPC(data, options?)`
|
|
57
|
+
|
|
58
|
+
Converts `ChartData` to Arrow IPC format (`Uint8Array`).
|
|
59
|
+
|
|
60
|
+
| Option | Type | Default | Description |
|
|
61
|
+
|--------|------|---------|-------------|
|
|
62
|
+
| `labelColumnName` | `string` | `"label"` | Name for the label column |
|
|
63
|
+
|
|
64
|
+
## Part of Chartts
|
|
65
|
+
|
|
66
|
+
Beautiful charts. Tiny bundle. Every framework.
|
|
67
|
+
|
|
68
|
+
- [Documentation](https://chartts.com/docs)
|
|
69
|
+
- [GitHub](https://github.com/chartts/chartts)
|
|
70
|
+
- [All packages](https://www.npmjs.com/org/chartts)
|
|
71
|
+
|
|
72
|
+
## License
|
|
73
|
+
|
|
74
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chartts/arrow",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Apache Arrow
|
|
3
|
+
"version": "0.1.4",
|
|
4
|
+
"description": "Apache Arrow adapter for Chartts. Import Arrow tables as chart data.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -14,11 +14,12 @@
|
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
|
-
"dist"
|
|
17
|
+
"dist",
|
|
18
|
+
"README.md"
|
|
18
19
|
],
|
|
19
20
|
"sideEffects": false,
|
|
20
21
|
"peerDependencies": {
|
|
21
|
-
"@chartts/core": "0.1.
|
|
22
|
+
"@chartts/core": "0.1.4"
|
|
22
23
|
},
|
|
23
24
|
"dependencies": {
|
|
24
25
|
"apache-arrow": "^18.0.0"
|