Adyen / lume

Lume is a component library for visual representations of data, built for Vue with D3.
https://lumedataviz.com
MIT License
37 stars 1 forks source link

πŸ› Fix wrong assumption on external hover #383

Closed joao-m-santos closed 6 months ago

joao-m-santos commented 6 months ago

πŸ“ Description

Before, when trying to sync tooltips between two charts (like the example below), one of them would fly in instead of appear in the chart.

<lume-bar-chart
    v-bind="args"
    type="stacked"
    :hovered-index="hoveredIndex"
    @tooltip-opened="hoveredIndex = $event.index"
    @tooltip-moved="hoveredIndex = $event.index"
    @tooltip-closed="hoveredIndex = -1"
/>
<lume-bar-chart
    v-bind="args"
    type="stacked"
    :hovered-index="hoveredIndex"
    @tooltip-opened="hoveredIndex = $event.index"
    @tooltip-moved="hoveredIndex = $event.index"
    @tooltip-closed="hoveredIndex = -1"
/>

This was because the handleExternalHover in <lume-chart> was always calling handleInternalHover even if the external index was -1 (or null).

This PR corrects that into checking if it should handle it as show or hide tooltip based on the provided index.

πŸ’₯ Is this a breaking change (Yes/No):

πŸ“ Additional Information

Before submitting the PR, please make sure you do the following

netlify[bot] commented 6 months ago

Deploy Preview for adyen-lume ready!

Name Link
Latest commit 7f7a4359e68380e5e58187234ed7fb04f98bcd94
Latest deploy log https://app.netlify.com/sites/adyen-lume/deploys/6597d8f7fb2cb30008fd4482
Deploy Preview https://deploy-preview-383--adyen-lume.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.