diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 13:21:35 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 13:21:35 +0000 |
commit | 8adc969fb08ffab5f8e9e0b05b081046bdc2ad9a (patch) | |
tree | 555499bc0262c29210c706b44e0fb23c0ddd8b92 /library/Graphite/Web/Widget/Graphs.php | |
parent | Adding debian version 1.2.2-3. (diff) | |
download | icingaweb2-module-graphite-8adc969fb08ffab5f8e9e0b05b081046bdc2ad9a.tar.xz icingaweb2-module-graphite-8adc969fb08ffab5f8e9e0b05b081046bdc2ad9a.zip |
Merging upstream version 1.2.4.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'library/Graphite/Web/Widget/Graphs.php')
-rw-r--r-- | library/Graphite/Web/Widget/Graphs.php | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/library/Graphite/Web/Widget/Graphs.php b/library/Graphite/Web/Widget/Graphs.php index e18b8da..e49a0eb 100644 --- a/library/Graphite/Web/Widget/Graphs.php +++ b/library/Graphite/Web/Widget/Graphs.php @@ -134,7 +134,7 @@ abstract class Graphs extends AbstractWidget * * @param MonitoredObject $object * - * @return static + * @return ?static */ public static function forMonitoredObject(MonitoredObject $object) { @@ -304,17 +304,17 @@ abstract class Graphs extends AbstractWidget $actheight = $this->height; } $actwidth = $this->width; - $actwidthfix = ""; + $explicitWidth = false; if (array_key_exists("width", $urlParams)) { $actwidth = $urlParams["width"]->resolve(['width']); - $actwidthfix = "width: {$actwidth}px; "; + $explicitWidth = $actwidth; } if ($this->renderInline) { $chart->setFrom($this->start) ->setUntil($this->end) - ->setWidth($actwidth) - ->setHeight($actheight) + ->setWidth((int) $actwidth) + ->setHeight((int) $actheight) ->setBackgroundColor('white') ->setForegroundColor('black') ->setMajorGridLineColor('grey') @@ -331,7 +331,7 @@ abstract class Graphs extends AbstractWidget ->setParam('height', $actheight); if (! $this->compact) { - $imageUrl->setParam('legend', 1); + $imageUrl->setParam('legend', '1'); } if ($this->preloadDummy) { @@ -344,8 +344,12 @@ abstract class Graphs extends AbstractWidget $img = '<img id="graphiteImg-' . md5((string) $imageUrl) . '"' . " src=\"$src\" data-actualimageurl=\"$imageUrl\" class=\"detach graphiteImg\"" - . " alt=\"\" width=\"$actwidth\" height=\"$actheight\"" - . " style=\"min-width: {$actwidth}px; $actwidthfix min-height: {$actheight}px;\">"; + . " alt=\"\" width=\"$actwidth\" height=\"$actheight\""; + if ($explicitWidth !== false) { + $img .= " data-width=\"$explicitWidth\""; + } + + $img .= '>'; } $currentGraphs[] = [$img, $metricVariables, $bestPos]; |