#18 - Create new graphic
This commit is contained in:
parent
5e7887740d
commit
01ecc09636
@ -64,6 +64,7 @@ dependencies {
|
|||||||
compile group: 'org.webjars', name: 'bootstrap', version: '4.6.0'
|
compile group: 'org.webjars', name: 'bootstrap', version: '4.6.0'
|
||||||
compile group: 'org.webjars', name: 'bootstrap-select', version: '1.13.8'
|
compile group: 'org.webjars', name: 'bootstrap-select', version: '1.13.8'
|
||||||
compile group: 'org.webjars', name: 'font-awesome', version: '4.7.0'
|
compile group: 'org.webjars', name: 'font-awesome', version: '4.7.0'
|
||||||
|
compile group: 'org.webjars', name: 'highcharts', version: '7.0.0'
|
||||||
|
|
||||||
testCompile group: 'org.springframework.boot', name: 'spring-boot-starter-test'
|
testCompile group: 'org.springframework.boot', name: 'spring-boot-starter-test'
|
||||||
}
|
}
|
||||||
|
@ -39,9 +39,14 @@ public class StatisticController {
|
|||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
model.addAttribute("commitUrlData", urlCommits);
|
model.addAttribute("commitUrlData", urlCommits);
|
||||||
List<Object[]> timeCommits = commitRepository.getCommitTimeStatistic().stream()
|
List<Object[]> timeCommits = commitRepository.getCommitTimeStatistic().stream()
|
||||||
.map(stat -> new Object[]{stat.getCountCommit(), stat.getDate()})
|
.map(stat -> new Object[]{stat.getDate(), stat.getCountCommit()})
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
model.addAttribute("commitTimeData", timeCommits);
|
model.addAttribute("commitTimeData", timeCommits);
|
||||||
|
String[] date = new String[timeCommits.size()];
|
||||||
|
for (int i = 0; i < timeCommits.size(); i++) {
|
||||||
|
date[i] = timeCommits.get(i)[0].toString();
|
||||||
|
}
|
||||||
|
model.addAttribute("datas", date);
|
||||||
return "statistic";
|
return "statistic";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ public interface CommitRepository extends JpaRepository<Commit, Integer> {
|
|||||||
@Query("SELECT new ru.ulstu.extractor.model.CommitUrlStatistic(c.branch.repository.url, COUNT(c)) FROM Commit c GROUP by c.branch.repository.url")
|
@Query("SELECT new ru.ulstu.extractor.model.CommitUrlStatistic(c.branch.repository.url, COUNT(c)) FROM Commit c GROUP by c.branch.repository.url")
|
||||||
List<CommitUrlStatistic> getCommitUrlStatistic();
|
List<CommitUrlStatistic> getCommitUrlStatistic();
|
||||||
|
|
||||||
@Query("SELECT new ru.ulstu.extractor.model.CommitTimeStatistic(cast(c.date as date), COUNT(c)) FROM Commit c GROUP by cast(c.date as date)")
|
@Query("SELECT new ru.ulstu.extractor.model.CommitTimeStatistic(cast(c.date as date), COUNT(c)) FROM Commit c GROUP by cast(c.date as date) ORDER by cast(c.date as date)")
|
||||||
List<CommitTimeStatistic> getCommitTimeStatistic();
|
List<CommitTimeStatistic> getCommitTimeStatistic();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -58,9 +58,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js">
|
<script src="/webjars/highcharts/7.0.0/highcharts.js"></script>
|
||||||
</script>
|
|
||||||
<script src="https://code.highcharts.com/highcharts.js"></script>
|
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
var chart = {
|
var chart = {
|
||||||
@ -71,9 +69,10 @@
|
|||||||
text: 'Height Versus Weight of Individuals'
|
text: 'Height Versus Weight of Individuals'
|
||||||
};
|
};
|
||||||
var xAxis = {
|
var xAxis = {
|
||||||
|
categories: [],
|
||||||
title: {
|
title: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
text: 'Height (cm)'
|
text: 'Дата'
|
||||||
},
|
},
|
||||||
startOnTick: true,
|
startOnTick: true,
|
||||||
endOnTick: true,
|
endOnTick: true,
|
||||||
@ -81,7 +80,7 @@
|
|||||||
};
|
};
|
||||||
var yAxis = {
|
var yAxis = {
|
||||||
title: {
|
title: {
|
||||||
text: 'Weight (kg)'
|
text: 'Кол-во коммитов'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var plotOptions = {
|
var plotOptions = {
|
||||||
@ -104,7 +103,7 @@
|
|||||||
},
|
},
|
||||||
tooltip: {
|
tooltip: {
|
||||||
headerFormat: '<b>{series.name}</b><br>',
|
headerFormat: '<b>{series.name}</b><br>',
|
||||||
pointFormat: '{point.x} cm, {point.y} kg'
|
pointFormat: '{point.x}, {point.y} commits'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -112,8 +111,7 @@
|
|||||||
{
|
{
|
||||||
name: 'Male',
|
name: 'Male',
|
||||||
color: 'rgba(119,152,191,0.5)',
|
color: 'rgba(119,152,191,0.5)',
|
||||||
data: [[174.0, 65.6], [175.3, 71.8], [193.5, 80.7], [186.5, 72.6]
|
data: [[${commitTimeData}]]
|
||||||
]
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user