-
-
+
+
+
+
@@ -33,10 +32,10 @@ $this->nav[] = array('link'=>"/data/visual",'title'=>'可视化数据列表');
- normaldecode($this->data['variable']);?>
+ data['variable'],true);?>
$v) { ?>
-
+
= $v['title'] ?>
@@ -82,8 +81,9 @@ $(function() {
$('#datachart').highcharts('StockChart', {
rangeSelector : {
+ buttons: [{type:'hour',count:1,text:'1h'},{type:'day',count:1,text:'1D'},{type:'month',count:1,text:'1m'},{type:'year',count:1,text:'1Y'},{type:'all',count:1,text:'All'}],
selected : 1,
- inputEnabled: $('#container').width() > 480
+ inputEnabled: $('#datachart').width() > 480
},
credits : {
@@ -96,7 +96,7 @@ $(function() {
tooltip : {
formatter: function() {
- var s = '
'+ Highcharts.dateFormat('%Y-%m-%d %A %H:%M:%S', this.x) +'';
+ var s = '
'+ Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x) +'';
$.each(this.points, function(i, point) {
s += '
' + point.series.name + ': ' + point.y +'';
@@ -130,7 +130,7 @@ $(function() {
tooltip : {
formatter: function () {
- var s = '
' + Highcharts.dateFormat('%Y-%m-%d %A %H:%M:%S', this.x) + '';
+ var s = '
' + Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x) + '';
$.each(this.points, function () {
s += '
' + this.series.name + ': ' + this.y + '';
diff --git a/application/models/Theme.php b/application/models/Theme.php
index 99425ea9..04e7b99e 100644
--- a/application/models/Theme.php
+++ b/application/models/Theme.php
@@ -139,7 +139,8 @@ class Theme
'highcharts' => array(
$this->ScriptKey => array(
- '/js/lib/highcharts/highcharts.js'
+ '/js/lib/highcharts/highcharts.js',
+ '/js/lib/highcharts/highcharts-more.js'
)
),
diff --git a/application/module/Westdc/Visual/Record.php b/application/module/Westdc/Visual/Record.php
index 80f693be..fe7c05ea 100644
--- a/application/module/Westdc/Visual/Record.php
+++ b/application/module/Westdc/Visual/Record.php
@@ -4,7 +4,7 @@ namespace Westdc\Visual;
class Record extends Database
{
- public $subdataset,$valueFilter,$vars,$uuid,$xaxis;
+ public $subdataset,$valueFilter,$vars,$uuid,$xaxis,$field;
private $sql;
function __construct($uuid,$identifier )
@@ -29,7 +29,9 @@ class Record extends Database
$this->vars = $var_data['variable'];
$this->xaxis=$var_data['xaxis'];
$json=json_decode($this->vars,true);
- $subvar=array_filter($json,function($sub) { return $sub['name']==$this->subdataset; });
+ //$subvar=array_filter($json,function($sub) { return $sub['name']==$this->subdataset; });
+ $subvar=$json[$this->subdataset];
+ $this->field=$subvar['name'];
if (isset($subvar['sql']) && !empty($subvar['sql']))
$this->sql=$this->makeSql($subvar['sql']);
elseif(isset($var_data['data']) && !empty($var_data['data']))
@@ -54,8 +56,8 @@ class Record extends Database
$data = [];
while($row = $rs->fetch(\PDO::FETCH_ASSOC))
{
-
- $row['utctime'] = $this->utcMsTime(strtotime($row['utctime']));
+ if ($this->xaxis!='category')
+ $row[$this->xaxis] = $this->utcMsTime(strtotime($row[$this->xaxis]));
//var_dump($row);
$t=[];
foreach($row as $k=>$v)
@@ -83,7 +85,7 @@ class Record extends Database
}
}
- $sql = "SELECT {$this->xaxis},{$this->subdataset}
+ $sql = "SELECT {$this->xaxis},{$this->field}
FROM ($table) as tbl
$wheresql
ORDER BY {$this->xaxis}";