Repository navigation
Conversation
|
Thanks for your contribution! 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: This message is shown because the PR description doesn't contain the document related template. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why is this change needed?
A
markPointdata item positioned by a plaincoordarray (no statistictype, no explicitvaluefield) reaches the label formatter withparams.value === undefined, so{c}renders asundefined. This is most visible with a time base axis, where users naturally writecoord: ['2024-01-02', 200]and expect the marker label to show the value at that point. close #20410Root cause
dataTransformonly assignsitem.valuefor statistic types (max/min/average/median). For a plain coord item, the marker'sSeriesDatastores the raw option object{coord: [...]}, andMarkerModel.getDataParamsbuildsparams.valueviaretrieveRawValue(mpData, idx)without a dimension — which returns the raw option object'svaluefield, i.e.undefined. Thetype: 'max'path works because line 143 forcesitem.value = coordInfo[1].What does this PR do?
In
dataTransform(src/component/marker/markerHelper.ts), when the coord branch finishes anditem.value == null:getAxisInfo.axisInfo.baseAxis.scale.parse(...)— this is what makes a time axis work, wherecoord[0]is a date string that must become a timestamp before lookup.seriesModel.indicesOfNearest(...)and copy its value-dimension value intoitem.value.The marker label and tooltip then carry the actual data value at that coord, consistent with what
type: 'max'already produces.markLineandmarkAreasharedataTransform, 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 assertsparams.valueis 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 checktypereports no errors in the touched files.What cannot be tested locally?
The sandbox cannot run the full browser rendering pipeline (
npm run devvisual cases), but the change only touches data-transform logic that the Jest suite covers.close #20410