From 23796d0099468875fc24feaea626ccc993191a6b Mon Sep 17 00:00:00 2001 From: schneefux Date: Wed, 6 Apr 2016 19:46:49 +0200 Subject: add boston slide --- code/bostonset.js | 21 ++++++++++++++++++++- code/weightviswrapper.js | 1 + 2 files changed, 21 insertions(+), 1 deletion(-) (limited to 'code') diff --git a/code/bostonset.js b/code/bostonset.js index 50b9d38..f5f1264 100644 --- a/code/bostonset.js +++ b/code/bostonset.js @@ -9,6 +9,7 @@ var Bostonset = (function() { this.dataScaler.setScales([[0.00632, 0.0, 0.46, 0.0, 0.385, 3.561, 2.9, 1.1296, 1.0, 187.0, 12.6, 0.32, 1.73], [88.9762, 100.0, 27.74, 1.0, 0.871, 8.78, 100.0, 12.1265, 24.0, 711.0, 22.0, 396.9, 37.97]]); this.targetScaler = new MinMaxScaler(); this.targetScaler.setScales([5.0, 50.0]); + this.readyHooks = []; } Bostonset.prototype.load = function(url) { @@ -22,15 +23,33 @@ var Bostonset = (function() { } self.data.push(arr); }); + self.readyHooks.forEach(function(hook) { hook(); }); }); }; + Bostonset.prototype.afterLoad = function(cb) { + if (!this.ready) { + this.readyHooks.push(cb); + } else { + cb(); + } + }; + + Bostonset.prototype.attributes = function() { + console.log(attrs); + return attrs; + }; + Bostonset.prototype.length = function() { return this.data.length; }; + Bostonset.prototype.rawData = function(row) { + return this.data[row]; + }; + Bostonset.prototype.rawInputs = function(row) { - return this.data[row].slice(0, -1); // leave out MEDV + return this.rawData(row).slice(0, -1); // leave out MEDV }; Bostonset.prototype.inputs = function(row) { diff --git a/code/weightviswrapper.js b/code/weightviswrapper.js index 1f17b55..94f6306 100644 --- a/code/weightviswrapper.js +++ b/code/weightviswrapper.js @@ -199,6 +199,7 @@ var WeightVisWrapper = (function() { /* helps with impress.js' stepenter/stepleave events */ // TODO move into its own file +// TODO must be a step's direct child var VisIntegrater = (function() { function VisIntegrater(enterCb, leaveCb, selector) { var self = this; -- cgit v1.3.1