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'
}]
}
}
],
title: {
text: 'Score',
textStyle: {
color: 'red',
},
borderWidth: 5,
borderColor: 'blue',
borderRadius: 5,
left: 50,
top: 10,
},
tooltip: {
trigger: 'axis',
tirggerOn: 'click',
formatter: `{b} is {c}`
}
}
myCharts.setOption(option)
<div id="container"></div>
#container {
width: 600px;
height: 400px;
background: linear-gradient(135deg,#fce38a,#f38181);
}