Skip to content

Commit

Permalink
feat(explorer): add filter for average line
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Mar 5, 2021
1 parent 39691d4 commit 286548a
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion web/public/js/graph/git/file-explorer.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ function renderCodeExplorer(freedom, data, elementId) {
}
return 0;
});
const average = d3.mean(allNodes, d => {
if (d.data.data && d.data.data.git && d.data.data.git.details.length) {
return Math.abs(d.data.data.git.details.length)
}
return 0;
});

let color = d3.scaleLinear()
.domain([0, +max])
.range(["#9be9a8", "red"])
Expand Down Expand Up @@ -103,7 +110,15 @@ function renderCodeExplorer(freedom, data, elementId) {
});

labels.selectAll('text')
.data(allNodes)
.data(allNodes.filter(d => {
if (d.data.data && d.data.data.git) {
if (d.data.data.git.details.length > average) {
return true;
}
}

return false;
}))
.enter()
.append('text')
.attr('class', d => `label-${d.id}`)
Expand Down

0 comments on commit 286548a

Please sign in to comment.