Multi-line graph 2 with v7: Colours
This chart displays monthly stock prices for three companies (MSFT, AMZN, IBM) from 2000 to 2010, using multiple colored lines to represent each symbol. The visualization uses D3.js v7 to read a CSV file, parse dates with `d3.timeParse`, and group data by symbol using `d3.group`. Lines are drawn with `d3.line` and colored via `d3.scaleOrdinal` with the `schemeCategory10` palette. The graph includes time-series axes created with `d3.axisBottom` and `d3.axisLeft`, rendering everything as SVG elements.
AI-generated descriptionThis is an example in the book D3 Tips and Tricks v7. The stock data was sourced from Mike Bostock's small multiples example.
It is the second 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 application of unique colours to the graph lines.
The graph should be taken in context with the text of the book which can be downloaded for free from Leanpub.