Open fireflysemantics opened 1 year ago
I think the example you have was wrong. It was a modified version from the original example. Instead of having tooltip
inside data
. it should be in the series object like this
const options = {
series: [
{
name: " ",
clockwise: true,
type: "pie",
radius: ["65%", "100%"],
center: ["50%", "50%"],
// should be here
tooltip: {
// your config
},
data: [
{
value: 500,
name: "Solana",
label: {
position: "center",
formatter: "",
fontSize: 22,
fontWeight: 600,
fontFamily: "Roboto",
color: "blue",
},
// not here
// tooltip: {},
},
{
value: 500,
name: "Tether",
},
{
value: 1000,
name: "Golem",
},
],
},
],
};
Hi @zhangchi0104 - The documentation does include tooltip
as an option within the data
object.
https://echarts.apache.org/en/option.html#series-pie.data.tooltip
Thoughts?
A very cautious opinion since I'm not familiar with TypeScript. And a question for the developers. The error says "'tooltip' does not exist in type 'OptionDataValueNumeric[] | PieDataItemOption'". Seems to me that tooltip has never been implemented in pie.data. Shouldn't it be in PieStateOption, since PieDataItemOption extends PieStateOption ? https://github.com/apache/echarts/blob/fd9e62d7fdd88e95ddaf3c371353e8f6ca7d9e6a/src/chart/pie/PieSeries.ts#L59
BTW, same error for scatter.data.tooltip Demo Code
?!?... wow, TS is tricky, despite the errors tooltip works inside data - tooltip: {formatter: 'shows up!'}
🤪
same problem v5.5.0
Version
5.4.2
Link to Minimal Reproduction
https://stackblitz.com/edit/stackblitz-starters-v7ee5w?file=src%2Fecharts.component.ts
Steps to Reproduce
The chart is created like this using
ngx-echarts
:Current Behavior
The
EChartsOption
should allow for specifying atooltip
when creating a pie chart data series. I've documented the rest in this Stackoverflow question with a runnable example.https://stackoverflow.com/questions/77442901/adding-a-tooltip-configuration-to-a-pie-chart-data-item-in-echarts
Expected Behavior
It should compile. However this error is produced.
Environment
Any additional comments?
I was trying to create a PIE chart with a tooltip on the data series.