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

148
Visualizações
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 à 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