Skip to main content
100%

Independent scale multi-line graph

✓ Published0🌍 Public
Dd3noob
Last edited Jul 21, 2018
Created on Jul 21, 2018

This interactive chart displays monthly stock prices for Microsoft, Amazon, and IBM from January 2000 to March 2010, with each line normalized to its own independent y-axis scale. This allows viewers to compare the shapes and relative trends of each company’s price movements without being distorted by differing absolute price ranges. Built with D3 v4 in SVG, the visualization uses `d3.nest()` to group data by symbol and `d3.scaleLinear()` to assign each line its own vertical domain. Clicking a legend label toggles the corresponding line’s opacity via a `transition()`, while `d3.axisBottom()` renders the shared time axis. Data originates from a CSV file.

AI-generated description

This is a derivative of the Multi-line graph 4 with v4: Toggle as used in the book D3 Tips and Tricks v4. The stock data was sourced from Mike Bostock's small multiples example.

It is a variation on all the graphs in that multi-line series in that the y axis scales to bounds of the graph for each line. This might sound like a waste of time, but it is done with the intention to allow the viewer to more easily percieve common (related) features in the graph independant of scale

You can toggle the lines off and on by clicking on the appropriate legend text.

mit Licensed

Similar vizzes