<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>echarts</title>
<!-- 引入 echarts.js -->
<script src="echarts.js"></script>
</head>
<body style="background-color:#F0F8FF; text-align:left">
<!-- 为ECharts准备一个具备大小(宽高)的Dom -->
<div id="main" style="width:600px;height:400px;"></div>
<script type="text/javascript">
// 基于准备好的dom,初始化echarts实例
var myChart = echarts.init(document.getElementById('main'));
option = {
tooltip: {
formatter: '{a} <br/>{b} : {c}%'
},
toolbox: {
feature: {
restore: {},
saveAsImage: {}
}
},
series: [
{
name: '业务指标',
type: 'gauge',
detail: {formatter: '{value}%'},
data: [{value: 50, name: '完成率'}]
}
]
};
option.series[0].data[0].value = (Math.random() * 100).toFixed(2) - 0;
myChart.setOption(option, true);
</script>
</body>
</html>
标签:formatter,option,series,value,Echarts,HTML,JS,data,echarts From: https://blog.51cto.com/u_14650780/5998676