配置项如下
var fontColor = '#30eee9';
var data_date = [
'1949',
// '1950',
'1951',
'1952',
'1953',
'1954',
'1955',
'1956',
'1957',
'1958',
'1959',
'1960',
'1961',
'1962',
'1963',
'1964',
'1965',
'1966',
'1967',
'1968',
'1969',
'1970',
'1971',
'1972',
'1973',
'1974',
'1975',
'1976',
'1977',
'1978',
'1979',
'1980',
'1981',
'1982',
'1983',
'1984',
'1985',
'1986',
'1987',
'1988',
'1989',
'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',
'2017',
'2018'
]; // 日期
var data_white = [
'165.13',
// '168.08',
'173.43',
'175.94',
'183.28',
'206.83',
'212.6',
'221.93',
'228.86',
'211.46',
'215.74',
'219.48',
'219.2',
'223.57',
'232.68',
'237.61',
'242.15',
'249.4',
'255.77',
'263.34',
'274.49',
'286.21',
'296.04',
'300.92',
'304.36',
'308.4',
'313.98',
'318.17',
'323.23',
'323.2',
'324.15',
'327.84',
'334.02',
'340.91',
'347.84',
'353.05',
'358.24',
'363.89',
'371.68',
'378.86',
'387.52',
'405.05',
'412.4',
'417.54',
'420.41',
'423.72',
'427.78',
'432.96',
'437.25',
'443.53',
'448.15',
'455.61',
'459.64',
'464.03',
'467.83',
'468.81',
'472.18',
'479.42',
'482.23',
'488.25',
'490.64',
'497.73',
'505.18',
'510.99',
'520.18',
'526.52',
'530.56',
'533.99',
'532.53',
'534.34'
]; // 年末总人口
var data_red = [
'81.32',
// '82.67',
'82.98',
'84.5',
'88.14',
'99.51',
'102.62',
'106.38',
'110.77',
'101.69',
'103.19',
'109.57',
'111.29',
'114.18',
'118.6',
'120.91',
'120.99',
'123.58',
'126.55',
'129.62',
'136.27',
'141.93',
'146.67',
'149.08',
'150.89',
'152.63',
'154.72',
'157.04',
'160.42',
'159.77',
'160.31',
'162.06',
'164.95',
'168.01',
'170.98',
'172.72',
'174.71',
'177.27',
'180.75',
'184.01',
'187.97',
'197.15',
'200.25',
'202.68',
'203.98',
'205.6',
'207.57',
'209.99',
'212.73',
'214.3',
'216.26',
'219.92',
'222.37',
'224.83',
'226.27',
'225.28',
'227.48',
'231.08',
'231.98',
'234.72',
'234.99',
'238.39',
'241.89',
'244.37',
'248.82',
'251.76',
'253.63',
'255.24',
'254.58',
'255.58'
]; // 女性人口
option = {
backgroundColor: '#11183c',
title: [{
text: '1949-2018连云港市人口数据',
left: 'center',
textStyle: {
color: fontColor,
align: 'center',
}
},
{
id: 'statistic',
text: '单位:万人',
right: '0%',
top: '9%',
textStyle: {
color: '#fff',
fontSize: 11
}
}
],
grid: {
left: '5%',
right: '10%',
top: '20%',
bottom: '15%',
containLabel: true
},
tooltip: {
show: true,
trigger: 'item'
},
legend: {
show: true,
x: 'right',
y: '35',
icon: 'stack',
itemWidth: 10,
itemHeight: 10,
textStyle: {
color: '#1bb4f6'
},
data: ['年末总人口', '女性人口']
},
xAxis: [{
type: 'category',
boundaryGap: false,
axisLabel: {
color: fontColor
},
axisLine: {
show: true,
lineStyle: {
color: '#397cbc'
}
},
axisTick: {
show: false,
},
splitLine: {
show: false,
lineStyle: {
color: '#195384'
}
},
data: data_date
}],
yAxis: [{
type: 'value',
name: '',
min: 0.0,
max: 600.0,
axisLabel: {
formatter: '{value}',
textStyle: {
color: '#2ad1d2'
}
},
axisLine: {
lineStyle: {
color: '#27b4c2'
}
},
axisTick: {
show: false,
},
splitLine: {
show: true,
lineStyle: {
color: '#11366e'
}
}
},
],
series: [{
name: '年末总人口',
type: 'line',
symbol: 'circle',
symbolSize: 8,
itemStyle: {
normal: {
color: 'white',
lineStyle: {
color: "white",
width: 1
},
}
},
label: {
normal: {
show: true,
position: 'top'
}
},
markPoint: {
itemStyle: {
normal: {
color: 'red'
}
}
},
data: data_white
},
{
name: '女性人口',
type: 'line',
symbol: 'circle',
symbolSize: 8,
label: {
normal: {
show: true,
position: 'top'
}
},
itemStyle: {
normal: {
color: 'red',
lineStyle: {
color: "red",
width: 1
},
}
},
data: data_red
}
]
};