Browse Source

Improved issue bar chart.

master
Christian P. MOMON 2 years ago
parent
commit
489e845484
  1. 2
      src/org/april/agirstatool/core/pages/ChartBarView.java
  2. 30
      src/org/april/agirstatool/core/pages/IssueStatChartView.java
  3. 8
      src/org/april/agirstatool/core/pages/ProjectPage.java

2
src/org/april/agirstatool/core/pages/ChartBarView.java

@ -57,7 +57,7 @@ public class ChartBarView
String source = XidynUtils.load(AgirStatool.class.getResource("/org/april/agirstatool/core/pages/chartBarView.xhtml"));
String code = XidynUtils.extractBodyContent(source);
code = code.replaceAll("myChart", "myChart_" + DigestUtils.md5Hex(title));
code = code.replaceAll("myChart", "myChart_" + DigestUtils.md5Hex(title + "chartBar"));
code = code.replace("# of Votes", labelTitle);
code = code.replaceAll("labels: \\[.*\\]", "labels: " + AgirStatoolUtils.toJSonStrings(labels));
code = code.replaceAll("data: \\[.*\\]", "data: " + AgirStatoolUtils.toJSonNumbers(values));

30
src/org/april/agirstatool/core/pages/IssueStatChartView.java

@ -19,7 +19,7 @@
package org.april.agirstatool.core.pages;
import org.april.agirstatool.core.AgirStatoolException;
import org.april.agirstatool.core.IssueStats;
import org.april.agirstatool.core.Project;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -41,7 +41,7 @@ public class IssueStatChartView
* @throws AgirStatoolException
* the agir statool exception
*/
public static String build(final String title, final IssueStats stats) throws AgirStatoolException
public static String build(final String title, final Project project) throws AgirStatoolException
{
String result;
@ -49,14 +49,15 @@ public class IssueStatChartView
StringList labels = new StringList("Maybe", "New", "Confirmed", "Ongoing", "Waiting", "Resolved");
StringList values = new StringList();
values.append(stats.getMaybeCount());
values.append(stats.getNewCount());
values.append(stats.getConfirmedCount());
values.append(stats.getOngoingCount());
values.append(stats.getWaitingCount());
values.append(stats.getResolvedCount());
values.append(project.issueStats().getMaybeCount());
values.append(project.issueStats().getNewCount());
values.append(project.issueStats().getConfirmedCount());
values.append(project.issueStats().getOngoingCount());
values.append(project.issueStats().getWaitingCount());
values.append(project.issueStats().getResolvedCount());
result = ChartBarView.build(title, title, labels, values);
String targetTitle = title + " – " + project.getName();
result = ChartBarView.build(targetTitle, targetTitle, labels, values);
//
return result;
@ -71,7 +72,7 @@ public class IssueStatChartView
* @throws AgirStatoolException
* the agir statool exception
*/
public static String buildGrouped(final String title, final IssueStats stats) throws AgirStatoolException
public static String buildGrouped(final String title, final Project project) throws AgirStatoolException
{
String result;
@ -79,11 +80,12 @@ public class IssueStatChartView
StringList labels = new StringList("Maybe", "Active", "Resolved");
StringList values = new StringList();
values.append(stats.getMaybeCount());
values.append(stats.getActiveCount());
values.append(stats.getResolvedCount());
values.append(project.issueStats().getMaybeCount());
values.append(project.issueStats().getActiveCount());
values.append(project.issueStats().getResolvedCount());
result = ChartBarView.build(title, title, labels, values);
String targetTitle = title + " – " + project.getName();
result = ChartBarView.build(targetTitle, targetTitle, labels, values);
//
return result;

8
src/org/april/agirstatool/core/pages/ProjectPage.java

@ -57,13 +57,13 @@ public class ProjectPage
data.setContent("projectName", project.getName());
data.setContent("issueRawChart", IssueStatChartView.build("Issue Raw Count", project.issueStats()));
data.setContent("issueGroupedChart", IssueStatChartView.buildGrouped("Issue Grouped Count", project.issueStats()));
data.setContent("issueRawChart", IssueStatChartView.build("Issue Raw Count", project));
data.setContent("issueGroupedChart", IssueStatChartView.buildGrouped("Issue Grouped Count", project));
if (project.hasChild())
{
data.setContent("issueRawChartAlone", IssueStatChartView.build("Issue Raw Count (#)", project.subProjects().get(0).issueStats()));
data.setContent("issueGroupedChartAlone", IssueStatChartView.buildGrouped("Issue Grouped Count (#)", project.subProjects().get(0).issueStats()));
data.setContent("issueRawChartAlone", IssueStatChartView.build("Issue Raw Count", project.subProjects().get(0)));
data.setContent("issueGroupedChartAlone", IssueStatChartView.buildGrouped("Issue Grouped Count", project.subProjects().get(0)));
}
String projectsRawView = ProjectsRawView.build(project);

Loading…
Cancel
Save