Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Improve survey-results bar styling

Robin Dekkersbe61bdf86c96
diff --git a/ui/component/or-survey-results/src/index.ts b/ui/component/or-survey-results/src/index.ts
index 4a5b77a9b..1105ae153 100644
--- a/ui/component/or-survey-results/src/index.ts
+++ b/ui/component/or-survey-results/src/index.ts
@@ -113,8 +113,8 @@ class OrSurveyResults extends LitElement {
${item.value.map((bar: ProcessedResultAnswer) => {
return html`
<div class="bar">
- <span style="height:${this.computeHeight(bar.count)}%;">
- <div class="bar-top-label">${this.computeHeight(bar.count)}%</div>
+ <span style="height:${this.computeHeight(bar.count)};">
+ <div class="bar-top-label">${this.computeHeight(bar.count)}</div>
<label>${bar.name} (${bar.count})</label>
</span>
</div>
@@ -169,12 +169,13 @@ class OrSurveyResults extends LitElement {
}
+
computeHeight(barAmount: number) {
if (barAmount && this.survey && this.survey.attributes) {
const maxAmount = this.survey.attributes.responseAmount.value;
- return Math.round((barAmount / maxAmount) * 100);
+ return Math.round((barAmount / maxAmount) * 100)+"%";
} else {
- return 0;
+ return "0%";
}
}
diff --git a/ui/component/or-survey-results/src/style.ts b/ui/component/or-survey-results/src/style.ts
index 3f0a919f1..d2c447dc4 100644
--- a/ui/component/or-survey-results/src/style.ts
+++ b/ui/component/or-survey-results/src/style.ts
@@ -167,7 +167,7 @@ export const surveyResultStyle = html`
position: relative;
margin-top: -16px;
line-height: 12px;
- font-size: 12px;
+ font-size: 11px;
}
@keyframes draw {