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

223
Vistas
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 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