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: add drag&drop support to vaadin-chart #8488

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

Conversation

bwajtr
Copy link
Contributor

@bwajtr bwajtr commented Jan 10, 2025

Description

Until now, the vaadin-chart component did not support drag&drop at all.

This PR brings support for drag and drop:

  • It loads the required extension module
  • It adds three new events to the vaadin-chart: dragStart, drag and drop -> the code is the same as for any other chart point event

The only significant change is in the __createEventListeners method: I found during testing, that the data of the customEvent are not correct in case of dragStart. Highcharts fires dragStart with a different content of the event object: event.type is missing, and the event object itself is actually the original mousedown event object.
However, Highcharts passes the point that is being dragged as a this of the event handler (it does this for every event type... even for the series events - in that case this refers to the series). Therefore the change in the __createEventListeners -> the arrow function was changed to a regular function, so different this can be passed to it. We then set this to customEvent.detail.point as the point that is being dragged.

I added a test that simulates what happens when you click the chart and you are over the draggable point.

Part of vaadin/flow-components#4731

Type of change

  • Bugfix
  • Feature

Checklist

  • I have read the contribution guide: https://vaadin.com/docs/latest/contributing/pr
  • I have added a description following the guideline.
  • The issue is created in the corresponding repository and I have referenced it.
  • I have added tests to ensure my change is effective and works as intended.
  • New and existing tests are passing locally with my change.
  • I have performed self-review and corrected misspellings.
  • I have not completed some of the steps above and my pull request can be closed immediately.

Additional for Feature type of change

  • Enhancement / new feature was discussed in a corresponding GitHub issue and Acceptance Criteria were created.

Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant