I've been working on a grouped bar chart using D3, but I'm encountering some issues with the display of the bars. Despite my efforts to troubleshoot, I can't seem to pinpoint the exact cause of this problem. The code snippet provided below should give you an idea of what I've implemented so far.
var margin = {
top: 20,
right: 30,
bottom: 30,
left: 40
},
width = 960 - margin.left - margin.right,
height = 500 - margin.top - margin.bottom;
var z = d3.scale.category20c();
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 + ")");
var parseDate = d3.time.format("%Y-%m-%dT%H:%M:%S.%LZ");
var data = [{
"data": [
[
"2016-01-21T01:20:00.000Z",
1.41818181818182
],
[
"2016-01-21T02:28:00.000Z",
1.90661764705882
],
[
"2016-01-21T03:36:00.000Z",
1.66764705882353
],
[
"2016-01-21T04:44:00.000Z",
1.51691176470588
],
[
"2016-01-21T05:52:00.000Z",
1.40955882352941
],
[
"2016-01-21T07:00:00.000Z",
1.46323529411765
],
[
"2016-01-21T08:08:00.000Z",
1.48308823529412
],
[
"2016-01-21T09:16:00.000Z",
1.89384615384615
]
],
"label": "a"
}, {
"data": [
[
"2016-01-21T01:20:00.000Z",
4.98701298701299
],
[
"2016-01-21T02:28:00.000Z",
5.0
],
[
"2016-01-21T03:36:00.000Z",
4.94852941176471
],
[
"2016-01-21T04:44:00.000Z",
4.91176470588235
],
[
"2016-01-21T05:52:00.000Z",
4.81617647058824
],
[
"2016-01-21T07:00:00.000Z",
5.0
],
[
"2016-01-21T08:08:00.000Z",
4.94117647058824
],
[
"2016-01-21T09:16:00.000Z",
4.96969696969697
]
],
"label": "b"
}];
... // The rest of the code structure remains unchanged
text.inner-circle {
font-weight: 400;
font-size: 12px;
text-transform: uppercase;
}
text.inner-text {
font-weight: 400;
font-size: 36px;
font-family: 'Metric Regular', 'Metric';
text-align: center;
font-style: normal;
text-transform: uppercase;
}
path {
stroke: steelblue;
stroke-width: 2;
fill: none;
}
.axis path,
.axis line {
fill: none;
stroke: grey;
stroke-width: 2;
shape-rendering: crispEdges;
}
.grid .tick {
stroke: lightgrey;
stroke-opacity: 0.7;
shape-rendering: crispEdges;
}
.grid path {
stroke-width: 0;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.4.11/d3.min.js"></script>
I would greatly appreciate any assistance in identifying the root cause of this issue. Plnkr.co