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(tooltip): missing data #4910

Merged
merged 1 commit into from
Apr 24, 2023
Merged

fix(tooltip): missing data #4910

merged 1 commit into from
Apr 24, 2023

Conversation

pearmini
Copy link
Member

fix #4892

  • 过滤相同 item 不符合预期:之前拥有相同 name 和 value 的 item 被认为是相同的 item,但实际上应该是拥有相同 name,value 和 color 的 item 被认为是相同的 item。
  • 不同系列图形的 x 值不一值:一个 x 可以找到多个不同线的多个点,只展示离 x 最近点对应的 tooltip。
  • groupName 默认值由 item 的个数有关,当 item 为一个的情况下,默认使用 color 或者 series 通道的值;否者用 name 的值,比如如下。

tooltip-missing

const provinces =[
  {
    "idx": 0,
    "number": 2445,
    "province": "四川省",
    "type": "number",
    "sub_type": "xx"
  },
  {
    "idx": 0,
    "number": 21094.69,
    "province": "四川省",
    "type": "price",
    "sub_type": "yy"
  },
   {
    "idx": 1,
    "number": 1244,
    "province": "四川省",
    "type": "number",
    "sub_type": "xx"
  },
  {
    "idx": 1,
    "number": 12756,
    "province": "四川省",
    "type": "price",
    "sub_type": "yy"
  },
  {
    "idx": 2,
    "number": 2244,
    "province": "四川省",
    "type": "number",
    "sub_type": "xx"
  },
  {
    "idx": 2,
    "number": 19756.88,
    "province": "四川省",
    "type": "price",
    "sub_type": "yy"
  },
  {
    "idx": 3,
    "number": 244,
    "province": "四川省",
    "type": "number",
    "sub_type": "xx"
  },
  //  type = number 缺少了一条数据
  {
    "idx": 4,
    "number": 1975,
    "province": "四川省",
    "type": "price",
    "sub_type": "yy"
  },
  {
    "idx": 4,
    "number": 4004,
    "province": "四川省",
    "type": "number",
    "sub_type": "xx"
  },
];

export function provincesLineGroupName() {
  return {
    type: 'line',
    data: provinces,
    paddingLeft: 60,
    encode: {
      x: (d) => d.idx + '',
      y: 'number',
      color: 'type',
    },
    scale: { y: { nice: true } },
    tooltip: {
      items: [
        { field: 'number', name: 'number' },
        { field: 'province', name: 'province' },
        { field: 'sub_type', name: 'sub_type' },
      ],
    },
  };
}

@hustcc
Copy link
Member

hustcc commented Apr 24, 2023

tooltip 和图形交叉的地方,显示 marker point 会加上吗?

@pearmini
Copy link
Member Author

tooltip 和图形交叉的地方,显示 marker point 会加上吗?

下个月加

@pearmini pearmini merged commit 131b032 into v5 Apr 24, 2023
@pearmini pearmini deleted the fix/tooltip-missing branch April 24, 2023 08:10
hustcc pushed a commit that referenced this pull request May 16, 2023
hustcc pushed a commit that referenced this pull request May 16, 2023
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.

【v5】颜色通道绑定字段生成多条折线 Tooltip 显示异常
2 participants