All examples By author By category About

d3noob

Multiple line graphs with labels

This is an example of a line graph with multiple lines and labels at the end of those lines.

Created in responce to a question on d3noob.org

A few points to note:

  1. The csv file starts with the newest data point and ends with the oldest. If you needed to get the 'y' position of the last point in the array you will need to use data[data.length-1].open rather than data[0].open.

  2. I've left some console.log calls in the code as small demos.

  3. The script makes the adjustment for scale using the y function.