#23-Create statistic method
This commit is contained in:
parent
0b41ef37ae
commit
f3df5f5ad1
@ -38,13 +38,6 @@ public class StatisticController {
|
||||
url[i] = urlCommits().get(i)[0].toString().substring(urlCommits().get(i)[0].toString().lastIndexOf("/") + 1);
|
||||
}
|
||||
model.addAttribute("urls", url);
|
||||
for (int i = 0; i < entityCommits().size(); i++) {
|
||||
entityCommits().get(i)[0] = Boolean.TRUE.equals(entityCommits().get(i)[0])
|
||||
? "Есть сущности"
|
||||
: (entityCommits().get(i)[0] == null
|
||||
? "Нет данных"
|
||||
: "Нет сущностей");
|
||||
}
|
||||
model.addAttribute("commitEntityData", entityCommits());
|
||||
model.addAttribute("commitTimeEntityData", allTimeEntityCommits());
|
||||
return STATISTIC;
|
||||
@ -75,6 +68,13 @@ public class StatisticController {
|
||||
List<Object[]> entityCommits = commitRepository.getCommitEntityStatistic().stream()
|
||||
.map(stat -> new Object[]{stat.getEntity(), stat.getCountCommit()})
|
||||
.collect(Collectors.toList());
|
||||
for (int i = 0; i < entityCommits.size(); i++) {
|
||||
entityCommits.get(i)[0] = Boolean.TRUE.equals(entityCommits.get(i)[0])
|
||||
? "Есть сущности"
|
||||
: (entityCommits.get(i)[0] == null
|
||||
? "Нет данных"
|
||||
: "Нет сущностей");
|
||||
}
|
||||
return entityCommits;
|
||||
}
|
||||
|
||||
|
@ -79,44 +79,44 @@
|
||||
$('#container').highcharts(json);
|
||||
});
|
||||
</script>
|
||||
<script th:inline="javascript">
|
||||
$(document).ready(function () {
|
||||
var chart = {
|
||||
plotBackgroundColor: null,
|
||||
plotBorderWidth: null,
|
||||
plotShadow: false
|
||||
};
|
||||
var title = {
|
||||
text: '% коммитов авторов'
|
||||
};
|
||||
var tooltip = {
|
||||
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
|
||||
};
|
||||
var plotOptions = {
|
||||
pie: {
|
||||
allowPointSelect: true,
|
||||
cursor: 'pointer',
|
||||
dataLabels: {
|
||||
enabled: false
|
||||
},
|
||||
showInLegend: true
|
||||
}
|
||||
};
|
||||
var series = [{
|
||||
type: 'pie',
|
||||
name: 'Browser share',
|
||||
data: [[${commitAuthorData}]]
|
||||
}];
|
||||
<!-- <script th:inline="javascript">-->
|
||||
<!-- $(document).ready(function () {-->
|
||||
<!-- var chart = {-->
|
||||
<!-- plotBackgroundColor: null,-->
|
||||
<!-- plotBorderWidth: null,-->
|
||||
<!-- plotShadow: false-->
|
||||
<!-- };-->
|
||||
<!-- var title = {-->
|
||||
<!-- text: '% коммитов авторов'-->
|
||||
<!-- };-->
|
||||
<!-- var tooltip = {-->
|
||||
<!-- pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'-->
|
||||
<!-- };-->
|
||||
<!-- var plotOptions = {-->
|
||||
<!-- pie: {-->
|
||||
<!-- allowPointSelect: true,-->
|
||||
<!-- cursor: 'pointer',-->
|
||||
<!-- dataLabels: {-->
|
||||
<!-- enabled: false-->
|
||||
<!-- },-->
|
||||
<!-- showInLegend: true-->
|
||||
<!-- }-->
|
||||
<!-- };-->
|
||||
<!-- var series = [{-->
|
||||
<!-- type: 'pie',-->
|
||||
<!-- name: 'Browser share',-->
|
||||
<!-- data: [[${commitAuthorData}]]-->
|
||||
<!-- }];-->
|
||||
|
||||
var json = {};
|
||||
json.chart = chart;
|
||||
json.title = title;
|
||||
json.tooltip = tooltip;
|
||||
json.series = series;
|
||||
json.plotOptions = plotOptions;
|
||||
$('#containerPie').highcharts(json);
|
||||
});
|
||||
</script>
|
||||
<!-- var json = {};-->
|
||||
<!-- json.chart = chart;-->
|
||||
<!-- json.title = title;-->
|
||||
<!-- json.tooltip = tooltip;-->
|
||||
<!-- json.series = series;-->
|
||||
<!-- json.plotOptions = plotOptions;-->
|
||||
<!-- $('#containerPie').highcharts(json);-->
|
||||
<!-- });-->
|
||||
<!-- </script>-->
|
||||
<script th:inline="javascript">
|
||||
$(document).ready(function () {
|
||||
var chart = {
|
||||
@ -212,11 +212,55 @@
|
||||
$('#containerEntityPie').highcharts(json);
|
||||
});
|
||||
</script>
|
||||
<script th:inline="javascript">
|
||||
document.getElementById('pie')
|
||||
|
||||
function createPie(idElement, data, title) {
|
||||
var chart = {
|
||||
plotBackgroundColor: null,
|
||||
plotBorderWidth: null,
|
||||
plotShadow: false
|
||||
};
|
||||
var title = {
|
||||
text: title
|
||||
};
|
||||
var tooltip = {
|
||||
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
|
||||
};
|
||||
var plotOptions = {
|
||||
pie: {
|
||||
allowPointSelect: true,
|
||||
cursor: 'pointer',
|
||||
dataLabels: {
|
||||
enabled: false
|
||||
},
|
||||
showInLegend: true
|
||||
}
|
||||
};
|
||||
var series = [{
|
||||
type: 'pie',
|
||||
name: 'Browser share',
|
||||
data: data
|
||||
}];
|
||||
|
||||
var json = {};
|
||||
json.chart = chart;
|
||||
json.title = title;
|
||||
json.tooltip = tooltip;
|
||||
json.series = series;
|
||||
json.plotOptions = plotOptions;
|
||||
$('#containerPie').highcharts(json);
|
||||
};
|
||||
// createPie([[${commitEntityData}]], '#containerEntityPie_');
|
||||
// createPie([[${commitAuthorData}]],'#containerPie_');
|
||||
$(document).ready(createPie('pieSuper', [[${commitAuthorData}]], 'title'));
|
||||
</script>
|
||||
<div class="row">
|
||||
<div id="container" style="width: 550px; height: 400px; margin: 0 auto"></div>
|
||||
<div id="containerPie" style="width: 550px; height: 400px; margin: 0 auto"></div>
|
||||
<div id="containerColumn" style="width: 550px; height: 400px; margin: 0 auto"></div>
|
||||
<div id="containerEntityPie" style="width: 550px; height: 400px; margin: 0 auto"></div>
|
||||
<div id="pieSuper" style="width: 550px; height: 400px; margin: 0 auto"></div>
|
||||
</div>
|
||||
</div>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user