From 542fd94012bce38024b58c227622cbc3eb8b0cb2 Mon Sep 17 00:00:00 2001 From: poka Date: Mon, 15 Mar 2021 20:19:12 +0100 Subject: [PATCH] Cumulate graph --- tpl/js/graph.js | 91 ++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 67 insertions(+), 24 deletions(-) diff --git a/tpl/js/graph.js b/tpl/js/graph.js index 41a891e..222bb9b 100644 --- a/tpl/js/graph.js +++ b/tpl/js/graph.js @@ -23,19 +23,11 @@ var jsonfileRW = $.getJSON( "../data/cum-daily.json", function(data) { type: 'line', data: { labels: date, - datasets: [{ - label: 'Ḡ1 reçus sur les simples portefeuilles', - data: rwallets, - backgroundColor: 'rgba(0, 119, 204, 0.3)', - pointBorderWidth: 1, - pointHoverRadius: 6, - pointHoverBackgroundColor: "beige", - pointHoverBorderColor: "brown", - pointHoverBorderWidth: 2, - pointRadius: 1, - pointHitRadius: 4 - }, { - label: 'Ḡ1 reçus sur les portefeuilles membres', + datasets: [ + + +{ + label: 'Portefeuilles membres', data: rmembers, backgroundColor: 'rgba(0, 178, 0, 0.3)', pointBorderWidth: 1, @@ -45,11 +37,45 @@ var jsonfileRW = $.getJSON( "../data/cum-daily.json", function(data) { pointHoverBorderWidth: 2, pointRadius: 1, pointHitRadius: 4 - }] + }, + + +{ + label: 'Simples portefeuilles', + data: rwallets, + backgroundColor: 'rgba(0, 119, 204, 0.3)', + pointBorderWidth: 1, + pointHoverRadius: 6, + pointHoverBackgroundColor: "beige", + pointHoverBorderColor: "brown", + pointHoverBorderWidth: 2, + pointRadius: 1, + pointHitRadius: 4 + }, + + + + ] }, options: { maintainAspectRatio: false, - responsive: true + responsive: true, + + +scales: { + xAxes: [{ + stacked: true + }], + yAxes: [ + { + id: 'y-axis', + stacked: true + } + ] +} + + + } }; var myChartRW = new Chart(ctx, config); @@ -61,10 +87,11 @@ var jsonfileRW = $.getJSON( "../data/cum-daily.json", function(data) { type: 'line', data: { labels: date, - datasets: [{ - label: 'Nombre de simple portefeuilles', - data: nbrwallets, - backgroundColor: 'rgba(0, 119, 204, 0.3)', + datasets: [ +{ + label: 'Portefeuilles membres', + data: nbrmembers, + backgroundColor: 'rgba(0, 178, 0, 0.3)', pointBorderWidth: 1, pointHoverRadius: 6, pointHoverBackgroundColor: "beige", @@ -72,10 +99,12 @@ var jsonfileRW = $.getJSON( "../data/cum-daily.json", function(data) { pointHoverBorderWidth: 2, pointRadius: 1, pointHitRadius: 4 - }, { - label: 'Nombre de portefeuilles membres', - data: nbrmembers, - backgroundColor: 'rgba(0, 178, 0, 0.3)', + }, + +{ + label: 'Simples portefeuilles', + data: nbrwallets, + backgroundColor: 'rgba(0, 119, 204, 0.3)', pointBorderWidth: 1, pointHoverRadius: 6, pointHoverBackgroundColor: "beige", @@ -87,7 +116,21 @@ var jsonfileRW = $.getJSON( "../data/cum-daily.json", function(data) { }, options: { maintainAspectRatio: true, - responsive: true + responsive: true, + +scales: { + xAxes: [{ + stacked: true + }], + yAxes: [ + { + id: 'y-axis', + stacked: true + } + ] +} + + } };