import { useState } from "react"; import ChartDraw from './ChartDraw.jsx'; import * as d3 from "d3"; const Chart = (props) => { const [ox, setOx] = useState("Страна"); const [oy, setOy] = useState([true, false]); const [oyBuf, setOyBuf] = useState([true, false]); const [graphType, setGraphType] = useState(0); const handleSubmit = (event) => { event.preventDefault(); setOx(event.target["ox"].value); setOy(oyBuf); setGraphType(event.target["graphType"].value); } const handleCheckboxes = (event)=>{ let buf = [...oyBuf]; buf[Number(event.target.id)]=event.target.checked; setOyBuf(buf); console.log(buf) } const createArrGraph = (data, key) => { const groupObj = d3.group(data, d => d[key]); let arrGraph = []; for (let entry of groupObj) { let minMax = d3.extent(entry[1].map(d => d['Высота'])); arrGraph.push({ labelX: entry[0], values: minMax }); } return arrGraph; } return ( <>