fix failing legend test by creating an invisible canvas

Fixes #336