markarea属性无法显示
配置项如下
//第七十三行的markarea属性和stock不兼容
option = {
toolbox: {
show: true,
feature: {
saveAsImage: {
pixelRatio: 5
}
}
},
title: [{
text: '美国储蓄率、投资率和净出口',
left: 'center'
}, ],
tooltip: {
trigger: 'axis',
formatter: '{b}<br/>{a0} : {c0}<br/>{a1} :{c1}'
},
legend: {
orient: 'vertical',
left: 'left',
data: ['Gross capital formation', 'Saving rate', 'Net export']
},
xAxis: {
type: 'category',
// axisTick: {
// alignWithLabel: true,
// interval: 0
// },
splitLine: {
show: false
},
data: ["1990", "1991", "1992", "1993", "1994", "1995", "1996", "1997", "1998", "1999", "2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", "2011", "2012", "2013", "2014", "2015", "2016"]
},
grid: {
left: '3%',
right: '4%',
top: '15%',
bottom: '3%',
containLabel: true
},
yAxis: [{
type: 'value',
scale: true,
min: 12,
splitLine: {
show: false
},
axisLabel: {
formatter: '{value}%'
// name: 'y'
},
},
{
type: 'value',
name: "千亿美元",
splitLine: {
show: false
}
}
],
series: [{
name: 'Saving rate',
type: 'line',
stack: '总量',
smooth: true,
data: [18.77, 18.84, 17.71, 17.06, 17.85, 18.73, 19.6, 20.79, 21.34, 20.91, 20.77, 19.63, 18.3, 17.47, 17.66, 18.04, 19.31, 17.51, 15.67, 14.57, 15.32, 15.95, 17.98, 18.54, 19.58, 19.44, 18.09],
},
{
name: 'Gross capital formation',
type: 'line',
smooth: true,
stack: '总量',
areaStyle: {
normal: {
opacity: 0.3
}
},
lineStyle: {
normal: {
type: 'dashed'
}
},
data: [2.7, 1.22, 2.31, 3.28, 3.36, 2.47, 2.03, 1.57, 1.51, 2.41, 2.8, 2.43, 3.28, 4.19, 4.86, 5.18, 4.02, 4.84, 5.11, 2.94, 3.08, 2.59, 1.37, 1.22, 0.6, 0.99, 1.6],
},
{
name: 'Net export',
type: 'bar',
markArea: {
data: [
[{
name: '突出显示',
xAxis: "2000",
}, {
xAxis: "2010",
}]
]
},
itemStyle: {
opacity: 0.3
},
yAxisIndex: 1,
data: [-0.81, -0.31, -0.39, -0.7, -0.99, -0.96, -1.04, -1.08, -1.66, -2.59, -3.73, -3.62, -4.19, -4.94, -6.1, -7.14, -7.62, -7.05, -7.09, -3.84, -4.95, -5.49, -5.37, -4.62, -4.9, -5, -5.05],
},
]
};