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

React mouse interactions ignored or not working or broken #2

Closed
butters16 opened this issue Oct 18, 2021 · 2 comments
Closed

React mouse interactions ignored or not working or broken #2

butters16 opened this issue Oct 18, 2021 · 2 comments

Comments

@butters16
Copy link

butters16 commented Oct 18, 2021

UPDATE: There was never really a problem here. My issue stemmed from creating multiple components with this chart-1 portion of <Chart id='chart-1' data={data1}/>. Making those ids actually unique for each component fixed my problem. Sorry for any confusion.

Below this line is a red herring


This example does not seem to support mouse interactions, either by default or by explicitly adding any of the following:

    chart.setMouseInteractions(true);
    chart.onBackgroundMouseMove(() => {console.log('here 0')});
    chart.onSeriesBackgroundMouseMove(() => {console.log('here 1');});
    series.setMouseInteractions(true);
    series.onMouseMove(() => {console.log('here 2')});

I move my mouse all over the chart, but never see any of my logs. I also never see a tooltip like I see on the most basic ChartXY example even though that code does not appear to do anything to make that work, which makes me assume it should be on by default: https://www.arction.com/lightningchart-js-interactive-examples/edit/lcjs-example-0000-lineSeries.html

Is this expected? Are others having the same issue? It just feel like something is fundamentally broken with the React approach, but I don't see any console logs indicating any errors, even with verbose web browser debugging.

Help or acknowledgment would be appreciated. Thanks in advance!

@butters16
Copy link
Author

My problem seems to be related to create chart printing multiple times, but not because the component is rerendering, rather because something in the parent chain was being destroyed and recreated, causing a new instance of the component. I'm not quite sure yet why that would be a problem, but when I did some hard-coding to work around that, the component started responding to mouse controls: tooltip and my console statements of here 0 and here 1.

I'm closing this issue, but I'll continue to research and post if I come up with anything new, like a different approach. I'm confused why this would be a problem and curious why the destroy chart log never appeared. I'm wondering if that would have helped with some cleanup and reassignment of event handlers.

@butters16
Copy link
Author

I wonder if this comment in the code is because somebody brushed up against something similar 🤔.

// NOTE: console log is used to make sure that chart is only created once, even if data is changed!

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

No branches or pull requests

1 participant