Closed marcodarko closed 4 months ago
Can you please check if your example works, I'm getting this error when trying to open it
@rokotyan sorry about that, I forgot to make it public, here's a new link
@marcodarko I think there might be a problem with the application setup itself. Even if I comment out all the Cosmograph-related code, it still doesn't work.
I think that site is having issues, let's try CodePen: https://codepen.io/marcodarko/pen/poYXWNj
Thanks @marcodarko
Try changing canvas
to div
here:
Looks like there is a typo in our docs. Thanks for bringing this to our attention.
Ah! perfect yeah I see the graph now! thanks!
@rokotyan one more question: initialZoomLevel
seems to have no effect, I see it resize for a split second then goes back to default. How can I make it stick? I've tried different values but can't get it to scale bigger.
config = {
initialZoomLevel: 5
}
cosmograph.setZoomLevel(5) //1
console.log(cosmograph.getZoomLevel()) // always 1 no matter what I do
@marcodarko
If the fitViewOnInit
property is set to true (which is true by default), the initialZoomLevel
value will be overridden. Additionally, if you call cosmograph.setZoomLevel(5)
followed by console.log(cosmograph.getZoomLevel())
, the zoom level displayed in the console will not be 5 because the zoom animation using d3's transition function will complete before the getZoomLevel()
method reads the updated zoom level, even if the animation duration is 0.
For initialZoomLevel
to have an effect, try to disable fitViewOnInit
in the config.
@Stukova thank you so much for this info! Works great now! Really appreciate your help. Perhaps I would suggest I would prefer the opposite the behavior, that my user setting would override the default, but it's a minor suggestion for consideration.
I don't know what is wrong because no errors occur also, here's a codebox of the basic setup: https://codesandbox.io/p/devbox/gallant-forest-7vgq4z?file=%2Fsrc%2Fcomponents%2FHelloWorld.vue
If you spot any errors or have any tips it would be much appreciated.