Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

169
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda