normal_table = {
let div = d3.create('div');
let table = div
.append('table')
.attr('border', '0')
.attr('align', 'center')
.attr('cellspacing', '2')
.attr('cellpadding', 3);
let first_row = table.append('tr');
first_row
.append('th')
.attr('class', 'tex')
.html('Z');
for (let j = 0; j < 0.09999; j = j + 0.01) {
first_row
.append('th')
.attr('col', `${Math.round(100 * j)}`)
.text(d3.format("0.2f")(j));
}
for (let i = 0; i <= 3.4001; i = i + 0.1) {
let row = d3.create('tr');
row
.append('th')
.text(d3.format("0.1f")(i))
.attr('row', `${Math.round(10 * i)}`);
for (let j = 0; j < 0.0999; j = j + 0.01) {
let td = row
.append('td')
.attr('row', `${Math.round(10 * i)}`)
.attr('col', `${Math.round(100 * j)}`)
.attr('title', `Z = ${d3.format('0.2f')(i + j)}`)
.text(normal(i + j));
const tip = tippy(td.node(), {
delay: [50, 0],
duration: [200, 50],
placement: 'top',
arrow: true
});
}
table.append(() => row.node());
}
div
.selectAll('td')
.on('mouseover', function() {
let row = d3.select(this).attr('row');
let col = d3.select(this).attr('col');
d3.selectAll(`[row="${row}"]`).attr('bgcolor', '#ddd');
d3.selectAll(`[col="${col}"]`).attr('bgcolor', '#ddd');
})
.on('mouseleave', function() {
let row = d3.select(this).attr('row');
let col = d3.select(this).attr('col');
d3.selectAll(`[row="${row}"]`).attr('bgcolor', '#fff');
d3.selectAll(`[col="${col}"]`).attr('bgcolor', '#fff');
});
return div.node();
}