#18 -- Fix labels

This commit is contained in:
Anton Romanov 2021-04-08 11:34:07 +04:00
parent 26942c6e88
commit d73e263814
3 changed files with 15 additions and 9 deletions

View File

@ -13,6 +13,7 @@ public class Route {
public static final String LIST_REPOSITORY_BRANCHES = "listBranches";
public static final String INDEXING_NEW_REPOSITORY = "indexNewRepository";
public static final String FILTER_COMMITS = "filterCommits";
public static final String STATISTIC = "statistic";
public static String getLIST_INDEXED_REPOSITORIES() {
return LIST_INDEXED_REPOSITORIES;
@ -29,4 +30,8 @@ public class Route {
public static String getFILTER_COMMITS() {
return FILTER_COMMITS;
}
public static String getSTATISTIC() {
return STATISTIC;
}
}

View File

@ -13,6 +13,8 @@ import ru.ulstu.extractor.repository.CommitRepository;
import java.util.List;
import java.util.stream.Collectors;
import static ru.ulstu.extractor.controller.Route.STATISTIC;
@Controller
public class StatisticController {
private final CommitRepository commitRepository;
@ -21,9 +23,8 @@ public class StatisticController {
this.commitRepository = commitRepository;
}
@GetMapping("/statistic")
public String indexBranch(
Model model) {
@GetMapping(STATISTIC)
public String indexBranch(Model model) {
List<Object[]> authorCommits = commitRepository.getCommitAuthorStatistic().stream()
.map(stat -> new Object[]{stat.getAuthor(), stat.getCountCommit()})
.collect(Collectors.toList());
@ -40,13 +41,13 @@ public class StatisticController {
for (int i = 0; i < timeCommits.size(); i++) {
date[i] = timeCommits.get(i)[0].toString();
}
model.addAttribute("datas", date);
model.addAttribute("dates", date);
String[] url = new String[urlCommits.size()];
for (int i = 0; i < urlCommits.size(); i++) {
url[i] = urlCommits.get(i)[0].toString();
url[i] = urlCommits.get(i)[0].toString().substring(urlCommits.get(i)[0].toString().lastIndexOf("/") + 1);
}
model.addAttribute("urls", url);
return "statistic";
return STATISTIC;
}
}

View File

@ -23,7 +23,7 @@
text: 'Количество коммитов во времени'
};
var xAxis = {
categories: [[${datas}]],
categories: [[${dates}]],
title: {
enabled: true,
text: 'Дата'
@ -129,7 +129,7 @@
categories: [[${urls}]],
crosshair: true,
title: {
text: 'Url'
text: 'Репозиторий'
}
};
var yAxis = {
@ -141,7 +141,7 @@
var tooltip = {
headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
'<td style="padding:0"><b>{point.y:.1f} mm</b></td></tr>',
'<td style="padding:0"><b>{point.y:.1f}</b></td></tr>',
footerFormat: '</table>',
shared: true,
useHTML: true