Skip to content

Commit 972876a

Browse files
authored
Merge pull request #6 from ChartGPU/update-readme
Enhance README with improved formatting and additional documentation …
2 parents a736e8c + 65da7a0 commit 972876a

File tree

1 file changed

+59
-33
lines changed

1 file changed

+59
-33
lines changed

README.md

Lines changed: 59 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,32 @@
11
# chartgpu-react
22

3-
React bindings for [ChartGPU](https://github.com/huntergemmer/chart-gpu) - a WebGPU-powered charting library delivering high-performance data visualization.
3+
<p align="center">
4+
React bindings for <a href="https://github.com/ChartGPU/ChartGPU">ChartGPU</a> — WebGPU-powered charting for high-performance data visualization.
5+
</p>
46

5-
## Documentation
7+
<div align="center">
68

7-
- **Getting started**: [`docs/GETTING_STARTED.md`](./docs/GETTING_STARTED.md)
8-
- **API reference**: [`docs/API.md`](./docs/API.md)
9-
- **Recipes**:
10-
- [`onCrosshairMove`](./docs/recipes/crosshair-move.md)
11-
- [`useConnectCharts` / `connectCharts`](./docs/recipes/chart-sync.md)
12-
- [`createAnnotationAuthoring`](./docs/recipes/annotation-authoring.md)
13-
- [`appendData` streaming](./docs/recipes/streaming.md)
14-
- [`dataZoom` + `onZoomChange`](./docs/recipes/datazoom-basics.md)
9+
[![Documentation](https://img.shields.io/badge/Documentation-Getting%20Started-blue?style=for-the-badge)](https://github.com/chartgpu/chartgpu-react/blob/main/docs/GETTING_STARTED.md)
10+
[![API Reference](https://img.shields.io/badge/API-Reference-blue?style=for-the-badge)](https://github.com/chartgpu/chartgpu-react/blob/main/docs/API.md)
11+
[![Examples](https://img.shields.io/badge/Examples-Run%20Locally-blue?style=for-the-badge)](https://github.com/chartgpu/chartgpu-react/tree/main/examples)
1512

16-
## Installation
13+
[![npm version](https://img.shields.io/npm/v/chartgpu-react?style=for-the-badge&color=blue)](https://www.npmjs.com/package/chartgpu-react)
14+
[![NPM Downloads](https://img.shields.io/npm/dm/chartgpu-react?style=for-the-badge&color=%2368cc49)](https://www.npmjs.com/package/chartgpu-react)
15+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=for-the-badge)](https://www.npmjs.com/package/chartgpu-react)
1716

18-
```bash
19-
npm install chartgpu-react chartgpu react react-dom
20-
```
17+
</div>
2118

22-
## Requirements
19+
`chartgpu-react` is a **thin React + TypeScript wrapper** around the [`chartgpu`](https://www.npmjs.com/package/chartgpu) core library.
2320

24-
- React 18.0.0 or higher
25-
- Browser with WebGPU support:
26-
- Chrome/Edge 113+
27-
- Safari 18+
28-
- Firefox (not yet supported)
21+
## Highlights
2922

30-
Check browser compatibility at [caniuse.com/webgpu](https://caniuse.com/webgpu)
23+
- **`ChartGPU` component (recommended)**: async create/dispose lifecycle + debounced `ResizeObserver` sizing
24+
- **Event props**: `onClick`, `onCrosshairMove`, `onZoomChange`, etc.
25+
- **Imperative `ref` API**: `ChartGPUHandle` (`getChart`, `getContainer`, `appendData`, `setOption`)
26+
- **Hooks**: `useChartGPU(...)`, `useConnectCharts(...)`
27+
- **Helper re-exports (from `chartgpu`)**: `createChart`, `connectCharts`, `createAnnotationAuthoring`
3128

32-
## Quick Start
29+
## Quick start
3330

3431
```tsx
3532
import { ChartGPU } from 'chartgpu-react';
@@ -56,15 +53,26 @@ function MyChart() {
5653
yAxis: { type: 'value' },
5754
};
5855

59-
return (
60-
<ChartGPU
61-
options={options}
62-
style={{ width: '100%', height: '400px' }}
63-
/>
64-
);
56+
return <ChartGPU options={options} style={{ width: '100%', height: '400px' }} />;
6557
}
6658
```
6759

60+
## Installation
61+
62+
```bash
63+
npm install chartgpu-react chartgpu react react-dom
64+
```
65+
66+
### Requirements
67+
68+
- React 18.0.0 or higher
69+
- Browser with WebGPU support:
70+
- Chrome/Edge 113+
71+
- Safari 18+
72+
- Firefox (not yet supported)
73+
74+
Check browser compatibility at [caniuse.com/webgpu](https://caniuse.com/webgpu).
75+
6876
## What this package provides
6977

7078
- **`ChartGPU`** React component (recommended)
@@ -82,7 +90,7 @@ function MyChart() {
8290

8391
For details, start with the [API reference](./docs/API.md).
8492

85-
## v0.2.3 feature snippets (ChartGPU core)
93+
## Feature snippets (ChartGPU core)
8694

8795
These snippets use helpers and events from the `chartgpu` core library (peer dependency of `chartgpu-react`).
8896

@@ -186,9 +194,23 @@ function CandlestickStreaming() {
186194
}
187195
```
188196

197+
## Documentation
198+
199+
- **Getting started**: [`docs/GETTING_STARTED.md`](./docs/GETTING_STARTED.md)
200+
- **API reference**: [`docs/API.md`](./docs/API.md)
201+
- **Recipes**:
202+
- [`onCrosshairMove`](./docs/recipes/crosshair-move.md)
203+
- [`useConnectCharts` / `connectCharts`](./docs/recipes/chart-sync.md)
204+
- [`createAnnotationAuthoring`](./docs/recipes/annotation-authoring.md)
205+
- [`appendData` streaming](./docs/recipes/streaming.md)
206+
- [`dataZoom` + `onZoomChange`](./docs/recipes/datazoom-basics.md)
207+
189208
## Examples
190209

191-
See the runnable example app in [`examples/main.tsx`](./examples/main.tsx).
210+
- Runnable example app: [`examples/main.tsx`](./examples/main.tsx)
211+
- Run locally:
212+
- `npm install`
213+
- `npm run dev` (opens `http://localhost:3000/examples/index.html`)
192214

193215
## Development
194216

@@ -208,7 +230,7 @@ npm run dev
208230

209231
The dev server will start at `http://localhost:3000` and open the examples page automatically.
210232

211-
### Local Development with Linked ChartGPU
233+
### Local development with linked ChartGPU
212234

213235
To develop `chartgpu-react` against a local version of the `chartgpu` package (useful for testing changes across both repositories):
214236

@@ -235,7 +257,7 @@ npm unlink chartgpu
235257
npm install
236258
```
237259

238-
## Type Exports
260+
## Type exports
239261

240262
The package re-exports common types from ChartGPU for convenience:
241263

@@ -255,7 +277,7 @@ import type {
255277
} from 'chartgpu-react';
256278
```
257279

258-
## Browser Compatibility
280+
## Browser support (WebGPU required)
259281

260282
WebGPU is required. Check support at runtime:
261283

@@ -269,6 +291,10 @@ const checkSupport = async () => {
269291
};
270292
```
271293

294+
## Contributing
295+
296+
Issues and pull requests are welcome. If you’re planning a larger change, open an issue first so we can discuss direction.
297+
272298
## License
273299

274300
MIT

0 commit comments

Comments
 (0)