Skip to content

Commit c1dae81

Browse files
committed
Update package dependencies to use published version of chartgpu, enhance README with local development instructions, and modify example data generation for improved performance. Additionally, refine type imports in ChartGPUChart component.
1 parent 57a1d76 commit c1dae81

5 files changed

Lines changed: 36 additions & 8 deletions

File tree

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,33 @@ npm run dev
199199

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

202+
### Local Development with Linked ChartGPU
203+
204+
To develop `chartgpu-react` against a local version of the `chartgpu` package (useful for testing changes across both repositories):
205+
206+
```bash
207+
# 1. Link the chartgpu package from the sibling repo
208+
cd ../chart-gpu
209+
npm link
210+
211+
# 2. Link chartgpu into this project
212+
cd ../chartgpu-react
213+
npm link chartgpu
214+
215+
# 3. Build and run - will use the linked local package
216+
npm run build
217+
npm run dev
218+
```
219+
220+
**Note:** After linking, `npm run build` and `npm run dev` will resolve imports to your local `chartgpu` package instead of the published version. This allows you to test changes in both repos simultaneously.
221+
222+
To unlink and return to the published package:
223+
224+
```bash
225+
npm unlink chartgpu
226+
npm install
227+
```
228+
202229
## Type Exports
203230

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

examples/main.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function LineChartExample() {
88
const [error, setError] = useState<string | null>(null);
99

1010
// Generate sample data
11-
const generateLineData = useCallback((points: number = 100) => {
11+
const generateLineData = useCallback((points: number = 5000000) => {
1212
const data = [];
1313
for (let i = 0; i < points; i++) {
1414
const x = i;
@@ -112,9 +112,9 @@ function MultiSeriesExample() {
112112
{
113113
type: 'line',
114114
name: 'Revenue',
115-
data: Array.from({ length: 50 }, (_, i) => ({
115+
data: Array.from({ length: 500000 }, (_, i) => ({
116116
x: i,
117-
y: 100 + Math.random() * 100 + i * 2,
117+
y: 100 + Math.random() * 5000000 + i * 2,
118118
})),
119119
lineStyle: {
120120
width: 2,
@@ -124,7 +124,7 @@ function MultiSeriesExample() {
124124
{
125125
type: 'line',
126126
name: 'Expenses',
127-
data: Array.from({ length: 50 }, (_, i) => ({
127+
data: Array.from({ length: 500000 }, (_, i) => ({
128128
x: i,
129129
y: 80 + Math.random() * 60 + i * 1.5,
130130
})),
@@ -136,7 +136,7 @@ function MultiSeriesExample() {
136136
{
137137
type: 'line',
138138
name: 'Profit',
139-
data: Array.from({ length: 50 }, (_, i) => ({
139+
data: Array.from({ length: 500000 }, (_, i) => ({
140140
x: i,
141141
y: 20 + Math.random() * 40 + i * 0.5,
142142
})),

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"preview": "vite preview"
3131
},
3232
"dependencies": {
33-
"chartgpu": "file:../chart-gpu"
33+
"chartgpu": "^0.1.0"
3434
},
3535
"peerDependencies": {
3636
"react": ">=18.0.0",

src/ChartGPUChart.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { useEffect, useRef, useCallback } from 'react';
2+
import type { CSSProperties } from 'react';
23
import { ChartGPU } from 'chartgpu';
34
import type { ChartGPUOptions, ChartGPUInstance } from 'chartgpu';
45

@@ -16,7 +17,7 @@ export interface ChartGPUChartProps {
1617
/**
1718
* Optional inline styles for the container
1819
*/
19-
style?: React.CSSProperties;
20+
style?: CSSProperties;
2021

2122
/**
2223
* Optional callback when chart instance is created

0 commit comments

Comments
 (0)