/* global d3 */ // Use the d3-tip library for tooltips. const tooltip = ((() => { const tip = d3.tip() .attr('class', 'd3-tip') .offset([50, 10]); return (svgSelection, state) => { // Wish we could use D3 here for DOM manipulation.. tip.html(d => [ `
${state.radius}: `, `${d[state.radius]}
`, `
${state.x}: `, `${d[state.x]}
`, `
${state.y}: `, `${d[state.y]}
`, `
${state.color}: `, `${d[state.color]}
`, ].join('')); svgSelection.call(tip); return { show: tip.show, hide: tip.hide, }; }; })());