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

226
Visualizações
how change color of block on the basis of a condition in anychart

I am creating a treemap using any chart js. But I am having an issue for a long time with coloring. What I want is a red block of color wherever the value of(change) object is negative and green where the change is positive. I am getting data from json in this form. json array format

And here you can see the change is negative but the chart is showing green color. treemap snapshot

This is my code below.

var chart = anychart.treeMap([data], "as-tree");

                    chart.maxDepth(2);
                    chart.hintDepth(1);
                    chart.hintOpacity(0.1);




                    chart.container("container");

                    chart.draw();
                    var customColorScale = anychart.scales.linearColor(data);
                    customColorScale.minimum(-5).maximum(5);
                    customColorScale.colors(["red", "green"]);

                    chart.colorScale(customColorScale);

Data is the array which I am passing to create tree map.

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