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 14:37] – support | handleiding_nieuw:sub_spacematrix [2025/04/15 15:51] (current) – support | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | <HTML> | + | <html> |
< | < | ||
+ | .inputrow { | ||
+ | display: flex; | ||
+ | align-items: | ||
+ | gap: 10px; | ||
+ | margin-bottom: | ||
+ | } | ||
+ | .inputrow label { | ||
+ | width: 200px; | ||
+ | } | ||
+ | .inputrow input { | ||
+ | width: 80px; | ||
+ | } | ||
+ | .resultblock { | ||
+ | margin-left: | ||
+ | font-size: 0.9em; | ||
+ | min-width: 200px; | ||
+ | text-align: right; | ||
+ | } | ||
+ | table.rekenblok { | ||
+ | border-collapse: | ||
+ | margin-top: 25px; | ||
+ | font-size: 0.9em; | ||
+ | } | ||
table.rekenblok td, table.rekenblok th { | table.rekenblok td, table.rekenblok th { | ||
- | padding: 4px 8px; | + | padding: 4px 6px; |
border: 1px solid #ccc; | border: 1px solid #ccc; | ||
text-align: right; | text-align: right; | ||
Line 8: | Line 31: | ||
table.rekenblok th { | table.rekenblok th { | ||
background-color: | background-color: | ||
+ | } | ||
+ | .scheiding td { | ||
+ | background-color: | ||
+ | border-top: 2px solid #666; | ||
+ | } | ||
+ | .kaartcontainer { | ||
+ | position: absolute; | ||
+ | top: 0; | ||
+ | right: 0; | ||
+ | width: 320px; | ||
+ | } | ||
+ | .kaartcontainer img { | ||
+ | width: 100%; | ||
+ | display: block; | ||
+ | } | ||
+ | .stipje { | ||
+ | position: absolute; | ||
+ | width: 14px; | ||
+ | height: 14px; | ||
+ | background: red; | ||
+ | border-radius: | ||
+ | transform: translate(-50%, | ||
+ | border: 2px solid white; | ||
} | } | ||
</ | </ | ||
+ | |||
+ | <div style=" | ||
+ | <div class=" | ||
+ | <img src=" | ||
+ | <div class=" | ||
+ | </ | ||
+ | </ | ||
< | < | ||
- | < | + | <div class=" |
- | < | + | |
- | < | + | |
- | < | + | <div class=" |
+ | </div> | ||
+ | <div class=" | ||
+ | | ||
+ | | ||
+ | <div class=" | ||
+ | </div> | ||
+ | <div class=" | ||
+ | | ||
+ | | ||
+ | <div class=" | ||
+ | </div> | ||
+ | <div class=" | ||
+ | | ||
+ | | ||
+ | | ||
+ | </div> | ||
+ | <div style=" | ||
<table class=" | <table class=" | ||
< | < | ||
<tr> | <tr> | ||
< | < | ||
- | < | + | < |
- | < | + | < |
+ | < | ||
+ | < | ||
</tr> | </tr> | ||
</ | </ | ||
- | <tbody id=" | + | <tbody id=" |
- | <!-- Dynamisch gevuld via JS --> | + | <tfoot> |
- | </tbody> | + | <tr class=" |
+ | < | ||
+ | <td id=" | ||
+ | <td id=" | ||
+ | <td id=" | ||
+ | <td id=" | ||
+ | </tr> | ||
+ | </tfoot> | ||
</ | </ | ||
- | < | + | </div> |
- | <button onclick=" | + | |
< | < | ||
Line 43: | Line 121: | ||
const tbody = document.getElementById(" | const tbody = document.getElementById(" | ||
+ | |||
types.forEach((type, | types.forEach((type, | ||
const row = document.createElement(" | const row = document.createElement(" | ||
+ | if (i === 5) row.className = " | ||
row.innerHTML = ` | row.innerHTML = ` | ||
<td style=" | <td style=" | ||
- | < | + | < |
- | < | + | < |
+ | <td id=" | ||
+ | <td id=" | ||
`; | `; | ||
tbody.appendChild(row); | tbody.appendChild(row); | ||
}); | }); | ||
- | function | + | function |
+ | return n.toLocaleString(" | ||
+ | } | ||
+ | |||
+ | function updateStipje(fsi, | ||
+ | const stip = document.getElementById(" | ||
+ | const x = Math.min(100, | ||
+ | const y = Math.max(0, Math.min(100, | ||
+ | stip.style.left = `${x}%`; | ||
+ | stip.style.top = `${y}%`; | ||
+ | } | ||
+ | |||
+ | function updateLaadvermogen() { | ||
const opp = parseFloat(document.getElementById(" | const opp = parseFloat(document.getElementById(" | ||
const fsi = parseFloat(document.getElementById(" | const fsi = parseFloat(document.getElementById(" | ||
+ | const gsi = parseFloat(document.getElementById(" | ||
const voorzieningPerc = parseFloat(document.getElementById(" | const voorzieningPerc = parseFloat(document.getElementById(" | ||
+ | const laadvermogen = Math.round(opp * fsi); | ||
+ | const bvoVoorzieningen = Math.round(laadvermogen * voorzieningPerc); | ||
+ | const bvoWonen = laadvermogen - bvoVoorzieningen; | ||
+ | |||
+ | document.getElementById(" | ||
+ | document.getElementById(" | ||
+ | document.getElementById(" | ||
+ | |||
+ | updateStipje(fsi, | ||
+ | bereken(); | ||
+ | } | ||
+ | |||
+ | function bereken() { | ||
+ | const opp = parseFloat(document.getElementById(" | ||
+ | const fsi = 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 66: | 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; | ||
- | details.push({ | + | details.push({ i, perc, bvo }); |
} | } | ||
- | if (totalPerc | + | if (totalPerc === 0 || gewogenBVO === 0) return; |
- | | + | |
- | | + | const totaalWoningenExact = woonBVO / gewogenBVO; |
+ | let sumWon = 0; | ||
+ | let sumBVO = 0; | ||
+ | let wonPerType = []; | ||
+ | |||
+ | let restant = Math.round(totaalWoningenExact); | ||
+ | for (let i = 0; i < details.length; i++) { | ||
+ | const { perc } = details[i]; | ||
+ | let aant = (perc / 100) * totaalWoningenExact; | ||
+ | let afgerond = Math.floor(aant); | ||
+ | | ||
+ | restant -= afgerond; | ||
} | } | ||
- | const totaalWoningen | + | const decimaalSort |
- | let html = `<p>< | + | i, rest: ((d.perc |
- | | + | |
- | html += `<b>Totaal aantal woningen:</ | + | |
- | | + | |
- | details.forEach(({ type, perc, bvo }) => { | + | |
- | | + | } |
- | const bvoTot = aant * bvo; | + | |
- | html += `< | + | |
- | }); | + | |
- | html += "</ | + | |
- | document.getElementById(" | + | |
+ | const aant = wonPerType[i]; | ||
+ | const bvoTot = aant * details[i].bvo; | ||
+ | document.getElementById(`aantal_${i}`).innerText = formatGetal(aant); | ||
+ | document.getElementById(`totbvo_${i}`).innerText = formatGetal(bvoTot); | ||
+ | sumWon += aant; | ||
+ | sumBVO += bvoTot; | ||
+ | } | ||
+ | |||
+ | document.getElementById(" | ||
+ | document.getElementById(" | ||
+ | document.getElementById(" | ||
+ | document.getElementById(" | ||
+ | |||
+ | | ||
+ | < | ||
+ | < | ||
+ | `; | ||
} | } | ||
+ | |||
+ | updateLaadvermogen(); | ||
</ | </ | ||
- | </HTML> | + | </html> |
handleiding_nieuw/sub_spacematrix.1744727866.txt.gz · Last modified: 2025/04/15 14:37 by support