Skip to main content
100%

Simple scatterplot with d3.js

✓ Published0🌍 Public
Aadamfknapp
Last edited Oct 19, 2017
Created on Oct 19, 2017

This example shows a hybrid line-and-scatterplot of stock closing prices over time, with a steelblue line connecting daily data points and small circles marking each individual value. The code loads date and close values from a CSV file using d3.csv, parses dates with d3.time.format, and scales the data with d3.time.scale and d3.scale.linear. It renders axes with d3.svg.axis and draws the line using d3.svg.line, while circles are appended to the SVG canvas with explicit cx and cy attributes.

AI-generated description

This is a follow on from the simple d3.js graph used as an example in the book D3 Tips and Tricks.

It adds points to a simple line graph to produce a hybrid line / scatterplot graph. It should be taken in context with the text of the book which can be downloaded for free from Leanpub.

forked from <a href='http://bl.ocks.org/d3noob/'>d3noob</a>'s block: <a href='http://bl.ocks.org/d3noob/38744a17f9c0141bcd04'>Simple scatterplot with d3.js</a>

forked from <a href='http://bl.ocks.org/nguyenbq/'>nguyenbq</a>'s block: <a href='http://bl.ocks.org/nguyenbq/a350280a02c8105529d0'>Simple scatterplot with d3.js</a>

mit Licensed

Similar vizzes