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

149
Vistas
How to fill up a segmented D3 arc

I am fairly new to D3 and generated a segmented arc/half donut chart as shown belowsegmented arc

I used d3.pie and arc to generate this segmented arc chart. Code below:

let pieGenerator = d3
  .pie()
  .startAngle(-0.75 * Math.PI)
  .endAngle(0.75 * Math.PI)
  .padAngle(0.05)
  .sort(null);

let pieGeneratorForeground = d3.pie().startAngle(-0.75 * Math.PI);

var data = [60, 20, 20, 20, 40];

// Create an arc generator with configuration
var arcGenerator = d3.arc().innerRadius(85).outerRadius(100).cornerRadius(5);

var arcData = pieGenerator(data);
console.log(arcData);

// Create a path element and set its d attribute
let arc = d3
  .select("g")
  .selectAll("path")
  .data(arcData)
  .join("path")
  .attr("d", arcGenerator);

What I would like to do is fill up the arc, starting from the left end, to whatever value from 250-850 with a transition. I'm having a hard time finding an example to do this with the use of d3.pie and d3.arc (since that's what I used to generate the segmented arc). Examples I looked at are: arc-progress, arc-gauge Any help or links would be much appreciated. I know I need to use a tween function but I wasn't sure how a tween function could 'fill'/transition the foreground arc between the segmented gaps. Here is a link to a working example of what I have so far: codepen

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