feat(documents): timeline date-range filter with density bars (#385) #478
@@ -48,6 +48,7 @@ import java.io.IOException;
|
|||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
import java.time.YearMonth;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@@ -171,8 +172,7 @@ public class DocumentService {
|
|||||||
|
|
||||||
Map<String, Integer> counts = new java.util.TreeMap<>();
|
Map<String, Integer> counts = new java.util.TreeMap<>();
|
||||||
for (LocalDate d : dates) {
|
for (LocalDate d : dates) {
|
||||||
String month = String.format("%04d-%02d", d.getYear(), d.getMonthValue());
|
counts.merge(YearMonth.from(d).toString(), 1, Integer::sum);
|
||||||
counts.merge(month, 1, Integer::sum);
|
|
||||||
}
|
}
|
||||||
List<MonthBucket> buckets = counts.entrySet().stream()
|
List<MonthBucket> buckets = counts.entrySet().stream()
|
||||||
.map(e -> new MonthBucket(e.getKey(), e.getValue()))
|
.map(e -> new MonthBucket(e.getKey(), e.getValue()))
|
||||||
|
|||||||
Reference in New Issue
Block a user