', '最高 : ' + max + ' ', '最低 : ' + min + '
', '漲跌幅 : ' + chaRate +'%' + '
' +'
', '成交量 : ' + volumeHtml + '
', '成交額 : ' + turnoverHtml + '
' ].join(''); } }, axisPointer: { link: {xAxisIndex: 'all'}, label: { backgroundColor: '#777' } }, visualMap: { show: false, seriesIndex: 5, dimension: 2, pieces: [{ value: 1, color: downColor }, { value: -1, color: upColor }] }, grid: [ { left: 90, right: 90, height: chartTopHeight }, { left: 90, right: 90, top: '62%', height: '20%' } ], xAxis: [ { type: 'category', data: data.categoryDataGang, scale: true, boundaryGap : true, axisLine: { onZero: false, lineStyle:{ color:'#6ca584' } }, splitLine: { show: true, lineStyle:{ color:'#e3f3f7' } }, axisLabel:{ show: false, margin:15, color:"#666" }, axisTick:{show:false}, splitNumber: 20, min: 'dataMin', max: 'dataMax', axisPointer: { z: 100 } }, { type: 'category', gridIndex: 1, data: data.categoryDataGang, scale: true, boundaryGap : true, axisLine: { onZero: false, lineStyle:{ color:'#6ca584' } }, axisTick: {show: false}, splitLine: { show: true, lineStyle:{ color:'#e3f3f7' } }, axisLabel: { show: true, margin:15, color:"#666", }, splitNumber: 20, min: 'dataMin', max: 'dataMax' } ], yAxis: [ { name:'價錢南昌大学档案学网', nameLocation: 'end', nameTextStyle:{ color:'#666', padding:[0,0,0,-45] }, scale: true, splitNumber: 4, splitLine:{ show:true, lineStyle:{ color:'#e3f3f7' } }, axisLabel:{ color:'#666', margin:20, textStyle: { color: function (value, index) { var preClose=rawData.prev_close; if(value>preClose){ return 'red'; }else if (value0){ return 'red'; }else if (value<0){ return 'green'; }else{ return 'black'; } } } }, splitLine: { show:false, lineStyle: { color: '#6ca584' } }, axisLine:{ show:true, lineStyle:{ color:'#e3f3f7' } }, }, { name:'成交額', nameLocation: 'end', nameTextStyle:{ color:'#666', padding:[0,0,0,86] }, scale: true, gridIndex:1, splitNumber: 2, splitLine:{ show:false, lineStyle:{ color:'#e3f3f7' } }, axisLabel:{ color:'#666', margin:20, formatter:function (value, index) { var language="zh-cn"; var value=calTurnoverUnit(language,value,1); return value; } }, axisTick:{ show:false }, axisLine:{ lineStyle:{ color:'#e3f3f7' } } }, ], dataZoom: [ { type: 'inside', }, { xAxisIndex:[0,1] }, ], series: [ { name: '上証所', type: 'candlestick', barMaxWidth: '10', data: data.values, itemStyle: { normal: { color: downColor, color0: upColor, borderColor: null, borderColor0: null } }, }, //日k top { name: '百分比', type: 'line', data: data.PercentageNum, yAxisIndex:2, symbol:'none', symbolSize:0, lineStyle:{ width:0 }, }, //日k bottom { name: '成交量',//成交量 type: 'bar', barMaxWidth: '10', xAxisIndex: 1, yAxisIndex: 1, data: data.volumes, color:'#db2517', }, { name: '成交額', type: 'bar', barMaxWidth: '10', xAxisIndex: 1, yAxisIndex: 3, data: data.valuesMoney, color:'#39a923' } ] }, true); //工夫南昌大学档案学网南昌大学档案学网軸事情 myChart.on('dataZoom', function (params) { //憑據dataZoom取到肇耑值和終值 var startDate = dateList[myChart.getOption().dataZoom[1].startValue].toString(); var endDate = dateList[myChart.getOption().dataZoom[1].endValue].toString(); var fromDate = startDate.slice(0,4) + '-' + startDate.slice(4,6) + '-' + startDate.slice(6,8); var toDate = endDate.slice(0,4) + '-' + endDate.slice(4,6) + '-' + endDate.slice(6,8); $('#beforeTime').val(fromDate); $('#today').val(toDate); }); setTimeout(function (){ window.onresize = function () { myChart.resize(); } },20); }}function splitDatas(rawDatas) { var categoryData = []; var values = []; var volumes = []; //var volumesWan = []; var Percentage = []; for (var i = 0; i < rawDatas.length; i++) { values.push(rawDatas[i][1]); volumes.push(rawDatas[i][2]); Percentage.push((rawDatas[i][3]*100).toFixed(2)) } function getWan(name,newName){ $.each(name, function (i,item){ var num = (item/10000).toFixed(2); newName.push(num); }) } //getWan(volumesWan,volumes); function TimeData (stockCode) { var h = 9; var m = 30; var ary = []; for (var i = 0; i<10000;i++) { var str = (h < 10 ? '0' + h : h) + ':' + (m < 10 ? '0' + m : m); ary.push(str); if (m < 59) { m = m + 1; } else { m = 0; h = h+ 1; } if(isKcb(stockCode)) { if (h === 15 && m === 31) { break; } } else { if (h === 15 && m === 1) { break; } } } if(isKcb(stockCode)) { ary.splice(331,5); ary[330] = "15:00/15:05"; } ary.splice(121,90); ary[120] = "11:30/13:00"; categoryData = ary; }; TimeData(688316); return { categoryData: categoryData, values: values, volumes: volumes, Percentage:Percentage, };}timeAjaxUrl();function timeAjaxUrl(){ myChart.showLoading(); $.ajax({ url: SSE.Config.HANGQING_PREFIX + "/line/688316", type: "GET", data: { begin: 0, end: -1, select: 'time,price,volume' }, dataType: "jsonp", success: function (data) { timePicture(data); } }); function timePicture(rawData){ var lineData = rawData.line; var d = dateConvert({data: rawData.line, date: rawData.date}); var d = percentConvert({data: rawData.line, prev_close: rawData.prev_close}); var data = splitDatas(d); myChart.hideLoading(); myChart.setOption(option = { backgroundColor: '#fff', animation: true, title:{ left:'left', //text:isKcb(688316) ? ['{b|(688316)} {a|}']:['{b|(688316)}'], textStyle:{ rich:{ a:{ backgroundColor: { image: 'public/images/interaction/icon.png', align: 'right', }, }, b:{ color:'#5d5d5d', fontSize: 12, padding:[0,10], } } } }, tooltip: { trigger: 'axis', axisPointer: { type: 'cross', label:{ show:false, } }, backgroundColor: 'rgba(245, 245, 245, 0.8)', borderWidth: 1, borderColor: '#ccc', padding: 10, textStyle: { color: '#000' }, formatter:function(params) { var stockPrice,chgRate,volume,volumeHtml; for(var i=0;i<3;i++){ if(params[i].seriesIndex==0){ stockPrice=params[i].data; }else if(params[i].seriesIndex==1){ chgRate=params[i].data; }else if(params[i].seriesIndex==2){ volume=params[i].data; } } var language="zh-cn"; volumeHtml=calVolumeUnit(language,volume,1); return [ '' + params[1].name + '
', '股價:'+ stockPrice + '
', '漲跌幅:' + chgRate+ '%
', '成交量:' + volumeHtml+'
', ].join(''); } }, axisPointer: { link: {xAxisIndex: 'all'}, label: { backgroundColor: '#777' } }, visualMap: { show: false, seriesIndex: 5, dimension: 2, pieces: [{ value: 1, color: downColor }, { value: -1, color: upColor }] }, grid: [ { left: 80, right: 80, height: chartTopHeight }, { left: 80, right: 80, top: '62%', height: '20%' } ], xAxis: [ { type: 'category', data: data.categoryData, scale: true, boundaryGap : true, axisLine: { onZero: false, lineStyle:{ color:'#6ca584' } }, splitLine: { show: true, lineStyle:{ color:'#d9eff4' } }, axisLabel:{ show:false, margin:15, color:'#666', interval:lineWidth, showMaxLabel:true }, axisTick:{show:false}, splitNumber: 10, min: '09:30', max: isKcb(688316) ? '15:30':'15:00', axisPointer: { z: 100 } }, { type: 'category', gridIndex: 1, data: data.categoryData, scale: true, boundaryGap : true, axisLine: { onZero: false, lineStyle:{ color:'#6ca584' } }, axisTick: {show: false}, splitLine: { show: true, lineStyle:{ color:'#d9eff4' } }, axisLabel: { show:true, margin:15, color:'#666', interval:lineWidth, showMaxLabel:true }, splitNumber: 20, min: '09:30', max: isKcb(688316) ? '15:30':'15:00', } ], yAxis: [ { name:'價錢南昌大学档案学网', nameLocation: 'end', nameTextStyle:{ color:'#666', padding:[0,0,0,0] }, scale: true, axisLabel:{ color:'#6ca584', margin:10, textStyle: { color: function (value, index) { var preClose=rawData.prev_close; if(value>preClose){ return 'red'; }else if (value0){ return 'red'; }else if (value<0){ return 'green'; }else{ return 'black'; } } } }, axisTick:{ show:false }, axisLine:{ lineStyle:{ color:'#e3f3f7' } } }, ], series: [ { name: '', type: 'line', symbolSize: 1, data: data.values, smooth: true, lineStyle: { normal: {opacity: 0.9} }, itemStyle:{ color:'#7eb6ea' }, //lineStyle:{ // width:2, // type:'solid', // shadowBlur:100, // shadowColor:'rgba(24,223,121,1)', // shadowOffsetY:45 //}, areaStyle: { color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ offset: 0, color: 'rgb(126, 182, 234)' }, { offset: 1, color: 'rgb(245, 245, 245)' }]) }, markLine: { symbol: 'none', label: { position: 'insideEndTop', formatter: '{b}: {c}' }, lineStyle: { type: 'dashed', color: '#000000', width: 1 }, name: '昨收', data: [ { name: '昨收', yAxis: rawData.prev_close } ] } }, { name: '百分比', type: 'line', symbolSize: 0, data: data.Percentage, smooth: false, lineStyle: { normal: {opacity: 0.9} }, itemStyle:{ color:'#7cc7da', }, symbol:'none', symbolSize:0, lineStyle:{ width:0 }, yAxisIndex: 3 }, { name: '成交量', type: 'line', xAxisIndex: 1, yAxisIndex: 1, data: data.volumes, color:'#d0d0d0', areaStyle: { color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ offset: 0, color: 'rgb(236, 236, 236)' }, { offset: 1, color: 'rgb(245, 245, 245)' }]) }, }, ] }, true); setTimeout(function (){ window.onresize = function () { myChart.resize(); } },20) }hqlist();function hqlist(){ $.ajax({ url: SSE.Config.HANGQING_PREFIX + "/snap/688316", type: "GET", data: { begin: 0, end: -1, select:'code,bid,ask,last,change,chg_rate,prev_close,open,low,amount,volume,high' }, dataType: "jsonp", success: function (data) { var lineData = data.snap; var bid = lineData[1]; var ask = lineData[2]; var c8=getColor(ask[8] , lineData[6] ); var c6=getColor(ask[6] , lineData[6] ); var c4=getColor(ask[4] , lineData[6] ); var c2=getColor(ask[2] , lineData[6] ); var c0=getColor(ask[0] , lineData[6] ); var htmlAsk = '賣五 | '+ask[8].toFixed(2)+' | '+ask[9]+' |
'; htmlAsk += '賣四 | '+ask[6].toFixed(2)+' | '+ask[7]+' |
'; htmlAsk += '賣三 | '+ask[4].toFixed(2)+' | '+ask[5]+' |
'; htmlAsk += '賣二 | '+ask[2].toFixed(2)+' | '+ask[3]+' |
'; htmlAsk += '賣一 | '+ask[0].toFixed(2)+' | '+ask[1]+' |
'; htmlAsk += ' |
'; $("#htmlAsk").html(htmlAsk); var c8=getColor(bid[8] , lineData[6] ); var c6=getColor(bid[6] , lineData[6] ); var c4=getColor(bid[4] , lineData[6] ); var c2=getColor(bid[2] , lineData[6] ); var c0=getColor(bid[0] , lineData[6] ); var htmlBid = '買一 | '+bid[0].toFixed(2)+' | '+bid[1]+' |
'; htmlBid += '買二 | '+bid[2].toFixed(2)+' | '+bid[3]+' |
'; htmlBid += '買三 | '+bid[4].toFixed(2)+' | '+bid[5]+' |
'; htmlBid += '買四 | '+bid[6].toFixed(2)+' | '+bid[7]+' |
'; htmlBid += '買五 | '+bid[8].toFixed(2)+' | '+bid[9]+' |
'; htmlBid += ' |
'; $("#htmlBid").html(htmlBid); //最新價錢南昌大学档案学网 var last=getColor(lineData[3],lineData[6]); $("#htmlLast").html(lineData[3].toFixed(2)).attr("style","font-size:32px;color:"+last); //漲跌 var change= lineData[4] > 0 ? "red":"green"; var flag=lineData[4]>0?"+":""; $("#htmlChange").html(flag+lineData[4].toFixed(2)).attr("style","color:"+change); //漲跌幅 var chg_rate=lineData[5] > 0 ?"red":"green"; var flagA=lineData[4]>0?"+":""; $("#htmlChg_rate").html(flagA+lineData[5].toFixed(2) + '%').attr("style",";color:"+chg_rate); //昨收 $("#zs").html(lineData[6].toFixed(2)); //最高 var zgColor=getColor(lineData[11] , lineData[6] ); $("#zg").html(lineData[11].toFixed(2)).attr("style","color:"+zgColor); //收盤南昌大学档案学网 var kpColor=getColor(lineData[7] , lineData[6] ); $("#kp").html(lineData[7].toFixed(2)).attr("style","color:"+kpColor); //最低 var zdColor= getColor(lineData[8] , lineData[6] ); $("#zd").html(lineData[8].toFixed(2)).attr("style","color:"+zdColor); //成交量成交額 //快炤行情成交量單元爲股 var language="zh-cn"; var volume=lineData[10]; var volumeHtml=calVolumeUnit(language,volume,1); $("#cjl").html(volumeHtml); var turnover=lineData[9]; var turnoverHtml=calTurnoverUnit(language,turnover,1); $("#cjje").html(turnoverHtml) } }); } //獲得以後工夫賦值給input function AppendZero(obj){ if(obj < 10) return "0" + obj;else return obj; } var date=new Date(); var year=date.getFullYear(); //獲得南昌大学档案学网以後南昌大学档案学网年份 var mon=date.getMonth()+1; //獲得以後月份 var da=date.getDate(); //獲得南昌大学档案学网以後南昌大学档案学网日 var myTime = AppendZero(year)+'-'+AppendZero(mon)+'-'+AppendZero(da) $("#today").val(myTime); var ul = document.getElementsByTagName("ul")[0]; var li = document.getElementsByTagName("li"); ul.onclick= function(e){ //第一步:切換工夫(三月,半年,一年),動態換色而且較量爭論好工夫點竝賦值到input中 for (var i = 0; i < li.length; i++) { li[i].style.background = ""; li[i].style.color = ""; li[i].style.fontWeight = "normal"; } var temp = e.srcElement; temp.style.background= "rgb(231, 240, 249)"; temp.style.color= "#444"; temp.style.fontWeight= "bold"; //較量爭論南昌大学档案学网工夫南昌大学档案学网 if(temp.innerText == '三月'){ var data=getBefEndDate(1); ajaxUrl(data.befD,data.nowD); }else if(temp.innerText == '半年'){ var data=getBefEndDate(2); ajaxUrl(data.befD,data.nowD); }else if(temp.innerText == '一年'){ var data=getBefEndDate(3); ajaxUrl(data.befD,data.nowD); } } //k線圖憑據昨收變換色彩 function getColor(num,baseNum){ if(num>baseNum){ return "red"; }else if(num