Skip to content

feat(marker): markPoint markLine markArea add z2 option to support change level #20782

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 13, 2025

Conversation

sz-p
Copy link
Contributor

@sz-p sz-p commented Feb 23, 2025

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

#6691

markPoint markLine markArea add z2 option to support change level.

image

Fixed issues

Details

Before: What was the problem?

After: How does it behave after the fixing?

Document Info

One of the following should be checked.

Misc

ZRender Changes

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

Related test cases or examples to use the new APIs

N.A.

Others

Merging options

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

Other information

Copy link

echarts-bot bot commented Feb 23, 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.

The pull request is marked to be PR: author is committer because you are a committer of this project.

Document changes are required in this PR. Please also make a PR to apache/echarts-doc for document changes and update the issue id in the PR description. When the doc PR is merged, the maintainers will remove the PR: awaiting doc label.

@sz-p sz-p closed this Feb 28, 2025
@sz-p sz-p reopened this Feb 28, 2025
sz-p added a commit to sz-p/echarts-doc that referenced this pull request Feb 28, 2025
Copy link
Contributor

github-actions bot commented Feb 28, 2025

The changes brought by this PR can be previewed at: https://echarts.apache.org/examples/editor?version=PR-20782@f559a45

Copy link
Contributor

@Ovilia Ovilia left a comment

Choose a reason for hiding this comment

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

This should be a great feature to have, only that z2 is exposed to developers only with custom series so I'm not sure it should be fine to use z2 to support this.

@@ -143,12 +143,14 @@ class MarkPointView extends MarkerView {
}

const style = itemModel.getModel('itemStyle').getItemStyle();
const z2 = itemModel.getModel('z2').option;
Copy link
Member

Choose a reason for hiding this comment

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

Usually be

const z2 = itemModel.get('z2'); 
// or const z2 = itemModel.get('z2', true); 

(no need to create a temporary model object, tho there is probably no performance issue here, handy optimization would be better.)

const style = areaData.getItemModel<MarkAreaMergedItemOption>(idx).getModel('itemStyle').getItemStyle();
const itemModel = areaData.getItemModel<MarkAreaMergedItemOption>(idx);
const style = itemModel.getModel('itemStyle').getItemStyle();
const z2 = itemModel.getModel('z2').option;
Copy link
Member

Choose a reason for hiding this comment

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

// lineData.setItemVisual(idx, {
// color: lineColor || fromData.getItemVisual(idx, 'color')
// });
lineData.setItemLayout(idx, [
fromData.getItemLayout(idx),
toData.getItemLayout(idx)
]);
const z2 = itemModel.getModel('z2').option;
Copy link
Member

Choose a reason for hiding this comment

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

@@ -80,7 +81,7 @@ class Symbol extends graphic.Group {
);

symbolPath.attr({
z2: 100,
Copy link
Member

@100pah 100pah Mar 11, 2025

Choose a reason for hiding this comment

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

  1. Symbol is used not only by markPoint, but also by line series, scatter series, etc.
    In the current PR, only markPoint allows users to set z2, which results in z2: 100 being missing in other cases. Is it intentional? If not, backward compatibility should be maintained.

  2. If users do not specify z2, here a undefined-z2 will be set to an zr element, which is error-prone (z2 is not meant to be a non-number yet in zrender) and might degrade the performance (theoretically).

Summary: I think every place a z2 is about to set to a zr element, use a default number value to make sure it's a number.
e.g.,

symbolPath.attr({
    zr: retrieve2(z2, 100),
    ...
})
graphic.updateProps(polygon, {
    retrieve2(z2, 0),
    // ...
})

The other place that sets z2 to zr elements in this PR follows this suggestion.

Copy link
Member

@100pah 100pah left a comment

Choose a reason for hiding this comment

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

LGTM

@Ovilia Ovilia merged commit 6cba74c into apache:master Mar 13, 2025
2 checks passed
@Ovilia Ovilia added this to the 6.0.0 milestone Mar 13, 2025
@Ovilia Ovilia moved this to Done in ECharts 6.0 Mar 13, 2025
@echarts-bot echarts-bot bot added PR: doc ready and removed PR: awaiting doc Document changes is required for this PR. labels Jul 1, 2025
sz-p added a commit to sz-p/echarts-doc that referenced this pull request Jul 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants