Skip to main content
100%

Using an 'if' statement in v7

✓ Published0🌍 Public
Dd3noob
Last edited Jun 19, 2021
Created on Jun 19, 2021

This example shows a line graph of stock closing prices over time, with data points color-coded based on their value. The visualization uses SVG rendering and the d3.v7 library, specifically `d3.line`, `d3.scaleTime`, `d3.scaleLinear`, and `d3.axisBottom`/`d3.axisLeft`. It reads CSV data from `data.csv` via `d3.csv` and parses dates with `d3.timeParse`. Each data point is drawn as a circle whose fill color is determined by an `if` statement: values at or below 400 appear red, while higher values are black.

AI-generated description

This is a simple graph demonstrating the addition of filtering using an if statement with a graph.

This graph is part of the code samples for the update to the book D3 Tips and Tricks to version 7 of d3.js.

mit Licensed

Similar vizzes