折线图两个 echart 图联动时,当鼠标在图1上移动时,联动的图2会死掉,并报错,图1没有问题。相同的当鼠标在图2上移动时,联动的图1也会死掉,图2没有问题。
希望可以正常的联动.
option = {
tooltip : {
trigger: 'axis',
axisPointer: {
type: 'cross'
}
},
toolbox: {
show : true,
feature : {
mark : {show: true},
dataView : {show: true, readOnly: true},
magicType: {show: true, type: ['line']},
restore : {show: true},
saveAsImage : {show: true}
}
},
legend: {
data: [
{'name': 'name1'},
{'name': 'name2'}
]
},
grid: {
top: '12%',
left: '1%',
right: '1%',
containLabel: true
},
xAxis: [
{
name: '时间',
type : 'time',
boundaryGap: [0, '30%'],
},
],
yAxis: [
{
name : '题数',
type : 'value',
position: 'left',
boundaryGap: [0, '30%'],
},
],
dataZoom: [{
end: 100,
start: 90,
show: true,
type: 'slider',
filterModel: 'empty',
labelFormatter: function (value) {
return ECHARTS.format.formatTime('MM-dd', new Date(value));
}
}],
series : [
{
name: 'name1',
type: 'line',
data: [[time1, data1], [time2, data2], [time3, data3]]
},
{
name: 'name2',
type: 'line',
data: [[time2, data1], [time3, data2], [time5, data3]]
}
]
}
option2 = {
tooltip : {
trigger: 'axis',
axisPointer: {
type: 'cross'
}
},
toolbox: {
show : true,
feature : {
mark : {show: true},
dataView : {show: true, readOnly: true},
magicType: {show: true, type: ['line']},
restore : {show: true},
saveAsImage : {show: true}
}
},
legend: {
data: [
{'name': 'name1'},
{'name': 'name2'}
]
},
grid: {
top: '12%',
left: '1%',
right: '1%',
containLabel: true
},
xAxis: [
{
name: '时间',
type : 'time',
gridIndex: 0,
boundaryGap: [0, '30%'],
},
],
yAxis: [
{
name : '题数',
type : 'value',
position: 'left',
boundaryGap: [0, '30%'],
},
],
dataZoom: [{
end: 100,
start: 90,
show: true,
type: 'slider',
filterModel: 'empty',
labelFormatter: function (value) {
return ECHARTS.format.formatTime('MM-dd', new Date(value));
}
}],
series : [
{
name: 'name1',
type: 'line',
data: [[time1, data1], [time2, data2], [time3, data3]]
},
{
name: 'name2',
type: 'line',
data: [[time2, data1], [time3, data2], [time5, data3]]
}
]
}
在上面给出的数据中,可以保证时间是一一对应的。
chrome 控制台报错信息:
echarts.min.js?bust=1493521950256:57121 Uncaught TypeError: Cannot read property 'seriesIndex' of undefined
at http://localhost:8000/static/plugins/echarts/echarts.min.js?bust=1493521950256:57121:68
at Array.forEach (native)
at each (http://localhost:8000/static/plugins/echarts/echarts.min.js?bust=1493521950256:3217:18)
at http://localhost:8000/static/plugins/echarts/echarts.min.js?bust=1493521950256:57118:22
at Array.forEach (native)
at each (http://localhost:8000/static/plugins/echarts/echarts.min.js?bust=1493521950256:3217:18)
at http://localhost:8000/static/plugins/echarts/echarts.min.js?bust=1493521950256:57107:18
at Array.forEach (native)
at each (http://localhost:8000/static/plugins/echarts/echarts.min.js?bust=1493521950256:3217:18)
at ExtendedClass._updateContentNotChangedOnAxis (http://localhost:8000/static/plugins/echarts/echarts.min.js?bust=1493521950256:57101:14)
Can we please expect a fast fix on this issue? @pissang
Xiexie!!!
@Mark-Brightcloud Will fix it in next version, which will be released on early next week :)
@pissang Thank you so much. Look forward to it!
It has been fixed on 254e4f9.
@100pah @pissang Could you release this fixed version to NPM? Or is there a way that I can use latest update from master via NPM?
Xiexie!
NPM will be published when next version is released. You can try installing from GitHub. Like following
npm install --save https://github.com/ecomfe/echarts/tarball/master