We had a minor improvement points. FIG echarts is the content of a tooltip, want displayed in descending order according to the current value of each line.
Queries echarts official documents, https: //www.echartsjs.com/option.html#tooltip
Formatter can modify the properties of the tooltip.
Paste the code below that part.
option = { tooltip: { trigger: 'axis', formatter: function (params) { let newParams = []; let tooltipString = []; newParams = [...params]; newParams.sort((a,b) => {return b.value - a.value}); newParams.forEach((p) => { const cont = p.marker + ' ' + p.seriesName + ': ' + p.value + '<br/>'; tooltipString.push(cont); }); return tooltipString.join(''); } } }
----------------
Disclaimer: This article is CSDN blogger "purple_lumpy 'original article, follow the CC 4.0 by-sa copyright agreement, reproduced, please attach the original source link and this statement. .
Original link: https: //blog.csdn.net/purple_lumpy/article/details/87181407