D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
geffkas
Full window
Github gist
D3.js - LabDay - 1 - Introduction
<!DOCTYPE html> <html lang="fr"> <head> <meta charset="utf-8"> <title>D3.js - LabDay - 1</title> <script type="text/javascript" src="https://d3js.org/d3.v4.min.js"></script> </head> <body> <script type="text/javascript"> var dataset = [ 5, 10, 15, 20, 25 ]; d3.select("body").selectAll("p") .data(dataset) .enter() .append("p") .text(function(d, i) { return i + " - Je peux compter jusqu'à " + d; }) .style("color", function(d) { if (d > 15) { // Seuil de 15 return "red"; } else { return "black"; } }); </script> </body> </html>
https://d3js.org/d3.v4.min.js