Merge branch 'SPM-11' of Studium/Softwareprojektmanagement into master

This commit is contained in:
Johannes Theiner 2019-05-08 16:42:34 +00:00 committed by Gitea
commit cdb743ca0a
30 changed files with 514 additions and 102 deletions

View File

@ -44,7 +44,7 @@
<property name="allowNonPrintableEscapes" value="true"/> <property name="allowNonPrintableEscapes" value="true"/>
</module> </module>
<module name="LineLength"> <module name="LineLength">
<property name="max" value="100"/> <property name="max" value="200"/>
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/> <property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
</module> </module>
<module name="AvoidStarImport"/> <module name="AvoidStarImport"/>
@ -55,13 +55,14 @@
<property name="tokens" <property name="tokens"
value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/> value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/>
</module> </module>
<module name="NeedBraces"/> <module name="NeedBraces">
<property name="tokens" value="LITERAL_DO"/>
</module>
<module name="LeftCurly"/> <module name="LeftCurly"/>
<module name="RightCurly"> <module name="RightCurly">
<property name="id" value="RightCurlySame"/> <property name="id" value="RightCurlySame"/>
<property name="tokens" <property name="tokens"
value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_DO, LITERAL_IF, LITERAL_ELSE"/>
LITERAL_DO"/>
</module> </module>
<module name="RightCurly"> <module name="RightCurly">
<property name="id" value="RightCurlyAlone"/> <property name="id" value="RightCurlyAlone"/>

View File

@ -1,11 +1,13 @@
package de.hsel.spm.baudas.analysis; package de.hsel.spm.baudas.analysis;
/** /**
* Indexes for all attributes.
*
* @author Johannes Theiner * @author Johannes Theiner
* @version 0.1 * @version 0.1
* @since 0.1 * @since 0.1
**/ **/
public class Attribute { class Attribute {
static final int SEX = 0; static final int SEX = 0;
static final int AGE = 1; static final int AGE = 1;

View File

@ -1,5 +1,6 @@
package de.hsel.spm.baudas.analysis; package de.hsel.spm.baudas.analysis;
import org.jetbrains.annotations.NotNull;
import weka.clusterers.SimpleKMeans; import weka.clusterers.SimpleKMeans;
import weka.core.Instances; import weka.core.Instances;
import weka.filters.Filter; import weka.filters.Filter;
@ -31,51 +32,51 @@ public class Cluster implements Analysis<Map<Integer, Map<String, String>>> {
*/ */
@Override @Override
public Map<Integer, Map<String, String>> getResult() { public Map<Integer, Map<String, String>> getResult() {
if(result == null) { if (result != null) {
result = new HashMap<>(); return result;
//TODO: anpassen wenn #SPM-17 gemerged ist. }
int[] keepIndexes = new int[]{0, 1, 3, 5, 6, 7}; result = new HashMap<>();
Remove remove = new Remove(); int[] keepIndexes = new int[]{Attribute.SEX, Attribute.AGE, Attribute.MARITAL_STATUS, Attribute.SHOPPING_DAY, Attribute.SHOPPING_HOUR, Attribute.RESIDENCE};
Remove remove = new Remove();
try { try {
remove.setAttributeIndicesArray(keepIndexes); remove.setAttributeIndicesArray(keepIndexes);
remove.setInvertSelection(true); remove.setInvertSelection(true);
remove.setInputFormat(instances); remove.setInputFormat(instances);
instances = Filter.useFilter(instances, remove); instances = Filter.useFilter(instances, remove);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
//creating a single cluster to get average, weka has no way to get that from a bigger one. //creating a single cluster to get average, weka has no way to get that from a bigger one.
SimpleKMeans fullMeans = new SimpleKMeans(); SimpleKMeans averageMeans = new SimpleKMeans();
Instances fullCentroids = null; Instances averageCentroids = null;
try { try {
fullMeans.setNumClusters(1); averageMeans.setNumClusters(1);
fullMeans.setPreserveInstancesOrder(true); averageMeans.setPreserveInstancesOrder(true);
fullMeans.buildClusterer(instances); averageMeans.buildClusterer(instances);
fullCentroids = fullMeans.getClusterCentroids(); averageCentroids = averageMeans.getClusterCentroids();
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
} }
assert fullCentroids != null; assert averageCentroids != null;
//creating real cluster //creating real cluster
SimpleKMeans kMeans = new SimpleKMeans(); SimpleKMeans fullMeans = new SimpleKMeans();
try { try {
kMeans.setNumClusters(5); fullMeans.setNumClusters(5);
kMeans.setPreserveInstancesOrder(true); fullMeans.setPreserveInstancesOrder(true);
kMeans.buildClusterer(instances); fullMeans.buildClusterer(instances);
int count = 0; int count = 0;
count = putIntoMap(fullCentroids, count); count = putIntoMap(averageCentroids, count);
Instances centroids = kMeans.getClusterCentroids(); Instances centroids = fullMeans.getClusterCentroids();
putIntoMap(centroids, count); putIntoMap(centroids, count);
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
}
} }
return result; return result;
} }
@ -84,10 +85,10 @@ public class Cluster implements Analysis<Map<Integer, Map<String, String>>> {
* puts data into map. * puts data into map.
* *
* @param centroids cluster analysis result * @param centroids cluster analysis result
* @param count current insert count * @param count current insert count
* @return count increment * @return count increment
*/ */
private int putIntoMap(Instances centroids, int count) { private int putIntoMap(@NotNull Instances centroids, int count) {
for (int i = 0; i < centroids.numInstances(); i++) { for (int i = 0; i < centroids.numInstances(); i++) {
Map<String, String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
for (int j = 0; j < centroids.numAttributes(); j++) { for (int j = 0; j < centroids.numAttributes(); j++) {

View File

@ -5,6 +5,8 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
/** /**
* object to better handle day, hour combinations.
*
* @author Johannes Theiner * @author Johannes Theiner
* @version 0.1 * @version 0.1
* @since 0.1 * @since 0.1

View File

@ -31,17 +31,19 @@ public class ShoppingTimes implements Analysis<Map<DayHour, Integer>> {
*/ */
@Override @Override
public Map<DayHour, Integer> getResult() { public Map<DayHour, Integer> getResult() {
if (result == null) { if (result != null) {
result = new HashMap<>(); return result;
}
for(Instance instance : instances) { result = new HashMap<>();
DayHour dayHour = new DayHour(instance.stringValue(Attribute.SHOPPING_DAY), instance.stringValue(Attribute.SHOPPING_HOUR));
int tmp = 1;
if(result.containsKey(dayHour))
tmp = result.get(dayHour) + 1;
result.put(dayHour, tmp); for (Instance instance : instances) {
} DayHour dayHour = new DayHour(instance.stringValue(Attribute.SHOPPING_DAY), instance.stringValue(Attribute.SHOPPING_HOUR));
int tmp = 1;
if (result.containsKey(dayHour))
tmp = result.get(dayHour) + 1;
result.put(dayHour, tmp);
} }
return result; return result;
} }

View File

@ -1,16 +1,18 @@
package de.hsel.spm.baudas.analysis; package de.hsel.spm.baudas.analysis;
import java.io.*;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.HashMap;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import weka.core.Instance; import weka.core.Instance;
import weka.core.Instances; import weka.core.Instances;
import java.io.File;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/** /**
* get sum for every article and sort them ascending.
*
* @author Karsten Eden * @author Karsten Eden
* @version 0.1 * @version 0.1
* @since 0.1 * @since 0.1
@ -22,29 +24,34 @@ public class TopFlopArticle implements Analysis<Map<String, Integer>> {
private Instances instances; private Instances instances;
private Map<String, Integer> results; private Map<String, Integer> results;
public TopFlopArticle(File file){ public TopFlopArticle(File file) {
results = new HashMap<>();
instances = load(file); instances = load(file);
} }
/** /**
* get sum for every article and sort them asending * get result of analysis.
*
* @return Map of Name of Products and Sum of Values * @return Map of Name of Products and Sum of Values
*/ */
public Map<String, Integer> getResult() { public Map<String, Integer> getResult() {
if (results != null) {
return results;
}
results = new HashMap<>();
String name; String name;
Double sum = 0.0; double sum = 0.0;
for(int i=11; i<=25; i++) { for (int i = 11; i <= 25; i++) {
for (Instance instance : instances) { for (Instance instance : instances) {
sum += instance.value(i); sum += instance.value(i);
} }
name = instances.attribute(i).name(); name = instances.attribute(i).name();
results.put(name, sum.intValue()); results.put(name, (int) sum);
sum = 0.0; sum = 0.0;
} }
//Sort Map in ascending order //Sort Map in ascending order
Stream<Map.Entry<String, Integer>> sorted = results.entrySet().stream().sorted(Map.Entry.comparingByValue()); Stream<Map.Entry<String, Integer>> sorted = results.entrySet().stream().sorted(Map.Entry.comparingByValue());
results = sorted.collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue(), (e1, e2) -> e2, LinkedHashMap::new)); results = sorted.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e2, LinkedHashMap::new));
return results; return results;
} }

View File

@ -9,7 +9,7 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
/** /**
* Week Overview Analysis. * Week WeekOverviewDiagram Analysis.
* *
* @author Julian Hinxlage * @author Julian Hinxlage
* @version 0.1 * @version 0.1
@ -21,19 +21,26 @@ public class WeekOverview implements Analysis<Map<String, Map.Entry<Double, Inte
private Map<String, Map.Entry<Double, Integer>> result; private Map<String, Map.Entry<Double, Integer>> result;
public WeekOverview(File file) { public WeekOverview(File file) {
result = new HashMap<>();
instances = load(file); instances = load(file);
} }
/**
* get results for analysis.
*
* @return day, amount, count
*/
@Override @Override
public Map<String, Map.Entry<Double, Integer>> getResult() { public Map<String, Map.Entry<Double, Integer>> getResult() {
if (result != null) {
return result;
}
result = new HashMap<>();
int dayIndex = Attribute.SHOPPING_DAY;
int amountIndex = Attribute.PURCHASE_AMOUNT;
//TODO: replace values when #SPM-17 is merged int startArticles = Attribute.POWER_TOOLS;
int dayIndex = 5; int endArticles = Attribute.GARDENING_TOOLS + 1;
int amountIndex = 10;
int startArticles = 11;
int endArticles = 26;
for (int i = 0; i < instances.numInstances(); i++) { for (int i = 0; i < instances.numInstances(); i++) {
Instance instance = instances.get(i); Instance instance = instances.get(i);

View File

@ -56,6 +56,6 @@ public class Upload extends HttpServlet {
Files.copy(inputStream, path, StandardCopyOption.REPLACE_EXISTING); Files.copy(inputStream, path, StandardCopyOption.REPLACE_EXISTING);
resp.sendRedirect("index.jsf"); resp.sendRedirect("");
} }
} }

View File

@ -0,0 +1,89 @@
package de.hsel.spm.baudas.web;
import com.google.gson.Gson;
import de.hsel.spm.baudas.analysis.WeekOverview;
import org.jetbrains.annotations.NotNull;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* changes data from week overview into readable format for chart.js
*
* @author Johannes Theiner
* @version 0.1
* @since 0.1
**/
@WebServlet("/week_overview")
public class WeekOverviewDiagram extends HttpServlet {
/**
* do get.
*
* @param req request
* @param resp response
* @throws IOException writer could not be retrieved
*/
@Override
protected void doGet(@NotNull HttpServletRequest req, @NotNull HttpServletResponse resp) throws IOException {
req.setCharacterEncoding(StandardCharsets.UTF_8.name());
resp.setCharacterEncoding(StandardCharsets.UTF_8.name());
resp.setContentType("application/json");
PrintWriter out = resp.getWriter();
List<String> definedOrder = Arrays.asList("Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag");
Map<String, List<String>> result = new HashMap<>();
Gson gson = new Gson();
SavedFile file = Data.getFiles().peek();
if (file == null) {
result.put("labels", definedOrder);
result.put("count", new ArrayList<>());
result.put("revenue", new ArrayList<>());
out.print(gson.toJson(result));
return;
}
assert file.getUuid() != null;
WeekOverview overview = new WeekOverview(Data.get(file.getUuid()));
List<String> labels = new ArrayList<>();
List<String> count = new ArrayList<>();
List<String> revenue = new ArrayList<>();
for (Map.Entry<String, Map.Entry<Double, Integer>> entry : overview.getResult().entrySet()) {
labels.add(entry.getKey());
count.add(entry.getValue().getKey().toString());
revenue.add(entry.getValue().getValue().toString());
}
Comparator<String> comparator = Comparator.comparingInt(definedOrder::indexOf);
labels.sort(comparator);
for (String label : labels) {
Map.Entry<Double, Integer> entry = overview.getResult().get(label);
count.add(entry.getKey().toString());
revenue.add(entry.getValue().toString());
}
result.put("labels", labels);
result.put("count", count);
result.put("revenue", revenue);
out.print(gson.toJson(result));
}
}

View File

@ -0,0 +1,20 @@
<!--Anfang Skriptbereich-->
<!--Script für Diagramme-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.bundle.min.js" integrity="sha256-xKeoJ50pzbUGkpQxDYHD7o7hxe0LaOGeguUidbq6vis=" crossorigin="anonymous"></script>
<!--Script für Materlialize-->
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
<script type="text/javascript" src="js/materialize_components.js"></script>
<script src="js/overview.js"></script>
<script src="js/shoping_times.js"></script>
<script src="js/sold_articles.js"></script>
<script src="js/top_articles.js"></script>
<script src="js/flop_articles.js"></script>
<!--Ende Skriptbereich-->
</body>
</html>

View File

@ -0,0 +1,95 @@
<% response.setCharacterEncoding(StandardCharsets.UTF_8.name()); %>
<% request.setCharacterEncoding(StandardCharsets.UTF_8.name()); %>
<!DOCTYPE html>
<html lang="de">
<head>
<title>BauDas</title>
<!--Import Google Icon Font-->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!--Import materialize.css-->
<link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css" media="screen,projection" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.min.css" integrity="sha256-aa0xaJgmK/X74WM224KMQeNQC2xYKwlAt08oZqjeF0E=" crossorigin="anonymous" />
<meta charset="UTF-8">
<META HTTP-EQUIV="content-type" CONTENT="text/html; charset=utf-8">
<!--Let browser know website is optimized for mobile-->
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body class="blue-grey lighten-5">
<!--Navbar-->
<div class="navbar-fixed">
<nav class="nav-extended blue-grey lighten-3 white-text row">
<a href="#" class="brand-logo hide-on-small-and-down center">BauDas</a>
<!--Navbar Tabs-->
<div class="nav-content col 12 ">
<ul class="tabs tabs-transparent blue-grey lighten-3 white-text">
<li class="tab"><a class="active" href="#analysis"><i class="material-icons left">poll</i>Analyse</a></li>
<li class="tab"><a href="#marketing"><i class="material-icons left">public</i>Marketing</a></li>
</ul>
</div>
<!--Navbar Items-->
<div class="nav-wrapper col 2 right">
<ul class="right hide-on-med-and-down">
<li><a data-target="slide-out" class="sidenav-trigger show-on-large"><i class="material-icons left">menu</i>Men&uuml;</a></li><!--Sidenav-->
<li><a href="login.html"><i class="material-icons left">person_outline</i>Logout</a></li><!--Logout-->
</ul>
<ul class="right">
<li><a href="#" data-target="slide-out" class="sidenav-trigger"><i class="material-icons">menu</i></a></li><!--Sidenav-->
<li><a href="login.html" class="sidenav-trigger"><i class="material-icons">person_outline</i></a></li><!--Logout-->
</ul>
</div>
</nav>
</div>
<br>
<!--Sidenav Content-->
<ul id="slide-out" class="sidenav">
<li><div class="user-view">
<div class="background">
<img style="width: 100%" src="logoOrginal.gif">
</div>
<br>
<br>
</div></li>
<li><div class="divider"></div></li>
<li><div class="input-field container">
<label>Gruppenauswahl</label>
<br>
<select>
<option value="0">alle</option>
<option value="1">Gruppe 1</option>
<option value="2">Gruppe 2</option>
<option value="3">Gruppe 3</option>
</select>
</div></li>
<li><div class="input-field container">
<label>Datensatzauswahl</label>
<br>
<select>
<option value="0">aktuell</option>
<option value="1">Datensatz 1</option>
<option value="2">Datensatz 2</option>
<option value="3">Datensatz 3</option>
<option value="4">Datensatz 4</option>
<option value="5">Datensatz 5</option>
</select>
<br>
</div></li>
<li><div class="divider"></div></li>
<li><form action="upload" method="post" enctype="multipart/form-data">
<br>
<div class="file-field input-field container">
<div class="btn blue-grey lighten-2">
<span>File</span>
<input type="file" name="file">
</div>
<div class="file-path-wrapper">
<input class="file-path validate" type="text" placeholder="Datei hochladen">
</div>
</div>
<button class="btn blue-grey waves-effect waves-light" type="submit" name="action">Hochladen<i class="material-icons right">file_upload</i>
</button>
</form></li>
</ul>

197
src/main/webapp/index.jsp Normal file
View File

@ -0,0 +1,197 @@
<%@ page import="java.nio.charset.StandardCharsets" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@include file="header.jsp"%>
<% response.setCharacterEncoding(StandardCharsets.UTF_8.name()); %>
<% request.setCharacterEncoding(StandardCharsets.UTF_8.name()); %>
<!--Cards-->
<!--Analyse-Cards-->
<div id="analysis" class="row container">
<!--Übersicht-->
<div class="col s12 m12">
<div id="overview" class="card white">
<div class="center">
<span class="card-title center">Übersicht</span>
</div>
<div class="card-action center">
<a href="#">Tagesübersicht</a>
<a href="#">Wochenübersicht</a>
</div>
<div class="card-content">
<div>
<canvas id="overview_chart" width="1000" height="400"></canvas>
</div>
</div>
</div>
</div>
<!--Einkaufszeiten-->
<div class="col s12 m6">
<div id="shoping_times" class="card white">
<div class="card-content">
<div class="center">
<span class="card-title">Einkaufszeiten</span>
</div>
<div class="center">
<div class="input-field col s12">
<select>
<option value="0">Montag</option>
<option value="1">Dienstag</option>
<option value="2">Mittwoch</option>
<option value="3">Donnerstag</option>
<option value="4">Freitag</option>
<option value="5">Samstag</option>
<option value="6">Sonntag</option>
</select>
<label>Wochentag</label>
</div>
</div>
<div>
<canvas id="shoping_times_chart" width="1000" height="400"></canvas>
</div>
</div>
</div>
</div>
<!--Verkaufte Artikel-->
<div class="col s12 m6">
<div id="sold_articles" class="card white">
<div class="card-content">
<div class="center">
<span class="card-title center">Verkaufte Artikel</span>
</div>
<div class="center">
<div class="input-field col s12">
<select>
<option value="0">Artikel 1</option>
<option value="1">Artikel 2</option>
<option value="2">Artikel 3</option>
</select>
<label>Artikel</label>
</div>
</div>
<div>
<canvas id="sold_articles_cake" width="1000" height="400"></canvas>
</div>
</div>
</div>
</div>
<!--Top Artikel-->
<div class="col s12 m6">
<div id="top_articles" class="card white">
<div class="center">
<span class="card-title center">Top Artikel</span>
</div>
<div class="card-action center">
<a href="#">Umsatz</a>
<a href="#">Stückzahl</a>
</div>
<div class="card-content">
<div>
<canvas id="top_articles_chart" width="1000" height="400"></canvas>
</div>
</div>
</div>
</div>
<!--Flop Artikel-->
<div class="col s12 m6">
<div id="flop_articles" class="card white">
<div class="center">
<span class="card-title center">Flop Artikel</span>
</div>
<div class="card-action center">
<a href="#">Umsatz</a>
<a href="#">Stückzahl</a>
</div>
<div class="card-content">
<div>
<canvas id="flop_articles_chart" width="1000" height="400"></canvas>
</div>
</div>
</div>
</div>
<!--Warenkorbanlyse-->
<div id="shopping_card_analysis" class="col s12 m6">
<div class="card white">
<div class="card-content">
<div class="center">
<span class="card-title center">Warenkorbanalyse</span>
</div>
<div>
<p>Coming Soon</p>
</div>
</div>
</div>
</div>
<!--Gruppenübersicht-->
<div class="col s12 m6">
<div id="group_overview" class="card white">
<div class="card-content">
<div class="center">
<span class="card-title center">Gruppenübersicht</span>
</div>
<div>
<p>Coming Soon</p>
</div>
</div>
</div>
</div>
</div>
<!--Marketing-Cards-->
<div id="marketing" class="row container">
<div class="col s12 m6">
<div id="marketing_tip_1" class="card white">
<div class="card-content">
<div class="center">
<span class="card-title center">Marketingmaßnahme 1</span>
</div>
<div>
<p>Coming Soon</p>
</div>
</div>
</div>
</div>
<div class="col s12 m6">
<div id="marketing_tip_2" class="card white">
<div class="card-content">
<div class="center">
<span class="card-title center">Marketingmaßnahme 2</span>
</div>
<div>
<p>Coming Soon</p>
</div>
</div>
</div>
</div>
<div class="col s12 m6">
<div id="marketing_tip_3" class="card white">
<div class="card-content">
<div class="center">
<span class="card-title center">Marketingmaßnahme 3</span>
</div>
<div>
<p>Coming Soon</p>
</div>
</div>
</div>
</div>
<div class="col s12 m6">
<div id="marketing_tip_4" class="card white">
<div class="card-content">
<div class="center">
<span class="card-title center">Marketingmaßnahme 4</span>
</div>
<div>
<p>Coming Soon</p>
</div>
</div>
</div>
</div>
</div>
<%@include file="footer.jsp"%>

View File

@ -1,5 +1,5 @@
$.ajax({ $.ajax({
url: 'data/overview.json', url: 'week_overview',
dataType: 'json' dataType: 'json'
}).done(function (results) { }).done(function (results) {
new Chart(document.getElementById("overview_chart"), { new Chart(document.getElementById("overview_chart"), {
@ -8,16 +8,16 @@ $.ajax({
labels: results.labels, labels: results.labels,
datasets: [{ datasets: [{
label: "Warenanzahl", label: "Warenanzahl",
data: results.data1, data: results.count,
fill: true, fill: true,
backgroundColor: 'rgba(113, 114, 231, 0.7)', backgroundColor: 'rgba(113, 114, 231, 0.7)',
lineTension: 0, lineTension: 0
}, { }, {
label: "Einnahmen in €", label: "Einnahmen in €",
data: results.data2, data: results.revenue,
fill: true, fill: true,
backgroundColor: 'rgba(104, 216, 154, 0.8)', backgroundColor: 'rgba(104, 216, 154, 0.8)',
lineTension: 0, lineTension: 0
}] }]
}, },
options: { options: {
@ -31,7 +31,7 @@ $.ajax({
}, },
tooltips: { tooltips: {
mode: 'index', mode: 'index',
intersect: false, intersect: false
}, },
hover: { hover: {
mode: 'nearest', mode: 'nearest',
@ -50,7 +50,7 @@ $.ajax({
} }
}], }],
yAxes: [{ yAxes: [{
display: true, display: true
}] }]
} }
} }

View File

@ -3,7 +3,7 @@ $.ajax({
dataType: 'json' dataType: 'json'
}).done(function (results) { }).done(function (results) {
new Chart(document.getElementById("top_articles_chart"), { new Chart(document.getElementById("top_articles_chart"), {
type: 'phorizontalBarie', type: 'horizontalBar',
data: { data: {
labels: results.labels, labels: results.labels,
datasets: [{ datasets: [{

View File

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

@ -44,7 +44,7 @@
<ul id="slide-out" class="sidenav"> <ul id="slide-out" class="sidenav">
<li><div class="user-view"> <li><div class="user-view">
<div class="background"> <div class="background">
<img style="width: 100%" src="logoOrginal.gif"> <img style="width: 100%" src="../logoOrginal.gif">
</div> </div>
<br> <br>
<br> <br>

View File

@ -18,7 +18,7 @@
<div class="card white col s6 push-s3"> <div class="card white col s6 push-s3">
<div class="card-content"> <div class="card-content">
<div class="center"> <div class="center">
<img style="width: 50%" src="logoOrginal.gif"> <img style="width: 50%" src="../logoOrginal.gif">
</div> </div>
<div class="divider"></div> <div class="divider"></div>
<div class="row"> <div class="row">

View File

@ -21,7 +21,7 @@
</div> </div>
<div class="card-content"> <div class="card-content">
<div> <div>
<img style="width: 100%" src="logoOrginal.gif"> <img style="width: 100%" src="../logoOrginal.gif">
</div> </div>
<div class="divider"></div> <div class="divider"></div>
<div class="row"> <div class="row">

View File

@ -1,11 +0,0 @@
<!doctype html>
<html>
<body>
<form action="upload" method="post" enctype="multipart/form-data">
<input type="file" name="file">
<button type="submit">
Hochladen
</button>
</form>
</body>
</html>

View File

@ -29,7 +29,7 @@ class ClusterTest {
AtomicReference<Map<Integer, Map<String, String>>> results = new AtomicReference<>(); AtomicReference<Map<Integer, Map<String, String>>> results = new AtomicReference<>();
assertTimeout(Duration.ofMillis(2000), () -> results.set(cluster.getResult())); assertTimeout(Duration.ofMillis(10000), () -> results.set(cluster.getResult()));
assertEquals("m", results.get().get(0).get("Geschlecht")); assertEquals("m", results.get().get(0).get("Geschlecht"));
} }

View File

@ -13,7 +13,7 @@ import static org.junit.jupiter.api.Assertions.assertTimeout;
/** /**
* Week Overview Analysis Test. * Week WeekOverviewDiagram Analysis Test.
* *
* @author Johannes Theiner * @author Johannes Theiner
* @version 0.1 * @version 0.1
@ -84,7 +84,7 @@ class WeekOverviewTest {
AtomicReference<Map<String, Map.Entry<Double, Integer>>> result = new AtomicReference<>(); AtomicReference<Map<String, Map.Entry<Double, Integer>>> result = new AtomicReference<>();
assertTimeout(Duration.ofMillis(15), () -> result.set(overview.getResult())); assertTimeout(Duration.ofMillis(30), () -> result.set(overview.getResult()));
assertEquals(295688, result.get().get("Montag").getKey()); assertEquals(295688, result.get().get("Montag").getKey());