Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

171
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda