var jsonfileRW = $.getJSON( "../data/cum-daily.json", function(data) { var date = jsonfileRW.responseJSON.map(function(e) { return e.date; }); var rwallets = jsonfileRW.responseJSON.map(function(e) { return e.rWallets; }); var rmembers = jsonfileRW.responseJSON.map(function(e) { return e.rMembers; }); var nbrwallets = jsonfileRW.responseJSON.map(function(e) { return e.nbrWallets; }); var nbrmembers = jsonfileRW.responseJSON.map(function(e) { return e.nbrMembers; }); //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', data: { labels: date, datasets: [ { label: 'Portefeuilles membres', data: rmembers, backgroundColor: 'rgba(0, 178, 0, 0.3)', pointBorderWidth: 1, pointHoverRadius: 6, pointHoverBackgroundColor: "beige", pointHoverBorderColor: "brown", 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, scales: { xAxes: [{ stacked: true }], yAxes: [ { id: 'y-axis', stacked: true } ] } } }; var myChartRW = new Chart(ctx, config); // NbrWallets Graph var ctx = document.getElementById("chartNBRW"); var config = { type: 'line', data: { labels: date, datasets: [ { label: 'Portefeuilles membres', data: nbrmembers, backgroundColor: 'rgba(0, 178, 0, 0.3)', pointBorderWidth: 1, pointHoverRadius: 6, pointHoverBackgroundColor: "beige", pointHoverBorderColor: "brown", pointHoverBorderWidth: 2, pointRadius: 1, pointHitRadius: 4 }, { label: 'Simples portefeuilles', data: nbrwallets, backgroundColor: 'rgba(0, 119, 204, 0.3)', pointBorderWidth: 1, pointHoverRadius: 6, pointHoverBackgroundColor: "beige", pointHoverBorderColor: "brown", pointHoverBorderWidth: 2, pointRadius: 1, pointHitRadius: 4 }] }, options: { maintainAspectRatio: true, responsive: true, scales: { xAxes: [{ stacked: true }], yAxes: [ { id: 'y-axis', stacked: true } ] } } }; var myChartNBRW = new Chart(ctx, config); });