mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
Visual Console Refactor: bugfix
Former-commit-id: 289d60e26486a0ddb2447841fe921fe84ea8871c
This commit is contained in:
parent
be5f68de80
commit
23bdde8400
@ -168,10 +168,10 @@ export default class Percentile extends Item<PercentileProps> {
|
|||||||
text.setAttribute("font-size", "16");
|
text.setAttribute("font-size", "16");
|
||||||
text.setAttribute("font-family", "arial");
|
text.setAttribute("font-family", "arial");
|
||||||
text.setAttribute("font-weight", "bold");
|
text.setAttribute("font-weight", "bold");
|
||||||
text.setAttribute("transform", "translate(50 32)");
|
|
||||||
text.setAttribute("fill", this.props.labelColor || "#FFFFFF");
|
text.setAttribute("fill", this.props.labelColor || "#FFFFFF");
|
||||||
|
|
||||||
if (this.props.valueType === "value") {
|
if (this.props.valueType === "value") {
|
||||||
|
if (this.props.unit && this.props.unit.length > 0) {
|
||||||
const value = document.createElementNS(svgNS, "tspan");
|
const value = document.createElementNS(svgNS, "tspan");
|
||||||
value.setAttribute("x", "0");
|
value.setAttribute("x", "0");
|
||||||
value.setAttribute("dy", "1em");
|
value.setAttribute("dy", "1em");
|
||||||
@ -179,12 +179,16 @@ export default class Percentile extends Item<PercentileProps> {
|
|||||||
const unit = document.createElementNS(svgNS, "tspan");
|
const unit = document.createElementNS(svgNS, "tspan");
|
||||||
unit.setAttribute("x", "0");
|
unit.setAttribute("x", "0");
|
||||||
unit.setAttribute("dy", "1em");
|
unit.setAttribute("dy", "1em");
|
||||||
if (this.props.unit) {
|
|
||||||
unit.textContent = `${this.props.unit}`;
|
unit.textContent = `${this.props.unit}`;
|
||||||
}
|
|
||||||
text.append(value, unit);
|
text.append(value, unit);
|
||||||
|
text.setAttribute("transform", "translate(50 33)");
|
||||||
|
} else {
|
||||||
|
text.textContent = `${this.props.value}`;
|
||||||
|
text.setAttribute("transform", "translate(50 50)");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
text.textContent = `${progress}%`;
|
text.textContent = `${progress}%`;
|
||||||
|
text.setAttribute("transform", "translate(50 50)");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Auto resize SVG using the view box magic: https://css-tricks.com/scale-svg/
|
// Auto resize SVG using the view box magic: https://css-tricks.com/scale-svg/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user