Skip to content

Conversation

@mikkurogue
Copy link

@mikkurogue mikkurogue commented Nov 3, 2025

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

Fixes a type error that causes ordinalMeta to be undefined when used on encoded axes with series.encode.

Fixed issues

Details

Before: What was the problem?

When defining a markline within a series that uses the series.encode option, a type error would be thrown that ordinalMeta is undefined. It seems like due to this axis encoding, the series can not figure out the correct dimension to use for a markline. I feel its the same for markarea too.

After: How does it behave after the fixing?

In the initial case reported in issue #21300 I used the broken example as input and created a test html file to render the chart, and I noticed the marklines appearing again without needing to use a workaround of an empty/invisible scatter series.

Document Info

One of the following should be checked.

  • This PR doesn't relate to document changes
  • The document should be updated later
  • The document changes have been made in apache/echarts-doc#xxx

Misc

Security Checking

  • This PR uses security-sensitive Web APIs.

ZRender Changes

  • This PR depends on ZRender changes (ecomfe/zrender#xxx).

Related test cases or examples to use the new APIs

test/markLine-dataset-encode-fix.html
test/ut/spec/component/marker.test.ts

Merging options

  • Please squash the commits into a single one when merging.

Other information

If anything needs to be changed or updated, please let me know. This is a bug affecting my workplace too so I felt I'd follow the ffmpeg motto of "Talk is cheap, send patches".

Thanks.

…defined causing a type error

Signed-off-by: mikkurogue <[email protected]>
@echarts-bot
Copy link

echarts-bot bot commented Nov 3, 2025

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.

@maeln
Copy link

maeln commented Nov 13, 2025

This affect our usage of EChart so this fix is very much appreciated 🙏 .

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request fixes a bug where using markLine, markPoint, or markArea with series.encode causes a type error due to undefined ordinalMeta. The fix adds proper fallback handling when dimension info is incomplete or undefined in dataset scenarios with encoding.

Key Changes

  • Added null checks and fallback creation of SeriesDimensionDefine when getDimensionInfo returns undefined
  • Added comprehensive test coverage for all three marker types with dataset and encode
  • Included visual test file for manual verification

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/component/marker/MarkLineView.ts Fixed undefined dimension info handling by creating fallback SeriesDimensionDefine
src/component/marker/MarkPointView.ts Fixed undefined dimension info handling by creating fallback SeriesDimensionDefine
src/component/marker/MarkAreaView.ts Fixed undefined dimension info handling by creating fallback SeriesDimensionDefine
test/ut/spec/component/marker.test.ts Added unit tests for markLine, markPoint, and markArea with dataset and encode
test/markLine-dataset-encode-fix.html Added manual test for visual verification of the fix

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

3 participants