westdc-zf1/application/default/views/scripts/visual/index.phtml

119 lines
3.5 KiB
PHTML
Raw Normal View History

2014-05-12 06:53:21 +00:00
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->data);
$this->headTitle()->setSeparator(' - ');
$theme = new Theme;
$theme->appendPlus($this,'highstock');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/data">数据与服务</a>');
$this->breadcrumb('数据可视化');
$this->breadcrumb()->setSeparator(' > ');
?>
<div class="row">
<div class="span3">
2014-05-21 09:26:15 +00:00
<h3>选择数据集</h3>
2014-05-12 06:53:21 +00:00
<hr />
2014-05-21 09:26:15 +00:00
<a class="btn btn-default control-btn" href="javascript:void(0);" data-dataset="sc" data-subdataset="avg" data-seriename="逐月含沙量平均值">
逐月含沙量平均值
</a>
<a class="btn btn-default control-btn" href="javascript:void(0);" data-dataset="sc" data-subdataset="max" data-seriename="逐月含沙量最大值">
逐月含沙量最大值
</a>
<a class="btn btn-default control-btn" href="javascript:void(0);" data-dataset="sc" data-subdataset="min" data-seriename="逐月含沙量最小值">
逐月含沙量最小值
</a>
<a class="btn btn-default control-btn" href="javascript:void(0);" data-dataset="SoilMoisture" data-subdataset="20cm" data-seriename="土壤水分20CM">
土壤水分20CM
</a>
<a class="btn btn-default control-btn" href="javascript:void(0);" data-dataset="SoilMoisture" data-subdataset="30cm" data-seriename="土壤水分30CM">
土壤水分30CM
</a>
<a class="btn btn-default control-btn" href="javascript:void(0);" data-dataset="SoilMoisture" data-subdataset="40cm" data-seriename="土壤水分40CM">
土壤水分40CM
</a>
<a class="btn btn-default control-btn" href="javascript:void(0);" data-dataset="SoilMoisture" data-subdataset="50cm" data-seriename="土壤水分50CM">
土壤水分50CM
2014-05-12 06:53:21 +00:00
</a>
</div>
<!-- 页面内容 -->
<div class="span9">
<div id="datachart" style="width:100%;height:500px;"></div>
2014-05-21 09:26:15 +00:00
<div id="loading" style="display:none">Loading...</div>
2014-05-12 06:53:21 +00:00
</div>
<!-- //页面内容 -->
</div>
<script>
2014-05-21 09:26:15 +00:00
_this = {};
2014-05-12 06:53:21 +00:00
$(function() {
2014-05-21 09:26:15 +00:00
$('#datachart').highcharts('StockChart', {
rangeSelector : {
selected : 1,
inputEnabled: $('#container').width() > 480
},
credits : {
enabled : false
}
});
var chart = $('#datachart').highcharts();
2014-05-12 06:53:21 +00:00
2014-05-21 09:26:15 +00:00
$(".control-btn").click(function(){
dataset = $(this).data('dataset');
subdataset = $(this).data('subdataset');
seriename = $(this).data('seriename');
for(i in chart.series)
{
if(chart.series[i].name == seriename)
{
chart.series[i].remove();
return;
}
}
$.ajax({
'url': '/visual/data',
'data': 'dataset=' + dataset + '&subdataset=' + subdataset,
'method': 'GET',
'dataType': 'json',
'success': function(data){
chart.addSeries({
name: seriename,
data: data,
type : 'column'
});
2014-05-12 06:53:21 +00:00
},
2014-05-21 09:26:15 +00:00
'timeout': 30000,
'global' : true
2014-05-12 06:53:21 +00:00
});
2014-05-21 09:26:15 +00:00
2014-05-12 06:53:21 +00:00
});
});
2014-05-21 09:26:15 +00:00
function onDataReceived(data)
{
chart.addSeries({
name: 'Sediment Concentration',
data: data,
type : 'column'
2014-05-12 06:53:21 +00:00
});
2014-05-21 09:26:15 +00:00
alert(chart.series[0].name)
}
2014-05-12 06:53:21 +00:00
2014-05-21 09:26:15 +00:00
$( document ).ajaxSend(function() {
$('#loading').css('display','none');
2014-05-12 06:53:21 +00:00
});
2014-05-21 09:26:15 +00:00
$( document ).ajaxSend(function() {
$('#loading').css('display','block');
2014-05-12 06:53:21 +00:00
});
2014-05-21 09:26:15 +00:00
$( document ).ajaxSend(function() {
$('#loading').css('display','none');
2014-05-12 06:53:21 +00:00
});
</script>