lab 5 done (again)

This commit is contained in:
2026-04-10 11:39:35 +10:00
parent 084d3ed9ca
commit b9871c38e6
3 changed files with 11 additions and 6 deletions

View File

@@ -4,14 +4,16 @@ import buildings from './data.js';
import './CSS/App.css'
import Chart from './components/Chart.jsx'
import Task from './Task.jsx'
function App() {
const [count, setCount] = useState(0)
const [filteredData, setFilteredData] = useState(buildings);
return (
<div className="App">
<h3>Самые высокие здания и сооружения</h3>
<Chart data={ buildings }/>
<Table data={ buildings } amountRows="15" />
<Chart data={ filteredData } />
<Table data={ buildings } setFilteredDataCallback={setFilteredData} amountRows="15" />
{/* <Task/> */}
</div>
)

View File

@@ -6,7 +6,7 @@ function drawGraph(data, keyX, drawMin, drawMax, graphtype) {
// значения по оси ОХ
// создаем массив для построения графика
console.log(keyX)
// console.log(keyX)
if(keyX=="Год"){
data = d3.sort(data, (x,y)=>Number(x["labelX"])-Number(y["labelX"]));
}
@@ -145,7 +145,7 @@ const ChartDraw = (props) => {
.attr("width", boundsWidth)
.attr("height", boundsHeight)
.style("fill", "lightgrey");
console.log(props)
// console.log(props)
drawGraph(props.data,props.ox,props.minMax[0],props.minMax[1],Number(props.graphType))
});

View File

@@ -13,7 +13,10 @@ const Table = (props) => {
const [activePage, setActivePage] = useState("1");
const [dataTable, setDataTable] = useState(props.data);
const updateDataTable = (value) => setDataTable(value);
const updateDataTable = (value) => {
props.setFilteredDataCallback(value);
setDataTable(value);
};
const changeActive = (event) => {
setActivePage(event.target.innerHTML);