diff --git a/Changelog.md b/Changelog.md index 748f49e28..15de52fd1 100644 --- a/Changelog.md +++ b/Changelog.md @@ -4,6 +4,7 @@ * Improved implementation of alignYAxes, by Mohamed Gazal and Gordon Woodhull ([#1033](https://github.com/dc-js/dc.js/pull/1033)) * Examples of downloading the table data as it's formatted, and formatting legend items. * `legend.legendText` documentation was missing. +* Stop error spew when row chart is emptied out, thanks Einar Norðfjörð and Fil ([#1008](https://github.com/dc-js/dc.js/issues/1008) / ([#1024](https://github.com/dc-js/dc.js/pull/1024)) ## 2.0.0 beta 31 * Brush was sometimes not displaying, fix by Paul Briton ([#1134](https://github.com/dc-js/dc.js/issues/1134)) diff --git a/spec/row-chart-spec.js b/spec/row-chart-spec.js index 91f320d9e..38b625d1b 100644 --- a/spec/row-chart-spec.js +++ b/spec/row-chart-spec.js @@ -297,6 +297,24 @@ describe('dc.rowChart', function () { }); }); + describe('removing all the data and restoring the data', function () { + // this test mainly exists to produce console errors for #1008; + // I can't seem to find any way to detect invalid setAttribute calls + beforeEach(function () { + chart.render(); + chart.group({all: function () { return []; }}); + chart.redraw(); + chart.group(groupHolder.group); + chart.redraw(); + }); + + it('should restore the row chart', function () { + chart.selectAll('g.row rect').each(function (p) { + expect(d3.select(this).attr('width').indexOf('NaN') < 0).toBeTruthy(); + }); + }); + }); + describe('custom labels', function () { beforeEach(function () { chart.label(function () { diff --git a/src/row-chart.js b/src/row-chart.js index ae8798884..1ac99e7a4 100644 --- a/src/row-chart.js +++ b/src/row-chart.js @@ -156,7 +156,6 @@ dc.rowChart = function (parent, chartGroup) { rowEnter.append('rect').attr('width', 0); createLabels(rowEnter); - updateLabels(rows); } function removeElements (rows) {