Skip to content

fix(marker): resolve the value of coord markPoint from the series data. close #20410 - #21806

Open
CJstate wants to merge 1 commit into
apache:masterfrom
CJstate:fix/markPoint-coord-value
Open

CJstate wants to merge 1 commit into
apache:masterfrom
CJstate:fix/markPoint-coord-value

Conversation

@CJstate

@CJstate CJstate commented Oct 24, 2026

Copy link
Copy Markdown

Why is this change needed?

A markPoint data item positioned by a plain coord array (no statistic type, no explicit value field) reaches the label formatter with params.value === undefined, so {c} renders as undefined. This is most visible with a time base axis, where users naturally write coord: ['2024-01-02', 200] and expect the marker label to show the value at that point. close #20410

Root cause

dataTransform only assigns item.value for statistic types (max/min/average/median). For a plain coord item, the marker's SeriesData stores the raw option object {coord: [...]}, and MarkerModel.getDataParams builds params.value via retrieveRawValue(mpData, idx) without a dimension — which returns the raw option object's value field, i.e. undefined. The type: 'max' path works because line 143 forces item.value = coordInfo[1].

What does this PR do?

In dataTransform (src/component/marker/markerHelper.ts), when the coord branch finishes and item.value == null:

  1. Resolve base/value axes via the existing getAxisInfo.
  2. Parse the base-dimension coord through axisInfo.baseAxis.scale.parse(...) — this is what makes a time axis work, where coord[0] is a date string that must become a timestamp before lookup.
  3. Find the nearest host-series datum with seriesModel.indicesOfNearest(...) and copy its value-dimension value into item.value.

The marker label and tooltip then carry the actual data value at that coord, consistent with what type: 'max' already produces. markLine and markArea share dataTransform, so coord-only items there get the same benefit.

How is it tested?

New unit test test/ut/spec/component/marker/markPointCoord.test.ts:

  • formatter_params_carry_the_value_for_a_coord_markPoint_on_a_time_axis — captures the formatter params for the exact issue repro (time axis, coord-only item) and asserts params.value is defined. Fails on master, passes with this fix.
  • defaultedLabel_dims_carry_the_value_for_coord_markPoint — guards the default-label dim path.

Full local suite: npx jest --config test/ut/jest.config.cjs → 27 suites / 196 tests passed, no regressions. npm run checktype reports no errors in the touched files.

What cannot be tested locally?

The sandbox cannot run the full browser rendering pipeline (npm run dev visual cases), but the change only touches data-transform logic that the Jest suite covers.

close #20410

@echarts-bot

echarts-bot Bot commented Oct 24, 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.

This branch has not been deployed

No deployments
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.

Value not shown on 'coord' markPoint with time axis

1 participant