reduce longer module name on odometers VC

This commit is contained in:
marcos 2021-09-03 14:59:39 +02:00
parent b3f4e68934
commit 197ae303e2
2 changed files with 11 additions and 1 deletions

View File

@ -53,6 +53,16 @@ final class Odometer extends Item
$return['thresholds'] = $this->extractThresholds($data);
$return['titleColor'] = $this->extractTitleColor($data);
$return['title'] = $this->extractTitle($data);
$module_text = $return['moduleName'];
$string_length = strlen($return['moduleName']);
if ($string_length >= 25) {
$module_text = substr($return['moduleName'], 0, 9);
$module_text .= ' ... ';
$module_text .= substr($return['moduleName'], -9);
}
$return['moduleName'] = $module_text;
$return['minMaxValue'] = $this->extractMinMaxValue($data);
return $return;

View File

@ -212,7 +212,7 @@ export default class Odometer extends Item<OdometerProps> {
} else {
h2.textContent = this.truncateTitle(this.props.title);
}
h2.style.fontSize = `12px`;
h2.style.fontSize = `${anchoB * 0.06}px`;
h2.style.color = `${this.props.titleColor}`;
h2.style.lineHeight = "0";