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

fix(markArea): markArea background color disappeared. close #13647 #14343

Merged
merged 3 commits into from
Feb 25, 2021

Conversation

Nick22nd
Copy link
Contributor

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

fix markArea background color disappearing when markArea inclued selected area

Fixed issues

Details

Before: What was the problem?

when selected area was included in markArea, then point would not meet condition that set allClipped to false.

13647-before

After: How is it fixed in this PR?

add condition that check if rectangle of markArea intersects the rectangle of display area.

13647-after

Usage

Are there any API changes?

  • The API has been changed.

Related test cases or examples to use the new APIs

NA.

Others

Merging options

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

Other information

@echarts-bot
Copy link

echarts-bot bot commented Feb 25, 2021

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.

@@ -248,22 +248,19 @@ class MarkAreaView extends MarkerView {
const points = map(dimPermutations, function (dim) {
return getSingleMarkerEndPoint(areaData, idx, dim, seriesModel, api);
});
const xAxis = coordSys.getAxis('x').scale.getExtent();
const yAxis = coordSys.getAxis('y').scale.getExtent();
const xPoint = [coordSys.getAxis('x').scale.parse(areaData.get('x0', idx)),
Copy link
Contributor

Choose a reason for hiding this comment

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

It's better to 'cache' coordSys.getAxis('x').scale and coordSys.getAxis('y').scale

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks for your advice :-)

const xPoint = [xScale.parse(areaData.get('x0', idx)), xScale.parse(areaData.get('x1', idx))];
const yPoint = [yScale.parse(areaData.get('y0', idx)), yScale.parse(areaData.get('y1', idx))];
xPoint.sort();
yPoint.sort();
Copy link
Contributor

Choose a reason for hiding this comment

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

There is a helper to sort an array to asc order. https://github.com/apache/echarts/blob/master/src/util/number.ts#L145

Default compare function in sort will convert the values to strings and use Unicode to compare. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#parameters

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks for helping!

@@ -248,22 +248,19 @@ class MarkAreaView extends MarkerView {
const points = map(dimPermutations, function (dim) {
return getSingleMarkerEndPoint(areaData, idx, dim, seriesModel, api);
});
const xScale = coordSys.getAxis('x').scale;
const yScale = coordSys.getAxis('y').scale;
const xAxis = xScale.getExtent();
Copy link
Contributor

Choose a reason for hiding this comment

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

Use a more specific name here. For example xAxisExtent, yAxisExtent

@pissang pissang merged commit 8b17abb into apache:master Feb 25, 2021
@echarts-bot
Copy link

echarts-bot bot commented Feb 25, 2021

Congratulations! Your PR has been merged. Thanks for your contribution! 👍

@pissang pissang added this to the 5.1.0 milestone Feb 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants