| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237 | var myCharta = echarts.init(document.getElementById('right_1'), 'vintage');// var xData = function() {//     var data = [];//     for (var i = 1; i < 6; i++) {//         data.push(i + "号库房");//     }//     return data;// }();nowList = [	[709, 1917, 2455, 2610, 1719, ],	[512, 332, 458, 734, 318, ],	[422, 512, 832, 510, 1010, ],	[418, 838, 316, 726, 514, ],	[416, 510, 710, 838, 710, ],	[428, 812, 432, 735, 417, ]];outList = [	[327, 1776, 507, 1200, 800, ],	[714, 430, 626, 520, 430, ],	[645, 454, 241, 736, 814, ],	[762, 434, 820, 630, 1264],	[416, 910, 710, 338, 510, ],	[628, 412, 532, 335, 717, ]]nameList = [	['1号库房', '2号库房', '3号库房', '4号库房', '5号库房'],	['6号库房', '7号库房', '8号库房', '9号库房', '10号库房'],	['11号库房', '12号库房', '13号库房', '14号库房', '15号库房'],	['16号库房', '17号库房', '18号库房', '19号库房', '20号库房'],	['21号库房', '22号库房', '23号库房', '24号库房', '25号库房'],	['26号库房', '27号库房', '28号库房', '29号库房', '30号库房'],]sumList=[	[1036,3693,2962,3810,2519],	[1226,762,1084,1254,748],	[1067,966,1073,1246,1824],	[1180,1272,1136,1356,1778],	[832,1420,1420,1176,1220,],	[1056,1224,964,1070,1134]]var a =-1;function autoChanges() {	if(a<5){	  a+=1;    	}else{		a=0;	}var now = Math.ceil(a);var out = Math.ceil(a);var name = Math.ceil(a);var sum = Math.ceil(a);// var now = Math.ceil(a);// var out = Math.ceil(a);// var name = Math.ceil(a);// var sum = Math.ceil(a);option = {	"tooltip": {		"trigger": "axis",		"axisPointer": {			"type": "shadow",			textStyle: {				color: "#fff"			}		},	},	"grid": {		"borderWidth": 0,		"top": 65,		"bottom": 80,		textStyle: {			color: "#fff"		}	},	"legend": {		x: '10%',		top: '8%',		textStyle: {			color: '#fff',		},		"data": ['现有', '出库', '平均']	},	"calculable": true,	"xAxis": [{		"type": "category",		"axisLine": {			lineStyle: {				color: '#90979c'			}		},		"splitLine": {			"show": false		},		"axisTick": {			"show": false		},		"splitArea": {			"show": false		},		"axisLabel": {			"interval": 0,			textStyle: {				color: '#fff',			},		},		"data": nameList[name],	}],	"yAxis": [{		"type": "value",		"splitLine": {			"show": false		},		"axisLine": {			lineStyle: {				color: '#90979c'			}		},		"axisTick": {			"show": false		},		"axisLabel": {			"interval": 0,			textStyle: {				color: '#fff',			},		},		"splitArea": {			"show": false		},	}],	"dataZoom": [{		"show": false,		"height": 10,		handleColor: '#0a4870',		fillerColor: ' #0a4870',		"xAxisIndex": [			0		],		bottom: 30,		"start": 10,		"end": 100,		handleIcon: 'path://M306.1,413c0,2.2-1.8,4-4,4h-59.8c-2.2,0-4-1.8-4-4V200.8c0-2.2,1.8-4,4-4h59.8c2.2,0,4,1.8,4,4V413z',		handleSize: '110%',		handleStyle: {			color: "#0a4870",		},		textStyle: {			color: "#fff"		},		borderColor: "#0a4870"	}, {		"type": "inside",		"show": true,		"height": 15,		"start": 1,		"end": 100	}],	"series": [{			"name": "现有",			"type": "bar",			"stack": "总量",			"barMaxWidth": 35,			"barGap": "10%",			"itemStyle": {				"normal": {					"color": "#0079fe",					"label": {						"show": true,						"textStyle": {							"color": "#fff"						},						"position": "inside",						formatter: function (p) {							return p.value > 0 ? (p.value) : '';						}					}				}			},			"data": nowList[now],		},		{			"name": "出库",			"type": "bar",			"stack": "总量",			"itemStyle": {				"normal": {					"color": "#00a041",					"barBorderRadius": 0,					"label": {						"show": true,						"position": "inside",						formatter: function (p) {							return p.value > 0 ? (p.value) : '';						}					}				}			},			"data": outList[out]		}, {			"name": "入库",			"type": "line",			symbolSize: 10,			symbol: 'circle',			"itemStyle": {				"normal": {					"color": "#00e4ff",					"barBorderRadius": 0,					"label": {						"show": true,						"position": "top",						formatter: function (p) {							return p.value > 0 ? (p.value) : '';						}					}				}			},			"data": sumList[sum]		},	]}myCharta.setOption(option);}autoChanges(); //初始化实例后,首次设置数据setInterval( //设置定时器,1s更新一次	function () {		autoChanges();	}, 5000);
 |