refactoring

This commit is contained in:
frankknoll
2023-04-18 17:21:41 +02:00
parent 71c7f8d261
commit 0fc151cccc
3 changed files with 23 additions and 9 deletions

View File

@@ -40,15 +40,14 @@ class HistogramTable {
]
},
{
render: (data, type, row, meta) => {
// FK-TODO: refactor
const numberWithBar = UIUtils.instantiateTemplate('template-number-with-bar');
const bar = numberWithBar.querySelector('.bar');
bar.style.width = (data / this.#sumFrequencies * 100).toString() + "%";
const number = numberWithBar.querySelector('.number');
number.textContent = data;
return numberWithBar.outerHTML;
},
render: frequency =>
NumberWithBarElementFactory
.createNumberWithBarElement(
{
number: frequency,
barLenInPercent: frequency / this.#sumFrequencies * 100
})
.outerHTML,
targets: [this.#getColumnIndex('Frequency')]
}
]