WIP command center

This commit is contained in:
Daniel Barbero Martin 2021-03-25 16:50:24 +01:00
parent 586707d12a
commit d92adfc008
1 changed files with 45 additions and 0 deletions

View File

@ -1939,3 +1939,48 @@ function ajaxRequest(id, settings) {
}
});
}
function progressBarSvg(option) {
var svgNS = "http://www.w3.org/2000/svg";
// SVG container.
var svg = document.createElementNS(svgNS, "svg");
var backgroundRect = document.createElementNS(svgNS, "rect");
backgroundRect.setAttribute("fill", option.color);
backgroundRect.setAttribute("fill-opacity", "0.5");
backgroundRect.setAttribute("width", "100%");
backgroundRect.setAttribute("height", "100%");
backgroundRect.setAttribute("rx", "5");
backgroundRect.setAttribute("ry", "5");
var progressRect = document.createElementNS(svgNS, "rect");
progressRect.setAttribute("fill", option.colorfill);
progressRect.setAttribute("fill-opacity", "1");
progressRect.setAttribute("width", option.start + "%");
progressRect.setAttribute("height", "100%");
progressRect.setAttribute("rx", "5");
progressRect.setAttribute("ry", "5");
var text = document.createElementNS(svgNS, "text");
text.setAttribute("text-anchor", "middle");
text.setAttribute("alignment-baseline", "middle");
text.setAttribute("font-size", "15");
text.setAttribute("font-family", "arial");
text.setAttribute("font-weight", "bold");
text.setAttribute("transform", `translate(10, 17.5)`);
text.setAttribute("fill", "green");
//if (this.props.valueType === "value") {
// text.style.fontSize = "6pt";
//
// text.textContent = this.props.unit
// ? `${formatValue} ${this.props.unit}`
// : `${formatValue}`;
//} else {
// text.textContent = `${progress}%`;
//}
svg.setAttribute("width", "100%");
svg.setAttribute("height", "100%");
svg.append(backgroundRect, progressRect, text);
return svg;
}