[vislib] properly render legend values

This commit is contained in:
Spencer Alger 2015-05-22 16:12:50 -07:00
parent dc07a456cd
commit 2c7a72c910
3 changed files with 11 additions and 5 deletions

View file

@ -21,7 +21,7 @@ define(function (require) {
this.el = el;
this.tooltip = new Tooltip('chart-title', el, function (d) {
return '<p>' + d.label + '</p>';
return '<p>' + _.escape(d.label) + '</p>';
});
}

View file

@ -78,9 +78,15 @@ define(function (require) {
.enter()
.append('li')
.attr('class', 'color')
.each(self._addIdentifier)
.html(function (d) {
return '<i class="fa fa-circle dots" style="color:' + args.color(d) + '"></i>' + d;
.each(function (label) {
var li = d3.select(this);
self._addIdentifier.call(this, label);
li.append('i')
.attr('class', 'fa fa-circle dots')
.attr('style', 'color:' + args.color(label));
li.append('span').text(label);
});
};

View file

@ -655,7 +655,7 @@ define(function (require) {
return this._div;
};
label.update = function () {
this._div.innerHTML = '<h2>' + mapLabel + '</h2>';
this._div.innerHTML = '<h2>' + _.escape(mapLabel) + '</h2>';
};
label.addTo(map);
};