-
Notifications
You must be signed in to change notification settings - Fork 8
Closed
Labels
Description
when using cellContent()
, the function is called twice for every cell. When doing display work (eg make it a certain color) it's safe to do twice, but when doing statics, and for general performance, this is bad.
steps to reproduce:
- create a maptable with a
cellContent()
function. - declare a var before the maptable:
var count = 0;
- inside your
cellContent()
function add a linecount += 1;
expected: count == number of rows in table
actual: count == 2 x number of rows in table
here's some prototypical code to illustrate the problem:
var rowCount = 0;
var viz = d3.maptable('#vizContainer')
.csv(URL_HERE)
.table()
.columns({
Key: {
cellContent: function(d){
rowCount += 1;
return d.Key;
},
},
})
.render(postProcess);
function postProcess() {
console.log('row count: ' + rowCount);
}