Skip to content

Instantly share code, notes, and snippets.

View ivanpepelko's full-sized avatar
🐧
Kowalski, analysis!

Ivan Pepelko ivanpepelko

🐧
Kowalski, analysis!
View GitHub Profile
@ivanpepelko
ivanpepelko / dotabuff-trendline.js
Last active September 3, 2015 19:54
Dotabuff trendline
(function () {
var svg = $('.player-chart-container svg'); //selector is valid only for charts under Trends pages
if (typeof (svg[0]) !== 'undefined') { //if there is no graph in page, do nothing
$('#trendline').remove(); //remove previously drawn line
var points = $('circle'); //get all graph points
//calculate parameters needed for trendline
var cnt = points.length;
var sumx, sumy, sumx2, sumxy;
sumx = sumy = sumx2 = sumxy = 0;
points.each(function () {