qt_demoe/echartgauge/file/gauge.html

48 lines
1007 B
HTML
Raw Normal View History

2020-01-04 06:46:39 +00:00
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>ECharts</title>
<!-- 引入 echarts.js -->
<script src="echarts.min.js"></script>
</head>
<body>
<!-- 为ECharts准备一个具备大小宽高的Dom -->
2020-01-04 06:53:35 +00:00
<div id="main" style="height:300px;"></div>
2020-01-04 06:46:39 +00:00
<script type="text/javascript">
// 基于准备好的dom初始化echarts实例
var myChart = echarts.init(document.getElementById('main'));
function setGaugeValue(value){
var option = {
tooltip : {
formatter: "{a} <br/>{b} : {c}%"
},
toolbox: {
feature: {
restore: {},
saveAsImage: {}
}
},
series: [
{
name: '业务指标',
type: 'gauge',
detail: {formatter:'{value}%'},
data: [{value: value, name: '完成率'}]
}
]
};
myChart.setOption(option);
}
window.onresize = myChart.resize ;
setGaugeValue(68);
</script>
</body>
</html>