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:22] – support | handleiding_nieuw:sub_spacematrix [2025/04/15 15:51] (current) – support | ||
---|---|---|---|
Line 86: | Line 86: | ||
<div class=" | <div class=" | ||
</ | </ | ||
- | |||
- | <button onclick=" | ||
<div style=" | <div style=" | ||
Line 94: | Line 92: | ||
<tr> | <tr> | ||
< | < | ||
- | <th style=" | + | <th style=" |
- | <th style=" | + | <th style=" |
< | < | ||
< | < | ||
Line 129: | Line 127: | ||
row.innerHTML = ` | row.innerHTML = ` | ||
<td style=" | <td style=" | ||
- | < | + | < |
- | < | + | < |
<td id=" | <td id=" | ||
<td id=" | <td id=" | ||
Line 143: | Line 141: | ||
function updateStipje(fsi, | function updateStipje(fsi, | ||
const stip = document.getElementById(" | const stip = document.getElementById(" | ||
- | | + | 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 160: | Line 157: | ||
const bvoWonen = laadvermogen - bvoVoorzieningen; | const bvoWonen = laadvermogen - bvoVoorzieningen; | ||
- | document.getElementById(" | ||
document.getElementById(" | document.getElementById(" | ||
document.getElementById(" | document.getElementById(" | ||
Line 173: | 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 182: | 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 189: | Line 184: | ||
} | } | ||
- | if (totalPerc === 0) return; | + | if (totalPerc |
- | 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 208: | Line 221: | ||
document.getElementById(" | document.getElementById(" | ||
document.getElementById(" | document.getElementById(" | ||
- | |||
- | let msg = ""; | ||
- | if (totalPerc !== 100) { | ||
- | msg = `<p style=" | ||
- | } | ||
document.getElementById(" | document.getElementById(" | ||
< | < | ||
- | < | + | < |
- | ${msg} | + | |
`; | `; | ||
} | } | ||
Line 224: | Line 231: | ||
</ | </ | ||
</ | </ | ||
+ |
handleiding_nieuw/sub_spacematrix.1744730554.txt.gz · Last modified: 2025/04/15 15:22 by support