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

308
Visualizações
transision() causes Uncaught TypeError with D3 version 7.2.1

I have selected svg element (circle) and I want to apply a transition on it. When I try to apply transition on the circle I get "Uncaught TypeError: circle.transition is not a function".

I've written this code:

import * as selection from '../node_modules/d3-selection/src/index.js';

const RENDER_AREA_ID = "#renderArea";
let svg = selection.select(RENDER_AREA_ID).append("svg")
    .attr("width", document.querySelector(RENDER_AREA_ID).offsetWidth)
    .attr("height", document.querySelector(RENDER_AREA_ID).offsetHeight);
let circle = svg.append("circle")
    .attr("r", 10)
    .attr("cx", 10)
    .attr("cy", 10)
    .attr("fill", "blue")
    .attr("stroke", "black");
circle.transition().attr("cx", 100); // here I get the TypeError

I've tried D3 version 4.x (avalible on this link: https://d3js.org/d3.v4.min.js) and the transition worked just fine. I face the issue while using version 7.2.1.

My question is: What could be possibly causing the Uncaught TypeError?

UPDATE: I've just find out that the issue is somehow associated with npm. When I access D3 through this link: https://d3js.org/d3.v7.min.js, then the transition works. But when I use d3 package from npm then the issue occurs.

about 4 years ago · Santiago Trujillo
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