You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2020/09/09 09:42:28 UTC

[GitHub] [incubator-echarts] Ghostbird opened a new issue #13250: Tooltip.Formatter return string or DOM Element

Ghostbird opened a new issue #13250:
URL: https://github.com/apache/incubator-echarts/issues/13250


   ### What problem does this feature solve?
   I'm using echarts in an Angular application and I imagine the same applies to other frameworks too.
   My framework has a built in mechanism to render templates as DOM Elements with lots of extra framework functionality such as live model-binding.
   
   Currently I have to manually craft an HTML string and pass it to echarts for use as a tooltip, and echarts will insert that HTML into the DOM. I would instead like to create the DOM elements myself and pass _that_ to echarts for use in the tooltip. In my opinion the only required functionality is that echarts bypasses moves the given DOM elements into it's template root DOM element insertion when it is passed an array of DOM elements.
   
   ### What does the proposed API look like?
   In TypeScript notation the current Formatter interface is:
   ```typescript
   interface Formatter {
       (
           params: Format | Format[],
           ticket: string,
           callback: (ticket: string, html: string) => void,
       ): string;
   }
   ```
   The proposed interface would look like this:
   ```typescript
   interface Formatter {
       (
           params: Format | Format[],
           ticket: string,
           callback: (ticket: string, html: string) => void,
       ): string | any[];
   }
   ```
   The caller of the Formatter would check whether the return is a string:
   
   - If so, use the current behaviour
   - If not, assume it is an array of DOM Elements and move those elements into the tooltip root element.
   
   It might be desirable to add an OnDestroy callback that can be called to clean up the rendered templates. In that case the API would look like:
   
   ```typescript
   interface Formatter {
       (
           params: Format | Format[],
           ticket: string,
           callback: (ticket: string, html: string) => void,
       ): string | { domNodes: any[], destroyCallback: () => void }
   }
   ```
   
   <!-- This issue is generated by echarts-issue-helper. DO NOT REMOVE -->
   <!-- This issue is in English. DO NOT REMOVE -->


----------------------------------------------------------------
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.

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


[GitHub] [incubator-echarts] plainheart commented on issue #13250: Tooltip.Formatter return string or DOM Element

Posted by GitBox <gi...@apache.org>.
plainheart commented on issue #13250:
URL: https://github.com/apache/incubator-echarts/issues/13250#issuecomment-702648877


   Hi @Ghostbird, sorry for my late response.
   Thank you for so detailed description.
   I think this is a great idea and it's possible to add this helpful feature. I've added this to the [TBD](https://github.com/apache/incubator-echarts/milestone/13) milestone.
   
   @pissang What do you think of it? It may be very helpful for using live model-binding, such as Vue and Angular.


----------------------------------------------------------------
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.

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


[GitHub] [incubator-echarts] Ghostbird commented on issue #13250: Tooltip.Formatter return string or DOM Element

Posted by GitBox <gi...@apache.org>.
Ghostbird commented on issue #13250:
URL: https://github.com/apache/incubator-echarts/issues/13250#issuecomment-713575648


   I've proposed an implementation that works for me.


----------------------------------------------------------------
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.

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


[GitHub] [incubator-echarts] Ghostbird closed issue #13250: Tooltip.Formatter return string or DOM Element

Posted by GitBox <gi...@apache.org>.
Ghostbird closed issue #13250:
URL: https://github.com/apache/incubator-echarts/issues/13250


   


----------------------------------------------------------------
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.

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


[GitHub] [incubator-echarts] echarts-bot[bot] commented on issue #13250: Tooltip.Formatter return string or DOM Element

Posted by GitBox <gi...@apache.org>.
echarts-bot[bot] commented on issue #13250:
URL: https://github.com/apache/incubator-echarts/issues/13250#issuecomment-689451815


   Hi! We've received your issue and please be patient to get responded. 🎉
   The average response time is expected to be within one day for weekdays.
   
   In the meanwhile, please make sure that **you have posted enough image to demo your request**. You may also check out the [API](http://echarts.apache.org/api.html) and [chart option](http://echarts.apache.org/option.html) to get the answer.
   
   If you don't get helped for a long time (over a week) or have an urgent question to ask, you may also send an email to dev@echarts.apache.org. Please attach the issue link if it's a technical questions.
   
   If you are interested in the project, you may also subscribe our [mail list](https://echarts.apache.org/en/maillist.html).
   
   Have a nice day! 🍵


----------------------------------------------------------------
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.

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


[GitHub] [incubator-echarts] Ghostbird commented on issue #13250: Tooltip.Formatter return string or DOM Element

Posted by GitBox <gi...@apache.org>.
Ghostbird commented on issue #13250:
URL: https://github.com/apache/incubator-echarts/issues/13250#issuecomment-718739734


   Functionality can be found in `echarts 5.0.0-beta.2`


----------------------------------------------------------------
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.

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


[GitHub] [incubator-echarts] Ghostbird commented on issue #13250: Tooltip.Formatter return string or DOM Element

Posted by GitBox <gi...@apache.org>.
Ghostbird commented on issue #13250:
URL: https://github.com/apache/incubator-echarts/issues/13250#issuecomment-701367541


   After looking this over again, I've found that I've not included any change of the `callback` function. I haven't used it, so I'm not sure about it's usage. but I can imagine that it would be desirable that `callback`'s second argument is of the same type as the return type of the `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.

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


[GitHub] [incubator-echarts] Ghostbird commented on issue #13250: Tooltip.Formatter return string or DOM Element

Posted by GitBox <gi...@apache.org>.
Ghostbird commented on issue #13250:
URL: https://github.com/apache/incubator-echarts/issues/13250#issuecomment-701365010


   @plainheart: Can you give any comment on the status of this issue? Is it clear, or do you need more info? Is it being considered, or just a plain bad idea?


----------------------------------------------------------------
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.

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