Your function that you pass to sortByshould return a single key that will sort the lines lexicographically or numerically in the order you want.
It is not possible to return two values when you try to do this. Instead of this
- if both columns are strings, join the values as strings separated by a character with a lower ASCII value than any character in
columnOne, or - ,
columnOne , columnTwo,
, :
.order(d3.descending)
.sortBy(function (d) {
return [d.columnOne,d.columnTwo].join('\x0');
});
,
.order(d3.descending)
.sortBy(function (d) {
return d.columnOne * 1e9 + d.columnTwo;
});
, - , .
, , , - .