diff --git a/css/charts.css b/css/charts.css new file mode 100644 index 0000000..9a3682e --- /dev/null +++ b/css/charts.css @@ -0,0 +1,12 @@ +#charts { + width: 98%; + margin-left: 0px; +} + +@media only screen and (max-width: 1100px) { + +#charts { + width: 95%; +} + +} diff --git a/css/style.css b/css/style.css index be3986c..dba574f 100644 --- a/css/style.css +++ b/css/style.css @@ -2,7 +2,7 @@ body { background-color: #c4a787; margin: 30px; font-family: "Gill Sans", sans-serif; - min-width: 1100px; +/* min-width: 1100px; */ } .footer img { @@ -20,8 +20,8 @@ pre { letter-spacing: 0.04em; } -#mainbloc, #statsHistory { - margin-top: 60px; +#mainbloc, #statsHistory, #charts { + margin-top: 20px; margin-bottom: 10px; margin-left: 300px; margin-right: 300px; @@ -63,8 +63,6 @@ a:hover { right: 30px; } - - @media only screen and (max-width: 1100px) { body { margin: 15px; @@ -75,7 +73,7 @@ a:hover { #mainbloc { margin: 5px; - margin-top: 50px; + margin-top: 20px; } a { font-size: 1em; diff --git a/g1-stats.sh b/g1-stats.sh index 74883a9..93b19df 100755 --- a/g1-stats.sh +++ b/g1-stats.sh @@ -103,6 +103,7 @@ pourcentWallets=$(echo "scale=1; $nbrSimpleWallets*100/$nbrTotalWallets/1" | bc) web() { [ ! -d $WEBPATH/history/ ] && mkdir -p $WEBPATH/history/ + [ ! -d $WEBPATH/graph/ ] && mkdir -p $WEBPATH/graph/ [ ! -d $WEBPATH/css ] && cp -r $SCRIPTPATH/css $WEBPATH/ cp $SCRIPTPATH/tpl/index.html $indexhtml diff --git a/tpl/graph.html b/tpl/graph.html deleted file mode 100644 index 3f50559..0000000 --- a/tpl/graph.html +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/tpl/graph.json b/tpl/graph.json deleted file mode 100644 index ea6c0ca..0000000 --- a/tpl/graph.json +++ /dev/null @@ -1 +0,0 @@ - {\n \"date\": \"_DATE\",\n \"rWallet\": \"_RWALLET\"\n }, diff --git a/tpl/index.html b/tpl/index.html index 3adebcb..dba0bbf 100644 --- a/tpl/index.html +++ b/tpl/index.html @@ -7,10 +7,11 @@
-

La Ḡ1 en quelques chiffres

+

La Ḡ1 en quelques chiffres

+ Voir les graphiques
-
+
 Date: _day - _heure 
 Noeud scanné: https://duniter-g1.p2p.legal 
@@ -19,11 +20,11 @@ Nombre total de wallet:		_nbrTotalWallets
 Nombre de membres:			_nbrMembers (_pourcentMbrs%) 
 Nombre de simple portefeuille:	_nbrSimpleWallets (_pourcentWallets%) 
 ---
-Reçus simples portefeuille:		_txInSimple Ḡ1 Voir le graphique
+Reçus simples portefeuille:		_txInSimple Ḡ1 Voir le graphique
 Envoyé simples portefeuille:	_txOutSimple Ḡ1
 Soldes simples portefeuille:	_soldeSimple Ḡ1 (_pourcentSimpleWallet% de la masse monétaire totale)
 ---
-Reçus membres:				_txInMembers Ḡ1 (sans les DU)
+Reçus membres:				_txInMembers Ḡ1 (sans les DU)  Voir le graphique
 Envoyé membres:				_txOutMembers Ḡ1
 Soldes membres:				_soldeMembers Ḡ1 (sans les DU)
 ---
diff --git a/tpl/mixed.html b/tpl/mixed.html
new file mode 100644
index 0000000..b38f501
--- /dev/null
+++ b/tpl/mixed.html
@@ -0,0 +1,145 @@
+
+
+
+	
+	
+	
+	
+
+
+
+
+
+

Graphiques

+
+

Ḡ1 reçus sur les wallets

+ +
+
+

Nombre de wallets

+ +
+
+ + + +
+ + + + diff --git a/tpl/nbr_wallets.html b/tpl/nbr_wallets.html new file mode 100644 index 0000000..ea10f3e --- /dev/null +++ b/tpl/nbr_wallets.html @@ -0,0 +1,67 @@ + + + + + + + + + + + + + diff --git a/tpl/nbr_wallets.json b/tpl/nbr_wallets.json new file mode 100644 index 0000000..1d69b11 --- /dev/null +++ b/tpl/nbr_wallets.json @@ -0,0 +1 @@ + {\n \"date\": \"_DATE\",\n \"nbrWallets\": \"_NBRWALLETS\",\n \"nbrMembres\": \"_NBRMEMBRES\"\n }, diff --git a/tpl/recus.html b/tpl/recus.html new file mode 100644 index 0000000..911517a --- /dev/null +++ b/tpl/recus.html @@ -0,0 +1,67 @@ + + + + + + + + + + + + + diff --git a/tpl/recus.json b/tpl/recus.json new file mode 100644 index 0000000..c80a393 --- /dev/null +++ b/tpl/recus.json @@ -0,0 +1 @@ + {\n \"date\": \"_DATE\",\n \"rWallets\": \"_RWALLETS\",\n \"rMembres\": \"_RMEMBRES\"\n }, diff --git a/transform_json.sh b/transform_json.sh index 2a16cb3..edc5f82 100755 --- a/transform_json.sh +++ b/transform_json.sh @@ -6,18 +6,53 @@ n=2 # Nombre de jours pour les pas en abscisse SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" if [[ -e $SCRIPTPATH/.env ]]; then source $SCRIPTPATH/.env; else echo "Veuillez créer votre fichier .env inspiré de .env.example" && exit 1; fi -rWallets=$(grep -E "Date:|Reçus simples wallets|Reçus simples portefeuille" $WEBPATH/history/index_*.html | awk -F '' '{ print $2 }' | awk '{ print $1 }' | tr -d '.' | tr ',' '.') -j=1 +## Ḡ1 reçus +rWallets() { +rWallets=$(grep -E "Date:|Reçus simples wallets|Reçus simples portefeuille|Reçus membres" $WEBPATH/history/index_*.html | awk -F '' '{ print $2 }' | awk '{ print $1 }' | tr -d '.' | tr ',' '.') +rWallets=$(sed '/-/i !' <<< $rWallets) + +local j=0 +local IFS=$'!' for i in $rWallets; do - ! [[ $j =~ ^(0|1)$ ]] && ((j--)) - if [[ $j == 1 ]]; then - jsonTPL=$(sed s/_DATE/$i/g tpl/graph.json) - j=0 - elif [[ $j == 0 ]]; then - result+=$(sed s/_RWALLET/$i/g <<< $jsonTPL) - [[ $n == 1 ]] && j=1 || j=$((n*2)) - fi + ((j++)) + [[ $j == 1 || ! $(( $j % $n )) == 0 ]] && continue + local dateN=$(sed '2q;d' <<< $i) + local RW=$(sed '3q;d' <<< $i) + local RM=$(sed '4q;d' <<< $i) + + local jsonTPL=$(sed s/_DATE/$dateN/g $SCRIPTPATH/tpl/recus.json) + local jsonTPL=$(sed s/_RWALLETS/$RW/g <<< $jsonTPL) + local result+=$(sed s/_RMEMBRES/$RM/g <<< $jsonTPL) done -sed "s/_JSONDATA/$result/g" $SCRIPTPATH/tpl/graph.html > $WEBPATH/graph.html +sed "s/_JSONDATA/$result/g" $SCRIPTPATH/tpl/recus.html > $WEBPATH/graph/recus.html +sed "s/_JSONDATARW/$result/g" $SCRIPTPATH/tpl/mixed.html > $WEBPATH/graph/mixed.html +} + +nbrWallets() { +## Nombre de wallets +nbrWallets=$(grep -E "Date:|Nombre de membres|Nombre de simple portefeuille" $WEBPATH/history/index_*.html | awk -F '' '{ print $2 }' | awk -F '' '{ print $1 }' | awk '{ print $1 }') +nbrWallets=$(sed '/-/i !' <<< $nbrWallets) + +local j=0 +local IFS=$'!' +for i in $nbrWallets; do + ((j++)) + [[ $j == 1 || ! $(( $j % $n )) == 0 ]] && continue + local dateN=$(sed '2q;d' <<< $i) + local NBRM=$(sed '3q;d' <<< $i) + local NBRW=$(sed '4q;d' <<< $i) + + local jsonTPL=$(sed s/_DATE/$dateN/g $SCRIPTPATH/tpl/nbr_wallets.json) + local jsonTPL=$(sed s/_NBRWALLETS/$NBRW/g <<< $jsonTPL) + local result+=$(sed s/_NBRMEMBRES/$NBRM/g <<< $jsonTPL) +done + +sed "s/_JSONDATA/$result/g" $SCRIPTPATH/tpl/nbr_wallets.html > $WEBPATH/graph/nbr_wallets.html +sed -i "s/_JSONDATANBRW/$result/g" $WEBPATH/graph/mixed.html + +} + +rWallets +nbrWallets