Beautify graph view; Improve cumulate.jq syntaxe

This commit is contained in:
poka 2020-10-02 21:34:49 +02:00
parent b2404ead75
commit 7d9b71fa54
2 changed files with 23 additions and 64 deletions

View File

@ -1,13 +1,10 @@
def round: . + 0.5 | floor;
def roundit: .*100.0|round/100.0;
[foreach .[] as $row ({nbrMembers: 0, nbrWallets: 0, sMembers: 0, rMembers: 0, sWallets: 0, rWallets: 0};
{
nbrMembers: ($row.nbrMembers + .nbrMembers),
nbrWallets: ($row.nbrWallets + .nbrWallets),
sMembers: ($row.sMembers + .sMembers|roundit),
rMembers: ($row.rMembers + .rMembers|roundit),
sWallets: ($row.sWallets + .sWallets|roundit),
rWallets: ($row.rWallets + .rWallets|roundit)
};
$row * .
)]
[foreach .[] as $row (null;
.nbrMembers += $row.nbrMembers |
.nbrWallets += $row.nbrWallets |
.sMembers = ($row.sMembers + .sMembers|roundit) |
.rMembers = ($row.rMembers + .rMembers|roundit) |
.sWallets = ($row.sWallets + .sWallets|roundit) |
.rWallets = ($row.rWallets + .rWallets|roundit);
$row + . )]

View File

@ -15,7 +15,9 @@ var jsonfileRW = $.getJSON( "../data/cum-daily.json", function(data) {
return e.nbrMembers;
});
//ReceivedGraph
//var optionsGen = 'pointBorderWidth: 1, pointHoverRadius: 6, pointHoverBackgroundColor: "beige", pointHoverBorderColor: "brown", pointHoverBorderWidth: 2, pointRadius: 1, pointHitRadius: 4';
//Received Graph
var ctx = document.getElementById("chartRW");
var config = {
type: 'line',
@ -26,23 +28,23 @@ var jsonfileRW = $.getJSON( "../data/cum-daily.json", function(data) {
data: rwallets,
backgroundColor: 'rgba(0, 119, 204, 0.3)',
pointBorderWidth: 1,
pointHoverRadius: 8,
pointHoverRadius: 6,
pointHoverBackgroundColor: "beige",
pointHoverBorderColor: "brown",
pointHoverBorderWidth: 2,
pointRadius: 3,
pointHitRadius: 8
pointRadius: 1,
pointHitRadius: 4
}, {
label: 'Ḡ1 reçus sur les portefeuilles membres',
data: rmembers,
backgroundColor: 'rgba(0, 178, 0, 0.3)',
pointBorderWidth: 1,
pointHoverRadius: 8,
pointHoverRadius: 6,
pointHoverBackgroundColor: "beige",
pointHoverBorderColor: "brown",
pointHoverBorderWidth: 2,
pointRadius: 3,
pointHitRadius: 8
pointRadius: 1,
pointHitRadius: 4
}]
},
options: {
@ -53,11 +55,6 @@ var jsonfileRW = $.getJSON( "../data/cum-daily.json", function(data) {
var myChartRW = new Chart(ctx, config);
// NbrWallets Graph
var ctx = document.getElementById("chartNBRW");
var config = {
@ -69,23 +66,23 @@ var jsonfileRW = $.getJSON( "../data/cum-daily.json", function(data) {
data: nbrwallets,
backgroundColor: 'rgba(0, 119, 204, 0.3)',
pointBorderWidth: 1,
pointHoverRadius: 8,
pointHoverRadius: 6,
pointHoverBackgroundColor: "beige",
pointHoverBorderColor: "brown",
pointHoverBorderWidth: 2,
pointRadius: 3,
pointHitRadius: 8
pointRadius: 1,
pointHitRadius: 4
}, {
label: 'Nombre de portefeuilles membres',
data: nbrmembers,
backgroundColor: 'rgba(0, 178, 0, 0.3)',
pointBorderWidth: 1,
pointHoverRadius: 8,
pointHoverRadius: 6,
pointHoverBackgroundColor: "beige",
pointHoverBorderColor: "brown",
pointHoverBorderWidth: 2,
pointRadius: 3,
pointHitRadius: 8
pointRadius: 1,
pointHitRadius: 4
}]
},
options: {
@ -97,38 +94,3 @@ var jsonfileRW = $.getJSON( "../data/cum-daily.json", function(data) {
var myChartNBRW = new Chart(ctx, config);
});
/*var jqxhr = $.getJSON( "example.json", function() {
console.log( "success" );
})
.done(function() {
console.log( "second success" );
})
.fail(function() {
console.log( "error" );
})
.always(function() {
console.log( "complete" );
});*/