Reputation: 3054
The default tooltip is nice:
I want to modify this formatter slightly: convert the data name to locale string, add some text to the series names. I can build one:
tooltip: {
trigger: 'axis',
formatter: (params) => {
const {name: name0, seriesName: seriesName0, data: data0, color: color0} = params[0]
const {name: name1, seriesName: seriesName1, data: data1, color: color1} = params[1]
return `Text: ${format(name0)} unit<br><br>
${color0} text ${lowercase(seriesName0)}: ${format(data0)} unit<br>
${color1} text ${lowercase(seriesName1)}: ${format(data1)} unit`
}
}
But it's just better to modify the default formatter directly, or to have the template it use. I try to search around ECharts' source to no avail. Is there a way to have the default formatter?
Upvotes: 0
Views: 32