/* global d3 */ // Use the d3-tip library for tooltips. const tooltip = (() => { const tip = d3 .tip() .attr('class', 'd3-tip') .offset([-10, 0]) return (svgSelection, state) => { // Wish we could use D3 here for DOM manipulation.. tip.html(d => [ `

${d.year} ${d.name}

`, `
${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 } } })()