var mychartsale= echarts.init(document.getElementById('main'));
option = {
title: {
text: ''
},
tooltip: {
trigger: 'axis',
},
legend: {
data:['交易指数','交易增长幅度','支付转化指数','流量指数','搜索人气']
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
toolbox: {
feature: {
saveAsImage: {}
}
},
xAxis: {
type: 'category',
boundaryGap: false,
data: timeData
},
yAxis : [
{
name: '指数',
type : 'value',
scale:true,
},
{
name: '百分比',
type : 'value',
scale:true,
axisLabel: {
show: true,
formatter: '{value} %'
}
}
],
series: [
{
name:'交易指数',
type:'line',
stack: '',
data:data1,
yAxisIndex:0
},
{
name:'交易增长幅度',
type:'line',
stack: '',
data:data2,
yAxisIndex:1,
itemStyle: {
normal: {
label: {
show: true,
positiong: 'top',
formatter: '{c}%'
}
}
}
},
{
name:'支付转化指数',
type:'line',
stack: '',
data:data3,
yAxisIndex:0
},
{
name:'流量指数',
type:'line',
stack: '',
data:data4,
yAxisIndex:0
},
{
name:'搜索人气',
type:'line',
stack: '',
data:data5,
yAxisIndex:0
}
]
};
mychartsale.setOption(option);
//注释的功能,是判断点击折线图的拐点。
mychartsale.on('click', function (param) {
console.log(param);//这里根据param填写你的跳转逻辑
});
window.addEventListener("resize",function(){
mychartsale.resize();
});
点击echarts的拐点或者区域,打印出相关的拐点信息,可以延伸在点击事件中添加新的方法。、
获取点击事件的拐点信息: