cardViz = {
const svg = d3
.create('svg')
.attr('width', width)
.attr('height', 500);
svg
.selectAll('cards')
.data(cards)
.enter()
.append('rect')
.attr('x', (d, i) => (width / 3) * i)
.attr('y', 100)
.attr('width', width / 3)
.attr('height', 300)
.attr('stroke', d => d3.interpolateViridis(d.value))
.attr('stroke-width', 20)
.attr('fill', 'none');
svg
.selectAll('cards')
.data(cards)
.enter()
.append('text')
.attr('x', (d, i) => (width / 3) * i + 100)
.attr('y', 150)
.attr('fill', d => d3.interpolateViridis(d.value))
.attr('font-family', 'impact')
.text(d => d.title)
.on('mouseover', function(d) {
d3.selectAll('.cards')
.transition()
.attr('opacity', 1);
});
svg
.selectAll('cards')
.data(cards)
.enter()
.append('text')
.attr('x', (d, i) => (width / 3) * i + 100)
.attr('y', 200)
.attr('fill', d => d3.interpolateViridis(d.value))
.attr('font-family', 'impact')
.text(d => d.content)
.attr('opacity', 0)
.attr('class', 'cards');
return svg.node();
}