From 1ae6204a40283473048fa7d688dd89ba7dacef58 Mon Sep 17 00:00:00 2001 From: Julian Hinxlage Date: Tue, 28 May 2019 15:08:39 +0200 Subject: [PATCH 1/2] ~week-overview proper labeling and scaling --- src/main/webapp/js/week_overview.js | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/main/webapp/js/week_overview.js b/src/main/webapp/js/week_overview.js index ee3d77c..522a3b1 100644 --- a/src/main/webapp/js/week_overview.js +++ b/src/main/webapp/js/week_overview.js @@ -5,13 +5,15 @@ let week_overview = new Chart($("#overview_chart"), { data: { labels: [0, 0, 0, 0, 0], datasets: [{ - label: "Warenanzahl", + label: "Kundenanzahl", + yAxisID: 'y-axis-1', data: [0, 0, 0, 0, 0], fill: true, backgroundColor: 'rgba(104, 216, 154, 0.5)', lineTension: 0 }, { label: "Einnahmen in €", + yAxisID: 'y-axis-2', data: [0, 0, 0, 0, 0], fill: true, backgroundColor: 'rgba(113, 114, 231, 1)', @@ -47,9 +49,25 @@ let week_overview = new Chart($("#overview_chart"), { display: false } }], - yAxes: [{ - display: true - }] + yAxes: [ + { + display: true, + position: 'right', + id: 'y-axis-1', + scaleLabel: { + display: true, + labelString: 'Kundenanzahl' + } + }, + { + display: true, + id: 'y-axis-2', + scaleLabel: { + display: true, + labelString: 'Einnahmen in €' + } + } + ] } } }); From 3e42b632907340a9b1ad4e99e701f8011bc3eaba Mon Sep 17 00:00:00 2001 From: Julian Hinxlage Date: Tue, 28 May 2019 15:22:39 +0200 Subject: [PATCH 2/2] ~set color for chart labels to black --- src/main/webapp/index.jsp | 4 ++-- src/main/webapp/js/cache.js | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/webapp/index.jsp b/src/main/webapp/index.jsp index 0f73f27..1d25b3d 100644 --- a/src/main/webapp/index.jsp +++ b/src/main/webapp/index.jsp @@ -6,7 +6,7 @@ -
+
@@ -16,7 +16,7 @@
- +
diff --git a/src/main/webapp/js/cache.js b/src/main/webapp/js/cache.js index e712e2b..705181b 100644 --- a/src/main/webapp/js/cache.js +++ b/src/main/webapp/js/cache.js @@ -1,3 +1,5 @@ +Chart.defaults.global.defaultFontColor = "black"; + $(document).ready(function () { let dataset = $('#dataset'); request('files').then(results => { @@ -33,7 +35,6 @@ function updateCache() { } } - function updateAll(uuid) { updateWeekOverviewChart(uuid); updateShoppingTimesChart(uuid);