Last active
July 7, 2020 08:45
-
-
Save josteinaj/f35ccef3513d6e6f031c68e339745ba9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.setInterval(function(){ | |
var paths = $("#scatter-chart > svg > g > g > g.nv-scatterWrap.nvd3-svg > g > g:nth-child(2) > g.nv-groups > g").children(); | |
var x = []; | |
var y = []; | |
var mean_x = 0; | |
var mean_y = 0; | |
var ab = 0; | |
var a2 = 0; | |
var b2 = 0; | |
for (var p = 0; p < paths.length; p++) { | |
var xy = $(paths[p]).attr("transform").replace(/.*\(/,'').replace(/\).*/,'').split(','); | |
x[p] = parseFloat(xy[0]); | |
y[p] = parseFloat(xy[1]); | |
mean_x += x[p]; | |
mean_y += y[p]; | |
} | |
mean_x /= paths.length; | |
mean_y /= paths.length; | |
for (var p = 0; p < x.length; p++) { | |
x[p] -= mean_x; | |
y[p] -= mean_y; | |
ab += x[p]*y[p]; | |
a2 += x[p]*x[p]; | |
b2 += y[p]*y[p]; | |
} | |
var result = ab / Math.sqrt(a2*b2); | |
$("#guess-input").val(""+(Math.round(Math.abs(result)*100)/100)); | |
$("#submit-btn").click(); | |
window.setTimeout(function(){ | |
$("#next-btn").click(); | |
},100); | |
},500) |
I don't remember what this is, sorry.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How do run