tooltip : { trigger : 'axis', axisPointer: { type: 'cross' }, position: function (pos, params, dom, rect, size) { // 鼠标在左侧时 tooltip 显示到右侧,鼠标在右侧时 tooltip 显示到左侧。 var obj = {top: 20}; obj[['left', 'right'][+(pos[0] < size.viewSize[0] / 2)]] = 5; return obj; } } //x轴的时间类型为long类型 xAxis : { type : 'time', splitNumber: 13, interval : 21600, axisLabel : { formatter : function(value, index) { // 将时间转换成"00:00:00"格式 var hms = ; return hms; } }, splitLine : { show : false }, axisPointer: { link: {xAxisIndex: 'all'}, label: { backgroundColor: '#777', // 文本标签文字的格式化器 formatter: function (params) { return ; } }, }, data : [] } |
echarts官方文档地址:https://echarts.apache.org/zh/option.html
具体需求以及标签含义可参考官方文档