-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
36 lines (27 loc) · 1.11 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { getAllPokemon, setUpData } from "./src/data";
import { createStackedBarChart } from "./src/charts/stackedBarchart";
import { createScatterPlotWeight } from "./src/charts/scatterplotWeight";
import { createScatterPlotHeight } from "./src/charts/scatterplotHeight";
import { createPolarChart } from "./src/charts/polarChart";
import "./style.css";
const scatterWeight = document.querySelector("#scatterplotWeight");
const scatterHeight = document.querySelector("#scatterplotHeight");
const toggleBtn = document.querySelector("#toggleScatterBtn");
toggleBtn.addEventListener("click", (e) => {
scatterWeight.classList.toggle("hidden");
scatterHeight.classList.toggle("hidden");
if (e.target.innerText === "Höhe") e.target.innerText = "Gewicht";
else e.target.innerText = "Höhe";
});
async function setUpDashboard() {
const allPokemon = await getAllPokemon();
setUpData(allPokemon);
drawAllCharts(allPokemon);
}
function drawAllCharts(allPokemon) {
createStackedBarChart(allPokemon);
createScatterPlotWeight(allPokemon);
createScatterPlotHeight(allPokemon);
createPolarChart();
}
setUpDashboard();