adding title to tile map legend

This commit is contained in:
ppisljar 2016-09-07 11:05:50 +02:00
parent 83a513505c
commit 9e08139cb5
2 changed files with 14 additions and 0 deletions

View file

@ -24,6 +24,10 @@
color: @tilemap-color;
}
.tilemap-legend-title {
font-weight: bold;
}
.tilemap-legend i {
width: 10px;

View file

@ -25,6 +25,12 @@ export default function MarkerFactory() {
this.quantizeLegendColors();
}
getLabel() {
if (this.popups.length) {
return this.popups[0].feature.properties.aggConfigResult.aggConfig.makeLabel();
}
return '';
};
/**
* Adds legend div to each map when data is split
* uses d3 scale from BaseMarker.prototype.quantizeLegendColors
@ -46,6 +52,10 @@ export default function MarkerFactory() {
// on relevant map events, and returns the element containing the control
const $div = $('<div>').addClass('tilemap-legend');
const titleText = self.getLabel();
const $title = $('<div>').addClass('tilemap-legend-title').text(titleText);
$div.append($title);
_.each(self._legendColors, function (color, i) {
const labelText = self._legendQuantizer
.invertExtent(color)