You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by "nghiepdev (via GitHub)" <gi...@apache.org> on 2023/02/10 09:07:27 UTC

[GitHub] [echarts] nghiepdev opened a new issue, #18258: [Feature] Allow customize series name in the tooltip.

nghiepdev opened a new issue, #18258:
URL: https://github.com/apache/echarts/issues/18258

   ### What problem does this feature solve?
   
   Is there a way to custom series name `cost, users, impressions, ctr` in tooltip?
   
   ![image](https://user-images.githubusercontent.com/4768095/218047744-503bd80c-1a6e-4356-affa-0a9d8c336bbd.png)
   
   ```js
   const options = {
     legend: {
       data: ['cost', 'users'],
       formatter(name) {
         return `custom ${name}`;
       },
     },
     series: [
       {
         name: 'cost', // keep the name, I don't want to change in here.
         data: [1, 2, 3],
       },
       {
         name: 'users',
         data: [1, 2, 3],
       },
     ],
   };
   ```
   
   ### What does the proposed API look like?
   
   ```js
   const options = {
     legend: {
       data: ['cost', 'users'],
       formatter(name) {
         return `custom ${name}`;
       },
     },
     series: [
       {
         name: 'cost', // keep the name, I don't want to change in here.
         data: [1, 2, 3],
         tooltip: {
           label: {
             formater(name) {
               return `custom ${name}`;
             },
           },
         },
       },
       {
         name: 'users',
         data: [1, 2, 3],
         tooltip: {
           label: {
             formater(name) {
               return `custom ${name}`;
             },
           },
         },
       },
     ],
   };
   
   ```


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


[GitHub] [echarts] nghiepdev commented on issue #18258: [Feature] Allow customize series name in the tooltip.

Posted by "nghiepdev (via GitHub)" <gi...@apache.org>.
nghiepdev commented on issue #18258:
URL: https://github.com/apache/echarts/issues/18258#issuecomment-1427202120

   @helgasoft Thanks, It would be better if there was some way like legend 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


[GitHub] [echarts] helgasoft commented on issue #18258: [Feature] Allow customize series name in the tooltip.

Posted by "helgasoft (via GitHub)" <gi...@apache.org>.
helgasoft commented on issue #18258:
URL: https://github.com/apache/echarts/issues/18258#issuecomment-1427148865

   Do you want _tooltip_ formatter to act like _legend_ formatter ? It can.
   [Demo Code](https://echarts.apache.org/examples/en/editor.html?c=line-simple&code=PYBwLglsB2AEC8sDeAoWsAeBBDEDOAXMmurGAJ4gCmRA5AMYCGYVA5sAE7m0A0J6AE2aMiAbVoBZGL1i0AKgFcqM2gHUqA2gF0SAXz7pyOfEST6SAGzZVoA0_1gAzTgFtmLDgApojF1QCUxKSkHFRgChxwAAb0CnhgwC6wACRIPn66UQDcDuboeWTAwBaQIKawDmAcEKysVBwEtIy4eLwOzhxuYB6eIIFIFcHoEI6wngCEIAB0VtCsYAAWgSAIsKIgWugA9FuwAlSOjAolZNW19Y0QLC60Dujdq9NuIJ4YCAB8QUOh4ZGyADwAIw471i8USsgA1Jgpnh6hAqHgAHK-KiwaEyIRgES0aEYKZYxhZWC6fw5IawH4RODdSG0Wjk0gFApw6qIsQOVAUijUOh4JjdeptCnpGiyejAeIyHawADWVCoK0WaNFPFgAEk9tIwLAAO6MaA6hKwegLA11WAQOALepUKZ3PbCMQARjVACY1QBmLQGJm-9BcoY8sW0fnuIX-0iiuhxeqtSOCJ1rD2wT1qgAsPtyvqzuiyQA) - for tooltip trigger _item_ or _axis_.


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