D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
sashamaryl
Full window
Github gist
Fry Data
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("body").append("svg") .attr("width", 960) .attr("height", 500) svg.selectAll('rect') .data(createData("frenchfry")).enter().append('rect') .attr('x', (d,i) => i * (10 + 2) + 20) .attr('width', '10') .attr('height', d => d * 5) .attr('fill', '#cdcf57') .attr('y', d => 400 - (d * 5)) function createData(string){ var alphabet = 'abcdefghijklmnopqrstuvwxyz'; var array = string.split(""); array = array.map(x => alphabet.indexOf(x)); console.log(array); return array; } createData('frenchfry'); </script> </body>
https://d3js.org/d3.v4.min.js