Skip to content

[Bug] canOmitUnusedDimensions will mess up the dimension indexes #20672

@Justin-ZS

Description

@Justin-ZS

Version

5.6.0

Link to Minimal Reproduction

Demo

Steps to Reproduce

Hover to see the unexpected NaN tooltip.

  tooltip: {
    trigger: 'axis',
    formatter: (p) => p[0].name,
    show: true
  },

the item selection is broken too.
Clicking an item will select all items in the same series.

Current Behavior

the name of the tooltip formatter params is NaN
Clicking an item will select all items in the same series.

Expected Behavior

Show correct category name
Clicking an item selects only that item.

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

It was caused by canOmitUnusedDimensions.
when canOmitUnusedDimensions is true

  1. prepareSeriesDataSchema only create necessary dimensions
    截屏2025-01-09 17 23 43
  2. DataStore is still generated with all dimensions.(see the length of _chunks)
    截屏2025-01-09 17 25 23
  3. SeriesData uses _nameDimIdx to reference the data in DataStore.
    Since unnecessrary dimensions are not created, _nameDimIdx is assigned the wrong idx
    截屏2025-01-09 17 33 01
    截屏2025-01-09 17 33 17
  4. SeriesData._nameList is filled with wrong names
    截屏2025-01-09 18 03 42

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugenThis issue is in EnglishpendingWe are not sure about whether this is a bug/new feature.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions