Step in chart way.

This commit is contained in:
Christian P. MOMON 2020-10-07 04:33:30 +02:00
parent 5e7f9c055e
commit 891bdc78f5
21 changed files with 2136 additions and 2 deletions

View file

@ -0,0 +1,134 @@
/*
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
* StatoolInfos 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.
*
* StatoolInfos 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 StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.devinsy.statoolinfos.core;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
/**
* The Class Metric.
*/
public class Metric
{
private static Logger logger = LoggerFactory.getLogger(Metric.class);
public enum Type
{
MONTHS,
WEEKS,
DAYS
}
private String name;
private String description;
private String startYear;
private StringList yearValues;
private StringList monthValues;
private StringList weekValues;
private StringList dayValues;
/**
* Instantiates a new metric.
*/
public Metric(final String name, final String description, final String startYear)
{
this.name = name;
this.description = description;
this.startYear = startYear;
this.yearValues = new StringList();
this.monthValues = new StringList();
this.weekValues = new StringList();
this.dayValues = new StringList();
}
public StringList getDayValues()
{
return this.dayValues;
}
public String getDescription()
{
return this.description;
}
public StringList getMonthValues()
{
return this.monthValues;
}
public String getName()
{
return this.name;
}
public String getStartYear()
{
return this.startYear;
}
public StringList getWeekValues()
{
return this.weekValues;
}
public StringList getYearValues()
{
return this.yearValues;
}
/**
* Checks if is empty.
*
* @return true, if is empty
*/
public boolean isEmpty()
{
boolean result;
if ((this.monthValues.isEmpty()) && (this.weekValues.isEmpty()) && (this.dayValues.isEmpty()))
{
result = true;
}
else
{
result = false;
}
//
return result;
}
public void setDescription(final String description)
{
this.description = description;
}
public void setName(final String name)
{
this.name = name;
}
public void setStartYear(final String startYear)
{
this.startYear = startYear;
}
}

View file

@ -22,11 +22,16 @@ import java.io.File;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang3.RegExUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import fr.devinsy.statoolinfos.properties.PathProperties; import fr.devinsy.statoolinfos.properties.PathProperties;
import fr.devinsy.statoolinfos.properties.PathProperty;
import fr.devinsy.statoolinfos.properties.PathPropertyList; import fr.devinsy.statoolinfos.properties.PathPropertyList;
import fr.devinsy.strings.StringList;
/** /**
* The Class Service. * The Class Service.
@ -204,6 +209,77 @@ public class Service extends PathPropertyList
return result; return result;
} }
/**
* Gets the metric.
*
* @param path
* the path
* @param year
* the year
* @return the metric
*/
public Metric getMetric(final String path)
{
Metric result;
String metricName = StringUtils.defaultIfBlank(get(path + ".name"), RegExUtils.removeFirst(path, "^metrics\\."));
String metricDescription = StringUtils.defaultIfBlank(get(path + ".description"), metricName);
StringList years = getMetricYears(path).sort();
if (years.isEmpty())
{
result = null;
}
else
{
result = new Metric(metricName, metricDescription, years.get(0));
for (String year : years)
{
result.getYearValues().add(get(path + "." + year));
result.getMonthValues().addAll(StatoolInfosUtils.splitMonthValues(get(path + "." + year + ".months")));
result.getWeekValues().addAll(StatoolInfosUtils.splitWeekValues(get(path + "." + year + ".weeks")));
result.getDayValues().addAll(StatoolInfosUtils.splitDayValues(get(path + "." + year + ".weeks")));
}
}
//
return result;
}
/**
* Gets the metric years.
*
* @param path
* the path
* @return the metric years
*/
public StringList getMetricYears(final String path)
{
StringList result;
result = new StringList();
Pattern pattern = Pattern.compile("^" + path + "\\.(?<year>\\d{4}).*=.*$");
for (PathProperty property : getByPrefix(path))
{
String subPath = property.getPath();
Matcher matcher = pattern.matcher(subPath);
if (matcher.matches())
{
if (matcher.start("year") != -1)
{
result.add(matcher.group("year"));
}
}
}
//
return result;
}
/** /**
* Gets the name. * Gets the name.
* *

View file

@ -146,6 +146,117 @@ public class StatoolInfosUtils
return new Date().getTime(); return new Date().getTime();
} }
/**
* Split day values.
*
* @param values
* the values
* @return the string list
*/
public static StringList splitDayValues(final String values)
{
StringList result;
result = new StringList();
if (StringUtils.isNotBlank(values))
{
for (String value : values.split("[,]"))
{
if (StringUtils.isBlank(value))
{
result.add("");
}
else
{
result.add(value);
}
}
for (int index = result.size(); index < 365; index++)
{
result.add("");
}
}
//
return result;
}
/**
* Split month values.
*
* @param values
* the values
* @return the string list
*/
public static StringList splitMonthValues(final String values)
{
StringList result;
result = new StringList();
if (StringUtils.isNotBlank(values))
{
for (String value : values.split("[,]"))
{
if (StringUtils.isBlank(value))
{
result.add("");
}
else
{
result.add(value);
}
}
for (int index = result.size(); index < 12; index++)
{
result.add("");
}
}
//
return result;
}
/**
* Split week values.
*
* @param values
* the values
* @return the string list
*/
public static StringList splitWeekValues(final String values)
{
StringList result;
result = new StringList();
if (StringUtils.isNotBlank(values))
{
for (String value : values.split("[,]"))
{
if (StringUtils.isBlank(value))
{
result.add("");
}
else
{
result.add(value);
}
}
for (int index = result.size(); index < 52; index++)
{
result.add("");
}
}
//
return result;
}
/** /**
* To human long. * To human long.
* *

View file

@ -141,6 +141,9 @@ public class Htmlizer
StatoolInfosUtils.copyRessource(source + "circle-icons/color/bookshelf.png", color); StatoolInfosUtils.copyRessource(source + "circle-icons/color/bookshelf.png", color);
StatoolInfosUtils.copyRessource(source + "circle-icons/mono/bookshelf.png", mono); StatoolInfosUtils.copyRessource(source + "circle-icons/mono/bookshelf.png", mono);
StatoolInfosUtils.copyRessource(source + "circle-icons/color/clipboard.png", color);
StatoolInfosUtils.copyRessource(source + "circle-icons/mono/clipboard.png", mono);
StatoolInfosUtils.copyRessource(source + "circle-icons/color/contacts.png", color); StatoolInfosUtils.copyRessource(source + "circle-icons/color/contacts.png", color);
StatoolInfosUtils.copyRessource(source + "circle-icons/mono/contacts.png", mono); StatoolInfosUtils.copyRessource(source + "circle-icons/mono/contacts.png", mono);

View file

@ -22,9 +22,12 @@ import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fr.devinsy.statoolinfos.core.Metric;
import fr.devinsy.statoolinfos.core.Organization; import fr.devinsy.statoolinfos.core.Organization;
import fr.devinsy.statoolinfos.core.Service; import fr.devinsy.statoolinfos.core.Service;
import fr.devinsy.statoolinfos.core.StatoolInfosException; import fr.devinsy.statoolinfos.core.StatoolInfosException;
import fr.devinsy.statoolinfos.htmlize.charts.BarMonthsChartView;
import fr.devinsy.statoolinfos.htmlize.charts.ChartColors;
import fr.devinsy.xidyn.XidynException; import fr.devinsy.xidyn.XidynException;
import fr.devinsy.xidyn.data.DisplayMode; import fr.devinsy.xidyn.data.DisplayMode;
import fr.devinsy.xidyn.data.TagDataManager; import fr.devinsy.xidyn.data.TagDataManager;
@ -149,6 +152,25 @@ public class ServicePage
data.getIdData("softwareSourceLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE); data.getIdData("softwareSourceLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
} }
//
int graphicIndex = 0;
// data.setContent("fooChart", graphicIndex++,
// LineMonthsChartView.build());
service.getPrefixes();
Metric metric = service.getMetric("metrics.http.hits");
if ((metric != null) && (!metric.isEmpty()))
{
data.setContent("fooChart", graphicIndex++, BarMonthsChartView.build(metric));
}
metric = service.getMetric("metrics.http.errors");
if ((metric != null) && (!metric.isEmpty()))
{
data.setContent("fooChart", graphicIndex++, BarMonthsChartView.build(metric, ChartColors.RED));
}
// //
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/service.xhtml", data).toString(); String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/service.xhtml", data).toString();

View file

@ -0,0 +1,124 @@
/*
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
* StatoolInfos 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.
*
* StatoolInfos 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 StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.devinsy.statoolinfos.htmlize.charts;
import java.io.IOException;
import java.time.LocalDate;
import org.apache.commons.codec.digest.DigestUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.statoolinfos.core.Metric;
import fr.devinsy.statoolinfos.core.StatoolInfosException;
import fr.devinsy.strings.StringList;
import fr.devinsy.xidyn.utils.XidynUtils;
/**
* The Class projectsRawPageBuilder.
*/
public class BarMonthsChartView
{
private static Logger logger = LoggerFactory.getLogger(BarMonthsChartView.class);
/**
* Builds the.
*
* @param metric
* the metric
* @return the string
* @throws StatoolInfosException
* the statool infos exception
*/
public static String build(final Metric metric) throws StatoolInfosException
{
String result;
result = build(metric, ChartColors.BLUE);
//
return result;
}
/**
* Builds the.
*
* @param metric
* the metric
* @return the string
* @throws StatoolInfosException
*/
public static String build(final Metric metric, final ChartColors color) throws StatoolInfosException
{
String result;
LocalDate start = LocalDate.parse(metric.getStartYear() + "-01-01");
LocalDate end = start.plusMonths(metric.getMonthValues().size());
StringList labels = ChabuUtils.buildYearMonthAlphaLabels(start, end);
result = build(metric.getName(), metric.getDescription(), labels, metric.getMonthValues(), color);
//
return result;
}
/**
* Builds the.
*
* @param title
* the title
* @param description
* the description
* @param labels
* the labels
* @param values
* the values
* @param color
* the color
* @return the string
* @throws StatoolInfosException
* the statool infos exception
*/
public static String build(final String title, final String description, final StringList labels, final StringList values, final ChartColors color) throws StatoolInfosException
{
String result;
try
{
String source = XidynUtils.load(ChabuUtils.class.getResource("/fr/devinsy/statoolinfos/htmlize/charts/barMonthsChartView.xhtml"));
String code = XidynUtils.extractBodyContent(source);
code = code.replace("rgb(54, 162, 235)", color.code());
code = code.replace("rgb(54, 162, 235, 0.2)", color.light());
code = code.replace("description", XidynUtils.escapeXmlBlank(description));
code = code.replace("myChart", "myChart_" + DigestUtils.sha1Hex(title + "barMonthsChart"));
code = code.replace("# of Votes", title.replaceAll("'", "\\\\'"));
code = code.replaceFirst("labels: \\[.*\\]", "labels: " + ChabuUtils.toJSonStrings(labels));
code = code.replaceFirst("data: \\[.*\\]", "data: " + ChabuUtils.toJSonNumbers(values));
result = code.toString();
}
catch (IOException exception)
{
throw new StatoolInfosException("Error building bar months chart view: " + exception.getMessage(), exception);
}
//
return result;
}
}

View file

@ -0,0 +1,77 @@
/*
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
* StatoolInfos 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.
*
* StatoolInfos 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 StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.devinsy.statoolinfos.htmlize.charts;
import java.io.IOException;
import org.apache.commons.codec.digest.DigestUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.statoolinfos.core.StatoolInfosException;
import fr.devinsy.strings.StringList;
import fr.devinsy.xidyn.utils.XidynUtils;
/**
* The Class projectsRawPageBuilder.
*/
public class BarTimeChartView
{
private static Logger logger = LoggerFactory.getLogger(BarTimeChartView.class);
/**
* Builds the.
*
* @param title
* the title
* @param labelTitle
* the label title
* @param labels
* the labels
* @param values
* the values
* @return the string
* @throws AgirStatoolException
* the agir statool exception
*/
public static String build(final String title, final String labelTitle, final StringList labels, final StringList values) throws StatoolInfosException
{
String result;
try
{
String source = XidynUtils.load(ChabuUtils.class.getResource("/fr/devinsy/statoolinfos/htmlize/charts/barTimeChartView.xhtml"));
String code = XidynUtils.extractBodyContent(source);
code = code.replaceAll("myChart", "myChart_" + DigestUtils.md5Hex(title + "chartBar"));
code = code.replace("# of Votes", labelTitle);
code = code.replaceAll("labels: \\[.*\\]", "labels: " + ChabuUtils.toJSonStrings(labels));
code = code.replaceAll("data: \\[.*\\]", "data: " + ChabuUtils.toJSonNumbers(values));
result = code.toString();
}
catch (IOException exception)
{
throw new StatoolInfosException("Error building ProjectsRaw view: " + exception.getMessage(), exception);
}
//
return result;
}
}

View file

@ -0,0 +1,672 @@
/*
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
* StatoolInfos 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.
*
* StatoolInfos 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 StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.devinsy.statoolinfos.htmlize.charts;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.Iterator;
import java.util.Locale;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/**
* The Class ChabuUtils.
*/
public class ChabuUtils
{
private static Logger logger = LoggerFactory.getLogger(ChabuUtils.class);
public static final DateTimeFormatter PATTERN_SHORTDATE = DateTimeFormatter.ofPattern("dd/MM/yyyy", Locale.FRANCE);
public static final DateTimeFormatter PATTERN_LONGDATE = DateTimeFormatter.ofPattern("dd/MM/yyyy HH':'mm", Locale.FRANCE);
/**
* Builds the month labels.
*
* @param start
* the start
* @param end
* the end
* @return the string list
*/
public static StringList buildMonthLabels(final LocalDate start, final LocalDate end)
{
StringList result;
result = new StringList();
if (start != null)
{
LocalDate normalizedEnd = normaliseMonthDate(end);
LocalDate date = normaliseMonthDate(start);
while (date.isBefore(normalizedEnd) || date.isEqual(normalizedEnd))
{
String label = date.format(DateTimeFormatter.ISO_DATE);
result.add(label);
date = date.plusMonths(1);
}
}
//
return result;
}
/**
* Builds the week labels.
*
* @param start
* the start
* @return the string list
*/
public static StringList buildWeekLabels(final LocalDate start)
{
StringList result;
result = buildWeekLabels(start, LocalDate.now());
//
return result;
}
/**
* Builds the week labels.
*
* @param start
* the start
* @param end
* the end
* @return the string list
*/
public static StringList buildWeekLabels(final LocalDate start, final LocalDate end)
{
StringList result;
result = new StringList();
if (start != null)
{
LocalDate normalizedEnd = normaliseWeekDate(end);
LocalDate date = normaliseWeekDate(start);
while (date.isBefore(normalizedEnd) || date.isEqual(normalizedEnd))
{
String label = date.format(DateTimeFormatter.ISO_DATE);
result.add(label);
date = date.plusWeeks(1);
}
}
//
return result;
}
/**
* Builds the year month alpha labels.
*
* @param start
* the start
* @param end
* the end
* @return the string list
*/
public static StringList buildYearMonthAlphaLabels(final LocalDate start, final LocalDate end)
{
StringList result;
result = new StringList();
if (start != null)
{
LocalDate normalizedEnd = normaliseMonthDate(end);
LocalDate date = normaliseMonthDate(start);
while (date.isBefore(normalizedEnd) || date.isEqual(normalizedEnd))
{
String label = date.format(DateTimeFormatter.ofPattern("YYYY-MMM", Locale.FRANCE));
result.add(label);
date = date.plusMonths(1);
}
}
//
return result;
}
/**
* Builds the year month labels.
*
* @param start
* the start
* @param end
* the end
* @return the string list
*/
public static StringList buildYearMonthLabels(final LocalDate start, final LocalDate end)
{
StringList result;
result = new StringList();
if (start != null)
{
LocalDate normalizedEnd = normaliseMonthDate(end);
LocalDate date = normaliseMonthDate(start);
while (date.isBefore(normalizedEnd) || date.isEqual(normalizedEnd))
{
String label = date.format(DateTimeFormatter.ofPattern("YYYY-MM", Locale.FRANCE));
result.add(label);
date = date.plusMonths(1);
}
}
//
return result;
}
/**
* Normalise month date.
*
* @param source
* the source
* @return the local date
*/
public static LocalDate normaliseMonthDate(final LocalDate source)
{
LocalDate result;
if (source == null)
{
result = source;
}
else
{
result = source.minusDays(source.getDayOfMonth() - 1);
}
//
return result;
}
/**
* Normalise week date.
*
* @param source
* the source
* @return the local date
*/
public static LocalDate normaliseWeekDate(final LocalDate source)
{
LocalDate result;
if (source == null)
{
result = source;
}
else
{
result = source.minusDays(source.getDayOfWeek().getValue() - 1);
}
//
return result;
}
/**
* Normalized month count list.
*
* @param source
* the source
* @param start
* the start
* @param end
* the end
* @return the date count list
*/
public static DateCountList normalizedMonthCountList(final DateCountList source, final LocalDate start, final LocalDate end)
{
DateCountList result;
result = new DateCountList();
LocalDate normalizedEnd = normaliseMonthDate(end);
LocalDate date = normaliseMonthDate(start);
int index = source.indexOf(toYearMonth(start));
if (index == -1)
{
index = 0;
}
while (date.isBefore(normalizedEnd) || date.isEqual(normalizedEnd))
{
String dateToken = toYearMonth(date);
long count;
if (index < source.size())
{
DateCount current = source.get(index);
// ChabuUtils.logger.info("===> " + dateToken + " " +
// current.getDate());
if (StringUtils.equals(current.getDate(), dateToken))
{
count = current.getCount();
index += 1;
}
else
{
count = 0;
}
}
else
{
count = 0;
}
result.add(new DateCount(dateToken, count));
date = date.plusMonths(1);
}
//
return result;
}
/**
* Normalized week count list.
*
* @param source
* the source
* @param start
* the start
* @param end
* the end
* @return the date count list
*/
public static DateCountList normalizedWeekCountList(final DateCountList source, final LocalDate start, final LocalDate end)
{
DateCountList result;
result = new DateCountList();
LocalDate normalizedEnd = normaliseWeekDate(end);
LocalDate date = normaliseWeekDate(start);
int index = source.indexOf(toYearWeek(start));
if (index == -1)
{
index = 0;
}
while (date.isBefore(normalizedEnd) || date.isEqual(normalizedEnd))
{
String dateToken = toYearWeek(date);
long count;
if (index < source.size())
{
DateCount current = source.get(index);
// AgirStatoolUtils.logger.info("===> " + dateToken + " " +
// current.getDate());
if (StringUtils.equals(current.getDate(), dateToken))
{
count = current.getCount();
index += 1;
}
else
{
count = 0;
}
}
else
{
count = 0;
}
result.add(new DateCount(dateToken, count));
date = date.plusWeeks(1);
}
//
return result;
}
/**
* Builds the week created count list.
*
* @param source
* the source
* @param start
* the start
* @return the date count list
*/
public static DateCountList normalizedWeekCountList(final DateCountMap source, final LocalDate start)
{
DateCountList result;
result = new DateCountList();
LocalDate date = normaliseWeekDate(start);
LocalDate end = normaliseWeekDate(LocalDate.now());
long count = 0;
while (date.isBefore(end) || date.isEqual(end))
{
String dateToken = toYearWeek(date);
DateCount current = source.get(dateToken);
if (current != null)
{
count += current.getCount();
}
result.add(new DateCount(dateToken, count));
date = date.plusWeeks(1);
}
//
return result;
}
/**
* Gets the current time in long format.
*
* @return the long
*/
public static long now()
{
return new Date().getTime();
}
/**
* Select stat indicator.
*
* @param value
* the value
* @return the string
*/
public static String selectStatIndicator(final long value)
{
String result;
if (value < 10)
{
result = null;
}
else if (value < 20)
{
result = "caution";
}
else if (value < 50)
{
result = "warning";
}
else
{
result = "alert";
}
//
return result;
}
/**
* Select unassigned indicator.
*
* @param value
* the value
* @return the string
*/
public static String selectUnassignedIndicator(final long value)
{
String result;
if (value == 0)
{
result = null;
}
else
{
result = "alert";
}
//
return result;
}
/**
* To human long.
*
* @param value
* the value
* @return the string
*/
public static String toHumanLong(final LocalDateTime value)
{
String result;
result = toHumanLong(value, null);
//
return result;
}
/**
* To human long.
*
* @param value
* the value
* @param defaultValue
* the default value
* @return the string
*/
public static String toHumanLong(final LocalDateTime value, final String defaultValue)
{
String result;
if (value == null)
{
result = null;
}
else
{
result = value.format(PATTERN_LONGDATE);
}
//
return result;
}
/**
* To human short.
*
* @param value
* the value
* @return the string
*/
public static String toHumanShort(final LocalDateTime value)
{
String result;
result = toHumanShort(value, null);
//
return result;
}
/**
* To human short.
*
* @param value
* the value
* @param defaultValue
* the default value
* @return the string
*/
public static String toHumanShort(final LocalDateTime value, final String defaultValue)
{
String result;
if (value == null)
{
result = null;
}
else
{
result = value.format(PATTERN_SHORTDATE);
}
//
return result;
}
public static Integer toInteger(final String value)
{
Integer result;
if ((value == null) || (!NumberUtils.isDigits(value)))
{
result = null;
}
else
{
result = Integer.parseInt(value);
}
//
return result;
}
/**
* To Json numbers.
*
* @param source
* the source
* @return the string
*/
public static String toJSonNumbers(final StringList source)
{
String result;
result = StringsUtils.toString(source, "[", ",", "]");
//
return result;
}
/**
* To J son numbers.
*
* @param labels
* the labels
* @param values
* the source
* @return the string
*/
public static String toJSonNumbers(final StringList labels, final StringList values)
{
String result;
Iterator<String> labelIterator = labels.iterator();
Iterator<String> valueIterator = values.iterator();
StringList buffer = new StringList();
while (labelIterator.hasNext())
{
String label = labelIterator.next();
String value = valueIterator.next();
buffer.append(String.format("{t: '%s', y: %s}", label, value));
}
result = StringsUtils.toString(buffer, "[", ",", "]");
//
return result;
}
/**
* To Json strings.
*
* @param source
* the source
* @return the string
*/
public static String toJSonStrings(final StringList source)
{
String result;
StringList target = new StringList();
target.append("[");
for (String string : source)
{
target.append("'");
target.append(string);
target.append("'");
target.append(",");
}
target.removeLast();
target.append("]");
result = target.toString();
//
return result;
}
/**
* To year month.
*
* @param source
* the source
* @return the string
*/
public static String toYearMonth(final LocalDate source)
{
String result;
if (source == null)
{
result = null;
}
else
{
result = source.format(DateTimeFormatter.ofPattern("YYYYMM", Locale.FRANCE));
}
//
return result;
}
/**
* To year week.
*
* @param source
* the source
* @return the string
*/
public static String toYearWeek(final LocalDate source)
{
String result;
if (source == null)
{
result = null;
}
else
{
result = source.format(DateTimeFormatter.ofPattern("YYYYww", Locale.FRANCE));
}
//
return result;
}
}

View file

@ -0,0 +1,78 @@
/*
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
* StatoolInfos 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.
*
* StatoolInfos 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 StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.devinsy.statoolinfos.htmlize.charts;
/**
* The Enum ChartColors.
*/
public enum ChartColors
{
RED("rgb(255, 99, 132)"),
ORANGE("rgb(255, 159, 64)"),
YELLOW("rgb(255, 205, 86)"),
GREEN("rgb(75, 192, 192)"),
BLUE("rgb(54, 162, 235)"),
PURPLE("'rgb(153, 102, 255)"),
GREY("rgb(201, 203, 207)");
private String code;
private String light;
/**
* Instantiates a new chart colors.
*
* @param code
* the code
*/
ChartColors(final String code)
{
this.code = code;
this.light = code.replace(")", ", 0.2)");
}
/**
* Code.
*
* @return the string
*/
public String code()
{
String result;
result = this.code;
//
return result;
}
/**
* Gamma.
*
* @return the string
*/
public String light()
{
String result;
result = this.light;
//
return result;
}
}

View file

@ -0,0 +1,72 @@
/*
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
* StatoolInfos 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.
*
* StatoolInfos 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 StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.devinsy.statoolinfos.htmlize.charts;
import org.apache.commons.lang3.StringUtils;
/**
* The Class Projects.
*/
public class DateCount
{
private String date;
private long count;
/**
* Instantiates a new date count.
*
* @param date
* the date
* @param count
* the count
*/
public DateCount(final String date, final long count)
{
setDate(date);
this.count = count;
}
public long getCount()
{
return this.count;
}
public String getDate()
{
return this.date;
}
public void setCount(final long count)
{
this.count = count;
}
public void setDate(final String date)
{
if (StringUtils.isBlank(date))
{
throw new IllegalArgumentException("Null parameter.");
}
else
{
this.date = date;
}
}
}

View file

@ -0,0 +1,112 @@
/*
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
* StatoolInfos 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.
*
* StatoolInfos 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 StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.devinsy.statoolinfos.htmlize.charts;
import java.util.ArrayList;
import org.apache.commons.lang3.StringUtils;
import fr.devinsy.strings.StringList;
/**
* The Class Projects.
*/
public class DateCountList extends ArrayList<DateCount>
{
private static final long serialVersionUID = -5526492552751712533L;
/**
* Instantiates a new date count map.
*/
public DateCountList()
{
super();
}
/**
* Instantiates a new date count list.
*
* @param capacity
* the capacity
*/
public DateCountList(final int capacity)
{
super(capacity);
}
/**
* Indexof.
*
* @param dateToken
* the date token
* @return the int
*/
public int indexOf(final String dateToken)
{
int result;
boolean ended = false;
result = -1;
int index = 0;
while (!ended)
{
if (index < this.size())
{
DateCount current = get(index);
if (StringUtils.equals(current.getDate(), dateToken))
{
ended = true;
result = index;
}
else
{
index += 1;
}
}
else
{
ended = true;
result = -1;
}
}
//
return result;
}
/**
* To value list.
*
* @return the string list
*/
public StringList toValueList()
{
StringList result;
result = new StringList();
for (DateCount item : this)
{
result.append(item.getCount());
}
//
return result;
}
}

View file

@ -0,0 +1,37 @@
/*
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
* StatoolInfos 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.
*
* StatoolInfos 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 StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.devinsy.statoolinfos.htmlize.charts;
import java.util.HashMap;
/**
* The Class Projects.
*/
public class DateCountMap extends HashMap<String, DateCount>
{
private static final long serialVersionUID = -5526492552751712533L;
/**
* Instantiates a new date count map.
*/
public DateCountMap()
{
super();
}
}

View file

@ -0,0 +1,88 @@
/*
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
* StatoolInfos 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.
*
* StatoolInfos 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 StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.devinsy.statoolinfos.htmlize.charts;
import java.io.IOException;
import java.time.LocalDate;
import java.time.LocalDateTime;
import org.apache.commons.codec.digest.DigestUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.statoolinfos.core.StatoolInfosException;
import fr.devinsy.strings.StringList;
import fr.devinsy.xidyn.utils.XidynUtils;
/**
* The Class projectsRawPageBuilder.
*/
public class FooChartView
{
private static Logger logger = LoggerFactory.getLogger(FooChartView.class);
public static String build() throws StatoolInfosException
{
String result;
try
{
String source = XidynUtils.load(FooChartView.class.getResource("/fr/devinsy/statoolinfos/htmlize/charts/foo.xhtml"));
String code = XidynUtils.extractBodyContent(source);
code = code.replaceAll("myChart", "myChart_" + DigestUtils.md5Hex(LocalDateTime.now() + "lineChart"));
// DO MonthsBarChart
LocalDate start = LocalDate.parse("2020-01-01");
LocalDate end = LocalDate.parse("2020-12-31");
DateCountList dates = new DateCountList();
dates.add(new DateCount("202001", 7));
dates.add(new DateCount("202002", 9));
dates.add(new DateCount("202003", 4));
dates.add(new DateCount("202004", 2));
dates.add(new DateCount("202005", 1));
dates.add(new DateCount("202006", 7));
StringList labels = ChabuUtils.buildYearMonthLabels(start, end);
StringList values = ChabuUtils.normalizedMonthCountList(dates, start, end).toValueList();
code = code.replaceAll("data: \\[.*\\]", "data: " + ChabuUtils.toJSonNumbers(labels, values));
/*
StringList labels = ChabuUtils.buildWeekLabels(LocalDate.parse("2020-01-01"), LocalDate.parse("2020-12-31"));
DateCountList dates = project.issueStats().getWeekCreatedIssueCounts();
StringList values = ChabuUtils.normalizedWeekCountList(dates, start, end).toValueList();
code = code.replaceAll("data: \\[.*\\]", "data: " + ChabuUtils.toJSonNumbers(labels, values));
dates = project.issueStats().getWeekConcludedIssueCounts();
values = ChabuUtils.normalizedWeekCountList(dates, start, end).toValueList();
code = code.replaceAll("data: \\[.*\\] ", "data: " + ChabuUtils.toJSonNumbers(labels, values));
*/
result = code.toString();
}
catch (IOException exception)
{
throw new StatoolInfosException("Error building foo charts view: " + exception.getMessage(), exception);
}
//
return result;
}
}

View file

@ -0,0 +1,88 @@
/*
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
* StatoolInfos 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.
*
* StatoolInfos 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 StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.devinsy.statoolinfos.htmlize.charts;
import java.io.IOException;
import java.time.LocalDate;
import java.time.LocalDateTime;
import org.apache.commons.codec.digest.DigestUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.statoolinfos.core.StatoolInfosException;
import fr.devinsy.strings.StringList;
import fr.devinsy.xidyn.utils.XidynUtils;
/**
* The Class projectsRawPageBuilder.
*/
public class LineMonthsChartView
{
private static Logger logger = LoggerFactory.getLogger(LineMonthsChartView.class);
public static String build() throws StatoolInfosException
{
String result;
try
{
String source = XidynUtils.load(LineMonthsChartView.class.getResource("/fr/devinsy/statoolinfos/htmlize/charts/lineMonthsChartView.xhtml"));
String code = XidynUtils.extractBodyContent(source);
code = code.replaceAll("myChart", "myChart_" + DigestUtils.md5Hex(LocalDateTime.now() + "lineChart"));
// DO MonthsBarChart
LocalDate start = LocalDate.parse("2020-01-01");
LocalDate end = LocalDate.parse("2020-12-31");
DateCountList dates = new DateCountList();
dates.add(new DateCount("202001", 7));
dates.add(new DateCount("202002", 9));
dates.add(new DateCount("202003", 4));
dates.add(new DateCount("202004", 2));
dates.add(new DateCount("202005", 1));
dates.add(new DateCount("202006", 7));
StringList labels = ChabuUtils.buildYearMonthLabels(start, end);
StringList values = ChabuUtils.normalizedMonthCountList(dates, start, end).toValueList();
code = code.replaceFirst("data: \\[.*\\]", "data: " + ChabuUtils.toJSonNumbers(labels, values));
/*
StringList labels = ChabuUtils.buildWeekLabels(LocalDate.parse("2020-01-01"), LocalDate.parse("2020-12-31"));
DateCountList dates = project.issueStats().getWeekCreatedIssueCounts();
StringList values = ChabuUtils.normalizedWeekCountList(dates, start, end).toValueList();
code = code.replaceAll("data: \\[.*\\]", "data: " + ChabuUtils.toJSonNumbers(labels, values));
dates = project.issueStats().getWeekConcludedIssueCounts();
values = ChabuUtils.normalizedWeekCountList(dates, start, end).toValueList();
code = code.replaceAll("data: \\[.*\\] ", "data: " + ChabuUtils.toJSonNumbers(labels, values));
*/
result = code.toString();
}
catch (IOException exception)
{
throw new StatoolInfosException("Error building foo charts view: " + exception.getMessage(), exception);
}
//
return result;
}
}

View file

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>StatoolInfos</title>
<meta charset="UTF-8" />
<meta name="keywords" content="statoolinfos,devinsy,federation" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="statoolinfos.css" />
<script src="sorttable.js"></script>
<script src="Chart.bundle.min.js"></script>
<link rel="stylesheet" type="text/css" href="datatables.min.css"/>
<script type="text/javascript" src="datatables.min.js"></script>
</head>
<body>
<div style="width: 100%; height: 100%; text-align: center; margin: 0 0; border: 1px solid red;" title="description">
<canvas id="myChart" width="100%" height="100%"></canvas>
<script>
var ctx = document.getElementById('myChart');
var myChart = new Chart(ctx,
{
type: 'bar',
data:
{
labels: ['New', 'Started', 'Waiting', 'Maybe', 'Resolved', 'Closed'],
datasets:
[{
label: '# of Votes',
data: [12, 19, 3, 5, 2, 3],
backgroundColor: 'rgb(54, 162, 235, 0.2)',
borderColor: 'rgb(54, 162, 235)',
borderWidth: 1
}]
},
options:
{
maintainAspectRatio: false,
scales:
{
xAxes:
[{
distribution: 'linear',
ticks:
{
beginAtZero: false,
maxTicksLimit: 0
},
gridLines:
{
zeroLineColor: 'rgba(0, 0, 0, 0.1)',
offsetGridLines: true
}
}],
yAxes:
[{
ticks:
{
beginAtZero: true,
suggestedMax: 10,
precision: 0
}
}]
}
}
});
</script>
</div>
</body>
</html>

View file

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>StatoolInfos</title>
<meta charset="UTF-8" />
<meta name="keywords" content="statoolinfos,devinsy,federation" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="statoolinfos.css" />
<script src="sorttable.js"></script>
<script src="Chart.bundle.min.js"></script>
<link rel="stylesheet" type="text/css" href="datatables.min.css"/>
<script type="text/javascript" src="datatables.min.js"></script>
</head>
<body>
<div style="width: 100%; height: 100%; text-align: center; margin: 0 0; border: 1px solid red;" title="titre utile ?">
<canvas id="myChart" width="100%" height="100%"></canvas>
<script>
var ctx = document.getElementById('myChart');
var myChart = new Chart(ctx,
{
type: 'bar',
data:
{
labels: ['New', 'Started', 'Waiting', 'Maybe', 'Resolved', 'Closed'],
datasets:
[{
label: '# of Votes',
data: [12, 19, 3, 5, 2, 3],
backgroundColor: 'rgba(54, 162, 235, 0.2)',
borderColor: 'rgba(54, 162, 235, 1)',
borderWidth: 1
}]
},
options:
{
maintainAspectRatio: false,
scales:
{
xAxes:
[{
distribution: 'linear',
ticks:
{
beginAtZero: false,
maxTicksLimit: 0
},
gridLines:
{
zeroLineColor: 'rgba(0, 0, 0, 0.1)',
offsetGridLines: true
}
}],
yAxes:
[{
ticks:
{
beginAtZero: true,
suggestedMax: 10,
precision: 0
}
}]
}
}
});
</script>
</div>
</body>
</html>

View file

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>StatoolInfos</title>
<meta charset="UTF-8" />
<meta name="keywords" content="statoolinfos,devinsy,federation" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="statoolinfos.css" />
<script src="sorttable.js"></script>
<script src="Chart.bundle.min.js"></script>
<link rel="stylesheet" type="text/css" href="datatables.min.css"/>
<script type="text/javascript" src="datatables.min.js"></script>
</head>
<body>
<div style="width: 100%; height: 100%; text-align: center; margin: 0 0; border: 1px solid red;" title="Created and Closed Issue Count">
<canvas id="myChart" width="100%" height="100%"></canvas>
<script>
var ctx = document.getElementById('myChart');
var myChart = new Chart(ctx,
{
type: 'line',
data:
{
datasets:
[
{
label: 'Created',
backgroundColor: 'rgba(255, 99, 132, 0.2)',
borderColor: 'rgba(255, 99, 132, 1)',
borderWidth: 1,
fill: true,
/* cubicInterpolationMode: 'monotone', */
lineTension: 0,
pointBorderWidth: 0.00000001,
data: [2, 9, 13, 15, 22, 23]
},
{
label: 'Closedᴿ',
backgroundColor: 'rgba(75, 192, 192, 0.2)',
borderColor: 'rgba(75, 192, 192, 1)',
borderWidth: 1,
fill: true,
lineTension: 0,
pointBorderWidth: 0.00000001,
data: [1, 5, 9, 13, 15, 22]
}
]
},
options:
{
maintainAspectRatio: false,
title: {
display: false,
text: 'Min and Max Settings'
},
scales:
{
xAxes:
[{
type: 'time',
time:
{
unit: 'month',
isoWeekday: true,
displayFormats:
{
month: 'YYYY MMM'
}
},
distribution: 'linear',
ticks:
{
beginAtZero: false,
maxTicksLimit: 0
},
gridLines:
{
zeroLineColor: 'rgba(0, 0, 0, 0.1)',
offsetGridLines: false
}
}],
yAxes:
[{
ticks:
{
beginAtZero: false,
suggestedMax: 10,
precision: 0
}
}]
}
}
});
</script>
</div>
</body>
</html>

View file

@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>StatoolInfos</title>
<meta charset="UTF-8" />
<meta name="keywords" content="statoolinfos,devinsy,federation" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="statoolinfos.css" />
<script src="sorttable.js"></script>
<script src="Chart.bundle.min.js"></script>
<link rel="stylesheet" type="text/css" href="datatables.min.css"/>
<script type="text/javascript" src="datatables.min.js"></script>
</head>
<body>
<div style="width: 100%; height: 100%; text-align: center; margin: 0 0; border: 1px solid red;" title="Created and Closed Issue Count">
<canvas id="myChart" width="100%" height="100%"></canvas>
<script>
var ctx = document.getElementById('myChart');
var myChart = new Chart(ctx,
{
type: 'line',
data:
{
datasets:
[
{
label: 'Created',
steppedLine: true,
backgroundColor: 'rgba(255, 99, 132, 0.2)',
borderColor: 'rgba(255, 99, 132, 1)',
borderWidth: 1,
fill: true,
/* cubicInterpolationMode: 'monotone', */
lineTension: 0,
pointBorderWidth: 0.00000001,
data: [2, 9, 13, 15, 22, 23]
},
{
label: 'Closedᴿ',
backgroundColor: 'rgba(75, 192, 192, 0.2)',
borderColor: 'rgba(75, 192, 192, 1)',
borderWidth: 1,
fill: true,
lineTension: 0,
pointBorderWidth: 0.00000001,
data: [1, 5, 9, 13, 15, 22]
}
]
},
options:
{
maintainAspectRatio: false,
title: {
display: false,
text: 'Min and Max Settings'
},
scales:
{
xAxes:
[{
type: 'time',
time:
{
unit: 'month',
isoWeekday: true,
displayFormats:
{
month: 'YYYY MMM'
}
},
distribution: 'linear',
ticks:
{
beginAtZero: false,
maxTicksLimit: 0
},
gridLines:
{
zeroLineColor: 'rgba(0, 0, 0, 0.1)',
offsetGridLines: false
}
}],
yAxes:
[{
ticks:
{
beginAtZero: false,
suggestedMax: 10,
precision: 0
}
}]
}
}
});
</script>
</div>
</body>
</html>

View file

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>StatoolInfos</title>
<meta charset="UTF-8" />
<meta name="keywords" content="statoolinfos,devinsy,federation" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="statoolinfos.css" />
<script src="sorttable.js"></script>
<script src="Chart.bundle.min.js"></script>
<link rel="stylesheet" type="text/css" href="datatables.min.css"/>
<script type="text/javascript" src="datatables.min.js"></script>
</head>
<body>
<div style="width: 100%; height: 100%; text-align: center; margin: 0 0; border: 1px solid red;" title="Created and Closed Issue Count">
<canvas id="myChart" width="100%" height="100%"></canvas>
<script>
var ctx = document.getElementById('myChart');
var myChart = new Chart(ctx,
{
type: 'line',
data:
{
datasets:
[
{
label: 'Created',
backgroundColor: 'rgba(255, 99, 132, 0.2)',
borderColor: 'rgba(255, 99, 132, 1)',
borderWidth: 1,
fill: true,
/* cubicInterpolationMode: 'monotone', */
lineTension: 0,
pointBorderWidth: 0.00000001,
data: [2, 9, 13, 15, 22, 23]
},
{
label: 'Closedᴿ',
backgroundColor: 'rgba(75, 192, 192, 0.2)',
borderColor: 'rgba(75, 192, 192, 1)',
borderWidth: 1,
fill: true,
lineTension: 0,
pointBorderWidth: 0.00000001,
data: [1, 5, 9, 13, 15, 22]
}
]
},
options:
{
maintainAspectRatio: false,
title: {
display: false,
text: 'Min and Max Settings'
},
scales:
{
xAxes:
[{
type: 'time',
time:
{
unit: 'month',
isoWeekday: true,
displayFormats:
{
month: 'YYYY MMM'
}
},
distribution: 'linear',
ticks:
{
beginAtZero: false,
maxTicksLimit: 0
},
gridLines:
{
zeroLineColor: 'rgba(0, 0, 0, 0.1)',
offsetGridLines: false
}
}],
yAxes:
[{
ticks:
{
beginAtZero: false,
suggestedMax: 10,
precision: 0
}
}]
}
}
});
</script>
</div>
</body>
</html>

View file

@ -7,7 +7,7 @@
<meta name="keywords" content="statoolinfos,devinsy,federation" /> <meta name="keywords" content="statoolinfos,devinsy,federation" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" /> <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="statoolinfos.css" /> <link rel="stylesheet" type="text/css" href="statoolinfos.css" />
<script src="sorttable.js" /> <script src="sorttable.js"></script>
<script src="Chart.bundle.min.js"></script> <script src="Chart.bundle.min.js"></script>
<link rel="stylesheet" type="text/css" href="datatables.min.css"/> <link rel="stylesheet" type="text/css" href="datatables.min.css"/>
<script type="text/javascript" src="datatables.min.js"></script> <script type="text/javascript" src="datatables.min.js"></script>

View file

@ -88,7 +88,14 @@ public class PathProperty
{ {
String result; String result;
if (StringUtils.countMatches(this.path, '.') > 1)
{
result = this.path.substring(0, this.path.indexOf(".", this.path.indexOf(".") + 1)); result = this.path.substring(0, this.path.indexOf(".", this.path.indexOf(".") + 1));
}
else
{
result = null;
}
// //
return result; return result;