Skip to content

Unwanted behavior when dragging outside of chart area #895

@joshkel

Description

@joshkel

I've noticed a couple of issues with zoom drag rectangles in 2.1.0. (I believe this relates to #811; I was experimenting with that PR's changes locally earlier. I apologize for not following up sooner.)

First, I believe that the behavior is more intuitive / feels cleaner to the end user if the drag rectangle pegs to the edge of the chart area, instead of allowing the rectangle to go beyond the chart area then doing something different with the actual results. (I realize this may be subjective.)

Second, the behavior when the rectangle does go beyond the chart area feels weird. Using https://codepen.io/joshkel/pen/LYwKzwR as a demo, if I click a bit below and to the left of the last point then to the bottom right corner of the canvas (outside of the chart area):

  • If I limit the zoom (limits: { x: { min: "original", max: "original" }, y: { min: "original", max: "original" } }), then the drag rectangle is shifted (?), so the last point appears even though the rectangle barely excludes it.
  • With the default chartjs-plugin-zoom options (no limits), I can end up with an X axis value greater than the chart started with. This feels weird for a "zoom in" operation.
Screen.Recording.2024-11-20.at.6.25.58.PM.mov

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions