@fishawack/lab-d3
Advanced tools
Comparing version 4.2.0 to 4.2.1
{ | ||
"name": "@fishawack/lab-d3", | ||
"version": "4.2.0", | ||
"version": "4.2.1", | ||
"description": "Abstract layer built on top of d3", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -97,2 +97,10 @@ "use strict"; | ||
} | ||
local.select.call(this, d, options); | ||
}, | ||
select: function select(d) { | ||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var local = that.store, | ||
att = local.att, | ||
data = local.data, | ||
chart = local.chart; | ||
local.active = d; | ||
@@ -280,3 +288,5 @@ local.activated.push(d); | ||
// Setup features | ||
var selection = local.geometry.selectAll(".feature").data(local.geoJson.features); | ||
var selection = local.geometry.selectAll(".feature").data(local.geoJson.features, function (d) { | ||
return d.id; | ||
}); | ||
var enter = selection.enter().append('g').attr('class', function (d) { | ||
@@ -556,2 +566,7 @@ return 'feature feature-' + d.id; | ||
att = local.att; | ||
for (var i = 0; i < local.activated.length; i++) { | ||
if (local.activated[i].id === key) { | ||
return; | ||
} | ||
} | ||
var d; | ||
@@ -565,2 +580,18 @@ for (var i = local.geoJson.features.length; i--;) { | ||
if (d) { | ||
local.select.call(d3.select('.feature-' + key).node(), d, { | ||
programmatic: true | ||
}); | ||
} | ||
}; | ||
Chart_Map.prototype.toggleSpecific = function (key) { | ||
var local = this.store, | ||
att = local.att; | ||
var d; | ||
for (var i = local.geoJson.features.length; i--;) { | ||
if (local.geoJson.features[i].id === key) { | ||
d = local.geoJson.features[i]; | ||
break; | ||
} | ||
} | ||
if (d) { | ||
local.clicked.call(d3.select('.feature-' + key).node(), d, { | ||
@@ -567,0 +598,0 @@ options: { |
@@ -352,7 +352,11 @@ "use strict"; | ||
var prevColor = node.attr('data-color'); | ||
node.classed(prevColor, false); | ||
var newColor = d && index > -1 && Shared.getKey(att, d, index, 'colors'); | ||
node.classed(newColor, true).attr('data-color', newColor); | ||
if (!newColor || newColor !== prevColor) { | ||
node.classed(prevColor, false); | ||
if (newColor) { | ||
node.classed(newColor, true).attr('data-color', newColor); | ||
} | ||
} | ||
} | ||
}; | ||
export default Shared; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
562419
5602