11 Server-side visualization
This chapter covers
- Rendering charts and visualizations with Node.js
- Building reusable functions for rendering charts that we can use when doing exploratory data analysis
- Using a headless browser to capture web pages to PNG image files and PDF documents
- Taking web scraping to the next level with a headless browser
When we’re doing exploratory coding (chapter 5) or data analysis (chapter 9), we want to render charts and visualizations to explore and understand our data. In chapter 10, we learned how to create web-based interactive visualizations for the browser. That’s a normal and common way to create visualizations in JavaScript. Browser-based visualization techniques are well known and well understood, and you can easily find help on the internet.
How about we take the browser out of the equation? What if we want to render our charts and visualization on the server directly from Node.js? Well, we can do that, but unlike browser-based visualization, this isn’t a common use case, and it can be difficult to find the help you need online.
First, though, you might wonder why it’s useful to render charts on the server side? It’s convenient for us to render charts directly from Node.js while doing exploratory data analysis (that’s what we were doing in chapter 9). This approach to data analysis is common in Python, and it would be nice if we could replicate it in Node.js.