private function getPreviewImage($host, $service, $metric)
 {
     if ($host != null) {
         $target = Macro::resolveMacros($this->hostMacro, $host, $this->legacyMode, true);
     } elseif ($service != null) {
         $target = Macro::resolveMacros($this->serviceMacro, $service, $this->legacyMode, true);
     } else {
         $target = '';
     }
     if ($this->graphType == "derivative") {
         $target = Macro::resolveMacros($this->DerivativeMacro, array("target" => $target, "summarizeInterval" => $this->summarizeInterval, "summarizeFunc" => $this->summarizeFunc), $this->legacyMode, false, false);
     }
     $target = Macro::resolveMacros($target, array("metric" => $metric), $this->legacyMode, true, true);
     $imgUrl = $this->baseUrl . Macro::resolveMacros($this->imageUrlMacro, array("target" => $target, "areaMode" => $this->areaMode, "areaAlpha" => $this->areaAlpha, "colorList" => $this->colorList), $this->legacyMode);
     $largeImgUrl = $this->baseUrl . Macro::resolveMacros($this->largeImageUrlMacro, array("target" => $target, "areaMode" => $this->areaMode, "areaAlpha" => $this->areaAlpha, "colorList" => $this->colorList), $this->legacyMode);
     $url = Url::fromPath('graphite', array('graphite_url' => urlencode($largeImgUrl), 'graphite_iframe_w' => urlencode($this->iframeWidth), 'graphite_iframe_h' => urlencode($this->iframeHeight)));
     $html = '<a href="%s" title="%s"><img src="%s" alt="%s" width="300" height="120" /></a>';
     return sprintf($html, $url, $metric, $imgUrl, $metric);
 }
 private function getPreviewImage($host, $service, $metric)
 {
     if ($host != Null) {
         $target = Macro::resolveMacros($this->hostMacro, $host, $this->legacyMode);
     } elseif ($service != null) {
         $target = Macro::resolveMacros($this->serviceMacro, $service, $this->legacyMode);
     } else {
         $target = '';
     }
     $target .= '.' . Macro::escapeMetric($metric, $this->legacyMode);
     if ($this->legacyMode == false) {
         $target .= '.value';
     }
     $target = $this->metricPrefix . "." . $target;
     $imgUrl = $this->baseUrl . Macro::resolveMacros($this->imageUrlMacro, array("target" => $target), $this->legacyMode, false);
     $largeImgUrl = $this->baseUrl . Macro::resolveMacros($this->largeImageUrlMacro, array("target" => $target), $this->legacyMode, false);
     $url = Url::fromPath('graphite', array('graphite_url' => urlencode($largeImgUrl)));
     $html = '<a href="%s" title="%s"><img src="%s" alt="%s" width="300" height="120" /></a>';
     return sprintf($html, $url, $metric, $imgUrl, $metric);
 }
 private function getPreviewImage($host, $service, $metric)
 {
     // metrics can contain chars which have to be replaced, too
     $metric = Macro::escapeMetric($metric, $this->legacyMode);
     if ($host != null) {
         $target = Macro::resolveMacros($this->hostMacro, $host, $this->legacyMode);
     } elseif ($service != null) {
         $target = Macro::resolveMacros($this->serviceMacro, $service, $this->legacyMode);
     } else {
         $target = '';
     }
     $target = Macro::resolveMacros($target, array("metric" => $metric), $this->legacyMode);
     $imgUrl = $this->baseUrl . Macro::resolveMacros($this->imageUrlMacro, array("target" => $target), $this->legacyMode, false);
     $largeImgUrl = $this->baseUrl . Macro::resolveMacros($this->largeImageUrlMacro, array("target" => $target), $this->legacyMode, false);
     $url = Url::fromPath('graphite', array('graphite_url' => urlencode($largeImgUrl)));
     $html = '<a href="%s" title="%s"><img src="%s" alt="%s" width="300" height="120" /></a>';
     return sprintf($html, $url, $metric, $imgUrl, $metric);
 }