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

[feature] Add clip option for scatter, line, bar, lines, custom chart #11240

Closed
6 of 7 tasks
pissang opened this issue Sep 16, 2019 · 16 comments
Closed
6 of 7 tasks

[feature] Add clip option for scatter, line, bar, lines, custom chart #11240

pissang opened this issue Sep 16, 2019 · 16 comments
Assignees
Labels
new-feature stale Inactive for a long time. Will be closed in 7 days. waiting-for: community

Comments

@pissang
Copy link
Contributor

pissang commented Sep 16, 2019

Currently we have overflow issue on the axis with fixed min/max. As described in the following issues.

They are all related to the function of clipping the overflowed graphics.

So I'm planning to add a clip option in these series, whose default value is true.

The clipping strategy varies between series to achieve a good visual quality. For example:

  • Scatter series will ignore the graphics whose centroid is outside the grid.
  • Line series will use a rect clip path and let canvas do the clipping. But the symbol in line series will follow scatter series.
  • Bar series will do an intersection operation with the grid rect.
  • Custom series will also use a clip path to do the clipping. Since we can't sure what graphics will be used.

Series needs clip option

  • scatter
  • line
  • bar
  • pictorialBar
  • lines
  • candlestick
  • custom

Q: Why not use clip path for all series?

A: Let canvas do clipping may cause visual artifacts on particular series. For example:

  • It may cut the graphics into half.
  • It may cause line along the edge looks thinner

Reference of highcharts. https://api.highcharts.com/highcharts/series.line.clip

@pissang pissang self-assigned this Sep 16, 2019
@100pah
Copy link
Member

100pah commented Sep 16, 2019

Agree.

For the

Q: Why not use clip path for all series?

I can give a bad case here:

image

BTW, what the default value of the option clip for each series will be?

Probably for custom series, the default value should better be false,
otherwise, some current cases might be broken. And usually, the clipping
have to be processed case by case in custom series.

@Ovilia
Copy link
Contributor

Ovilia commented Sep 16, 2019

I'm cool with most of these. Just to be clarified, what happens to scatter items whose centroid is inside the grid but part of the circle is outside the grid area? I think (A) displaying the whole graphic and (B) displaying the part inside the grid both make sense. Would it be possible for a user to decide which policy to use?
image

@100pah
Copy link
Member

100pah commented Sep 16, 2019

@Ovilia
Which scenario the (B, displaying the part inside the grid) is needed for scatter and line chart?
I've thought about it for a while but can not find some cases that are reasonable enough.

@Ovilia
Copy link
Contributor

Ovilia commented Sep 16, 2019

For example, if I wish to keep my grid area clean and do not want anything to overflow from it, or if there is axis tick label on the left side and I don't want the circle to overflow from the grid to touch the axis label.
image
In this case, neither of the situations when the circle is on the top of the axis label or under it creates a satisfying result.

This is just one example. What I wish to say is that it is important (to provide the ability) to keep the series inside the grid area to avoid unexpected results.

@pissang
Copy link
Contributor Author

pissang commented Sep 16, 2019

Probably for custom series, the default value should better be false,
otherwise, some current cases might be broken. And usually, the clipping
have to be processed case by case in custom series

I think it's fine if custom series have its own default value.

@100pah
Copy link
Member

100pah commented Sep 16, 2019

I don't want the circle to overflow from the grid to touch the axis label

This case probably makes sense, especially when dataZoom available and the symbols are too big or the labels are too long.

@pissang
Copy link
Contributor Author

pissang commented Sep 17, 2019

@100pah @Ovilia I found this issue #11010 (comment) about overflow in candlestick series.

I'm not sure if we need to clip the shape in this scenario

@Ovilia
Copy link
Contributor

Ovilia commented Sep 18, 2019

I think it should absolutely be clipped without explicit configuration. Why asking?

@ngoc308
Copy link

ngoc308 commented Sep 17, 2020

I'm cool with most of these. Just to be clarified, what happens to scatter items whose centroid is inside the grid but part of the circle is outside the grid area? I think (A) displaying the whole graphic and (B) displaying the part inside the grid both make sense. Would it be possible for a user to decide which policy to use?
image

How can I decide which policy to use in Echarts version 4.9.0?
I see now all circle display as (A) solution. But, in my case, I expect display as (B) solution or ignore circles that have a part outside the grid.

@ngoc308
Copy link

ngoc308 commented Sep 28, 2020

@pissang, @Ovilia please help to answer the above question. Thanks in advance.

@pissang
Copy link
Contributor Author

pissang commented Sep 28, 2020

@ngoc308 Currently you can use custom series to draw the bubble chart. It can be clipped as (B) does.

@ngoc308
Copy link

ngoc308 commented Sep 28, 2020

@pissang I have to use ScatterGL to draw points due to the large dataset: ~300k points and deal with this issue.
Do you have any plans to support this feature?

@ngoc308
Copy link

ngoc308 commented Dec 7, 2020

@pissang , @Ovilia any updates for clipping the ScatterGL series?

@nguyencuongabcxyz
Copy link

For example, if I wish to keep my grid area clean and do not want anything to overflow from it, or if there is axis tick label on the left side and I don't want the circle to overflow from the grid to touch the axis label.
image
In this case, neither of the situations when the circle is on the top of the axis label or under it creates a satisfying result.

This is just one example. What I wish to say is that it is important (to provide the ability) to keep the series inside the grid area to avoid unexpected results.

Hi Olivia,
Is there anything new with this. I think it is really cool to provide flexibility for users. In my case, I am in the need of hiding the part of scatters outside the grid.

@github-actions
Copy link
Contributor

This issue has been automatically marked as stale because it did not have recent activity. It will be closed in 7 days if no further activity occurs. If you wish not to mark it as stale, please leave a comment in this issue.

@github-actions github-actions bot added the stale Inactive for a long time. Will be closed in 7 days. label Mar 29, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Apr 5, 2023

This issue has been automatically closed because it did not have recent activity. If this remains to be a problem with the latest version of Apache ECharts, please open a new issue and link this to it. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-feature stale Inactive for a long time. Will be closed in 7 days. waiting-for: community
Projects
None yet
Development

No branches or pull requests

5 participants