question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

data.onclick is not firing when cursor changed

See original GitHub issue

Description

data.onclick is not firing when the cursor(pointer) changed.

Steps to check or reproduce

Screen Shot 2020-01-20 at 1 39 45 PM

When I clicked the blue circle position the above, both changes cursor of chart but only the second blue circle fire data.onclick. It doesn’t make sense that cursor and onclick don’t work together in same condition.

Or please let me know if there’s another event listener I can use in this case.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
netilcommented, Jan 22, 2020

@softage0, it might better use as:

  tooltip: {
    onshow: () => {
      setTimeout(() => {
          console.log(JSON.parse(this.chart.$.tooltip.datum().current))
      });
    },
    // or if is okay retrieve data after tooltip layer is shown without wrapping with timeout
    onshown: () => {
      console.log(JSON.parse(this.chart.$.tooltip.datum().current))
    }
  }
1reaction
softage0commented, Jan 22, 2020

Thanks a lot, @netil.

I got all the solutions I needed.

I left my codes for the next person who has a similar issue to me:

bb.generate({
      ...
                onshow: () => {
                    const {_parents} = this.chart.$.tooltip.selectAll('.name, .value');

                    setTimeout(() => {
                        const {__data__} = _parents[0];
                        const currentPoint = JSON.parse(__data__.current);
                        console.log(currentPoint);    // the data the current tooltip has
                    });
                },
      ...
});
Read more comments on GitHub >

github_iconTop Results From Across the Web

Click event is not firing for element which changes position ...
When an element has onFocus event handler, which changes the element's position, the onClick event handler is not firing.
Read more >
Handling Events :: Eloquent JavaScript
Event listeners are called only when the event happens in the context of the object they are registered on. <button>Click me</button> <p>No handler...
Read more >
Mouse events - The Modern JavaScript Tutorial
For instance, a left-button click first triggers mousedown , when the button is pressed, then mouseup and click when it's released. In cases ......
Read more >
Button events | Decentraland Documentation
Decentraland accepts events from pointer clicks, a primary button and a ... the cursor changes shape to hint to the player that the...
Read more >
SyntheticEvent - React
The specific mapping is not part of the public API and may change at any time. ... The event handlers below are triggered...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found