Skip to content

Commit a47736e

Browse files
committed
Fix single-point timelines on repos with no activity data
1 parent a7100d7 commit a47736e

3 files changed

Lines changed: 12 additions & 6 deletions

File tree

assets/js/visualize/largeRepos/line_repoActivity.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ function draw_line_repoActivity(areaID, repoNameWOwner) {
1515
function drawGraph(data, areaID) {
1616
var graphHeader =`Activity Across Top ${cutOffSize} Repos by Stars [Default Branches, 1 Year]`;
1717

18-
// Removes most recent week from graph to avoid apparent dip in activity
19-
data.pop();
18+
if (data.length > 2) { // Minimum of 2 points for visible timeline
19+
// Removes most recent week from graph to avoid apparent dip in activity
20+
data.pop();
21+
}
2022

2123
const repoKeys = mostPopularRepositories.map(d => `${d.owner}/${d.name}`);
2224

assets/js/visualize/line_repoActivity.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ function draw_line_repoActivity(areaID, repoNameWOwner) {
2020
graphHeader = "Activity for '" + repoNameWOwner + "' [Default Branch, 1 Year]";
2121
}
2222

23-
// Removes most recent week from graph to avoid apparent dip in activity
24-
data.pop();
23+
if (data.length > 2) { // Minimum of 2 points for visible timeline
24+
// Removes most recent week from graph to avoid apparent dip in activity
25+
data.pop();
26+
}
2527

2628
data.forEach(function(d) {
2729
d.date = parseTime(d.date);

assets/js/visualize/line_repoActivityExplore.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ function draw_line_repoActivity(areaID, repoNameWOwner) {
2222
graphHeader = "Activity for '" + repoNameWOwner + "' [Default Branch, 1 Year]";
2323
}
2424

25-
// Removes most recent week from graph to avoid apparent dip in activity
26-
data.pop();
25+
if (data.length > 2) { // Minimum of 2 points for visible timeline
26+
// Removes most recent week from graph to avoid apparent dip in activity
27+
data.pop();
28+
}
2729

2830
data.forEach(function(d) {
2931
d.date = parseTime(d.date);

0 commit comments

Comments
 (0)