Beginner in D3 seeking assistance. I have successfully created a line chart that meets my requirements.
Below is the code I used, with some modifications, mostly inspired by this source:
<!DOCTYPE html>
<meta charset="utf-8">
<style> /* set the CSS */
.line {
fill: none;
stroke: steelblue;
stroke-width: 2px;
}
</style>
<body>
<!-- load the d3.js library -->
<script src="lib/d3/d3.min.js"></script>
<script src="lib/d3-dsv/d3-dsv.min.js"></script>
<script src="lib/d3-fetch/d3-fetch.min.js"></script>
<script>
// set the dimensions and margins of the graph
var margin = {top: 20, right: 20, bottom: 50, left: 70},
width = 960 - ma...
...x.bandwidth)
.height(function(d) { return height - y(d.running_total); });
Then just after I append the path, I thought I could add bars to the chart using rectangles.
svg.append("g")
.attr("fill", "steelblue")
.attr("fill-opacity", 0.8)
.selectAll("rect")
.data(data)
.join("rect")
.attr("d", d => valuebox)
Your help on this matter is highly appreciated!