20 lines
643 B
JavaScript
20 lines
643 B
JavaScript
class UIUtils {
|
|
|
|
static instantiateTemplate(templateId) {
|
|
return document.getElementById(templateId).content.firstElementChild.cloneNode(true);
|
|
}
|
|
|
|
static createChartViewElementWithHeading(heading) {
|
|
const chartViewElement = UIUtils.instantiateTemplate('template-ChartView');
|
|
chartViewElement.querySelector(".heading").textContent = heading;
|
|
return {
|
|
chartViewElement: chartViewElement,
|
|
canvas: chartViewElement.querySelector(".canvas")
|
|
};
|
|
}
|
|
|
|
static getSelectedOption(selectElement) {
|
|
return selectElement.options[selectElement.selectedIndex];
|
|
}
|
|
}
|