老師,我的工具箱保存圖片為什么沒顯示出來?
<!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>Js</title>
<style>
.red{
border:1px solid red;
}
</style>
</head>
<body>
<!-- 為ECharts準備一個具備大小的Dom -->
<div id="main" style="width:900px;height:600px"></div>
<script src="echarts.min.js"></script>
<script>
// 基于準備好的Dom,初始化echarts實例
var myChart=echarts.init(document.getElementById('main'));
//指定圖表的配置項和數(shù)據(jù)
var options={
//標題
title:{
text:'ECharts入門實例'
},
//工具箱
toolBox:{
show:true,
feature:{
saveAsImage:{
show:true
}
}
},
//圖例
legend:{
data:['銷量']
},
//x軸
xAxis:{
data:['襯衫','羊毛衫','雪紡衫','褲子','高跟鞋','襪子']
},
//y軸
yAxis:{},
//數(shù)據(jù)
series:[{
name:'銷量',
type:'bar',
data:[5,15,25,13,23,6]
},{
name:'產(chǎn)量',
type:'line',
data:[7,30,89,55,67,88]
}]
}
//使用剛指定的配置項和數(shù)據(jù)顯示圖表
myChart.setOption(options)
</script>
</body>
</html>
2019-07-23
工具箱的配置項是:toolbox,而你的代碼中寫的toolBox,請諒解!