diff --git a/application/default/views/scripts/visual/view.phtml b/application/default/views/scripts/visual/view.phtml index 9a645b3b..d8f205c5 100644 --- a/application/default/views/scripts/visual/view.phtml +++ b/application/default/views/scripts/visual/view.phtml @@ -12,7 +12,14 @@ $this->breadcrumb()->setSeparator(' > ');

info['title'] ?> 数据可视化查看

-

请在需要查看的可视化要素上点击以描绘图表,再次点击可取消显示

+

请在需要查看的可视化要素上点击以描绘图表,再次点击可取消显示,绘制图像前可自主选择图像类型

+
+ + +
+ + 清除图像 +
normaldecode($this->data['vars']);?> @@ -23,20 +30,31 @@ $this->breadcrumb()->setSeparator(' > ');
- +
+
- - 清除图像 -
\ No newline at end of file diff --git a/application/module/Westdc/Visual/Record.php b/application/module/Westdc/Visual/Record.php index c368be6d..4b1144df 100644 --- a/application/module/Westdc/Visual/Record.php +++ b/application/module/Westdc/Visual/Record.php @@ -1,106 +1,106 @@ -initDatabase(); - - if(!empty($identifier)) - { - $this->subdataset = $identifier; - } - - if(!empty($uuid) && !empty($identifier)) - { - $this->initVisual($uuid); - } - } - - public function __invoke() - { - return $this->getData(); - } - - public function initDatabase() - { - $config = \Zend_Registry::get('config'); - - $dsn = "pgsql:host={$config->visual_db->hostname};" - ."port={$config->visual_db->port};" - ."dbname={$config->visual_db->database};" - ."user={$config->visual_db->username};" - ."password={$config->visual_db->password}"; - - $this->db = new \PDO($dsn); - } - - public function initVisual($uuid) - { - $visual = new Visual; - - $var_data = $visual->getVisualVars($uuid); - - $this->sql = $this->makeSql($var_data['data'],$this->subdataset); - - //echo $this->sql;exit(); - } - - public function getSql() - { - return $this->sql; - } - - public function getData() - { - $rs = $this->db->query($this->sql); - - $data = []; - while($row = $rs->fetch(\PDO::FETCH_ASSOC)) - { - - $row['utctime'] = $this->utcMsTime(strtotime($row['utctime'])); - //var_dump($row); - $data[] = array( - $row['utctime'], - $row['value'] - ); - } - - return $data; - } - - public function makeSql($table,$fieldValue) - { - $sql = "SELECT - {$this->timeFiled} as utctime , \"$fieldValue\" as value - FROM $table - ORDER BY - extract(YEAR from \"{$this->timeFiled}\") ASC, - extract(MONTH from \"{$this->timeFiled}\") ASC, - extract(DAY from \"{$this->timeFiled}\") ASC, - extract(HOUR from \"{$this->timeFiled}\") ASC, - extract(MINUTE from \"{$this->timeFiled}\") ASC, - extract(SECOND from \"{$this->timeFiled}\") ASC - "; - - return $sql; - } - - public function utcMsTime($time=''){ - if(empty($time)) - return (time()+8*3600)*1000; - else - return $time*1000; - } +initDatabase(); + + if(!empty($identifier)) + { + $this->subdataset = $identifier; + } + + if(!empty($uuid) && !empty($identifier)) + { + $this->initVisual($uuid); + } + } + + public function __invoke() + { + return $this->getData(); + } + + public function initDatabase() + { + $config = \Zend_Registry::get('config'); + + $dsn = "pgsql:host={$config->visual_db->hostname};" + ."port={$config->visual_db->port};" + ."dbname={$config->visual_db->database};" + ."user={$config->visual_db->username};" + ."password={$config->visual_db->password}"; + + $this->db = new \PDO($dsn); + } + + public function initVisual($uuid) + { + $visual = new Visual; + + $var_data = $visual->getVisualVars($uuid); + + $this->sql = $this->makeSql($var_data['data'],$this->subdataset); + + //echo $this->sql;exit(); + } + + public function getSql() + { + return $this->sql; + } + + public function getData() + { + $rs = $this->db->query($this->sql); + + $data = []; + while($row = $rs->fetch(\PDO::FETCH_ASSOC)) + { + + $row['utctime'] = $this->utcMsTime(strtotime($row['utctime'])); + //var_dump($row); + $data[] = array( + $row['utctime'], + $row['value'] + ); + } + + return $data; + } + + public function makeSql($table,$fieldValue) + { + $sql = "SELECT + {$this->timeFiled} as utctime , \"$fieldValue\" as value + FROM $table + ORDER BY + extract(YEAR from \"{$this->timeFiled}\") ASC, + extract(MONTH from \"{$this->timeFiled}\") ASC, + extract(DAY from \"{$this->timeFiled}\") ASC, + extract(HOUR from \"{$this->timeFiled}\") ASC, + extract(MINUTE from \"{$this->timeFiled}\") ASC, + extract(SECOND from \"{$this->timeFiled}\") ASC + "; + + return $sql; + } + + public function utcMsTime($time=''){ + if(empty($time)) + return (time()+8*3600)*1000; + else + return ($time+8*3600)*1000; + } } \ No newline at end of file