Search code examples
jquerychartsamcharts

How to change color of the stacked bar charts in amchart


I have started exploring AmCharts recently and was impressed by its superb features. However, I am trying to change the color of each stack in the bar but I haven`t been successful so far. I tried various properties like "balloonColor" to change the color of the respective stack but nothing happened.

Can someone let me know how can we do this?

This is the graph I am taking about.


Solution

  • You can change the bar's color by setting a particular graph's fillColors property, i.e.

    AmCharts.makeChart("chartdiv", {
      // ...
      "graphs": [{
          "fillColors": "#008800",
          "fillAlpha": 1, //must also be non-zero value; valid values are decimal values <= 1
           // ...
      },
      // repeat for each graph
      ],
      // ...
    });
    

    Here's a modified version of the graph that changes the Europe segment to green.