配置项如下
const set = [
['日期', '项目商品总数', '行业商品总数'],
['2019/10/1', 458, 519],
['2019/10/2', 466, 547],
['2019/10/3', 419, 481],
['2019/10/4', 440, 496],
['2019/10/5', 413, 441],
['2019/10/6', 456, 554],
['2019/10/7', 480, 527],
['2019/10/8', 481, 516],
['2019/10/9', 420, 450],
['2019/10/10', 479, 517],
['2019/10/11', 467, 471],
['2019/10/12', 417, 447],
['2019/10/13', 417, 473],
['2019/10/14', 466, 560],
['2019/10/15', 462, 540],
['2019/10/16', 442, 520],
['2019/10/17', 400, 415],
['2019/10/18', 437, 495],
['2019/10/19', 495, 552],
['2019/10/20', 435, 502],
['2019/10/21', 419, 480],
['2019/10/22', 434, 488],
['2019/10/23', 425, 497],
['2019/10/24', 481, 513],
['2019/10/25', 433, 521],
['2019/10/26', 481, 543],
['2019/10/27', 451, 468],
['2019/10/28', 437, 532],
['2019/10/29', 462, 477],
['2019/10/30', 438, 478]
];
option = {
dataset: {
source: set
},
grid: {
left: 8,
right: 8,
top: 8,
bottom: 8
},
// backgroundColor: '#e5e5e5',
tooltip: {
// formatter: '{a0}: {c0}</br>{a1}: {c1}'
},
xAxis: {
// type:'time',
type: 'category',
show: false,
},
yAxis: {
show: false,
},
series: [
{
type:'bar',
barWidth:'60%',
color:'#02A7F0'
},
{
type: 'line',
lineStyle: {
color: '#D2D2D2'
},
showSymbol: false,
areaStyle: {
color: {
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [{
offset: 1,
color: '#fff' // 0% 处的颜色
}, {
offset: 0,
color: '#D2D2D2' // 100% 处的颜色
}],
global: false // 缺省为 false
}
},
}]
};
myChart.resize({
width: 280,
height: 88
})