Browse Source

Improved age chart. Refactored code.

master
Christian P. MOMON 2 years ago
parent
commit
5dffbcb888
  1. 44
      src/org/april/agirstatool/core/Issue.java
  2. 27
      src/org/april/agirstatool/core/Issues.java
  3. 8
      src/org/april/agirstatool/core/pages/chartLineView.xhtml
  4. 2
      src/org/april/agirstatool/core/pages/chartLineView2.xhtml
  5. 4
      src/org/april/agirstatool/core/pages/issueAgeChartView.xhtml
  6. 12
      src/org/april/agirstatool/core/pages/project.xhtml

44
src/org/april/agirstatool/core/Issue.java

@ -179,6 +179,50 @@ public class Issue
return result;
}
/**
* Checks if is active between.
*
* @param start
* the start
* @param end
* the end
* @return true, if is active between
*/
public boolean isActiveBetween(final LocalDate start, final LocalDate end)
{
boolean result;
if ((start == null) || (end == null))
{
result = false;
}
else
{
LocalDate createdDate = this.createdOn.toLocalDate();
LocalDate closedDate;
if (this.closedOn == null)
{
closedDate = null;
}
else
{
closedDate = this.closedOn.toLocalDate();
}
if ((!createdDate.isAfter(start)) && ((closedDate == null) || (end.isBefore(closedDate))))
{
result = true;
}
else
{
result = false;
}
}
//
return result;
}
public void setClosedOn(final LocalDateTime closedOn)
{
this.closedOn = closedOn;

27
src/org/april/agirstatool/core/Issues.java

@ -115,4 +115,31 @@ public class Issues extends ArrayList<Issue>
//
return result;
}
/**
* Extract actived between.
*
* @param start
* the start
* @param end
* the end
* @return the issues
*/
public Issues extractActivedBetween(final LocalDate start, final LocalDate end)
{
Issues result;
result = new Issues();
for (Issue issue : this)
{
if (issue.isActiveBetween(start, end))
{
result.add(issue);
}
}
//
return result;
}
}

8
src/org/april/agirstatool/core/pages/chartLineView.xhtml

@ -35,7 +35,7 @@ var myChart = new Chart(ctx,
pointBorderWidth: 0.00000001
},
{
label: 'Concluded',
label: 'Closedᴿ',
data: [1, 5, 9, 13, 15, 22] ,
backgroundColor: 'rgba(75, 192, 192, 0.2)',
borderColor: 'rgba(75, 192, 192, 1)',
@ -60,11 +60,15 @@ var myChart = new Chart(ctx,
ticks:
{
beginAtZero: false
},
gridLines:
{
offsetGridLines: false
}
}],
yAxes:
[{
ticks:
ticks:
{
beginAtZero: false,
suggestedMax: 10,

2
src/org/april/agirstatool/core/pages/chartLineView2.xhtml

@ -24,7 +24,7 @@ var myChart = new Chart(ctx,
datasets:
[
{
label: 'Active',
label: 'Active Issues',
data: [2, 9, 13, 15, 22, 23],
backgroundColor: 'rgba(255, 159, 64, 0.2)',
borderColor: 'rgba(255, 159, 64, 1)',

4
src/org/april/agirstatool/core/pages/issueAgeChartView.xhtml

@ -11,7 +11,7 @@
<script src="Chart.bundle.min.js"></script>
</head>
<body>
<div style="width: 100%; height: 100%; text-align: center; margin: 0 0; border: 1px solid red;">
<div style="width: 100%; height: 100%; text-align: center; margin: 0 0; border: 1px solid red;" title="Issues Age">
<canvas id="myChart" width="100%" height="100%"></canvas>
<script>
var ctx = document.getElementById('myChart');
@ -63,7 +63,7 @@ var myChart = new Chart(ctx,
maintainAspectRatio: false,
title: {
display: false,
text: 'Min and Max Settings'
text: 'Issue Age'
},
scales:
{

12
src/org/april/agirstatool/core/pages/project.xhtml

@ -41,9 +41,9 @@
<div id="created-ClosedPreviousYearChart" style="display: inline-block; width: 33%; height: 400px;">CREATED-CLOSED PREVIOUS YEAR CHART</div>
<div id="agePreviousYearChart" style="display: inline-block; width: 33%; height: 400px;">AGE PREVIOUS YEAR CHART</div>
</div>
<div id="fullBox">
<div id="fullBox" style="">
<div id="createdClosedFullChart" style="height: 400px;" onclick="javascript: selectMainChart('C-C');">CREATED/CLOSED FULL CHART</div>
<div id="created-ClosedFullChart" style="height: 400px; display: none;" onclick="javascript: selectMainChart('AGE');">CREATED-CLOSED FULL CHART</div>
<div id="created-ClosedFullChart" style="display: none; height: 400px;" onclick="javascript: selectMainChart('AGE');">CREATED-CLOSED FULL CHART</div>
<div id="ageFullChart" style="display: none; height: 400px;" onclick="javascript: selectMainChart('CC');">ISSUE AGE CHART</div>
</div>
</div>
@ -59,8 +59,8 @@
<div>
<div id="issueRawChart" style="width: 400px; height: 200px; display: inline-block;">ISSUES BAR CHART</div>
<div id="unassignedRawChart" style="width: 360px; height: 200px; display: inline-block;"></div>
<div id="createdClosed6MonthsChartA" style="width: 340px; height: 200px; display: inline-block;">CREATED/CLOSED 6 MONTHS CHART A</div>
<div id="created-Closed6MonthsChartA" style="width: 340px; height: 200px; display: inline-block;">CREATED-CLOSED 6 MONTHS CHART A</div>
<div id="createdClosed6MonthsChartA" style="width: 220px; height: 200px; display: inline-block;">CREATED/CLOSED 6 MONTHS CHART A</div>
<div id="created-Closed6MonthsChartA" style="width: 220px; height: 200px; display: inline-block;">CREATED-CLOSED 6 MONTHS CHART A</div>
</div>
<br/>
<div>
@ -71,8 +71,8 @@
<div>
<div id="issueGroupedChart" style="width: 400px; height: 200px; display: inline-block;">ISSUES BAR CHART</div>
<div id="unassignedGroupedChart" style="width: 360px; height: 200px; display: inline-block;"></div>
<div id="createdClosed6MonthsChartB" style="width: 340px; height: 200px; display: inline-block;">CREATED/CLOSED 6 MONTHS CHARTB</div>
<div id="created-Closed6MonthsChartB" style="width: 340px; height: 200px; display: inline-block;">CREATED-CLOSED 6 MONTHS CHART B</div>
<div id="createdClosed6MonthsChartB" style="width: 220px; height: 200px; display: inline-block;">CREATED/CLOSED 6 MONTHS CHARTB</div>
<div id="created-Closed6MonthsChartB" style="width: 220px; height: 200px; display: inline-block;">CREATED-CLOSED 6 MONTHS CHART B</div>
</div>
<br/>
<div>

Loading…
Cancel
Save