; dataT=GetArray(stockDate,""); dataZ=GetArray(stockNet,"N"); LoadChart(dataT,dataZ); LoadUp(); LoadStock(); function LoadStock(){ $("#tbStock").html(""); $.each(stock.retData.market,function(n,value){ if (n=="shenzhen"||n=="shanghai") { $("#tbStock").append(""+value.name+""+value.curdot+""+value.curprice+""+value.rate+""); } }); } function LoadUp(){ var net=GetUpData(dataZ); var ddxArray=GetArray(stockDDX,""); var ddx=GetUpData(ddxArray); var upArray=GetArray(stockUp,""); var up=GetUpData(upArray); $(".ri_sp01").html(""); $(".ri_sp01").append("盐田港"+net+" "+ddx+" ("+up+"%)") } function GetUpData(dataA){ var result; if (dataA!=""&&dataA.length>1) { result=dataA[dataA.length-1]; } else { result=""; } return result; } function timeFormatter(value) { var da = value.split("-"); var year = da[0]; var month = da[1]; var day = da[2].split(":"); var day1 = day[0].split(" ")[1]; return day1 + ":" + day[1]; } function GetArray(dataArray,action){ if (dataArray=="0") { result=""; } else { dataArray=dataArray.split(","); var result=new Array(); for (var i = 0; i < dataArray.length; i++) { if (action=="N") { result.push(Number(dataArray[i])); } else { result.push(dataArray[i]); } } result=result.reverse(); } return result; } // 折线图 function LoadChart(dataT,dataZ){ $('#ri_pic').highcharts({ chart: { type: 'spline' }, title: { text: ' ' }, credits: {//右下角的文本 enabled: false, }, xAxis: { type: 'datetime', categories:dataT, tickInterval:20, labels: { formatter: function (){ return timeFormatter(this.value); //return Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', ); //return this.value; } } }, yAxis: { title: { text: ' ' }, //min: 0, minorGridLineWidth: 0, gridLineWidth: 0, alternateGridColor: null, plotBands: [{ from: 0, to: 1, color: 'rgba(68, 170, 213, 0.1)', }, { from: 1, to: 2, color: 'rgba(0, 0, 0, 0)', }, { from: 2, to: 3, }, { from: 3, to: 4, color: 'rgba(68, 170, 213, 0.1)', }, { from: 4, to: 5, color: 'rgba(0, 0, 0, 0)', }, { from: 5, to: 6, color: 'rgba(68, 170, 213, 0.1)', }, { from: 6, to: 7, color: 'rgba(0, 0, 0, 0)', }, { from: 7, to: 8, color: 'rgba(68, 170, 213, 0.1)', }, { from: 8, to: 9, color: 'rgba(0, 0, 0, 0)', }], tickInterval:0.01 }, plotOptions: { dataLabels: { enabled: false, }, spline: { lineWidth: 4, states: { hover: { lineWidth: 5 } }, marker: { enabled: false }, //pointInterval: 3600000, // one hour //pointStart: Date.UTC(2017,01-1, 20, 0, 0, 0) //pointStart: Date.UTC(2015,12,16, 0, 0, 0) //enableMouseTracking:false //showInLegend: false } }, series: [{ name: ' ', data: dataZ, }], navigation: { menuItemStyle: { fontSize: '10px' } } }); }