svelte-chartjs icon indicating copy to clipboard operation
svelte-chartjs copied to clipboard

[Bug]: Chart does not render*

Open taylorjdawson opened this issue 1 year ago • 12 comments

Would you like to work on a fix?

  • [x] Check this if you would like to implement a PR, we are more than happy to help you go through the process.

Current and expected behavior

*I understand that you said "if you are experiencing an issue with charts rendering, please create a related issue in Chart.js repository." However, this code is a direct port from your scatter example but it only works in code-sandbox and not in a local sveltekit repo.

I would expect svelte-chartjs to work in a sveltekit app but I have been unable to discover a working example that uses sveltekit nor have I been able to get mine to work with sveltekit.

Reproduction

https://github.com/taylorjdawson/svelte-chartjs-example

chart.js version

4.3.0

svelte-chartjs version

3.1.2

Possible solution

Sveltekit uses ssr so that could potentially be causing issues. I am unsure if this library accounts for ssr?

taylorjdawson avatar May 01 '23 22:05 taylorjdawson

Same issue for me

Lau-r-a avatar May 13 '23 08:05 Lau-r-a

For SSR you could check out:

https://github.com/Rich-Harris/pancake or: https://layercake.graphics/

And try turning off SSR for the chart route.

valle-xyz avatar May 20 '23 09:05 valle-xyz

Did anyone find a fix for this? Been unable to even render a line chart within svelte.

harbour0 avatar May 27 '23 11:05 harbour0

Running into the same issue with SvelteKit and svelte-chartjs

Sheco avatar Jun 07 '23 18:06 Sheco

same here with sveltekit :/

faulander avatar Jun 13 '23 12:06 faulander

chartjs does work fine on sveltekit without this library, I using it.

elhananjair avatar Aug 10 '23 12:08 elhananjair

Is this still a problem for anyone? I'm able to use all the charts in my SvelteKit project.

dysfunc avatar Feb 02 '24 15:02 dysfunc

Is this still a problem for anyone? I'm able to use all the charts in my SvelteKit project.

Yes :( , even with SSR turned off, charts don't render. Any solution?

jevb-wsm avatar Feb 06 '24 16:02 jevb-wsm

Could you provide a CodeSandbox or StackBlitz with your current setup?

dysfunc avatar Feb 06 '24 18:02 dysfunc

I can't make this work either, it just doesn't work, I can't even get the examples working.I am using sveltekit too if that matters. The chart renders in the DOM, but isn't filled in, no errors in the console or on the browser

EdwardLucas2 avatar Mar 26 '24 19:03 EdwardLucas2

Similarly, I can't get even the examples working by directly copy and pasting. Edit: OK, I've solved the issue. For anyone else encountering the same issue, try adding a continer to the chart with a width and height.

Guandor avatar Jun 09 '24 10:06 Guandor

work fine on sveltekit without this library, I using it.

Could you share some working code example?

tzezar avatar Sep 05 '24 20:09 tzezar