From b85a1526bdafe7af5f4d7af17b5599da09efccbc Mon Sep 17 00:00:00 2001 From: Pim van den Berg Date: Sun, 23 Mar 2014 12:24:45 +0100 Subject: add SVG graph support --- type/Default.class.php | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'type/Default.class.php') diff --git a/type/Default.class.php b/type/Default.class.php index 909ac32..91f557f 100644 --- a/type/Default.class.php +++ b/type/Default.class.php @@ -196,6 +196,14 @@ class Type_Default { print_r($graphdata); print ''; break; + case 'svg': + # caching + if (is_numeric($this->cache) && $this->cache > 0) + header("Expires: " . date(DATE_RFC822,strtotime($this->cache." seconds"))); + header("content-type: image/svg+xml"); + $graphdata = implode(' ', $graphdata); + echo `$graphdata`; + break; case 'png': default: # caching @@ -209,9 +217,18 @@ class Type_Default { } function rrd_options() { - if ($this->graph_type != 'canvas') { - $rrdgraph[] = $this->rrdtool; - $rrdgraph[] = 'graph - -a PNG'; + switch ($this->graph_type) { + case 'png': + case 'hybrid': + $rrdgraph[] = $this->rrdtool; + $rrdgraph[] = 'graph - -a PNG'; + break; + case 'svg': + $rrdgraph[] = $this->rrdtool; + $rrdgraph[] = 'graph - -a SVG'; + break; + default: + break; } if ($this->rrdtool_opts != '') $rrdgraph[] = $this->rrdtool_opts; -- cgit v1.1