Does somebody know what is the default tooltip.formatter
value for pie charts ? Currently I am using version 5.4.2
, and for previous versions it was like this {a} <br/>{b}: {c} ({d}%)
, but now you can see that they added an icon near category name, and I want to catch it.
option = {
//...
tooltip: {
trigger: 'item'
},
//...
}
I want to get something similar to this formatter: '{b.icon} {b}: {c} ({d}%)'
. Another thing I observed is that the number in the default formatter is bold, but in mine is not.
Any help will be useful, thanks!
You can get the icon via params.marker
. The default formatter is like this.
tooltip: {
trigger: 'item',
formatter(params) {
return `${params.seriesName}<br>${params.marker}${params.name}<span style="float: right; margin-left: 20px"><b>${params.value}</b> (${params.percent}%)</span>`;
}
},