Closed zac-garland closed 3 years ago
Honestly, I never really understood how this works in htmlwidgets, I wasn't sure how I'm supposed to implement it. I looked at a few other wiedgets when I wrote timevis and none of the ones I looked at did anything special with these sizing policies, and I couldn't find much documentation or uses of them, so I didn't do anything.
Does this work for other htmlwidgets?
Funny enough, I was looking to see if I could find an example... wasn't this a similar issue that you posted on re: ggiraph that was solved?
Shiny: ggiraph output object is huge, goes beyond its height, overlaps content below it
I'm not sure about sizing policy (what it does or how it works), but I just tested the width+height properties and they do in fact work.
timevis::timevis(timevis::timevisData, height="700px")
timevis::timevis(timevis::timevisData, width="200px")
# in shiny:
timevis::timevisOutput("test", height="700px", width="200px")
All of the above do work
consider the attached (where I removed font size styling to ensure it was timevis behavior)
where the left side 700px has the same relative "size" as the 50% on the right.
I can't disagree with you that the height option works. e.g. it decreases or increases the height of the plot container.
But rather than adjusting the contents inside (adjusts font size, and content to reflect its container) it adjusts just the container and leaves the content the same size.
As a simple example, when I decrease the size of the picture in word, e.g. click on the bottom and drag up, I wouldn't expect to lose half the picture in the process or for half the picture to disappear under my new height container.
My goal is to fit the above content into one screen, otherwise whats the use of a timeline if you can only see one section? This limits the use-ability to people with just a few tasks, otherwise you are off the screen or dragging up and down trying to remember what happens when.
It's okay if this isn't possible, just trying to determine whether we can use this for a presentation or not.
Thanks for taking a look!
Zac
I don't think this widget is meant to decrease the font size and everything inside it relatively. The size is just meant to tell the browser how many pixels to allow it to take up. You can try using the underlying javascript library visjs's timeline and see if setting the height does what you want - but I doubt it!
I just tested this out, and I can confirm that visjs does not scale the contents of the timeline. The height parameter in visjs is also just a number of pixels to occupy in the browser. Closing this issue as it's not a timevis (R implementation) issue
Hello,
I've been trying to figure this out for more than 3 days and probably have spent 4 hours trying to get it to work. At this point I'm stuck.
I've tried modifying the htmlwidgets sizingPolicy directly, I've tried custom css, I've tried using the height argument, I've tried looking into the min.visjs.css file to see if there was anything I was missing, I've tried to create custom containers, and still no avail.
The problem I'm trying to solve occurs in Rmarkdown's flexdashboard. But the problem can be reproduced directly in the viewer pane. I'd like to fit the below timeline into a full page. e.g. 100% width, and adjust the height to fit all of the content in one page.
After many attempts, I figure it would be a good time to check in with you.
Do you have any idea how to accomplish what I'm setting out to do? The height does not auto adjust to fit all contents which from my understanding was what it was set to do. I've also tried this with no styling and decreasing the font-size.
Reprex is below.
Thanks for your help in advance.