Skip to content

Commit

Permalink
älä näytä 0 prosenttisia
Browse files Browse the repository at this point in the history
  • Loading branch information
ArttuKuikka committed Dec 31, 2023
1 parent 6dc9ee2 commit 41e56c3
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions wwwroot/js/aanestys.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,12 @@ function createPercentageBar(level1, level2, level3, level4, body) {
var bar1text = document.createElement('p');
bar1text.classList.add('percentage-' + listOfPercentages[0].level);
bar1text.textContent = listOfPercentages[0].procentage + '%';
if(listOfPercentages[0].procentage === 0){
bar1text.hidden = true;
}
bar1.appendChild(bar1text);
colorbardiv.appendChild(bar1);


//second bar
var bar2 = document.createElement('div');
Expand All @@ -168,8 +172,12 @@ function createPercentageBar(level1, level2, level3, level4, body) {
var bar2text = document.createElement('p');
bar2text.classList.add('percentage-' + listOfPercentages[1].level);
bar2text.textContent = listOfPercentages[1].procentage + '%';
if(listOfPercentages[1].procentage === 0){
bar2text.hidden = true;
}
bar2.appendChild(bar2text);
colorbardiv.appendChild(bar2);


//third bar
var bar3 = document.createElement('div');
Expand All @@ -182,8 +190,12 @@ function createPercentageBar(level1, level2, level3, level4, body) {
var bar3text = document.createElement('p');
bar3text.classList.add('percentage-' + listOfPercentages[2].level);
bar3text.textContent = listOfPercentages[2].procentage + '%';
if(listOfPercentages[2].procentage === 0){
bar3text.hidden = true;
}
bar3.appendChild(bar3text);
colorbardiv.appendChild(bar3);


//fourth bar
var bar4 = document.createElement('div');
Expand All @@ -195,8 +207,12 @@ function createPercentageBar(level1, level2, level3, level4, body) {
bar4text.classList.add('percentage-' + listOfPercentages[3].level);
bar4text.textContent = listOfPercentages[3].procentage + '%';
bar4.style.borderRadius = '0px 10px 10px 0px';
if(listOfPercentages[3].procentage === 0){
bar4text.hidden = true;
}
bar4.appendChild(bar4text);
colorbardiv.appendChild(bar4);



body.appendChild(colorbardiv);
Expand Down

0 comments on commit 41e56c3

Please sign in to comment.