/** * @format */ import './style.css' import React, {FC, useEffect, useState} from 'react' import { XAxis, YAxis, CartesianGrid, Tooltip, Brush, LineChart, Line, ResponsiveContainer, Label, Legend, LabelList } from 'recharts' import { scatterDataFormatter, nFormatter, setChartTicks, tickFormatter } from '../../common/utils' import {CustomLabel, CustomTooltip} from './ChartElemets' import {ChartOptions, TimePeriods} from '../../types/types' import {useChartActiveDataPoints} from '../../hooks/useChartActiveDataPoints' const dotStyle = {stroke: '#233876', fill: '#233876', strokeWidth: 4} export const ScatterChartComponent: FC = ({ data, xAxisLabeL, yAxisLabeL, currentTimePeriod }) => { const [activeLegends, handleDotClick] = useChartActiveDataPoints() const [processedData, setProcessedData] = useState(data) useEffect(() => { setProcessedData(scatterDataFormatter(data, currentTimePeriod)) }, [data]) return ( <> { handleDotClick(chartState, event) }}> tickFormatter(tick, currentTimePeriod)}> nFormatter(tick, 3)}> } /> } > ( )} /> ) }