console
const myCharts = echarts.init(document.getElementById('container'))
const xDataArr = ['张三', '李四', '王五', '闰土', '小明', '茅台', '二妞', '大强']
const yDataArr = [88, 92, 63, 77, 94, 80, 72, 86]
const option = {
xAxis: {
type: 'category',
data: xDataArr
},
yAxis: {
type: 'value'
},
series: [
{
name: '语文',
type: 'bar',
data: yDataArr,
color: 'red',
markPoint: {
data: [{
name: '最小值',
type: 'min'
}, {
name: '最大值',
type: 'max'
}]
},
markLine: {
data: [{
name: '平均值',
type: 'average'
}]
}
}
],
toolbox: {
feature: {
saveAsImage: {},
dataView: {},
restore: {},
dataZoom: {},
magicType: {
type: ['bar', 'line']
}
}
}
}
myCharts.setOption(option)
<div id="container"></div>
#container {
width: 600px;
height: 400px;
background: linear-gradient(135deg,#fce38a,#f38181);
}