//创建图表 chart_tsd = Highcharts.stockChart('stock_line', { chart: { marginLeft: 0, marginRight: 0, marginBottom: 0, panning:false, pinchType:'', events: { load: function() { var date = new Date(); var myhours = date.getHours(); var myminute = date.getMinutes(); var mysecond = date.getSeconds(); if (myhours == 9 && myminute >= 30) { //每日早上9:30分后开始启用定时器 timeTicket(this); } else if (myhours > 9) { timeTicket(this); } } } }, rangeSelector: { enabled: false }, exporting: { enabled: false }, navigator: { enabled: false }, scrollbar: { enabled: false }, credits: { enabled: false }, tooltip: { enabled: false }, plotOptions: { series: { states: { hover: { lineWidth: 1 } } } }, xAxis: { tickInterval: 60 * 1000 * 60, min: minTime, max: maxTime, gridLineColor: '#f8f8f8', gridLineDashStyle: 'dotted', gridLineWidth: 1, tickWidth: 0, tickColor: '#000', lineColor: '#f8f8f8', breaks: breakss, //上午场最终时间无缝连接下午场开始时间 tickPositioner: function() { return positions; }, labels: { y:0, formatter: function() { var tt = Highcharts.dateFormat("%H:%M", this.value); if (tt == "11:30"){ tt = "11:30/13:00"; } return tt; } } }, yAxis: [{ //y轴右 allowDecimals: true, showFirstLabel: true, showLastLabel: true, opposite: true, height: '70%', gridLineWidth: 0, labels: { overflow: 'justify', useHTML: true, align: 'right', x: 0, formatter: function() { chartNumR++; var vDate = decimal2(parseFloat(this.value)); if ((chartNumR%labelNumR) == 1) { return '<span style="color:rgb(18, 160, 38)">' + vDate + "%" + '</span>'; } else if ((chartNumR%labelNumR) == 0) { return '<span style="color:red; position: absolute; top: 5px; right:0px;">' + vDate + "%" + '</span>'; } else { return '<span>' + vDate + "%" + '</span>'; } } }, tickPositioner: function() { var ypositions = [min_PricePer, 0, max_PricePer]; labelNumR = ypositions.length; return ypositions; } }, { //y轴左 max: max_preclosePx, min: min_preclosePx, height: '70%', allowDecimals: true, showFirstLabel: true, showLastLabel: true, opposite: false, gridLineWidth: 0, labels: { overflow: 'justify', useHTML: true, align: 'left', x: 0, formatter: function() { chartNumL++; if (this.value > 100000) { this.value = preclosePx; } if (this.value > 10000) { var vDate = Math.ceil(this.value); } else if (this.value >= 100) { var vDate = decimal2(parseFloat(this.value)); } else { var vDate = decimal2(parseFloat(this.value)); } if ((chartNumL%labelNumL) == 1) { return '<span style="color:rgb(18, 160, 38)">' + vDate + '</span>'; } else if ((chartNumL%labelNumL) == 0) { return '<span style="color:red; position: absolute; top: 5px; left:0px;">' + vDate + '</span>'; } else { return '<span>' + vDate + '</span>'; } } }, plotLines: [{ //昨收 color: 'red', dashStyle: 'Dot', value: preclosePx, width: 1, zIndex: 99 }], tickPositioner: function() { var ypositions = [min_Price, preclosePx, max_Price]; labelNumL = ypositions.length; return ypositions; }, gridLineColor: '#f8f8f8', }, { //交易量y轴 height: '15%', top: '80%', offset: 0, gridLineWidth: 0, showFirstLabel: true, showLastLabel: true, gridLineColor: '#f8f8f8', opposite: false, labels: { overflow: 'justify', x: 0, align: 'left', formatter: function() { return parseInt(this.value); } } }], series: [{ type: 'area', name: '最新价', lineWidth: 1, fillColor: { linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, stops: [ [0, '#A6CDF2'], [1, Highcharts.Color('#A6CDF2').setOpacity(0).get('rgba')] ] }, data: tData0.tValues0, dataGrouping: { enabled: false, }, zIndex: 100, yAxis: 1 }, { name: '日均价', type: 'line', data: tData1.tValues1, color: '#f7ce28', lineWidth: 1, dataGrouping: { enabled: false, }, yAxis: 1 }, { name: '交易量', type: 'column', data: tData2, color: '#9DC8F1', yAxis: 1, dataGrouping: { enabled: false }, yAxis: 2 },{ name : '实时价', type: 'scatter', data : series3_data, zIndex: 200, yAxis: 1 }] });//console.log(typeof tData0.tValues0);}
目前暂无任何回答
- 0 回答
- 2 关注
- 2536 浏览
添加回答
举报
0/150
提交
取消