Skip to main content
100%

Multi-line graph 3: Legend

✓ Published0🌍 Public
Dd3noob
Last edited Nov 30, 2019
Created on Jul 5, 2014

Three stock price time series are plotted as separate colored lines, with a legend beneath the x-axis identifying each series by its symbol (MSFT, AMZN, IBM). The SVG chart is built with D3.js, using `d3.nest` to group monthly CSV data by symbol and a categorical color scale to assign line and legend colors. Axes are generated with `d3.svg.axis`, and data spans January 2000 through March 2010.

AI-generated description

This is a derivative of the simple d3.js graph used as an example in the book D3 Tips and Tricks. 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.

mit Licensed

Similar vizzes