Multi-line graph 3 with v6: Legend
A multi-line graph displays monthly stock prices for MSFT, AMZN, and IBM from 2000 to 2010, with each series colored distinctly via a categorical scale. The visualization uses D3 v6 APIs such as `d3.csv`, `d3.timeParse`, `d3.scaleTime`, `d3.scaleLinear`, and `d3.line`, rendering to SVG. A legend is automatically generated beneath the chart, spacing labels evenly and matching each company's line color, with data sourced from Mike Bostock's small multiples example.
AI-generated descriptionThis is used as an example in the book D3 Tips and Tricks v6. The stock data was sourced from Mike Bostock's small multiples example.
It is the third graph in a series that is building a multi-line graph that incorperates an automatically developed legend and a system that can toggle the lines off and on as desired.
This version is demonstrating the addition of a legend to the graph.
The graph should be taken in context with the text of the book which can be downloaded for free from Leanpub.