xxxxxxxxxx
<style>
.axis .domain {
display: none;
}
</style>
<body>
<script src="https://d3js.org/d3.v4.min.js"></script>
<script>
// Source: https://bl.ocks.org/mbostock/3886208
var n = 67, // number of samples
m = 67; // number of series
var margin = {top: 20, right: 30, bottom: 30, left: 40},
width = 960 - margin.left - margin.right,
height = 500 - margin.top - margin.bottom;
var svg = d3.select("body").append("svg")
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom)
.append("g")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
d3.tsv("nutriments.tsv", function(data)
{
console.log(data);
var z = d3.scaleOrdinal()
.range(["#98abc5", "#8a89a6", "#7b6888", "#6b486b", "#a05d56", "#d0743c", "#ff8c00"]);
var x = d3.scaleBand()
.rangeRound([0, 960 - margin.left - margin.right])
.paddingInner(0.05)
.align(0.1)
.domain(d3.range(67));
var y = d3.scaleLinear()
.domain([0, 67])
.rangeRound([500 - margin.top - margin.bottom, 0])
.nice();
svg.append("g").selectAll("g")
.data(d3.stack().keys(d3.range(n))(data))
.enter().append("g")
.style("fill", function(d) { return z(d.key); })
.selectAll("rect")
.data(function(d) { return d; })
.enter().append("rect")
.attr("x", function(d, i) { return x(i); })
.attr("y", function(d) { return y(d[0].AvK); })
.attr("height", function(d) { return y(d[0].AvK) - y(d[1].AvMoisture); })
.attr("width", x.bandwidth());
});
</script>
https://d3js.org/d3.v4.min.js