配置项如下
/*var areaStyle = {
silent: false,
itemStyle: {
normal: {
color: 'rgba(241, 28, 93, 0.05)'
}
},
data: [
[{
name: '预警区域',
xAxis: '产品4',
label: {
normal: {
offset: [0, 100],
color: "#666",
fontSize: 14
}
}
}, {
xAxis: '产品9'
}]
]
}*/
var xData = function() {
var data = [];
for (var i = 1; i < 13; i++) {
data.push(i+"月");
}
return data;
}();
var option = {
title: {
"text": "生产总值累计值\n",
subtext:"",
top:'12%',
"left": "10%",
"subtextStyle": {
"color": "#fff",
fontWeight:800,
fontSize:16
},
textStyle:{
"color": "#fff",
fontSize:28
}
},
backgroundColor: '#020306',
color: ['#4162ff', '#c78b42', '#CD3F2A', '#ff6e72', '#9692ff'],
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
legend: {
top:'14%',
right:'30%',
textStyle:{
color:'#FFFFFF'
},
orient: 'vertical',
data: ['第一产业', '第二产业', '第三产业', '']
},
grid: {
left: '10%',
right: '30%',
bottom: '20%',
top: '27%',
containLabel: true,
z: 22
},
yAxis: [{
type: 'value',
splitLine: {
show: true,
lineStyle: {
color: ['#f2f2f2']
}
},
axisLine: {
lineStyle: {
color: '#0c3b71'
}
},
axisLabel: {
color: 'rgb(170,170,170)',
formatter: '{value} '
}
}],
xAxis: [{
type: 'category',
axisLine: {
lineStyle: {
color: '#0c3b71'
}
},
axisLabel: {
show: true,
color: 'rgb(170,170,170)',
fontSize:14
},
data:xData
}],
series: [{
name: '第一产业',
type: 'bar',
stack: '总量',
barWidth: '16px',
data: [80, 212, 101, 110, 80, 212, 101, 120, 113, 101, 120, 113],
// markArea: areaStyle
},
{
name: '第二产业',
type: 'bar',
stack: '总量',
data: [90, 232, 251, 212, 101, 110,212, 101, 110, 10, 120, 113],
// markArea: areaStyle
},
{
name: '第三产业',
type: 'bar',
stack: '总量',
data: [90, 232, 231, 134, 190, 90, 232, 251, 212, 101, 110, 10],
// markArea: areaStyle
},
{
name: '',
type: 'bar',
xAxisIndex: 0,
barWidth: '16px',
barGap: '-95%',
itemStyle: {
normal: {
color: 'rgba(255,255,255,0.1)'
}
},
zlevel: 9,
data: [700, 700, 700, 700, 700, 700, 700, 700, 700, 700, 700, 700],
// markArea: areaStyle
},
]
};