CHAPTER 4

image

Drawing a Line Chart

In the previous chapter, you built an HTML table as a sample of structured data and developed parsers in JavaScript to extract the data into arrays. In this chapter, you will build a line chart with JavaScript as one of the possible visualizations for the data in the table from Chapter 3.

Before you start to convert the data into graphic elements to achieve your line chart, you need a place in which to use it. Therefore, I will begin this chapter by introducing the canvas. You will see what this is and how to implement it, and, in the end, you will integrate it into your web page.

Once you understand what the canvas ...

Get Beginning JavaScript Charts: With jqPlot, d3, and Highcharts now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.