echartsLikeTooltipFormatter = (params) => {
let arr = _(params)
.filter((p) => p.value !== undefined && isFinite(p.value))
.take(15)
.map((p, pi) => {
let seriesName = p.seriesName;
let seriesFormatted = seriesName;
const metricIdx = p.seriesIndex;
const metric = metrics[metricIdx];
const metricFormatterFn = _.includes(translationDict[metric], "%")
? d3.format(".2~%")
: metricsFormatDict[metric] || ((v) => _.round(v * 100, 2));
let val = (
_.isFunction(metricFormatterFn) ? metricFormatterFn : _.identity
)(p.value);
let valHtml = `<span style='float:right;margin-left:10px;'>${val}</span>`;
return `<span style='display:inline-block;margin-right:5px;border-radius:10px;width:9px;height:9px;background-color:${p.color}' ></span>${seriesFormatted} : ${valHtml}`;
})
.value();
let xVal = params[0].name;
return `${xVal}<br />${arr.join("<br />")}`;
}