option = {
tooltip:{
formatter : "{a},{c}",//提示框格式设置
//position:'top',
show:true,
},
title: [],
singleAxis: [],
series: [],
animation: false
};
echarts.util.each(days, function (day, idx) {
opt.title.push({
textBaseline: 'middle',
top: (idx + 0.5) * 100 / 4 + '%',
text: day
});
opt.singleAxis.push({
left: 150,
type: 'category',
boundaryGap: false,
data: hours,//设置横坐标
top: (idx * 100 / 4 + 5) + '%',
height: (100 / 4 - 20) + '%',
axisLabel: {
interval: 0
}
});
opt.series.push({
singleAxisIndex: idx,
coordinateSystem: 'singleAxis',
type: 'scatter',
data: [],
symbolSize: function (dataItem) {
return dataItem[1] * 0.5;//设置散点图大小
}
});
});
echarts.util.each(data, function (dataItem) {
opt.series[dataItem[0]].data.push([dataItem[1], dataItem[2]]);//series赋值
});
//散点图添加点击事件
myChartA.on('click', function (param){
});
注意:
myChartA.clear();用于清空图表,必须实例化之后才能清。