Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

165
Views
ReChart Graph onClick

I want to have a graph where, when I click on the graph, a modal shows up. However, I'm struggling to get the graph to recognize the onclick listener.

Any ways on making this work?

in my graphview:

class GraphView extends React.Component {
    render() {
        return (
            <ResponsiveContainer width="100%" height={180} onClick={this.props.onClick}>
                <LineChart data={mydata} width={600} height={400} margin={{ top: 5, bottom: 5, left:-30, right: 0}}>
                <XAxis dataKey='time'/>
                <YAxis>
                    {/* <Label angle={-90} value='stuff' position='insideLeft'style={{textAnchor: 'middle'}} dy={0} dx={0}/> */}
                </YAxis>
                <Legend />
                <Line type="monotone" dataKey="visitors" stroke="#4285f4" activeDot={{r: 5}}/>
                    <Line type="monotone" dataKey="visitors2" stroke="#001529" activeDot={{r: 5}}/>
                <Tooltip/>
                </LineChart>
            </ResponsiveContainer>
        );
    }
}

in my function component:

function showModal  () {
        console.log("aaaaaaaaaa");
}

function alarmLog() {
    const modal = <div>
        <GraphView onClick={() => showModal()}/>
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!