web数据可视化(Echarts版)4-8多仪表盘图(代码仅供参考)

echarts.js文件下载地址:Apache ECharts

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<script src="echarts.js"></script>
		<title></title>
	</head>
	<body>
		<div id="main" style="height: 1000px;width:1000px;"></div>
		<script type="text/javascript">
			var myChart=echarts.init(document.getElementById("main"));
			var option={
				backgroundColor:'rgba(128,128,128,0.1)',
				tooltip:{formatter:"{a} <br/>{c} {b}"},
				title:{
					text:'多仪表盘实例(共四个仪表盘)',
					x:'center',y:100,
					show:true,
					offsetCenter:[50,"20%"],
					textStyle:{
						fontFamily:"黑体",
						color:"blue",
						fontSize:20,
					}
				},
				series:[
					{
						name:"速度",type:"gauge",z:3,
						radius:"35%",
						min:0,
						max:220,
						splitNumber:22,
						axisLine:{lineStyle:{width:10}},
						axisTick:{
							length:15,
							splitNumber:5,
							lineStyle:{
								color:"auto",
							},
						},
						splitLine:{length:20,lineStyle:{color:"auto",}},
						title:{textStyle:{fontWeight:'bolder',fontSize:20,fontStyle:'italic'}},
						detail:{textStyle:{fontWeight:'bolder'}},
						data:[{value:40,name:'车速(km/h)'}]
					},
					{
						name:"转速",type:"gauge",
						radius:"35%",
						center:["20%","55%"],
						min:0,
						max:7,
						endAngle:45,
						splitNumber:7,
						axisLine:{lineStyle:{width:8}},
						axisTick:{
							length:12,
							splitNumber:5,
							lineStyle:{
								color:"auto",
							},
						},
						splitLine:{length:20,lineStyle:{color:"auto",}},
						pointer:{width:5},
						title:{offsetCenter:[0,'-30%'],},
						detail:{textStyle:{fontWeight:'bolder'}},
						data:[{value:1.5,name:'转速(x1000 r/min)'}]
					},
					{
						name:"油表",type:"gauge",
						radius:"25%",
						center:["77%","50%"],
						min:0,
						max:2,
						startAngle:135,
						endAngle:45,
						splitNumber:2,
						axisLine:{lineStyle:{width:8}},
						axisTick:{
							length:10,
							splitNumber:5,
							lineStyle:{
								color:"auto",
							},
						},
						axisLabel:{
							formatter:function(v){
								switch(v+''){
									case '0':return 'E';
									case '1':return '油表';
									case '2':return 'F';
								}
							}
						},
						splitLine:{length:15,lineStyle:{color:"auto",}},
						pointer:{width:4},
						title:{show:false},
						detail:{show:false},
						data:[{value:0.5,name:'gas'}]
					},
					{
						name:"水表",type:"gauge",
						radius:"25%",
						center:["77%","50%"],
						min:0,
						max:2,
						startAngle:315,
						endAngle:225,
						splitNumber:2,
						axisLine:{lineStyle:{width:8}},
						axisTick:{show:false},
						axisLabel:{
							formatter:function(v){
								switch(v+''){
									case '0':return 'H';
									case '1':return '水表';
									case '2':return 'C';
								}
							}
						},
						splitLine:{length:15,lineStyle:{color:"auto",}},
						pointer:{width:2},
						title:{show:false},
						detail:{show:false},
						data:[{value:0.5,name:'gas'}]
					},
				]
			};
			setInterval(function(){
					option.series[0].data[0].value=(Math.random()*100).toFixed(2)-0;
					option.series[1].data[0].value=(Math.random()*7).toFixed(2)-0;
					option.series[2].data[0].value=(Math.random()*2).toFixed(2)-0;
					option.series[3].data[0].value=(Math.random()*2).toFixed(2)-0;
					myChart.setOption(option,true);
				},2000);
			myChart.setOption(option);
		</script>
	</body>
</html>
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值