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

712
Vistas
Uncaught TypeError: Cannot read properties of undefined (reading '#<Object>') with D3.js and Laravel

I'm using D3.js (v. 7) with Laravel (v. 8) and I was able to plot a kind of scatter chart on the page. Everything went well, but when I tried to insert some transitions with the following code:

    .on('mouseover', function (d, i, n) {
        d3.select(n[i])
            .transition()
            .duration(128)
            .style('opacity', 0.75)
    })

I began to receive the following error on the console:

Uncaught TypeError: Cannot read properties of undefined (reading '#<Object>')

I'm not sure if this function (d, i, n) is correct or if anything else should be different as I'm following a tutorial that is using version 5 of D3.

Here the whole js file:

import * as d3 from 'd3';

// SVG common attributes
const width = '100%';
const height = '100%';

// set html element id where chart will be plotted
const earthquake = d3.select('#earthquake');

// create svg background
const svg = earthquake
    .append('svg')
    .attr('width', width)
    .attr('height', height);

// create circles
const circle = svg.selectAll('circle');

// populate circles
// api dataset source
const url = 'https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/significant_month.geojson';
d3.json(url)  // parse json
    .then(data => {circle
        .data(data.features) // data to use
        .enter().append('circle') // automatically create new circle
        .attr('cx', (d, i) => ((i + 1) * 100)) // x axis circle center coordenate
        .attr('cy', (d, i) => d.properties.mag * 10) // y axis circle center coordenate
        .attr('r', (d, i) => d.properties.mag * 10) // circle radius lenght
        .attr('fill', (d, i) => d.properties.alert) // circle fill color
        .on('mouseover', function (d, i, n) {
            d3.select(n[i])
                .transition()
                .duration(128)
                .style('opacity', 0.75)
        })
    })
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