helgasoft commented on issue #19718: URL: https://github.com/apache/echarts/issues/19718#issuecomment-2000366122
> tooltip formatter can accept dataset-related attributes, but the parameters received by legend.formatter are only name yes, there is a significant difference - tooltip is data related, legend is series related. Legend can be styled in detail thru [legend.data](https://echarts.apache.org/en/option.html#legend.data) - [Demo](https://echarts.apache.org/examples/en/editor.html?c=dataset-simple1&code=CYQwLiDOCmYAQF44G0BQc4G90bsAlgLbQB2k-A9mQFwoDkADgE4XACuAxmHQDRx0AmAAwBGAKy9-wkQDZJg0QHY6AXR44MkCmyYdotNLlzI6AWXAcAFiDgAZcGGiSALAGYAdK74AOMe-98AJweimoaxmb4ADYA1nAAKtAgkt4eInyKHs58Yn4iYUYYJgDCltDQMHDFFBwUyT4y7tlwMn4CPgLuYgWFJgDqIFEkbPAAQiwA7iT4ThmdzWIegXyuge754So4AL6oKgDcqFHQAObAiCg4mHAkIMS0CuKS-LUkDwR3VMB0cNvqGNdbvcpKI5HwXlQHmAmPgQCQTscfn8rjc7voQSJlODXg8mNAuEi9ocKAwwJQSBdsBgwBQKFEyQxaJhkRhQBAYGB_nAAB4AQW5-EgTLgYAAngx0XQOOBThQmKKkVzRfzBUyWXBjidSMBheE2SBaJrgHxwgAzOWEBzQJgPUVJJhYIHQba8HbqHAAeg9cAAIvioiA8XAYAA3a2DOAAI0DwetM0gfCSVjgE2iUSj0DgloYEuAnu9NLgNlqUTYhApFFNeHAUFg7i0Oj0UdFeGgppAbHp7hwMBhFQM1zFEoe0aYiqwIvFktH48HU5HgaRW22-yAA). legend.formatter can access _dataset_ (below), but it doesn't make sense to store series-related attributes (color,symbol) in data. ``` formatter: (name) => { col = option.dataset[0].dimensions.indexOf(name); console.log(name + ' ' +option.dataset[0].source.map(x => x[col]) ); return name; } ``` 📌 please close issue if problem solved. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
