Creating a line chart
Line charts are the most basic type of charts. They display a series of data points connected together by lines. Line charts are often used to visualize time series data.
There are various libraries that implement this charting functionality, both paid and free. We're going to use the Flot chart library. It's free, simple, and easy to use and it has been in active development for the past 4 years. It also aims to produce aesthetically pleasing charts.
In this recipe, we're going to make a time series chart that displays the outside temperature history for the past 24 hours.
Getting ready
We'll need to download Flot from the official website at http://www.flotcharts.org/, and extract the contents to a separate folder named flot
.
How to do it...
Let's write the HTML and JavaScript code.
Create a basic HTML page with a placeholder for our chart. We're also going to include jQuery (needed by Flot) and Flot itself. Flot needs to draw the chart canvas a placeholder div, so we're...