Skip to content

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

Closed as not planned

Description

@pissang

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

Activity

  1. self-assigned this
    on Sep 16, 2019
  2. 100pah commented on Sep 16, 2019

    @100pah
    Member

    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.

  3. Ovilia commented on Sep 16, 2019

    @Ovilia
    Contributor

    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

  4. 100pah commented on Sep 16, 2019

    @100pah
    Member

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

  5. Ovilia commented on Sep 16, 2019

    @Ovilia
    Contributor

    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.

  6. pissang commented on Sep 16, 2019

    @pissang
    ContributorAuthor

    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.

  7. 100pah commented on Sep 16, 2019

    @100pah
    Member

    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.

  8. pissang commented on Sep 17, 2019

    @pissang
    ContributorAuthor

    @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

  9. Ovilia commented on Sep 18, 2019

    @Ovilia
    Contributor

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

  10. ngoc308 commented on Sep 17, 2020

    @ngoc308

    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.

  11. ngoc308 commented on Sep 28, 2020

    @ngoc308

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

  12. pissang commented on Sep 28, 2020

    @pissang
    ContributorAuthor

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

  13. ngoc308 commented on Sep 28, 2020

    @ngoc308

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

  14. ngoc308 commented on Dec 7, 2020

    @ngoc308

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

  15. nguyencuongabcxyz commented on Mar 29, 2021

    @nguyencuongabcxyz

    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.

  16. github-actions commented on Mar 29, 2023

    @github-actions
    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.

  17. added
    stale
    on Mar 29, 2023
  18. github-actions commented on Apr 5, 2023

    @github-actions
    Contributor

    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

Metadata

Metadata

Assignees

Labels

new-featurestalewaiting-for: community

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions