almende / vis

⚠️ This project is not maintained anymore! Please go to https://github.com/visjs
7.86k stars 1.48k forks source link

Printed timeline label+content misaligned for multiple pages #4279

Open bg opened 5 years ago

bg commented 5 years ago

When a timeline has a large height, such that when printed, it is printed to more than one page, group labels end up misaligned with the timeline content cells. See this minimal failing example, based on the groups example code, but modified to inflate the number of groups so that it spans multiple pages when printed.

https://jsbin.com/datovitunu/1/edit?html,output

Here's a screenshot of part of the print preview in Chrome:

2019-04-02 11_17_45-Window

This looks like #825, closed in 2016 due to inactivity. I am currently experiencing this problem with some of our production code. While arguably the printed output will be sloppy without a redesign of our graph into an explicitly paginated form due to awkward splits of the bars on the graph across page boundaries, I can see some of our users potentially willing to live with that so long as the rest of it prints properly across multiple sheets. So I do think this is a realistic use case that should be supported.

I briefly experimented with triggering a resize & redraw of the whole graph on beforePrint, but the graph generation took sufficiently long that the page wasn't ready before it was printed, resulting in it being mostly blank. I later thought about this and figure I could probably wrap that in a setTimeout to give enough time for the redraw before invoking print(), but that seems horribly clumsy. I thought before I explored more in this direction, I had better see if you have any further thoughts on #825 as to whether there is the possibility of some practical & clean solution to this problem now.

Ben