aliencharts 0.1.1 → 0.1.3
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 +50 -1
- package/assets/aliencharts_logo_small.png +0 -0
- package/assets/aliencharts_title.svg +3 -0
- package/assets/chartdrawings.png +0 -0
- package/assets/chartgrid.png +0 -0
- package/dist/index.cjs +158 -117
- package/dist/index.cjs.map +2 -2
- package/dist/index.js +158 -117
- package/dist/index.js.map +2 -2
- package/index.d.ts +161 -0
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
<h1 align="center">
|
|
2
|
+
<img src="./assets/aliencharts_logo_small.png" alt="AlienCharts logo" width="88" height="88"><br>
|
|
3
|
+
<img src="./assets/aliencharts_title.svg" alt="AlienCharts" height="42">
|
|
4
|
+
</h1>
|
|
2
5
|
|
|
3
6
|
GPU-rendered chart grid for multi-metric dashboards — such as monitoring AI training runs, where you need many live-updating charts with millions of points each.
|
|
4
7
|
|
|
@@ -64,6 +67,43 @@ export default function Dashboard() {
|
|
|
64
67
|
|
|
65
68
|
For a fuller example, including live appending and theming — see [`examples/DemoPage.jsx`](./examples/DemoPage.jsx).
|
|
66
69
|
|
|
70
|
+
### Drawings
|
|
71
|
+
|
|
72
|
+
Drawings are controlled by your app. Keep the drawing array and active tool in state, then pass that state into `ChartGrid`:
|
|
73
|
+
|
|
74
|
+
```jsx
|
|
75
|
+
import { useCallback, useState } from "react";
|
|
76
|
+
import { ChartGrid } from "aliencharts";
|
|
77
|
+
|
|
78
|
+
export default function Dashboard({ charts }) {
|
|
79
|
+
const [drawings, setDrawings] = useState([]);
|
|
80
|
+
const [activeDrawingTool, setActiveDrawingTool] = useState(null);
|
|
81
|
+
const [selectedDrawingId, setSelectedDrawingId] = useState(null);
|
|
82
|
+
|
|
83
|
+
const createDrawingId = useCallback(
|
|
84
|
+
({ chartId, type }) => `${chartId}:${type}:${crypto.randomUUID()}`,
|
|
85
|
+
[],
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<ChartGrid
|
|
90
|
+
charts={charts}
|
|
91
|
+
drawings={drawings}
|
|
92
|
+
onDrawingsChange={setDrawings}
|
|
93
|
+
activeDrawingTool={activeDrawingTool}
|
|
94
|
+
onActiveDrawingToolChange={setActiveDrawingTool}
|
|
95
|
+
selectedDrawingId={selectedDrawingId}
|
|
96
|
+
onSelectedDrawingIdChange={setSelectedDrawingId}
|
|
97
|
+
createDrawingId={createDrawingId}
|
|
98
|
+
/>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Supported drawing tools are `"trendline"`, `"hline"`, `"vline"`, and `"pin"`. Since drawings live outside the component, you can persist them however you want, such as local storage, a database, or app state.
|
|
104
|
+
|
|
105
|
+
Set `disableDrawings` when you want a read-only chart toolbar without drawing or moving-average tools.
|
|
106
|
+
|
|
67
107
|
## API
|
|
68
108
|
|
|
69
109
|
### `createSeries(options)`
|
|
@@ -97,6 +137,15 @@ Renders a responsive grid of charts. Commonly used props:
|
|
|
97
137
|
| `xAxisLabel` | `string` | `"STEP"` | Label shown on the x-axis. |
|
|
98
138
|
| `backgroundColor` | `string` | — | Chart background color. |
|
|
99
139
|
| `antialiasLines` | `boolean` | `false` | Enable line antialiasing. |
|
|
140
|
+
| `drawings` | `Drawing[]` | `[]` | Controlled drawing objects. |
|
|
141
|
+
| `onDrawingsChange` | `(drawings) => void` | — | Called when drawings are created, edited, deleted, or styled. |
|
|
142
|
+
| `activeDrawingTool` | `"trendline" \| "hline" \| "vline" \| "pin" \| null` | `null` | Controlled active drawing tool. |
|
|
143
|
+
| `onActiveDrawingToolChange` | `(tool) => void` | — | Called when the toolbar or hotkeys change the active drawing tool. |
|
|
144
|
+
| `selectedDrawingId` | `string \| null` | `null` | Controlled selected drawing id. |
|
|
145
|
+
| `onSelectedDrawingIdChange` | `(id) => void` | — | Called when a drawing is selected or deselected. |
|
|
146
|
+
| `createDrawingId` | `({ chartId, type }) => string` | — | Optional id factory for new drawings. |
|
|
147
|
+
| `disableDrawings` | `boolean` | `false` | Hide and disable drawing and moving-average tools. |
|
|
148
|
+
| `onChartContextMenu` | `({ chart, event, point }) => void` | — | Called on chart right-click. Use it to render your own context menu. |
|
|
100
149
|
|
|
101
150
|
## License
|
|
102
151
|
|
|
Binary file
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="194" height="46" viewBox="0 0 194 46" role="img" aria-label="AlienCharts">
|
|
2
|
+
<text x="2" y="34" fill="#92FF72" stroke="#18303D" stroke-width="2" stroke-linejoin="round" paint-order="stroke fill" font-family="-apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif" font-size="34" font-weight="600">AlienCharts</text>
|
|
3
|
+
</svg>
|
|
Binary file
|
|
Binary file
|