Skip to content
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

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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.

  • 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

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 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

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

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.

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