fix: move constant definition inside hook

This commit is contained in:
Nikola Ubavic 2021-10-21 21:01:32 +02:00
parent f10f881e31
commit 3c79a44358

View file

@ -6,13 +6,12 @@ import { backgroundColor, java, neon } from 'src/styling/variables'
const RefScatterplot = ({ data: realData, timeFrame, timezone }) => {
const svgRef = useRef()
const dstOffset = parseInt(timezone.split(':')[1])
const drawGraph = useCallback(() => {
const svg = d3.select(svgRef.current)
const margin = { top: 25, right: 0, bottom: 25, left: 15 }
const width = 555 - margin.left - margin.right
const height = 150 - margin.top - margin.bottom
const dstOffset = parseInt(timezone.split(':')[1])
// finds maximum value for the Y axis. Minimum value is 100. If value is multiple of 1000, add 100
// (this is because the Y axis looks best with multiples of 100)
const findMaxY = () => {