useEffect(() => {
console.log('useEffect()')
// console.log('data', data)
if (ref.current) {
d3.select(ref.current)
.select('.area')
.datum(data)
.transition()
.duration(1000)
.attr('d', areaGenerator)
}
// }, [ref.current, data])
})
// return () => window.removeEventListener('resize', onResize);
const onResize = () => {
if (!node.current) {
return false
}
const bounds = node.current.getBoundingClientRect()
changeWidth(bounds.width)
return () => window.removeEventListener('resize', onResize);
}
chart.svg.select('#xAxis')
.transition(d3.easeLinear)
.duration(1000)
.call(d3.axisBottom(chart.xScale));
chart.svg.select('#yAxis')
.transition(d3.easeLinear)
.duration(1000)
.call(d3.axisLeft(chart.yScale).tickSize(chart.graphWidth))
.call(g => g.select('.domain').remove())
.call(g => g
.selectAll('.tick:not(:first-of-type) line')
.attr('stroke-opacity', 0.5)
.attr('stroke-dasharray', '2,2')
)
.call(g => g.selectAll('.tick text').attr('dy', -4));
INSERT INTO people (pbfirstName, pblastName, pbcity, pbphoneNumber) VALUES
('user', 'one', 'сочи', '+7 (111) 111-11-11'),
('user', 'two', 'москва', '+7 (222) 222-22-22'),
('user', 'three', 'москва', '+7 (333) 333-33-33'),
('user', 'four', 'москва', '+7 (444) 444-44-44'),
('user', 'five', 'москва', '+7 (555) 555-55-55');