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

182
Visualizações
Changing attribute of subclass within D3 based on dictionary value

What is the best way to make sure I can differentiate each line by size based on the values of my dictionary.

Problem is all lines would adjust instead of my desired line and I am not sure how to approach it.

Down below is a simplified example.

draw.axis = function ()
{
    var element; 
    function axis(g){
        element = g.append("g"); 
        
        
        element 
            .append("g")
            .attr("class", axis dotted line)
            .attr("height", 100);  //default size 
        
    }
}

var size_adjuster = [    
    {size: "big",     adjusted: false  },
    {size: "regular", adjusted: false  },
    {size: "small",   adjusted: false  },
    {size: "small",   adjusted: true   },
    {size: "big",     adjusted: true   },
];

size_adjuster = function(){
    size_adjuster.forEach(function(item) {
        if(item.size == "big" && item.adjusted == false){
            item.adjusted == true; 
            d3.selectedAll("g.axis.line line")
                .attr("height", 200);
        }
        else if(item.size == "regular" && item.adjusted == false){
            d3.selectedAll("g.axis.line line")
                .attr("height", 100);
        }
        else if(item.size == "small" && item.adjusted == false){
            d3.selectedAll("g.axis.line line")
                .attr("height", 50);
        }
    });
}
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