var tmax_9 = new Array(); var tmin_9 = new Array(); var time_9 = new Array(); var date_week_9 = new Array(); $(function () { day15(); //Foshorttime(); //Titfodaily(); }); var _shikuangStation = { "G6808": ["禅城", "59828"], "G2213": ["南海", "59288"], "G2230": ["顺德", "59480"], "G7045": ["高明", "59829"], "G2229": ["三水", "59279"] };//站点名称 ///////////////////////////////////////////// function day15() { $.getJSON("weather/data/15day.js?t=" + Math.random(), function (json) { if (json) { var strbtit = new Array(); var lastobj = eval(json).length - 1; var datetime = new Date(json[lastobj]["valid_datetime"].replace(/-/g, "/")); //转换成Data(); var datehour = datetime.getHours(); var create_date = json[0]["datetime"].substring(0, (json[0]["datetime"].length - 10)); var create_datetime = new Date(create_date.replace(/-/g, "/")); var datehour = datetime.getHours(); if (datehour >= 6 && datehour <= 11) { if ($("#date_fb").length > 0) { $("#date_fb").append(create_datetime.Format('yyyy-MM-dd hh:mm')) }; datetime.setDate(datetime.getDate()); } else { if ($("#date_fb").length > 0) { $("#date_fb").append(create_datetime.Format('yyyy-MM-dd hh:mm')) }; datetime.setDate(datetime.getDate() + 1); } var dayNames = new Array("周日", "周一", "周二", "周三", "周四", "周五", "周六"); for (var i = 1; i <= 15; i++) { var _tmax = json[lastobj]["tmax" + i + ""]; var _tmin = json[lastobj]["tmin" + i + ""]; //strbtit.push("" + datetime.Format('MM/dd') + "
" + dayNames[datetime.getDay()] + "

\""
"); strbtit.push("" + datetime.Format('MM/dd') + "
" + dayNames[datetime.getDay()] + "

\""
"); time_9.push(datetime.Format('MM/dd')); tmax_9.push(_tmax); tmin_9.push(_tmin); datetime.setDate(datetime.getDate() + 1); } $("#littit_15").append(strbtit.join("")); $("#littit_15 span:last").css("background", "none"); //line_10day(); fifteenday(); } }) } //add by terry 20160106 function fifteenday() { var ten1 = []; var ten2 = []; for (var i = 0; i < tmax_9.length; i++) { ten1[i] = parseFloat(tmax_9[i]); ten2[i] = parseFloat(tmin_9[i]); } var chart; chart = new Highcharts.Chart({ chart: { renderTo: 'weather_10', //图表放置的容器,DIV defaultSeriesType: 'line', //图表类型line(折线图), zoomType: 'x', //x轴方向可以缩放 backgroundColor: 'rgba(0,0,0,0)' }, credits: { enabled: false //右下角不显示LOGO }, title: { text: '' //图表标题 }, tooltip: { //enabled: false, formatter: function () { return '' + this.series.name + '
' + this.y + '°C'; } }, subtitle: { text: '' //副标题 }, xAxis: { //x轴 title: { text: '' }, //标题 gridLineWidth: 0, //设置网格宽度为0 lineColor: 'rgba(0,0,0,0)', tickWidth: 0, labels: { enabled: false } }, yAxis: { //y轴 title: { text: '' }, //标题 gridLineWidth: 0, //设置网格宽度为0 labels: { enabled: false } }, colors: ['#f9a700'], plotOptions: { //设置数据点 line: { dataLabels: { enabled: true, //在数据点上显示对应的数据值 formatter: function () { return '' + this.y + ''; } } //enableMouseTracking: false //取消鼠标滑向触发提示框 } }, legend: { //图例 enabled: false }, exporting: { enabled: false //设置导出按钮不可用 }, series: [ { //数据列 name: '最高气温', data: ten1 } ] }); chart = new Highcharts.Chart({ chart: { renderTo: 'weather_101', //图表放置的容器,DIV defaultSeriesType: 'line', //图表类型line(折线图), zoomType: 'x', //x轴方向可以缩放 backgroundColor: 'rgba(0,0,0,0)' }, credits: { enabled: false //右下角不显示LOGO }, title: { text: '' //图表标题 }, tooltip: { //enabled: false, formatter: function () { return '' + this.series.name + '
' + this.y + '°C'; } }, subtitle: { text: '' //副标题 }, xAxis: { //x轴 title: { text: '' }, //标题 gridLineWidth: 0, //设置网格宽度为0 lineColor: 'rgba(0,0,0,0)', tickWidth: 0, labels: { enabled: false } }, yAxis: { //y轴 title: { text: '' }, //标题 gridLineWidth: 0, //设置网格宽度为0 labels: { enabled: false } }, colors: ['#6196ff'], plotOptions: { //设置数据点 line: { dataLabels: { enabled: true, //在数据点上显示对应的数据值 formatter: function () { return '' + this.y + ''; } } //enableMouseTracking: false //取消鼠标滑向触发提示框 } }, legend: { //图例 enabled: false }, exporting: { enabled: false //设置导出按钮不可用 }, series: [ { name: '最低气温', data: ten2 }] }); } //日期 Date.prototype.Format = function (fmt) { //author: meizz var o = { "M+": this.getMonth() + 1, //月份 "d+": this.getDate(), //日 "h+": this.getHours(), //小时 "m+": this.getMinutes(), //分 "s+": this.getSeconds(), //秒 "q+": Math.floor((this.getMonth() + 3) / 3), //季度 "S": this.getMilliseconds() //毫秒 }; if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)); for (var k in o) if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length))); return fmt; }