Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

How do I manage onClick events? #24

Open
stephan227 opened this issue Feb 20, 2016 · 2 comments
Open

How do I manage onClick events? #24

stephan227 opened this issue Feb 20, 2016 · 2 comments

Comments

@stephan227
Copy link

I am attempting to implement onClick events on react-nvd3 components. Is there a way I can use onClick events on a react-nvd3 component?

@topicus
Copy link
Contributor

topicus commented Feb 23, 2016

@stephanbochet I have to check this. Could you provide an example about what you're trying to do?

@stephan227
Copy link
Author

I managed to temporarily solve the issue by using jQuery to get the series, name and value of the element clicked on a chart.

handler: function (e) {
    console.log("Mouse Up Event");
    console.log(e.toElement["__data__"]);
},

componentDidMount: function () {
    var x = this.refs.linePlusBarChartComponent;
    if (x !== null) {
        $(x).bind( "mouseup", this.handler );
    }      
},
componentWillUnmount: function () {
    var x = this.refs.linePlusBarChartComponent;
    if (x !== null) {
        $(x).unbind( "mouseup", this.handler );
    }
},

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

No branches or pull requests

2 participants