Fix timeline worker sorting

In the nested 'data' array, nested lists of tests should be sorted by
their worker key. However, the 'd3.ascending' comparator sorts by
string rather than numerically, resulting in the array being out of
order with more than 10 workers. This caused item selection (but not
hovering) to break after the second row.

This patch replaces the built-in comparator ('d3.ascending') with a
comparator that uses parseInt() to make sure the nested lists are in
the correct order for fast lookups.

Change-Id: Idbd94369fb35f4cf03c39b0c9fa2cc07623885ab
This commit is contained in:
Tim Buckley 2016-06-15 12:02:56 -06:00
parent 4f441cd27c
commit e6037d640a
1 changed files with 3 additions and 1 deletions

View File

@ -362,7 +362,9 @@ function timeline($window, $log, datasetService, progressService) {
self.data = d3Collection.nest()
.key(function(d) { return d.worker; })
.sortKeys(d3Array.ascending)
.sortKeys(function(a, b) {
return parseInt(a, 10) - parseInt(b, 10);
})
.entries(raw.filter(function(d) { return d.duration > 0; }));
self.axes.x.domain(self.timeExtents);