From 883916609015be15d4233d9942913343cac92279 Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Wed, 25 Jun 2014 14:53:39 +0200 Subject: [PATCH] Add number format 'none' to InlinePie --- library/Icinga/Web/Widget/Chart/InlinePie.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/library/Icinga/Web/Widget/Chart/InlinePie.php b/library/Icinga/Web/Widget/Chart/InlinePie.php index f9fac171a..f35312f9e 100644 --- a/library/Icinga/Web/Widget/Chart/InlinePie.php +++ b/library/Icinga/Web/Widget/Chart/InlinePie.php @@ -46,7 +46,8 @@ use Icinga\Logger\Logger; */ class InlinePie extends AbstractWidget { - const NUMBER_FORMAT_TIME = 'time'; + const NUMBER_FORMAT_NONE = 'none'; + const NUMBER_FORMAT_TIME = 'time'; const NUMBER_FORMAT_BYTES = 'bytes'; const NUMBER_FORMAT_RATIO = 'ratio'; @@ -168,7 +169,7 @@ EOD; * * @var array */ - private $format = self::NUMBER_FORMAT_BYTES; + private $format = self::NUMBER_FORMAT_NONE; /** * Set if the tooltip for the empty area should be hidden @@ -396,11 +397,13 @@ EOD; */ private function formatValue($value) { - if ($this->format === self::NUMBER_FORMAT_BYTES) { + if ($this->format === self::NUMBER_FORMAT_NONE) { + return (string)$value; + } elseif ($this->format === self::NUMBER_FORMAT_BYTES) { return Format::bytes($value); - } else if ($this->format === self::NUMBER_FORMAT_TIME) { + } elseif ($this->format === self::NUMBER_FORMAT_TIME) { return Format::duration($value); - } else if ($this->format === self::NUMBER_FORMAT_RATIO) { + } elseif ($this->format === self::NUMBER_FORMAT_RATIO) { return $value; } else { Logger::warning('Unknown format string "' . $this->format . '" for InlinePie, value not formatted.');