0

Struggling with creating a bar chart where the x-axis is a date. The format of my date data is "2017-01-31","2017-02-28" etc..

When I plot my data I get Jan 08, Jan 15, Jan 22.. on my x axis

var countbarChart= dc.barChart("#countbarChart");

countbarChart
.width(768)
.height(480)
.x(d3.time.scale().domain([minDate,maxDate]))
.xUnits(d3.time.months)
.elasticY(true)
.brushOn(true)
.yAxisLabel("Reports called per Month")
.dimension(dateDim)
.group(dhits)
.on('renderlet', function(chart) {
    chart.selectAll('rect').on("click", function(d) {
        console.log("click!", d);
    });
});

Is there a way to have the x axis, and bars broken down like Jan-17 Feb-17 .. ?

Gordon
  • 19,811
  • 4
  • 36
  • 74
user3007270
  • 406
  • 4
  • 15
  • Please use the dc.js tag for questions about the charting library - dc is quite something else. – Gordon Mar 19 '17 at 01:16
  • This is an old question, but I guess your want to aggregate by month. Crossfilter can do that pretty well. I missed it the first time due to the bad tag but I'll answer if you still need help. – Gordon Mar 19 '17 at 01:26

0 Answers0