Browse Source

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
changes/27/330127/3
Tim Buckley 6 years ago
parent
commit
e6037d640a
  1. 4
      app/js/directives/timeline.js

4
app/js/directives/timeline.js

@ -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);

Loading…
Cancel
Save