summaryrefslogtreecommitdiff
path: root/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'index.html')
-rw-r--r--index.html11
1 files changed, 7 insertions, 4 deletions
diff --git a/index.html b/index.html
index 5308008..8684d38 100644
--- a/index.html
+++ b/index.html
@@ -185,7 +185,9 @@
var table = d3.select("#boston-example");
table.attr("class", "center mdl-data-table mdl-js-data-table");
var htr = table.append("thead").append("tr")
- bostonset.attributes().forEach(function(attr) {
+ var attrs = bostonset.attributes();
+ var medv = attrs.indexOf("medv");
+ attrs.forEach(function(attr) {
var th = htr.append("th")
.html(attr)
.attr("class", "mdl-data-table__cell--non-numeric");
@@ -196,9 +198,10 @@
for(c=0; c<5; c++) {
var row = Math.floor(Math.random()*bostonset.length());
var tr = table.select("tbody").append("tr");
- bostonset.rawData(row).forEach(function(val) {
- tr.append("td").text(val);
- });
+ for (a=0; a<attrs.length; a++) {
+ var td = tr.append("td").text(bostonset.rawData(row)[a]);
+ if (a == medv) td.attr("class", "table-highlight");
+ }
}
componentHandler.upgradeElement(table.node());
});