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.