diff --git a/labs/lab5/src/App.jsx b/labs/lab5/src/App.jsx index f194b2d..d34ab2a 100644 --- a/labs/lab5/src/App.jsx +++ b/labs/lab5/src/App.jsx @@ -3,7 +3,7 @@ import Table from './components/Table.jsx'; import buildings from './data.js'; import './CSS/App.css' import Chart from './components/Chart.jsx' -import Task from './Task.jsx' +import Task from './components/Task.jsx' function App() { @@ -14,7 +14,7 @@ function App() {
Totoal:{totalClickCount}
- > - ) -} - - -export default Task; \ No newline at end of file diff --git a/labs/lab5/src/components/Chart.jsx b/labs/lab5/src/components/Chart.jsx index 19d537e..8b960c4 100644 --- a/labs/lab5/src/components/Chart.jsx +++ b/labs/lab5/src/components/Chart.jsx @@ -6,14 +6,22 @@ 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([event.target["oy"][0].checked, event.target["oy"][1].checked]); + 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]); @@ -28,24 +36,24 @@ const Chart = (props) => { return ( <>