From c2d4396bf7afd07854303142eaa833a7160e6283 Mon Sep 17 00:00:00 2001 From: Grayson Earle Date: Thu, 26 Apr 2018 17:58:13 -0400 Subject: [PATCH] updated stats --- desktop/assets/bb-icon.png | Bin 0 -> 1370 bytes desktop/assets/cute-graph-donation.png | Bin 0 -> 187 bytes desktop/assets/cute-graph-green.png | Bin 0 -> 101 bytes desktop/assets/cute-graph-payout.png | Bin 0 -> 187 bytes .../assets/{pages => }/cute-graph-pink.png | Bin desktop/assets/{pages => }/cute-graph.png | Bin desktop/package-lock.json | 2 +- desktop/stats.css | 16 ++- desktop/stats.html | 25 ++-- desktop/stats.js | 123 ++++++++++++------ 10 files changed, 106 insertions(+), 60 deletions(-) create mode 100644 desktop/assets/bb-icon.png create mode 100644 desktop/assets/cute-graph-donation.png create mode 100644 desktop/assets/cute-graph-green.png create mode 100644 desktop/assets/cute-graph-payout.png rename desktop/assets/{pages => }/cute-graph-pink.png (100%) rename desktop/assets/{pages => }/cute-graph.png (100%) diff --git a/desktop/assets/bb-icon.png b/desktop/assets/bb-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..1b36d4e050f72839cf527cd14e2e717de1f30f5b GIT binary patch literal 1370 zcmeAS@N?(olHy`uVBq!ia0y~yV3Y;2mvFEF$yGOg6#*&964!{5;QX|b^2DN42FH~A zq*MjZ+{E`0rLn>~)xqC3{Rg_4>!zWif)0^~z3IyhAeoUP6 zOU3WEL8Dc+49C8X2Wu8TDvalP-j`SHFJ6}ZyLLjRf%eOIrIM|?V)R1w+^?5jy{h^s zW7e`$FK;RJm*fT(dl}1rdVc<8WM@rXvCX1qUsj(warm(Fjh%Ax@~eYf1Sl(S#U(auS z{r2tXjpp{BZYibPg)G0k^48n3`*!C)R+uc;UvXJ&eaxKm&o@Y$%k{5bzI?e-e%-9V zS)nZ^i%nKXN9j#}`EYN@ouz9Q9j+Ca`}>)-tV0RIMMeP-<-!i9fI=?pU>Ojl;d(M! z_U9c9-H@&cW*2g|-+sh4W!slrGihTkllkW_+dZ^;bPs5y()7mI`BSZu7C%02cJ57D zNvFlEWh*a<9lF%F?)4ds%ZqbwZ>XMp`{MW76FrwIi*|3@aD8=<`9t^I1NxP2_Di2E z{S>%eLAs~xz4%meke{wI)YwnJjpO754=EPRzot;t5lO9`5y_mFdg|gq2 zZI7mA7|jex6M3Ed`2P0u#a45>=3adLI{SqFN|V=ju4L|(xN|ATZ1uO_d)d#w7Ug+; zl@S^MNZ|ms5!vD&(*ynF)p93y-zqVa>+imMMSN?ezNfL*=BC{}=N=ZU2wNR`!fofW z%vbx~ckju3{naYxbKLdP(%ak0|2h}&=I_0m=UgY5V>Y|nl2^lOV)r)hdw$}TxvKi+ z|5x?f-k7&j`s~Sat2=vF{QnX7tNwS#tjRAJ%vI5n12A#GQw1oYe0IMw|D3w&ddZGG z+fK~n553~I@Y45}E@w4YtHxb^xuvSIa;5UQ&`(_Fo?aI~4^QB#Ln7l8s z?Rr}leW#)Cc=FbpIcGF3)Y$p2wtd}EU2HeMJBF>SHtbc$+v%CJAC~&vJo`eZ(8M=* zscy?s+1Tqd1DCnq-j?`XZTsT)zb8m8{rsdXH*tOVQoW^pQEsuHdg{DRdOuwp=U7}b z_3K<DXcQf#?STU0hL&un(+@4xq&%a_+oJd+SF3ypZ>_=hAsSVlQzopr0M%P{DgXcg literal 0 HcmV?d00001 diff --git a/desktop/assets/cute-graph-donation.png b/desktop/assets/cute-graph-donation.png new file mode 100644 index 0000000000000000000000000000000000000000..8bc9173772954254e9c5baa5aeeddae10d73fc14 GIT binary patch literal 187 zcmeAS@N?(olHy`uVBq!ia0vp^oFL4>1|%O$WD@{VO`a}}Arezt&u`>B6d=<2P=Ebp z$t`CEt`%|~^$QnxZSsmo(^ck>owY^;Yj{V(XPug`V?WHr`Ru0`Z<1Ji^(uq(8AG>b z<+9Ls6Ls|qJB-!#tu*9)={#NG>Fb7@{0|Q+E#a%}anibZ-1fm2cPo~hz2PN+$?~gW lx|vk-DwahrT2b_tJ0@3_N%4~LDxhl^JYD@<);T3K0RS%5LqPxl literal 0 HcmV?d00001 diff --git a/desktop/assets/cute-graph-green.png b/desktop/assets/cute-graph-green.png new file mode 100644 index 0000000000000000000000000000000000000000..95b7c552a2e727b28f15cb3788a295acf00f22dc GIT binary patch literal 101 zcmeAS@N?(olHy`uVBq!ia0vp^oFL4>1|%O$WD@{VI-V|$Are!Q|NQ@N&uli~)C8{S z35QlO@d_;MV4W_iGTUW}(y=N3HE-;77k1|%O$WD@{VO`a}}Arezt&oAUX6d=<2aQ*p% zJR6+Y9j2=)SVS}~$Zn9-;!NbIv8@O>%%ytJhK1i%bN|khC+E*D-XyX3^(hAFGlp)> z%4L;LC&o@I>@Zf_x6+XJrSo)!r>`4s@;^MRw1ls=$4TqvaoY!9+^tx0_J)@PCd+^F l>Sj{St5_Dj=!EuL?qCI3t_MpS?*U!I;OXk;vd$@?2><~FL=6A{ literal 0 HcmV?d00001 diff --git a/desktop/assets/pages/cute-graph-pink.png b/desktop/assets/cute-graph-pink.png similarity index 100% rename from desktop/assets/pages/cute-graph-pink.png rename to desktop/assets/cute-graph-pink.png diff --git a/desktop/assets/pages/cute-graph.png b/desktop/assets/cute-graph.png similarity index 100% rename from desktop/assets/pages/cute-graph.png rename to desktop/assets/cute-graph.png diff --git a/desktop/package-lock.json b/desktop/package-lock.json index aca20e5..e693b93 100644 --- a/desktop/package-lock.json +++ b/desktop/package-lock.json @@ -1,6 +1,6 @@ { "name": "bailbloc", - "version": "1.2.0", + "version": "1.2.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/desktop/stats.css b/desktop/stats.css index 3b0e0e8..d72929c 100644 --- a/desktop/stats.css +++ b/desktop/stats.css @@ -1,3 +1,5 @@ + + #individual { position:absolute; width:100%; @@ -88,16 +90,16 @@ .payouticon, .donationicon { position: absolute; - width: 18px; - height: 18px; - background-image: url(assets/payout.png); + width: 14px; + height: 14px; + background-image: url(assets/cute-graph-payout.png); background-repeat: no-repeat; background-size: 100%; z-index:98; } .donationicon { - background-image: url(assets/donation.png); + background-image: url(assets/cute-graph-donation.png); } #xaxis-label-friends a img, #label-donations a img { @@ -111,7 +113,7 @@ } #xaxis-label-friends, #label-donations { - right: 94px; + left: 550px; } #topbox { @@ -193,4 +195,8 @@ z-index: 99; color: #fff; text-shadow: 1px 1px 2px #888888; +} + +#stats-date, #scrub-actual, #scrub-friends, #scrub-line { + opacity:0 !important; } \ No newline at end of file diff --git a/desktop/stats.html b/desktop/stats.html index 3bd1b7f..d3a7a13 100644 --- a/desktop/stats.html +++ b/desktop/stats.html @@ -26,23 +26,22 @@
- - -
FUNDS RAISED TO DATE
+ +
XMR generated
- +
CHECK CUT TO BAIL FUND
- -
if everyone invited 3 friends
- - + +
USD raised
+
- +
DONATION RECEIVED
@@ -56,11 +55,11 @@
- display as
-

money raised

-

hashrate

-

people participating

+

+

$1234 USD raised USD

+

something XMR

+

something else USD:XMR

diff --git a/desktop/stats.js b/desktop/stats.js index 8fbd004..8b7e147 100644 --- a/desktop/stats.js +++ b/desktop/stats.js @@ -16,7 +16,7 @@ var yMax = 0.0; var minExRate = 0.0; var maxExRate = 500.0; var minUSD = 0.0; -var maxUSD = 10000.0; +var maxUSD = 1000.0; var myFont; var fontS = 18.7; @@ -162,45 +162,77 @@ function draw() { // NEW------ var y = 0.0; - // draw XMR graph - // stroke(255, 0, 0); - // strokeWeight(8); - noStroke(); - fill(255, 0, 0); - - beginShape(); - vertex(mL, height); - vertex(gp[0].x, gp[0].y); - - for (var i = 1; i < gp.length; i++) { - vertex(gp[i].x, gp[i].y); - } - vertex(mR, height); - endShape(); + // // draw XMR graph + // // stroke(255, 0, 0); + // // strokeWeight(8); + // noStroke(); + // fill(255, 0, 0); + + // beginShape(); + // vertex(mL, height); + // vertex(gp[0].x, gp[0].y); - // draw exchange rate graph - stroke(100, 100, 255, 200); - noFill(); - beginShape(); + // for (var i = 1; i < gp.length; i++) { + // vertex(gp[i].x, gp[i].y); + // } + // vertex(mR, height); + // endShape(); + // USD as vertical bars + strokeWeight(4); + stroke(100,255,100); for (var i = 0; i < gp.length; i++) { - y = map(gp[i].eRate, minExRate, maxExRate, height, 0); - vertex(gp[i].x, y); + y = map(gp[i].usd, minUSD, maxUSD, height, 0); + line(gp[i].x - 1, height, gp[i].x - 1, y); } - endShape(); + // XMR as vertical bars + stroke(255,80,80); + for (var i = 0; i < gp.length; i++) { + line(gp[i].x - 1, height, gp[i].x - 1, gp[i].y); + } + // turn nearest bar to mouse yellow + var nearestBar = int(map(mouseX,0,width,0,gp.length-1)); + nearestBar = constrain(nearestBar,0,gp.length-1); + stroke(255,255,100); + // usd + y = map(gp[nearestBar].usd, minUSD, maxUSD, height, 0); + line(gp[nearestBar].x - 1, height, gp[nearestBar].x - 1, y); + // xmr + line(gp[nearestBar].x - 1, height, gp[nearestBar].x - 1, gp[nearestBar].y); + + // clean lines between + // stroke(255); + // strokeWeight(1); + // for (var i = 0; i < gp.length; i++) { + // line(gp[i].x + 2, height, gp[i].x + 2, 0); + // } - // draw USD graph - stroke(100, 255, 100, 200); - noFill(); - beginShape(); + // // draw exchange rate graph + // stroke(100, 100, 255, 200); + // noFill(); + // beginShape(); + + // for (var i = 0; i < gp.length; i++) { + // y = map(gp[i].eRate, minExRate, maxExRate, height, 0); + // vertex(gp[i].x, y); + // } + // endShape(); + + + + // // draw USD graph + // stroke(100, 255, 100, 200); + // noFill(); + // beginShape(); + + // for (var i = 0; i < gp.length; i++) { + // y = map(gp[i].usd, minUSD, maxUSD, height, 0); + // vertex(gp[i].x, y); + // } + // endShape(); - for (var i = 0; i < gp.length; i++) { - y = map(gp[i].usd, minUSD, maxUSD, height, 0); - vertex(gp[i].x, y); - } - endShape(); for (var i = 0; i < gp.length; i++) { @@ -227,9 +259,9 @@ function mouseMoved() { mouseReady = true; } - // check mouse - var pointInQuestion = int(map(mouseX, 0, width, 0, numPoints)); - pointInQuestion = constrain(pointInQuestion, 0, numPoints - 1); + // check mouse (4 pixel offset helps) + var pointInQuestion = int(map(mouseX, 0, width + 4, 0, gp.length)); + // pointInQuestion = constrain(pointInQuestion, 0, gp.length - 1); //console.log(pointInQuestion); @@ -245,6 +277,12 @@ function mouseMoved() { $("#scrub-actual").offset({ top: y, left: x }); $("#scrub-actual").html(valToPrint); + $("#scrub-date").html(gp[pointInQuestion].date); + $("#scrub-usd").html(gp[pointInQuestion].usd); + $("#scrub-xmr").html(gp[pointInQuestion].xmr.toFixed(1)); + $("#scrub-exrate").html(gp[pointInQuestion].eRate.toFixed(0)); + + y = height - (height - gp[pointInQuestion].y) * friendsMultiplier; y += $("#defaultCanvas0").offset().top - 18; y = constrain(y, 150, height); @@ -304,7 +342,7 @@ function redrawGraph(stats, numWorkers) { minExRate = maxExRate = stats[0].ticker.price; minUSD = ((stats[stats.length - 1].stats.amtPaid + stats[stats.length - 1].stats.amtDue) / 1000000000000) * stats[stats.length - 1].ticker.price; console.log(stats[stats.length - 1].ticker.price); - maxUSD = (stats[0].stats.amtPaid + stats[0].stats.amtDue) / 1000000000000 * stats[0].ticker.price; + // maxUSD = (stats[0].stats.amtPaid + stats[0].stats.amtDue) / 1000000000000 * stats[0].ticker.price; // add points to array for (var i = stats.length - 1; i >= 0; i--) { @@ -315,13 +353,12 @@ function redrawGraph(stats, numWorkers) { var usd = 0; var hashrate = stats[i].stats.hash / 1000.0; var nMiners = stats[i].n_miners; - var eRate = stats[i].ticker.price; + var eRate = parseFloat(stats[i].ticker.price); if (eRate > maxExRate) maxExRate = eRate; if (eRate < minExRate) minExRate = eRate; - if (usd > maxUSD) maxUSD = usd; - if (usd < minUSD) minUSD = usd; + var date = new Date(convertTimestamp(stats[i].timestamp)); var month = date.getMonth(); @@ -348,6 +385,10 @@ function redrawGraph(stats, numWorkers) { totalUSD = usd; // ! + // use for min/max graph stuff + if (usd > maxUSD) maxUSD = usd; + if (usd < minUSD) minUSD = usd; + // y = map(usd, yMin, yMax, height, 0); y = map(xmr, yMin, yMax, height, 0); @@ -486,8 +527,8 @@ function pullStatsData() { // get all the bb. server data $.ajax({ - - url: "https://bb.darkinquiry.com/?step=65&n=120", + // was step=65, n=120 + url: "https://bb.darkinquiry.com/?step=130&n=80", type: 'get', cache: false, success: function(stats) {