barchart cannot select last day
I select all from barchart, I have 19 records, but the table and the Count say there are only 17 records selected.
totalAmountPerDayBarChart
.width(1200)
.height(300)
.margins({top: 10, right: 50, bottom: 30, left: 40})
.dimension(dateDim)
.group(totalAmountPerDayGroup)
.elasticY(true)
.centerBar(true)
.gap(0)
.outerPadding(100)
.round(d3.time.day.round)
.alwaysUseRounding(true)
.x(d3.time.scale().domain([minDate, maxDate]))
.renderHorizontalGridLines(true)
.xUnits(d3.time.days)
.filterPrinter(function (filters) {
var date1 = filters[0][0];
var date2 = filters[0][1];
// date2.setDate(date2.getDate() - 1);
return date1.getFullYear() + '/' + (date1.getMonth() + 1) + '/' + date1.getDate() +
' - ' + date2.getFullYear() + '/' + (date2.getMonth() + 1) + '/' + date2.getDate();
});
Why did you remove the screenshot and text? I put the text back in.
I'm going to guess you have data on April 5 and you are running into #792. Even though you are computing the domain manually, dc.js interprets the domain too literally and won't show the last bar, because it simply shows exactly the domain, and the last bar starts on the end date.
Workaround is to increment the upper bound of the domain by one unit, as shown in that issue.
For a real solution, I guess dc.js will have to have its own, different domain which is not the same one that it gives to the d3 domain object. :-/
Yes, I added 1 second for the max date, then disable the alwaysUseRounding and round. It works now. thanks!