SauravKanchan / svelte-chartjs

svelte wrapper for chart.js
https://saurav.tech/mdbsvelte/?path=/story/charts--examples
MIT License
296 stars 38 forks source link

[Bug]: Chart does not render* #108

Open taylorjdawson opened 1 year ago

taylorjdawson commented 1 year ago

Would you like to work on a fix?

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?

Lau-r-a commented 1 year ago

Same issue for me

valle-xyz commented 1 year ago

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.

harbour0 commented 1 year ago

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

Sheco commented 1 year ago

Running into the same issue with SvelteKit and svelte-chartjs

faulander commented 1 year ago

same here with sveltekit :/

elhananjair commented 1 year ago

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

dysfunc commented 7 months ago

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

jevb-wsm commented 7 months ago

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?

dysfunc commented 7 months ago

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

EdwardLucas2 commented 5 months ago

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

Guandor commented 3 months ago

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.

tzezar commented 1 week ago

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

Could you share some working code example?