配置项如下
option = {
backgroundColor: '#0A2E5D',
title: {
text: '随堂测试对学生考试成绩的影响',
textStyle: {
color: 'white', //坐标的字体颜色
}
},
tooltip: {
trigger: 'axis'
},
legend: {
data: ['开展随堂测试前的成绩', '开展随堂测试后的成绩'],
left: '40%',
textStyle: {
color: 'white', //坐标的字体颜色
},
},
toolbox: {
show: true,
feature: {
dataView: {
show: true,
readOnly: false
},
magicType: {
show: true,
type: ['bar']
},
restore: {
show: true
},
saveAsImage: {
show: true
}
}
},
calculable: true,
xAxis: [{
axisLine: {
lineStyle: {
color: 'white', //坐标轴的颜色
},
},
type: 'category',
data: ['语文','数学','英语','生物','化学','物理','地理','历史','政治']
}],
yAxis: [
{
type: 'value',
name: '平均分',
min: 0,
max: 100,
interval: 10,
axisLabel: {
textStyle: {
color: 'white', //坐标的字体颜色
},
formatter: '{value} '
},
axisLine: {
lineStyle: {
color: 'white', //坐标轴的颜色
},
},
}
],
color: [ '#6449f7', '#7cb17b'],
series: [{
name: '开展随堂测试前的成绩',
type: 'bar',
data: [89, 88, 76, 91,86,95,81,85,74],
},
{
name: '开展随堂测试后的成绩',
type: 'bar',
data: [89, 90, 83, 93.5,91,93,87,92,89],
}
]
};