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] The legend item can not ellipsis correctly #505

Closed
kkxxkk2019 opened this issue Aug 11, 2023 · 0 comments
Closed

[Bug] The legend item can not ellipsis correctly #505

kkxxkk2019 opened this issue Aug 11, 2023 · 0 comments
Assignees
Labels
bug Something isn't working online biz
Milestone

Comments

@kkxxkk2019
Copy link
Collaborator

Version

latest

Link to Minimal Reproduction

none

Steps to Reproduce

const data = [
  { value: 10, category: 'OneOneOneOneOne' },
  { value: 9, category: 'Two' },
  { value: 6, category: 'Three' },
  { value: 5, category: 'Four' },
  { value: 4, category: 'Five' },
  { value: 3, category: 'Six' },
  { value: 1, category: 'Seven' }
];
let totalValue = 0;
data.forEach(obj => (totalValue += obj.value));
const map = {};
data.forEach(obj => {
  map[obj.category] = `${((obj.value / totalValue) * 100).toFixed(2)}%`;
});

const spec = {
  type: 'pie',
  data: [
    {
      id: 'pie',
      values: data
    }
  ],
  categoryField: 'category',
  valueField: 'value',
  legends: {
    visible: true,
    orient: 'right',
    data: items => {
      return items.map(item => {
        item.value = map[item.label];
        return item;
      });
    },
    item: {
      width: '15%',
      value: {
        alignRight: true,
        style: {
          fill: '#333',
          fillOpacity: 0.8,
          fontSize: 10
        },
        state: {
          unselected: {
            fill: '#d8d8d8'
          }
        }
      }
    }
  }
};

Current Behavior

image

Expected Behavior

fix it

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

No response

@kkxxkk2019 kkxxkk2019 added the bug Something isn't working label Aug 11, 2023
@kkxxkk2019 kkxxkk2019 self-assigned this Aug 11, 2023
@kkxxkk2019 kkxxkk2019 added this to the v1.2.1 milestone Aug 11, 2023
kkxxkk2019 added a commit to VisActor/VRender that referenced this issue Aug 15, 2023
@kkxxkk2019 kkxxkk2019 modified the milestones: v1.2.1, v1.3.0 Aug 15, 2023
@kkxxkk2019 kkxxkk2019 added the online biz label Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working online biz
Projects
None yet
Development

No branches or pull requests

1 participant