Yeah, phantomjs doesn't have proper flexbox support so it fails to render the visualization layout correctly. This is one of the reasons we take screenshots of each visualization individually in x-pack reporting. You would probably have better luck with Headless Chrome if it truely needs to be headless. Alternatively there is always standard browser automation software like Selenium.