You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by "HxinY499 (via GitHub)" <gi...@apache.org> on 2024/03/15 03:23:49 UTC
[I] [Feature] legend.formatter函数,接收的参数可不可以像tooltip.formatter一样 [echarts]
HxinY499 opened a new issue, #19718:
URL: https://github.com/apache/echarts/issues/19718
### What problem does this feature solve?
- 我尝试将theme和dataset这两个特性结合使用,dataset里定义规定好的属性,在主题的某些组件的formatter使用,达到样式个性化又方便扩展的目的,这个方式在tooltip里奏效了,它的formatter可以接受到了dataset相关的属性,但是legend.formatter接收的参数只有name,无法扩展。
### What does the proposed API look like?
```javascript
{
legend: {
formatter: (params) => params.data.xxx
}
}
```
--
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: commits-unsubscribe@echarts.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
Re: [I] [Feature] legend.formatter函数,接收的参数可不可以像tooltip.formatter一样 [echarts]
Posted by "HxinY499 (via GitHub)" <gi...@apache.org>.
HxinY499 commented on issue #19718:
URL: https://github.com/apache/echarts/issues/19718#issuecomment-1998873315
I hope that all formatters that can add dataset-related data will be added. That would be great and can truly achieve a development model in which styles and data are separated.
--
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: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
Re: [I] [Feature] legend.formatter函数,接收的参数可不可以像tooltip.formatter一样 [echarts]
Posted by "echarts-bot[bot] (via GitHub)" <gi...@apache.org>.
echarts-bot[bot] commented on issue #19718:
URL: https://github.com/apache/echarts/issues/19718#issuecomment-1998870838
@HxinY499 It seems you are not using English, I've helped translate the content automatically. To make your issue understood by more people and get helped, we'd like to suggest using English next time. 🤗
<details><summary><b>TRANSLATED</b></summary><br>
**TITLE**
[Feature] legend.formatter function, can the parameters it receives be the same as tooltip.formatter?
**BODY**
### What problem does this feature solve?
- I tried to combine the two features of theme and dataset. Define the specified attributes in the dataset and use them in the formatter of some components of the theme to achieve the purpose of personalizing the style and convenient expansion. This method worked in the tooltip. Its formatter can accept dataset-related attributes, but the parameters received by legend.formatter are only name and cannot be expanded.
### What does the proposed API look like?
```javascript
{
legend: {
formatter: (params) => params.data.xxx
}
}
```
</details>
--
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: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
Re: [I] [Feature] legend.formatter函数,接收的参数可不可以像tooltip.formatter一样 [echarts]
Posted by "helgasoft (via GitHub)" <gi...@apache.org>.
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: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
Re: [I] [Feature] legend.formatter函数,接收的参数可不可以像tooltip.formatter一样 [echarts]
Posted by "HxinY499 (via GitHub)" <gi...@apache.org>.
HxinY499 closed issue #19718: [Feature] legend.formatter函数,接收的参数可不可以像tooltip.formatter一样
URL: https://github.com/apache/echarts/issues/19718
--
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: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
Re: [I] [Feature] legend.formatter函数,接收的参数可不可以像tooltip.formatter一样 [echarts]
Posted by "HxinY499 (via GitHub)" <gi...@apache.org>.
HxinY499 commented on issue #19718:
URL: https://github.com/apache/echarts/issues/19718#issuecomment-1998873885
我期望所有能增加dataset相关数据的formatter,都加上,那样就太好了,可以真正达到样式和数据分开的开发模式。
--
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: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org