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

fix(transform): sort x only sort data in specified domain #4932

Merged
merged 1 commit into from
May 4, 2023
Merged

Conversation

pearmini
Copy link
Member

@pearmini pearmini commented May 4, 2023

  • 问题:sortX 会覆盖用户指定的 domain,从而不能通过 domain 过滤数据。
  • 解决版本:当用户指定 domain 的时候,sortX 只会对在这个 domain 里面的数据生效。

image

export function alphabetIntervalSortXDomain(): G2Spec {
  return {
    type: 'interval',
    data: {
      type: 'fetch',
      value: 'data/alphabet.csv',
    },
    encode: {
      x: 'letter',
      y: 'frequency',
    },
    transform: [{ type: 'sortX', by: 'y', reverse: true }],
    scale: { x: { domain: ['A', 'B', 'C'] } }, // 只对  A,B,C 排序
    axis: { y: { labelFormatter: '.0%' } },
  };
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants