echarts仪表盘样式设置

function fillpan(obj){
	var myChart1 = echarts.init($(obj.id)[0]);
	var option = {
		    backgroundColor: "#ffffff",
		    title: {
		        text: obj.text,
		        left:'center', //标题位置
		        bottom:'10%',
		        textStyle:{
		        	color:"#999",
		        	fontSize:18
		        },
		    },
		    color : defaultColor,
		    tooltip:{
	            formatter: obj.data.value
	        },
		    series: [{
		        name: obj.text,
		        type: 'gauge',
		        max:obj.max,
		        min:obj.min,
		        detail: {
		           /* formatter: '{value}',*/
		        	formatter:function(value){
	            			return value  +"\n"+"("+obj.danwei+")";//实际数据显示加单位并且换行
	            	},
		            textStyle: { 
	                    color: 'auto',
	                    fontSize : 19,
	                },
	                offsetCenter:["0","55%"] //实际值位置
		        },
		        axisLine: {            // 坐标轴线
	                show: true,        // 默认显示,属性show控制显示与否
	                lineStyle: {       // 属性lineStyle控制线条样式
	                    /*color: [[0.2, 'lightgreen'],[0.65, 'orange'],[0.8, 'skyblue'],[1, '#ff4500']],*/
	                	color:obj.color,//根据数据分层颜色
	                    width: 22
	                }
	            },
		        pointer: {
		        	width: 5, //指针的宽度
		        	length: "70%", //指针长度,按照半圆半径的百分比
		        },
		        splitLine: { //分割线样式
		        	 length: 20
		        },
		        data: obj.data

		    }]
		};
	myChart1.setOption(option);
	window.addEventListener("resize",function(){
		$("#paitable").datagrid("resize",{
			height:$("#paitable_").height()+"px"
		});
		myChart1.resize();
	});
}

猜你喜欢

转载自blog.csdn.net/qq_36784628/article/details/83820712