handleiding_nieuw:sub_spacematrix
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
handleiding_nieuw:sub_spacematrix [2025/04/15 15:12] – support | handleiding_nieuw:sub_spacematrix [2025/04/15 15:51] (current) – support | ||
---|---|---|---|
Line 8: | Line 8: | ||
} | } | ||
.inputrow label { | .inputrow label { | ||
- | width: | + | width: |
} | } | ||
.inputrow input { | .inputrow input { | ||
Line 16: | Line 16: | ||
margin-left: | margin-left: | ||
font-size: 0.9em; | font-size: 0.9em; | ||
+ | min-width: 200px; | ||
+ | text-align: right; | ||
} | } | ||
table.rekenblok { | table.rekenblok { | ||
border-collapse: | border-collapse: | ||
- | margin-top: | + | margin-top: |
font-size: 0.9em; | font-size: 0.9em; | ||
- | width: auto; | ||
} | } | ||
table.rekenblok td, table.rekenblok th { | table.rekenblok td, table.rekenblok th { | ||
Line 39: | Line 40: | ||
top: 0; | top: 0; | ||
right: 0; | right: 0; | ||
- | width: | + | width: |
- | margin-top: 10px; | + | |
} | } | ||
.kaartcontainer img { | .kaartcontainer img { | ||
Line 83: | Line 83: | ||
<div class=" | <div class=" | ||
<label for=" | <label for=" | ||
- | <input id=" | + | <input id=" |
<div class=" | <div class=" | ||
</ | </ | ||
- | <button onclick="bereken()">Bereken</ | + | <div style="margin-top: 30px;"> |
<table class=" | <table class=" | ||
< | < | ||
<tr> | <tr> | ||
< | < | ||
- | < | + | < |
- | < | + | < |
< | < | ||
< | < | ||
Line 110: | Line 109: | ||
</ | </ | ||
</ | </ | ||
+ | </ | ||
< | < | ||
Line 127: | Line 127: | ||
row.innerHTML = ` | row.innerHTML = ` | ||
<td style=" | <td style=" | ||
- | < | + | < |
- | < | + | < |
<td id=" | <td id=" | ||
<td id=" | <td id=" | ||
Line 141: | Line 141: | ||
function updateStipje(fsi, | function updateStipje(fsi, | ||
const stip = document.getElementById(" | const stip = document.getElementById(" | ||
- | const x = Math.min(100, | + | const x = Math.min(100, |
- | const y = Math.max(0, Math.min(100, | + | const y = Math.max(0, Math.min(100, |
stip.style.left = `${x}%`; | stip.style.left = `${x}%`; | ||
stip.style.top = `${y}%`; | stip.style.top = `${y}%`; | ||
Line 153: | Line 153: | ||
const voorzieningPerc = parseFloat(document.getElementById(" | const voorzieningPerc = parseFloat(document.getElementById(" | ||
- | const laadvermogen = opp * fsi; | + | const laadvermogen = Math.round(opp * fsi); |
- | const bvoVoorzieningen = laadvermogen * voorzieningPerc; | + | const bvoVoorzieningen = Math.round(laadvermogen * voorzieningPerc); |
const bvoWonen = laadvermogen - bvoVoorzieningen; | const bvoWonen = laadvermogen - bvoVoorzieningen; | ||
- | document.getElementById(" | ||
document.getElementById(" | document.getElementById(" | ||
document.getElementById(" | document.getElementById(" | ||
Line 170: | Line 169: | ||
const fsi = parseFloat(document.getElementById(" | const fsi = parseFloat(document.getElementById(" | ||
const voorzieningPerc = parseFloat(document.getElementById(" | const voorzieningPerc = parseFloat(document.getElementById(" | ||
- | |||
const laadvermogen = opp * fsi; | const laadvermogen = opp * fsi; | ||
const woonBVO = laadvermogen * (1 - voorzieningPerc); | const woonBVO = laadvermogen * (1 - voorzieningPerc); | ||
Line 179: | Line 177: | ||
for (let i = 0; i < types.length; | for (let i = 0; i < types.length; | ||
- | const perc = parseFloat(document.getElementById(`perc_${i}`).value); | + | const perc = parseFloat(document.getElementById(`perc_${i}`).value) |
- | const bvo = parseFloat(document.getElementById(`bvo_${i}`).value); | + | const bvo = parseFloat(document.getElementById(`bvo_${i}`).value) |
gewogenBVO += (perc / 100) * bvo; | gewogenBVO += (perc / 100) * bvo; | ||
totalPerc += perc; | totalPerc += perc; | ||
Line 186: | Line 184: | ||
} | } | ||
- | if (totalPerc | + | if (totalPerc === 0 || gewogenBVO |
- | document.getElementById(" | + | |
- | | + | |
- | } | + | |
- | const totaalWoningen | + | const totaalWoningenExact |
let sumWon = 0; | let sumWon = 0; | ||
let sumBVO = 0; | let sumBVO = 0; | ||
+ | let wonPerType = []; | ||
- | | + | |
- | const aant = Math.round((perc / 100) * totaalWoningen); | + | for (let i = 0; i < details.length; |
- | const bvoTot = aant * bvo; | + | const { perc } = details[i]; |
+ | let aant = (perc / 100) * totaalWoningenExact; | ||
+ | let afgerond | ||
+ | wonPerType.push(afgerond); | ||
+ | restant -= afgerond; | ||
+ | } | ||
+ | |||
+ | const decimaalSort = details.map((d, | ||
+ | i, rest: ((d.perc / 100) * totaalWoningenExact) % 1 | ||
+ | })).sort((a, | ||
+ | |||
+ | for (let j = 0; j < restant; j++) { | ||
+ | wonPerType[decimaalSort[j].i]++; | ||
+ | } | ||
+ | |||
+ | for (let i = 0; i < details.length; | ||
+ | const aant = wonPerType[i]; | ||
+ | const bvoTot = aant * details[i].bvo; | ||
document.getElementById(`aantal_${i}`).innerText = formatGetal(aant); | document.getElementById(`aantal_${i}`).innerText = formatGetal(aant); | ||
document.getElementById(`totbvo_${i}`).innerText = formatGetal(bvoTot); | document.getElementById(`totbvo_${i}`).innerText = formatGetal(bvoTot); | ||
sumWon += aant; | sumWon += aant; | ||
sumBVO += bvoTot; | sumBVO += bvoTot; | ||
- | }); | + | } |
document.getElementById(" | document.getElementById(" | ||
Line 211: | Line 224: | ||
document.getElementById(" | document.getElementById(" | ||
< | < | ||
- | < | + | < |
`; | `; | ||
} | } | ||
Line 218: | Line 231: | ||
</ | </ | ||
</ | </ | ||
+ |
handleiding_nieuw/sub_spacematrix.1744729942.txt.gz · Last modified: 2025/04/15 15:12 by support