Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed bug where charts stop updating after 60 seconds #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions lib/views/chartView.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down