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

114
Visualizações
D3 events in new versions

I have written the following snippet:

ngAfterViewInit() {
    var svg = d3
      .select("svg")
      .call(d3.zoom().on("zoom", () => {
        svg.attr("transform", d3.event.transform)
      }))
      .append("g")
}

I am aware that the d3.event has been removed in new releases, but reading through the documentation on how to handle the events in callbacks does not make me understand how to modify this...

Can someone please explain this tiny bit to me and how to fix it to work, in a simple way that a novice like me can understand? Thanks

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

From this migration guide, the d3.event.transform must be replaced with the following

ngAfterViewInit() {
  let svg = d3                                // <-- I'd suggest using `let` instead of `var`
    .select("svg")
    .call(d3.zoom().on("zoom", (event) => {   // <-- `event` argument
      svg.attr("transform", event.transform); // <-- use `event` here
    }))
    .append("g");
}
over 4 years ago · Santiago Trujillo Relatório
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