Skip to content

[Bug] convertFromPixel后的索引不准,且出现小数 #16386

@snowyang2021

Description

@snowyang2021

Version

5.2.2

Link to Minimal Reproduction

No response

Steps to Reproduce

chart.getZr().on('click', (params) => {

  const pointInPixel = [params.offsetX, params.offsetY];

  const yIndex = chart.convertFromPixel(
   {
      seriesIndex: 0
    },
    pointInPixel
  )[1];
  const yData = options.yAxis.data[yIndex];
  console.log(yIndex, options);
});

Current Behavior

yIndex 打印出来是小数,并不是索引

Expected Behavior

期望 yIndex 打印出来是索引值

Environment

- OS:
- Browser:chrome
- Framework:

Any additional comments?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpendingWe are not sure about whether this is a bug/new feature.staleInactive for a long time. Will be closed in 7 days.waiting-for: community

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions