delete the YTD button form highstock plugin

This commit is contained in:
Li Jianxuan 2013-06-03 16:54:45 +00:00
parent b15e1b59b6
commit 3409a60d43
1 changed files with 177 additions and 157 deletions

View File

@ -1,158 +1,178 @@
<?php <?php
$this->headTitle($this->config->title->site); $this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->data); $this->headTitle($this->config->title->data);
$this->headTitle()->setSeparator(' - '); $this->headTitle()->setSeparator(' - ');
$this->headScript()->appendFile('/js/jquery.colorbox-min.js'); $this->headScript()->appendFile('/js/jquery.colorbox-min.js');
$this->headLink()->appendStylesheet('/css/colorbox.css'); $this->headLink()->appendStylesheet('/css/colorbox.css');
$this->headScript()->appendFile('/static/js/highstock/highstock.js'); $this->headScript()->appendFile('/static/js/highstock/highstock.js');
$this->headScript()->appendFile('/static/js/highstock/modules/exporting.js'); $this->headScript()->appendFile('/static/js/highstock/modules/exporting.js');
//$this->headScript()->appendFile('/static/js/highcharts/highcharts.js'); //$this->headScript()->appendFile('/static/js/highcharts/highcharts.js');
//$this->headScript()->appendFile('/static/js/highcharts/modules/exporting.js'); //$this->headScript()->appendFile('/static/js/highcharts/modules/exporting.js');
$this->breadcrumb('<a href="/">首页</a>'); $this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/data">数据与服务</a>'); $this->breadcrumb('<a href="/data">数据与服务</a>');
$this->breadcrumb('数据可视化'); $this->breadcrumb('数据可视化');
$this->breadcrumb()->setSeparator(' > '); $this->breadcrumb()->setSeparator(' > ');
?> ?>
<!-- 左侧导航 --> <!-- 左侧导航 -->
<div id='sidebar' style="width:240px;float:left;overflow:hidden;"> <div id='sidebar' style="width:240px;float:left;overflow:hidden;">
<div class="tbox mt12"> <div class="tbox mt12">
<div class="title corners-top">气象数据</div> <div class="title corners-top">气象数据</div>
<div class="content"> <div class="content">
<ul> <ul>
<li><button value="temperature" class="fetchSeries btn meteorology">气温</button></li> <li><button value="temperature" class="fetchSeries btn meteorology">气温</button></li>
<li><button value="windspeed" class="fetchSeries btn meteorology">风速</button></li> <li><button value="windspeed" class="fetchSeries btn meteorology">风速</button></li>
<li><button value="precipitation" class="fetchSeries btn meteorology">日合计降水量</button></li> <li><button value="precipitation" class="fetchSeries btn meteorology">日合计降水量</button></li>
<li><button value="sunshine" class="fetchSeries btn meteorology">日照小时数</button></li> <li><button value="sunshine" class="fetchSeries btn meteorology">日照小时数</button></li>
</ul> </ul>
</div> </div>
</div> </div>
<div class="tbox mt12"> <div class="tbox mt12">
<div class="title corners-top">水文数据</div> <div class="title corners-top">水文数据</div>
<div class="content"> <div class="content">
<ul> <ul>
<li><button value="dp" class="fetchSeries btn hydrology">日降水量</button></li> <li><button value="dp" class="fetchSeries btn hydrology">日降水量</button></li>
<li><button value="mtp" class="fetchSeries btn hydrology">月降水量</button></li> <li><button value="mtp" class="fetchSeries btn hydrology">月降水量</button></li>
<li><button value="yrp" class="fetchSeries btn hydrology">年降水量</button></li> <li><button value="yrp" class="fetchSeries btn hydrology">年降水量</button></li>
<li><button value="dq" class="fetchSeries btn hydrology">日平均流量</button></li> <li><button value="dq" class="fetchSeries btn hydrology">日平均流量</button></li>
<li><button value="mtq" class="fetchSeries btn hydrology">月平均流量</button></li> <li><button value="mtq" class="fetchSeries btn hydrology">月平均流量</button></li>
<li><button value="yrq" class="fetchSeries btn hydrology">年平均流量</button></li> <li><button value="yrq" class="fetchSeries btn hydrology">年平均流量</button></li>
</ul> </ul>
</div> </div>
</div> </div>
<div class="tbox mt12"> <div class="tbox mt12">
<div class="title corners-top">环境监测</div> <div class="title corners-top">环境监测</div>
<div class="content"> <div class="content">
<ul> <ul>
<li><button value="tsp" class="fetchSeries btn ambient">总悬浮颗粒物</button></li> <li><button value="tsp" class="fetchSeries btn ambient">总悬浮颗粒物</button></li>
<li><button value="pm10" class="fetchSeries btn ambient">可吸入颗粒物</button></li> <li><button value="pm10" class="fetchSeries btn ambient">可吸入颗粒物</button></li>
<li><button value="so2" class="fetchSeries btn ambient">二氧化硫</button></li> <li><button value="so2" class="fetchSeries btn ambient">二氧化硫</button></li>
<li><button value="no2" class="fetchSeries btn ambient">二氧化氮</button></li> <li><button value="no2" class="fetchSeries btn ambient">二氧化氮</button></li>
</ul> </ul>
</div> </div>
</div> </div>
</div> </div>
<!-- //左侧导航 --> <!-- //左侧导航 -->
<!-- 页面内容 --> <!-- 页面内容 -->
<div id="wapper" style="width:700px;overflow:hidden;float:right;" class="mt12"> <div id="wapper" style="width:700px;overflow:hidden;float:right;" class="mt12">
<div id="loading" style="margin:0px;border:1px solid #ccc;height:500px;background:url(/images/loading.gif) center center no-repeat;display:none"></div> <div id="loading" style="margin:0px;border:1px solid #ccc;height:500px;background:url(/images/loading.gif) center center no-repeat;display:none"></div>
<div id="tableTitle"></div> <div id="tableTitle"></div>
<div id="datachart" style="width:700px;height:500px;"></div> <div id="datachart" style="width:700px;height:500px;"></div>
</div> </div>
<!-- //页面内容 --> <!-- //页面内容 -->
<script> <script>
function drawchart(type,range,data,title) { function drawchart(type,range,data,title) {
// Create the chart // Create the chart
window.chart = new Highcharts.StockChart({ window.chart = new Highcharts.StockChart({
'chart' : { 'chart' : {
'renderTo' : 'datachart', 'renderTo' : 'datachart',
'type': type 'type': type
}, },
'rangeSelector' :{ 'rangeSelector' :{
'enabled' : true, 'enabled' : true,
'selected' : range 'selected' : range,
}, buttons: [{
type: 'month',
'credits':{ count: 1,
'enabled': false text: '1m'
}, }, {
type: 'month',
'exporting': { count: 3,
'enabled': false text: '3m'
}, }, {
type: 'month',
'title' : { count: 6,
'text' : title text: '6m'
}, }, {
type: 'year',
'series' : data count: 1,
text: '1y'
}); }, {
} type: 'all',
$(".fetchSeries").click(function () { text: 'All'
}]
var button = $(this); },
$('.fetchSeries').removeClass('btn-green'); 'credits':{
button.addClass('btn-green'); 'enabled': false
},
var ac = button.val();
var dt = ""; 'exporting': {
'enabled': false
if(button.hasClass('meteorology')) },
{
dt = 'meteorology'; 'title' : {
} 'text' : title
},
if(button.hasClass('hydrology'))
{ 'series' : data
dt = 'hydrology';
} });
}
if(button.hasClass('ambient')) $(".fetchSeries").click(function () {
{
dt = 'ambient'; var button = $(this);
}
$('.fetchSeries').removeClass('btn-green');
$('#datachart').html(''); button.addClass('btn-green');
function onDataReceived(series) { var ac = button.val();
if(typeof(series)=='undefined') var dt = "";
{$('.fetchSeries').removeClass('btn-green');Alert('未请求到数据');return false;}
if(typeof(series.datas)=='undefined' || series.datas=='') if(button.hasClass('meteorology'))
{$('.fetchSeries').removeClass('btn-green');Alert('未请求到数据');return false;} {
if(typeof(series.error)!='undefined') dt = 'meteorology';
{$('.fetchSeries').removeClass('btn-green');Alert(series.error);return false;} }
drawchart(series.type,series.range,series.datas,series.title);
} if(button.hasClass('hydrology'))
{
$.ajax({ dt = 'hydrology';
'url': '/visual/data/', }
'data': 'ac='+ac+'&dt='+dt,
'method': 'GET', if(button.hasClass('ambient'))
'dataType': 'json', {
'success': onDataReceived, dt = 'ambient';
'timeout': 30000 }
});
$('#datachart').html('');
});
$('#loading').ajaxComplete(function() { function onDataReceived(series) {
$(this).css('display','none'); if(typeof(series)=='undefined')
$('#datachart').css('display','block'); {$('.fetchSeries').removeClass('btn-green');Alert('未请求到数据');return false;}
}); if(typeof(series.datas)=='undefined' || series.datas=='')
$('#loading').ajaxSend(function() { {$('.fetchSeries').removeClass('btn-green');Alert('未请求到数据');return false;}
$(this).css('display','block'); if(typeof(series.error)!='undefined')
$('#datachart').css('display','none'); {$('.fetchSeries').removeClass('btn-green');Alert(series.error);return false;}
}); drawchart(series.type,series.range,series.datas,series.title);
$("#loading").ajaxError(function() { }
$(this).css('display','none');
$('.fetchSeries').removeClass('btn-green'); $.ajax({
Alert('请求超时或服务器开小差了,请刷新页面后重试'); 'url': '/visual/data/',
}); 'data': 'ac='+ac+'&dt='+dt,
function Alert(html){ 'method': 'GET',
$.colorbox({'innerWidth':'50%','html':'<h4>'+html+'</h4>'}); 'dataType': 'json',
} 'success': onDataReceived,
'timeout': 30000
});
});
$('#loading').ajaxComplete(function() {
$(this).css('display','none');
$('#datachart').css('display','block');
});
$('#loading').ajaxSend(function() {
$(this).css('display','block');
$('#datachart').css('display','none');
});
$("#loading").ajaxError(function() {
$(this).css('display','none');
$('.fetchSeries').removeClass('btn-green');
Alert('请求超时或服务器开小差了,请刷新页面后重试');
});
function Alert(html){
$.colorbox({'innerWidth':'50%','html':'<h4>'+html+'</h4>'});
}
</script> </script>