diff --git a/lib/views/chartView.js b/lib/views/chartView.js index 1ae9dda..6650f52 100644 --- a/lib/views/chartView.js +++ b/lib/views/chartView.js @@ -41,16 +41,26 @@ module.exports = function (screen, chart, chartData, table, hashes, refresh) { ] } if (currentRecord) { - if (data[0].x.length == 0) { //first record - data[0].x.unshift('0') - data[1].x.unshift('0') + if (data[0].x.length == 0) { // empty array + for ( var i = 0; i < 61; i++) { // initiate the array + if (data[0].x.length == 0) { + data[0].x.unshift('0') + data[1].x.unshift('0') + } else { + data[0].x.unshift('-'+data[0].x.length) + data[1].x.unshift('-'+data[1].x.length) + } + data[0].y.unshift(0) //inserting blank data to upload and download + data[1].y.unshift(0) + } } else { //following records if (data[0].x.length > 60) { // maximum length - data[0].x.shift() - data[1].x.shift() + data[0].y.shift() + data[1].y.shift() + } else { + data[0].x.unshift('-'+data[0].x.length) + data[1].x.unshift('-'+data[1].x.length) } - data[0].x.unshift('-'+data[0].x.length) - data[1].x.unshift('-'+data[1].x.length) } data[0].y.push(currentRecord['downloadspeedBytesSec']/1000) data[1].y.push(currentRecord['uploadspeedBytesSec']/1000) diff --git a/package.json b/package.json index 45e8d4b..c9731c7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "utorrent-console", - "version": "1.4.0", + "version": "1.4.2", "description": "Manage your uTorrent from console", "main": "./bin/utorrent-console", "scripts": {