Skip to content

fix(MarkLineView): skip invalid markLine items that were normalized to undefined - #21716

Open
waterWang wants to merge 1 commit into
apache:masterfrom
waterWang:fix/markline-empty-entry
Open

fix(MarkLineView): skip invalid markLine items that were normalized to undefined#21716
waterWang wants to merge 1 commit into
apache:masterfrom
waterWang:fix/markline-empty-entry

Conversation

@waterWang

Copy link
Copy Markdown

Fix: skip invalid markLine items that were normalized to undefined

Issue

Fixes #21683

Problem

When a markLine data entry is an empty object {}:

markLine: {
    data: [
        { yAxis: 1 },
        {},          // <-- empty entry
        { yAxis: 3 }
    ]
}

markLineTransform normalizes the empty object to [undefined, undefined, {...}].
The subsequent markLineFilter call then crashes on item[0].coord because item[0] is undefined,
causing no markLines to be rendered at all — not even the valid ones.

Root Cause

In markLineTransform, the else branch (invalid data) sets itemArray = [], but the function continues to construct normalizedItem from itemArray[0], itemArray[1], itemArray[2] — all of which are undefined. The filter then crashes on the undefined values.

Fix

Added a guard in markLineFilter to return false (skip) when item[0] or item[1] is undefined, which is the expected behavior: invalid entries should be silently skipped and valid entries should still render.

Verification

  • Valid markLines continue to render when no empty entries exist
  • An empty {} entry is silently skipped without error
  • Other valid markLines in the same data array still render normally

…o undefined

When a markLine data entry is an empty object `{}`, markLineTransform
normalizes it to `[undefined, undefined, {...}]`. The subsequent
markLineFilter call then crashes on `item[0].coord` because item[0] is
undefined, causing no markLines to be rendered at all.

Fix: add a guard in markLineFilter to skip items where item[0] or item[1]
is undefined, matching the expected behavior described in the issue.

Fixes apache#21683
@echarts-bot

echarts-bot Bot commented Aug 9, 2026

Copy link
Copy Markdown

Thanks for your contribution!
The community will review it ASAP. In the meanwhile, please checkout the coding standard and Wiki about How to make a pull request.

Please DO NOT commit the files in dist, i18n, and ssr/client/dist folders in a non-release pull request. These folders are for release use only.

To reviewers: If this PR is going to be described in the changelog in the future release, please make sure this PR has one of the following labels: PR: doc ready, PR: awaiting doc, PR: doc unchanged

This message is shown because the PR description doesn't contain the document related template.

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.

[Bug] No markLine drawn if one of the markLines is empty

1 participant