I need to draw a rather large diagram ('diagram' might be misleading, as it'll have loads of small text and colour boxes, but for lack of a better term, I'll leave it at that), with the x-axis many times longer than the width of the screen, and was wondering how to approach this to get the best performance.
a) I draw a large canvas inside an smaller div, so that scrollbars appear. That way, only part of the canvas would be visible. If browsers are smart enough only to render the part of the canvas that is being displayed, that would be the easiest option.
b) I draw a smaller canvas with custom scrollbars and rerender the contents of the canvas when the user scrolls. If my code is smart, I am sure I can save some rendering cycles.
So I guess my question is: Are browsers smart enough to figure out that they have to render only the truly visible part of a canvas? Or am I better of to rerender the part of the canvas that is supposed to be visible?