#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-select', version: '1.13.8'
|
||||
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'
|
||||
}
|
||||
|
@ -39,9 +39,14 @@ public class StatisticController {
|
||||
.collect(Collectors.toList());
|
||||
model.addAttribute("commitUrlData", urlCommits);
|
||||
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());
|
||||
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";
|
||||
}
|
||||
}
|
||||
|
@ -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")
|
||||
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();
|
||||
|
||||
}
|
||||
|
@ -18,16 +18,16 @@
|
||||
google.setOnLoadCallback(drawChart);
|
||||
|
||||
function drawChart() {
|
||||
var onlyCommitData = [[${commitAuthorData}]];
|
||||
var commitAuthorData = [
|
||||
['Автор','% коммитов']
|
||||
].concat(onlyCommitData);
|
||||
var onlyCommitData = [[${commitAuthorData}]];
|
||||
var commitAuthorData = [
|
||||
['Автор', '% коммитов']
|
||||
].concat(onlyCommitData);
|
||||
var data = google.visualization.arrayToDataTable(commitAuthorData);
|
||||
var options = {
|
||||
title: '% коммитов авторов',
|
||||
is3D: true,
|
||||
width:600,
|
||||
height:300,
|
||||
width: 600,
|
||||
height: 300,
|
||||
pieResidueSliceLabel: 'Остальные'
|
||||
};
|
||||
var chart = new google.visualization.PieChart(document.getElementById('air'));
|
||||
@ -58,9 +58,7 @@
|
||||
}
|
||||
|
||||
</script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js">
|
||||
</script>
|
||||
<script src="https://code.highcharts.com/highcharts.js"></script>
|
||||
<script src="/webjars/highcharts/7.0.0/highcharts.js"></script>
|
||||
<script th:inline="javascript">
|
||||
$(document).ready(function () {
|
||||
var chart = {
|
||||
@ -71,9 +69,10 @@
|
||||
text: 'Height Versus Weight of Individuals'
|
||||
};
|
||||
var xAxis = {
|
||||
categories: [],
|
||||
title: {
|
||||
enabled: true,
|
||||
text: 'Height (cm)'
|
||||
text: 'Дата'
|
||||
},
|
||||
startOnTick: true,
|
||||
endOnTick: true,
|
||||
@ -81,7 +80,7 @@
|
||||
};
|
||||
var yAxis = {
|
||||
title: {
|
||||
text: 'Weight (kg)'
|
||||
text: 'Кол-во коммитов'
|
||||
}
|
||||
};
|
||||
var plotOptions = {
|
||||
@ -104,7 +103,7 @@
|
||||
},
|
||||
tooltip: {
|
||||
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',
|
||||
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