92 lines
2.7 KiB
Java
92 lines
2.7 KiB
Java
/*
|
|
* Copyright (C) 2020 Christian Pierre MOMON <christian.momon@devinsy.fr>
|
|
*
|
|
* This file is part of AgirStatool, simple key value database.
|
|
*
|
|
* AgirStatool is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Affero General Public License as
|
|
* published by the Free Software Foundation, either version 3 of the
|
|
* License, or (at your option) any later version.
|
|
*
|
|
* AgirStatool is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU Affero General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
* along with AgirStatool. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
package org.april.agirstatool.core.pages;
|
|
|
|
import org.april.agirstatool.core.AgirStatoolException;
|
|
import org.april.agirstatool.core.IssueStats;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import fr.devinsy.strings.StringList;
|
|
|
|
/**
|
|
* The Class projectsRawPageBuilder.
|
|
*/
|
|
public class IssueStatChartView
|
|
{
|
|
private static Logger logger = LoggerFactory.getLogger(IssueStatChartView.class);
|
|
|
|
/**
|
|
* Builds the.
|
|
*
|
|
* @param projects
|
|
* the projects
|
|
* @return the string
|
|
* @throws AgirStatoolException
|
|
* the agir statool exception
|
|
*/
|
|
public static String build(final String title, final IssueStats stats) throws AgirStatoolException
|
|
{
|
|
String result;
|
|
|
|
logger.info("Building issue stat chart view…");
|
|
|
|
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());
|
|
|
|
result = ChartBarView.build(title, title, labels, values);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Builds the grouped.
|
|
*
|
|
* @param stats
|
|
* the stats
|
|
* @return the string
|
|
* @throws AgirStatoolException
|
|
* the agir statool exception
|
|
*/
|
|
public static String buildGrouped(final String title, final IssueStats stats) throws AgirStatoolException
|
|
{
|
|
String result;
|
|
|
|
logger.info("Building issue stat chart view…");
|
|
|
|
StringList labels = new StringList("Maybe", "Active", "Resolved");
|
|
StringList values = new StringList();
|
|
values.append(stats.getMaybeCount());
|
|
values.append(stats.getActiveCount());
|
|
values.append(stats.getResolvedCount());
|
|
|
|
result = ChartBarView.build(title, title, labels, values);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
}
|