D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
bhgray
Full window
Github gist
d3 stacked charts mockup
Built with
blockbuilder.org
<!DOCTYPE html> <head> <meta charset="utf-8"> <script src="https://d3js.org/d3.v4.min.js"></script> <style> body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; } </style> </head> <body> <script> // Feel free to change or delete any of the code you see in this editor! var svg = d3.select("svg"), margin = {top: 20, right: 60, bottom: 30, left: 40}, width = +svg.attr("width") - margin.left - margin.right, height = +svg.attr("height") - margin.top - margin.bottom, g = svg.append("g").attr("transform", "translate(" + margin.left + "," + margin.top + ")"); var x = d3.scaleBand() .rangeRound([0, width]) .padding(0.5) .align(0.1); var y = d3.scaleLinear() .rangeRound([height, 0]); var z = d3.scaleOrdinal() .range(["#D8666A","#F4865F","#FFD774","#C9E068","#5DB575"]); var stack = d3.stack() .offset(d3.stackOffsetExpand); </script> </body>
https://d3js.org/d3.v4.min.js