




23.儀表盤的實現.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<script src="lib/echarts.min.js"></script>
</head>
<body>
<div style="width: 600px;height:400px"></div>
<script>
//1. ECharts最基本的代碼結構
//2. 准備數據, 設置給series下的data
//3. 將type的值設置為gauge
var mCharts = echarts.init(document.querySelector("div"))
var option = {
series: [
{
type: 'gauge', // gauge:計量器;標准尺寸;容量規格
data: [
// 每一個對象就代表一個指針
{
value: 97,
// 指針的樣式
itemStyle: {
color: 'pink' // 指針的顏色
}
},
{
value: 85,
itemStyle: {
color: 'green'
}
}
],
min: 50, // min max 控制儀表盤數值范圍
max: 120
}
]
}
mCharts.setOption(option)
</script>
</body>
</html>
