function showTooltip(d, i, options, popoverTooltip) { // test the bootstrap.native import // console.log('bsn', bsn); // var Popover = bsn.__moduleExports.Popover; const idVariable = options.idVariable; const xVariable = options.xVariable; const yVariable = options.yVariable; const xSelector = options.xSelector; const ySelector = options.ySelector; const tip = options.tip; const wrapper = options.wrapper; const height = options.height; const width = options.width; const tooltipVariables = options.tooltipVariables; const xDroplineTextFormat = options.xDroplineTextFormat; const yDroplineTextFormat = options.yDroplineTextFormat; // Save the circle element (so not the voronoi which is triggering the hover event) // in a variable by using the unique class of the voronoi (idVariable) let elementSelector; if (typeof d.datum !== 'undefined' && typeof d.datum[idVariable] !== 'undefined') { elementSelector = `.marks.${d.datum[idVariable]}`; } else { elementSelector = `.marks.${d[idVariable]}`; } console.log('elementSelector from showTooltip', elementSelector); const element = d3.selectAll(elementSelector); const el = element._groups[0]; function generateHTML() { // console.log('d from tooltip html function', d); let allRows = ''; tooltipVariables.forEach(e => { let currentValue; let f; if (typeof d.datum !== 'undefined') { f = d.datum; } else { f = d; } // now parse based on the format if (typeof e.format !== 'undefined') { if (e.type === 'time') { // time formatting const inputValue = new Date(Number(f[e.name])); // TODO: handle case where date values are strings const currentFormat = d3.timeFormat(e.format); currentValue = currentFormat(inputValue); } else { // number formatting const _inputValue = Number(f[e.name]); const _currentFormat = d3.format(e.format); currentValue = _currentFormat(_inputValue); } } else { // no formatting currentValue = f[e.name]; } let currentText; if (typeof e.valueOnly !== 'undefined') { currentText = `${currentValue}`; } else { currentText = `${e.name} ${currentValue}`; } const currentRow = `${currentText}`; allRows = allRows.concat(currentRow); }); const html = `