Skip to main content
100%

Filtering in d3.js

✓ Published0🌍 Public
KKirun1
Last edited Apr 7, 2018
Created on Apr 7, 2018

This example demonstrates how the `.filter` method in d3.js selectively highlights data points on a line chart. It plots a time series of stock closing prices from a CSV file, drawing a smooth line for the full dataset, then overlays red circular dots only for values below 400. The visualization uses d3.svg.line for the path, d3.time.scale for the date axis, and d3.svg.axis for tick marks. The filtering occurs on circle elements appended via the data join, applying the condition directly to the data array before setting visual attributes.

AI-generated description

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

It is aimed at demonstrating the use of the .filter statement in d3.js and 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/8dc93bce7e7200ab487d'>Filtering in d3.js</a>

mit Licensed

Similar vizzes