Browse Source

highcharts jshint errors

master
yuriy0803 5 years ago
parent
commit
1dbc7835b3
  1. 53
      www/app/controllers/account.js
  2. 81
      www/app/controllers/account/index.js
  3. 44
      www/app/controllers/account/payouts.js
  4. 28
      www/app/controllers/index.js

53
www/app/controllers/account.js

@ -18,10 +18,10 @@ export default Ember.Controller.extend({
load: function() { load: function() {
var series = this.series[0]; var series = this.series[0];
setInterval(function() { setInterval(function() {
var x = (new Date).getTime(), var x = (new Date()).getTime(),
y = e.getWithDefault("model.currentHashrate") / 1000000; y = e.getWithDefault("model.currentHashrate") / 1000000;
series.addPoint([x, y], true, true) series.addPoint([x, y], true, true);
}, 109000000) }, 109000000);
} }
} }
}, },
@ -58,7 +58,7 @@ export default Ember.Controller.extend({
}, },
tooltip: { tooltip: {
formatter: function() { formatter: function() {
return this.y > 1000000000000 ? "<b>" + this.point.d + "<b><br>Hashrate&nbsp;" + (this.y / 1000000000000).toFixed(2) + "&nbsp;TH/s</b>" : this.y > 1000000000 ? "<b>" + this.point.d + "<b><br>Hashrate&nbsp;" + (this.y / 1000000000).toFixed(2) + "&nbsp;GH/s</b>" : this.y > 1000000 ? "<b>" + this.point.d + "<b><br>Hashrate&nbsp;" + (this.y / 1000000).toFixed(2) + "&nbsp;MH/s</b>" : "<b>" + this.point.d + "<b><br>Hashrate&nbsp;<b>" + this.y.toFixed(2) + "&nbsp;H/s</b>" return this.y > 1000000000000 ? "<b>" + this.point.d + "<b><br>Hashrate&nbsp;" + (this.y / 1000000000000).toFixed(2) + "&nbsp;TH/s</b>" : this.y > 1000000000 ? "<b>" + this.point.d + "<b><br>Hashrate&nbsp;" + (this.y / 1000000000).toFixed(2) + "&nbsp;GH/s</b>" : this.y > 1000000 ? "<b>" + this.point.d + "<b><br>Hashrate&nbsp;" + (this.y / 1000000).toFixed(2) + "&nbsp;MH/s</b>" : "<b>" + this.point.d + "<b><br>Hashrate&nbsp;<b>" + this.y.toFixed(2) + "&nbsp;H/s</b>";
}, },
@ -72,61 +72,68 @@ export default Ember.Controller.extend({
name: "Average hashrate", name: "Average hashrate",
data: function() { data: function() {
var e, a = []; var e, a = [];
if (null != t) if (null != t) {
for (e = 0; e <= t.length - 1; e += 1) { for (e = 0; e <= t.length - 1; e += 1) {
var n = 0, var n = 0,
r = 0, r = 0,
l = 0; l = 0;
r = new Date(1e3 * t[e].x), l = r.toLocaleString(), n = t[e].minerLargeHash, a.push({ r = new Date(1e3 * t[e].x);
l = r.toLocaleString();
n = t[e].minerLargeHash;
a.push({
x: r, x: r,
d: l, d: l,
y: n y: n
}) });
} else a.push({ }
} else {
a.push({
x: 0, x: 0,
d: 0, d: 0,
y: 0 y: 0
}); });
return a }
return a;
}() }()
}, { }, {
name: "Current hashrate", name: "Current hashrate",
data: function() { data: function() {
var e, a = []; var e, a = [];
if (null != t) if (null != t) {
for (e = 0; e <= t.length - 1; e += 1) { for (e = 0; e <= t.length - 1; e += 1) {
var n = 0, var n = 0,
r = 0, r = 0,
l = 0; l = 0;
r = new Date(1e3 * t[e].x), l = r.toLocaleString(), n = t[e].minerHash, a.push({ r = new Date(1e3 * t[e].x);
l = r.toLocaleString();
n = t[e].minerHash;
a.push({
x: r, x: r,
d: l, d: l,
y: n y: n
}) });
} else a.push({ }
} else {
a.push({
x: 0, x: 0,
d: 0, d: 0,
y: 0 y: 0
}); });
return a }
return a;
}() }()
}] }]
}; };
return a return a;
} }
}), }),
roundPercent: Ember.computed('stats', 'model', { roundPercent: Ember.computed('stats', 'model', {
get() { get() {
var percent = this.get('model.roundShares') / this.get('stats.nShares'); var percent = this.get('model.roundShares') / this.get('stats.roundShares');
if (!percent) { if (!percent) {
return 0; return 0;
} }
if(percent>100){
return 100;
}
return percent; return percent;
} }
}) })
}); });

81
www/app/controllers/account/index.js

@ -2,8 +2,10 @@ import Ember from 'ember';
export default Ember.Controller.extend({ export default Ember.Controller.extend({
applicationController: Ember.inject.controller('application'), applicationController: Ember.inject.controller('application'),
config: Ember.computed.reads('applicationController.config'), netstats: Ember.computed.reads('applicationController'),
stats: Ember.computed.reads('applicationController.model.stats'), stats: Ember.computed.reads('applicationController.model.stats'),
config: Ember.computed.reads('applicationController.config'),
chartOptions: Ember.computed("model.hashrate", { chartOptions: Ember.computed("model.hashrate", {
get() { get() {
var e = this, var e = this,
@ -13,15 +15,15 @@ export default Ember.Controller.extend({
backgroundColor: "rgba(255, 255, 255, 0.1)", backgroundColor: "rgba(255, 255, 255, 0.1)",
type: "spline", type: "spline",
marginRight: 10, marginRight: 10,
height: 400, height: 200,
events: { events: {
load: function() { load: function() {
var series = this.series[0]; var series = this.series[0];
setInterval(function() { setInterval(function() {
var x = (new Date).getTime(), var x = (new Date()).getTime(),
y = e.getWithDefault("model.currentHashrate") / 1000000; y = e.getWithDefault("model.currentHashrate") / 1000000;
series.addPoint([x, y], true, true) series.addPoint([x, y], true, true);
}, 109000000) }, 1090000000);
} }
} }
}, },
@ -44,9 +46,10 @@ export default Ember.Controller.extend({
}, },
yAxis: { yAxis: {
title: { title: {
text: "HASHRATE" text: "Hashrate by Account"
}, },
min: 0 //softMin: e.getWithDefault("model.currentHashrate") / 1000000,
//softMax: e.getWithDefault("model.currentHashrate") / 1000000,
}, },
plotLines: [{ plotLines: [{
value: 0, value: 0,
@ -58,7 +61,7 @@ export default Ember.Controller.extend({
}, },
tooltip: { tooltip: {
formatter: function() { formatter: function() {
return this.y > 1000000000000 ? "<b>" + this.point.d + "<b><br>Hashrate&nbsp;" + (this.y / 1000000000000).toFixed(2) + "&nbsp;TH/s</b>" : this.y > 1000000000 ? "<b>" + this.point.d + "<b><br>Hashrate&nbsp;" + (this.y / 1000000000).toFixed(2) + "&nbsp;GH/s</b>" : this.y > 1000000 ? "<b>" + this.point.d + "<b><br>Hashrate&nbsp;" + (this.y / 1000000).toFixed(2) + "&nbsp;MH/s</b>" : "<b>" + this.point.d + "<b><br>Hashrate&nbsp;<b>" + this.y.toFixed(2) + "&nbsp;H/s</b>" return this.y > 1000000000000 ? "<b>" + this.point.d + "<b><br>Hashrate&nbsp;" + (this.y / 1000000000000).toFixed(2) + "&nbsp;TH/s</b>" : this.y > 1000000000 ? "<b>" + this.point.d + "<b><br>Hashrate&nbsp;" + (this.y / 1000000000).toFixed(2) + "&nbsp;GH/s</b>" : this.y > 1000000 ? "<b>" + this.point.d + "<b><br>Hashrate&nbsp;" + (this.y / 1000000).toFixed(2) + "&nbsp;MH/s</b>" : "<b>" + this.point.d + "<b><br>Hashrate&nbsp;<b>" + this.y.toFixed(2) + "&nbsp;H/s</b>";
}, },
@ -69,60 +72,62 @@ export default Ember.Controller.extend({
}, },
series: [{ series: [{
color: "#E99002", color: "#E99002",
name: "Average hashrate", name: "3 hours average hashrate",
data: function() { data: function() {
var e, a = []; var e, a = [];
if (null != t) if (null != t) {
for (e = 0; e <= t.length - 1; e += 1) { for (e = 0; e <= t.length - 1; e += 1) {
var n = 0, var n = 0,
r = 0, r = 0,
l = 0; l = 0;
r = new Date(1e3 * t[e].x), l = r.toLocaleString(), n = t[e].minerLargeHash, a.push({ r = new Date(1e3 * t[e].x);
l = r.toLocaleString();
n = t[e].minerLargeHash;
a.push({
x: r, x: r,
d: l, d: l,
y: n y: n
}) });
} else a.push({ }
} else {
a.push({
x: 0, x: 0,
d: 0, d: 0,
y: 0 y: 0
}); });
return a }
return a;
}() }()
}, { }, {
name: "Current hashrate", name: "30 minutes average hashrate",
data: function() { data: function() {
var e, a = []; var e, a = [];
if (null != t) if (null != t) {
for (e = 0; e <= t.length - 1; e += 1) { for (e = 0; e <= t.length - 1; e += 1) {
var n = 0, var n = 0,
r = 0, r = 0,
l = 0; l = 0;
r = new Date(1e3 * t[e].x), l = r.toLocaleString(), n = t[e].minerHash, a.push({ r = new Date(1e3 * t[e].x);
l = r.toLocaleString();
n = t[e].minerHash;
a.push({
x: r, x: r,
d: l, d: l,
y: n y: n
}) });
} else a.push({ }
x: 0, } else {
d: 0, a.push({
y: 0 x: 0,
}); d: 0,
return a y: 0
});
}
return a;
}() }()
}] }]
}; };
return a return a;
} }
}), })
});
roundPercent: Ember.computed('stats', 'model', {
get() {
var percent = this.get('model.roundShares') / this.get('stats.nShares');
if (!percent) {
return 0;
}
return percent;
}
})
});

44
www/app/controllers/account/payouts.js

@ -29,10 +29,10 @@ export default Ember.Controller.extend({
load: function() { load: function() {
var series = this.series[0]; var series = this.series[0];
setInterval(function() { setInterval(function() {
var x = (new Date).getDate(), var x = (new Date()).getDate(),
y = e.getWithDefault("model.paymentCharts"); y = e.getWithDefault("model.paymentCharts");
series.addPoint([x, y], true, true) series.addPoint([x, y], true, true);
}, 1090000000) }, 1090000000);
} }
} }
}, },
@ -64,7 +64,7 @@ export default Ember.Controller.extend({
}, },
tooltip: { tooltip: {
formatter: function() { formatter: function() {
return "<b>" + Highcharts.dateFormat('%Y-%m-%d', new Date(this.x)) + "<b><br>Payment&nbsp;<b>" + this.y.toFixed(8) + "&nbsp;ESN</b>" return "<b>" + Highcharts.dateFormat('%Y-%m-%d', new Date(this.x)) + "<b><br>Payment&nbsp;<b>" + this.y.toFixed(8) + "&nbsp;ESN</b>";
}, },
useHTML: true useHTML: true
}, },
@ -76,28 +76,32 @@ export default Ember.Controller.extend({
name: "Payment Series", name: "Payment Series",
data: function() { data: function() {
var e, a = []; var e, a = [];
if (null != t) if (null != t) {
for (e = 0; e <= t.length - 1; e += 1) { for (e = 0; e <= t.length - 1; e += 1) {
var n = 0, var n = 0,
r = 0, r = 0,
l = 0; l = 0;
r = new Date(1e3 * t[e].x), r = new Date(1e3 * t[e].x);
l = r.toLocaleString(), l = r.toLocaleString();
n = t[e].amount / 1000000000, a.push({ n = t[e].amount / 1000000000;
x: r, a.push({
d: l, x: r,
y: n d: l,
}) y: n
} else a.push({ });
x: 0, }
d: 0, } else {
y: 0 a.push({
}); x: 0,
return a d: 0,
y: 0
});
}
return a;
}() }()
}] }]
}; };
return a return a;
} }
}) })
}); });

28
www/app/controllers/index.js

@ -28,7 +28,10 @@ export default Ember.Controller.extend({
events: { events: {
load: function() { load: function() {
var series = this.series[0]; var series = this.series[0];
setInterval(function() {var x = (new Date).getTime(), y = e.getWithDefault("model.Hashrate") / 1000000; series.addPoint([x, y], true, true)}, 1090000000) setInterval(function() {
var x = (new Date()).getTime(), y = e.getWithDefault("model.Hashrate") / 1000000;
series.addPoint([x, y], true, true);
}, 1090000000);
} }
} }
}, },
@ -68,7 +71,7 @@ export default Ember.Controller.extend({
}, },
tooltip: { tooltip: {
formatter: function() { formatter: function() {
return this.y > 1000000000000 ? "<b>" + this.point.d + "<b><br>Hashrate&nbsp;" + (this.y / 1000000000000).toFixed(2) + "&nbsp;TH/s</b>" : this.y > 1000000000 ? "<b>" + this.point.d + "<b><br>Hashrate&nbsp;" + (this.y / 1000000000).toFixed(2) + "&nbsp;GH/s</b>" : this.y > 1000000 ? "<b>" + this.point.d + "<b><br>Hashrate&nbsp;" + (this.y / 1000000).toFixed(2) + "&nbsp;MH/s</b>" : "<b>" + this.point.d + "<b><br>Hashrate<b>&nbsp;" + this.y.toFixed(2) + "&nbsp;H/s</b>" return this.y > 1000000000000 ? "<b>" + this.point.d + "<b><br>Hashrate&nbsp;" + (this.y / 1000000000000).toFixed(2) + "&nbsp;TH/s</b>" : this.y > 1000000000 ? "<b>" + this.point.d + "<b><br>Hashrate&nbsp;" + (this.y / 1000000000).toFixed(2) + "&nbsp;GH/s</b>" : this.y > 1000000 ? "<b>" + this.point.d + "<b><br>Hashrate&nbsp;" + (this.y / 1000000).toFixed(2) + "&nbsp;MH/s</b>" : "<b>" + this.point.d + "<b><br>Hashrate<b>&nbsp;" + this.y.toFixed(2) + "&nbsp;H/s</b>";
}, },
useHTML: true useHTML: true
}, },
@ -80,26 +83,31 @@ export default Ember.Controller.extend({
name: "Hashrate", name: "Hashrate",
data: function() { data: function() {
var e, a = []; var e, a = [];
if (null != t) if (null != t) {
for (e = 0; e <= t.length - 1; e += 1) { for (e = 0; e <= t.length - 1; e += 1) {
var n = 0, var n = 0,
r = 0, r = 0,
l = 0; l = 0;
r = new Date(1e3 * t[e].x), l = r.toLocaleString(), n = t[e].y, a.push({ r = new Date(1e3 * t[e].x);
l = r.toLocaleString();
n = t[e].y; a.push({
x: r, x: r,
d: l, d: l,
y: n y: n
}) });
} else a.push({ }
} else {
a.push({
x: 0, x: 0,
d: 0, d: 0,
y: 0 y: 0
}); });
return a }
return a;
}() }()
}] }]
}; };
return a return a;
} }
}) })
}); });
Loading…
Cancel
Save