配置项如下
option = {
title: {
text: '近三月趋势图'
},
legend: {
data: ['涨跌幅'],
left: 450,
top: 6,
itemHeight: 10,
selectedMode: false
},
xAxis: {
gridIndex: 0,
name: 'x',
data: ['2016-06', '2016-07', '2016-08'],
nameTextStyle: {
color: '#2c9ad3'
}
},
yAxis: [
{
gridIndex: 0,
name: 'y',
type: 'value',
min: 80,
max: 130,
splitNumber: 5
}
],
series: [
{
name: '涨跌幅',
type: 'line',
smooth: false,
data: [90, 100, 110]
}]
}
var options2 = {
title: {
text: '近三月趋势图'
},
legend: {
data: ['环比涨跌幅'],
left: 450,
top: 6,
itemHeight: 10,
selectedMode: false
},
xAxis: {
gridIndex: 0,
name: 'x',
data: ['2016-06', '2016-07', '2016-08'],
nameTextStyle: {
color: '#2c9ad3'
}
},
yAxis: [
{
gridIndex: 0,
name: 'y',
type: 'value',
min: 80,
max: 130,
splitNumber: 5
}
],
series: [
{
name: '环比涨跌幅',
type: 'line',
smooth: false,
data: [94, 105, 109]
}]
};
setTimeout(function () {
myChart.setOption(options2);
}, 1000);