Comments (8)
Cool! Possibly related: if I console.log($width)
in the chart components, I get 2 results, with the first number being a lot smaller than my container.
from layercake.
This is now in 3.0.0 https://github.com/mhkeller/layercake/releases/tag/v3.0.0
from layercake.
Ya I think having it either 1) only load things once the pages load or 2) load everything with per-determined dimensions is the way to go. It's related to this comment here about server-side rendering and the flash of unsized content not being ideal: #5 (comment)
I'll look into the best way to do this. It could be that it just looks for the window
object. The trick will just be to make sure that it fails gracefully on first load and doesn't error.
from layercake.
I did some work on this and I think the best solution is to add a prop like ssr
that defaults to false that turns off all server-side rendering by adding this conditional which is now in the ssr branch:
layercake/src/LayerCake.svelte
Lines 270 to 278 in 734e449
it won't attempt to render any of the elements, which is nice because you won't have to put a bunch of conditional statements in each renderer to check to make sure variables have been calculated.
I've started building out server-side rendered examples on the ssr branch of the website repo and I did an export of the current site with the ssr branch so you can see how it works.
This would also close #5
from layercake.
@jurb Can you put an example together in the REPL of the charts you say aren't sizing properly?
from layercake.
@mhkeller Yes, I'll try to do so.
from layercake.
I'll merge this into master when I'm done building out the ssr examples to make sure that it works with all use cases built so far.
from layercake.
@jurb Can you put an example together in the REPL of the charts you say aren't sizing properly?
I'm sorry but I worked on a tight deadline for that project and can't manage to reconstruct the issue in the upcoming time. Once I have time I'll let you know.
Thanks for the great work!
from layercake.
Related Issues (20)
- Color bar component HOT 4
- Set a default height in pixels on the examples HOT 1
- Handle mouse events for an entire LayerCake HOT 5
- yTick in AxisY.svelte changes position of marks and gridlines HOT 2
- 3d graph HOT 3
- more axis examples HOT 5
- Issue with package.json "exports" prop HOT 5
- Upgrade to svelte 4 HOT 2
- Create `cScale` for color? HOT 5
- Update REPL examples HOT 1
- Option to use different canvas contexts? HOT 6
- Should auto-calculated ordinal domain return sorted? HOT 2
- Sorted ordinal regression HOT 14
- Collapsible tree HOT 3
- Migrate to Runes HOT 6
- Chart showing up blank HOT 10
- Update to SvelteKit 2 HOT 2
- Question: is it NOT meant to be used with TypeScript? HOT 4
- Scatter plot with two dataset HOT 9
- Add prop to not sort a calculated domain from ordinal scale HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from layercake.