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 round: . + 0.5 | floor;
def roundit: .*100.0|round/100.0; def roundit: .*100.0|round/100.0;
[foreach .[] as $row ({nbrMembers: 0, nbrWallets: 0, sMembers: 0, rMembers: 0, sWallets: 0, rWallets: 0}; [foreach .[] as $row (null;
{ .nbrMembers += $row.nbrMembers |
nbrMembers: ($row.nbrMembers + .nbrMembers), .nbrWallets += $row.nbrWallets |
nbrWallets: ($row.nbrWallets + .nbrWallets), .sMembers = ($row.sMembers + .sMembers|roundit) |
sMembers: ($row.sMembers + .sMembers|roundit), .rMembers = ($row.rMembers + .rMembers|roundit) |
rMembers: ($row.rMembers + .rMembers|roundit), .sWallets = ($row.sWallets + .sWallets|roundit) |
sWallets: ($row.sWallets + .sWallets|roundit), .rWallets = ($row.rWallets + .rWallets|roundit);
rWallets: ($row.rWallets + .rWallets|roundit) $row + . )]
};
$row * .
)]

View File

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