2条回答 默认 最新
- h724590957 2018-02-28 06:58关注
类似这样,在toolTip里面写就可以了
//初始化EChatrs var tempChart = echarts.init(document.getElementById('temp')); //定义ECharts的Value var tempXData = []; var supplyTempYData = []; var returnTempYData = []; //显示温度曲线 function setTempData(data) { tempXData.splice(0, tempXData.length); supplyTempYData.splice(0, supplyTempYData.length); returnTempYData.splice(0, returnTempYData.length); for (var i = 0; i < data.length; i++) { tempXData.push(data[i].SavedDatetime.substr(0, 10)); supplyTempYData.push(data[i].SupplyWaterTemp); returnTempYData.push(data[i].ReturnWaterTemp); } tempChart.setOption(TempDataoption); } var TempDataoption = { tooltip: { trigger: 'axis', formatter:function(params) { var result = params[0].name + '<br />'; params.forEach(function (item) { result += '<span style="display:inline-block;margin-right:5px;border-radius:10px;width:9px;height:9px;background-color:' + item.color + '"></span> ' + item.seriesName + ' : ' + item.data + '℃<br />'; }); return result; } }, legend: { data: ['供水温度', '回水温度'] }, toolbox: { show: true, feature: { dataZoom: { yAxisIndex: 'none' }, dataView: { readOnly: true }, magicType: { type: ['line', 'bar'] }, restore: {}, saveAsImage: {} } }, xAxis: { type: 'category', boundaryGap: false, data: tempXData }, yAxis: { type: 'value', boundaryGap: false, axisLabel: { formatter: '{value} °C' } }, dataZoom: [ { type: 'slider', show: true, xAxisIndex: [0] }, { type: 'inside', xAxisIndex: [0] } ], series: [ { name: '供水温度', type: 'line', data: supplyTempYData }, { name: '回水温度', type: 'line', data: returnTempYData }, ] };
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 1无用 2
悬赏问题
- ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
- ¥30 截图中的mathematics程序转换成matlab
- ¥15 动力学代码报错,维度不匹配
- ¥15 Power query添加列问题
- ¥50 Kubernetes&Fission&Eleasticsearch
- ¥15 報錯:Person is not mapped,如何解決?
- ¥15 c++头文件不能识别CDialog
- ¥15 Excel发现不可读取的内容
- ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题
- ¥20 yolov5自定义Prune报错,如何解决?