last changes before BREAKING some shit|

This commit is contained in:
Michael Murtaugh
2019-07-08 20:28:06 +02:00
parent 86ca425af0
commit 2f23dd9b46
6 changed files with 87 additions and 39 deletions

View File

@@ -31,7 +31,7 @@ export class Map {
this.historylinks = {};
this.links = null;
this.highlight_category = null;
this.show_history = false;
this.show_history = true;
}
nodeclick (d, elt) {
@@ -148,6 +148,28 @@ export class Map {
cat.append("span").attr("class", "count").html(d => d.tcount)
}
async load_legend (src, elt) {
var data = await json(src);
console.log("load_legend", data);
var cat = select(elt)
.selectAll("div.cat")
.data(data)
.enter()
.append("div")
.attr("class", "cat icon");
cat.append("span")
.attr("class", "icon")
.style("background-image", d => "url("+d.icon+")");
cat.append("a")
.attr("class", "label")
.html(d => d.key)
.attr("href", "#").on("click", d => {
event.preventDefault();
this.category_click(d);
})
cat.append("span").attr("class", "count").html(d => d.tcount)
}
category_click (d) {
console.log("category click", d);
if (this.highlight_category) {