Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there any way to use signals in a Chart island? #25

Open
cbowdon opened this issue Nov 5, 2023 · 0 comments
Open

Is there any way to use signals in a Chart island? #25

cbowdon opened this issue Nov 5, 2023 · 0 comments

Comments

@cbowdon
Copy link

cbowdon commented Nov 5, 2023

I'd like to redraw my chart when the data changes, but I'm afraid I can't figure out how to do it. The aim is something like this that works:

import { signal } from "@preact/signals";

const data = signal({ labels: ["a", "b"], datasets: [{ data: [1, 2] }] }); 

...
<ChartIsland type="bar" data={data} />

From my rough understanding of the fresh charts code, I think it would mean a change to the library to thread a Signal into useChart in island.tsx, then unwrap it in the call to the ChartJS constructor. I couldn't get that working locally though.

Any advice much appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant