Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] series-pie.label.formatter {@xxx} is not taking effect #20616

Open
paopjian opened this issue Dec 24, 2024 · 1 comment
Open

[Bug] series-pie.label.formatter {@xxx} is not taking effect #20616

paopjian opened this issue Dec 24, 2024 · 1 comment
Labels
bug en This issue is in English pending We are not sure about whether this is a bug/new feature.

Comments

@paopjian
Copy link

paopjian commented Dec 24, 2024

Version

5.2.1

Link to Minimal Reproduction

https://echarts.apache.org/examples/zh/editor.html?c=pie-simple&version=5.5.1&code=PYBwLglsB2AEC8sDeAoWtJgDYFMBcya6GOAHmAQOQBKOAZjgE5OzB2wCGsA6jgEYBnCGByUANEXQCArnxHkqAMQ4BrHLAAiHMB3GTYuOhViUAxjmgjGlIgF8J6MMGBZIIAqmIZGEAOa-mKmEcAFsbdHsiXADoABMPfWAfC2NKADcmSFMOLD0vQ1SC8NhIqSYIHAECAG19Ty8DDj4cLDx6htg6JJDtKzxKJFNbZAABUnHbPI7YAHoZzu7ewLppaFNIGAAKEA5GDhCBAEp2hrniZjBpRjgAAwASJB29g4A6WO0OF_HSWxv9LzOtn-JQcDWg-3wJgAgqZzAIBLBFIxgGFQV4wABPECQyggCpTLx7WIQaRVEwAVgADABSAnEd46GrA9BIWBpHLSSEARkpABYABxiWDgkI4gDKOF2pgAFrAAKLQXwQaCiIXffpcyilaas9lYTkEADsAGZyUKRTiNBBmOtxLB1ZQAEyUEHM5BsjmQ8n8ynmiFUOU9CC5NXjfrGl3ajq6z0EAW8v2iqgAVWgUDgUNiAjtDt5kbRDRj-shxspvuF_pMADUILEcMBYJns6HSP1yZHgQBdAvoUIgaUcIRkk5eYIhMWY3AJabEAQD2LAADuACF9YwCDyew05xwF4uAPJ0OgCHBgAAaBF9bqk86XAGEXEkqIxfHwOJty5-hZSXuTDsUOiBQD9CA2BOxQWwAG4gA

Steps to Reproduce

  1. set series data with 'xxx' key in object
  2. set series label:{ formatter:'{@xxx}',}

Current Behavior

{@xxx} is not taking effort , {c} shows.

Expected Behavior

expect 'xxx':1 show in the label, not value

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

option = {
  title: {
    text: 'Referer of a Website',
    subtext: 'Fake Data',
    left: 'center'
  },
  tooltip: {
    trigger: 'item'
  },
  legend: {
    orient: 'vertical',
    left: 'left'
  },
  series: [
    {
      label:{
        formatter:'{c} {@xxx}',
        // formatter:function(params){
        //   return `${params.data.xxx}`
        // }
      },
      name: 'Access From',
      type: 'pie',
      radius: '50%',
      data: [
        { value: 1048, name: 'Search Engine', xxx:'1'},
        { value: 735, name: 'Direct', xxx:'2' },
        { value: 580, name: 'Email', xxx:'3' },
        { value: 484, name: 'Union Ads', xxx:'4' },
        { value: 300, name: 'Video Ads', xxx:'5' }
      ],
      emphasis: {
        itemStyle: {
          shadowBlur: 10,
          shadowOffsetX: 0,
          shadowColor: 'rgba(0, 0, 0, 0.5)'
        }
      }
    }
  ]
};
@paopjian paopjian added the bug label Dec 24, 2024
@echarts-bot echarts-bot bot added en This issue is in English pending We are not sure about whether this is a bug/new feature. labels Dec 24, 2024
@helgasoft
Copy link

apparently label format [@xxx] works under one of two conditions:

  • series dataset as array-of-arrays or array-of-objects
  • series data as array-of-arrays

Series data as array-of-objects, as your example, does not work unfortunately. This is not explained in the documentation.
Demo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug en This issue is in English pending We are not sure about whether this is a bug/new feature.
Projects
None yet
Development

No branches or pull requests

2 participants