diff --git a/modules/util/jsonp_request.js b/modules/util/jsonp_request.js index c4c79d6b0..b81896a22 100644 --- a/modules/util/jsonp_request.js +++ b/modules/util/jsonp_request.js @@ -1,4 +1,5 @@ -import * as d3 from 'd3'; +import { select as d3_select } from 'd3-selection'; + var jsonpCache = {}; window.jsonpCache = jsonpCache; @@ -35,7 +36,7 @@ export function jsonpRequest(url, callback) { } var cb = create(url), - script = d3.select('head') + script = d3_select('head') .append('script') .attr('type', 'text/javascript') .attr('src', url.replace(/(\{|%7B)callback(\}|%7D)/, cb)); diff --git a/modules/util/tooltip.js b/modules/util/tooltip.js index 44d8dc33d..fefdf266b 100644 --- a/modules/util/tooltip.js +++ b/modules/util/tooltip.js @@ -1,6 +1,7 @@ -import * as d3 from 'd3'; +import { select as d3_select } from 'd3-selection'; import { utilFunctor } from './index'; + export function tooltip() { var tooltip = function(selection) { selection.each(setup); @@ -82,7 +83,7 @@ export function tooltip() { function setup() { - var root = d3.select(this), + var root = d3_select(this), animate = animation.apply(this, arguments), tip = root.selectAll('.tooltip').data([0]); @@ -114,7 +115,7 @@ export function tooltip() { function show() { - var root = d3.select(this), + var root = d3_select(this), content = title.apply(this, arguments), tip = root.selectAll('.tooltip') .classed('in', true), @@ -152,7 +153,7 @@ export function tooltip() { function hide() { - d3.select(this).selectAll('.tooltip') + d3_select(this).selectAll('.tooltip') .classed('in', false); this.tooltipVisible = false; @@ -172,7 +173,7 @@ export function tooltip() { function getPosition(node) { - var mode = d3.select(node).style('position'); + var mode = d3_select(node).style('position'); if (mode === 'absolute' || mode === 'static') { return { x: node.offsetLeft, diff --git a/modules/util/util.js b/modules/util/util.js index f3edcc91a..c9a22fa43 100644 --- a/modules/util/util.js +++ b/modules/util/util.js @@ -1,4 +1,5 @@ -import * as d3 from 'd3'; +import _map from 'lodash-es/map'; + import { t, textDirection } from './locale'; import { utilDetect } from './detect'; import { remove as removeDiacritics } from 'diacritics'; @@ -6,8 +7,8 @@ import { fixRTLTextForSvg, rtlRegex } from './svg_paths_rtl_fix'; export function utilTagText(entity) { - return d3.entries(entity.tags).map(function(e) { - return e.key + '=' + e.value; + return _map(entity.tags, function(v, k) { + return k + '=' + v; }).join(', '); }