Color Bar in stacked charts


I have to change the default color in stacked bar. Like in the example at the link, but with different bar color.

I tried with:
PlotOptionsColumn plotOptionsMachine = new PlotOptionsColumn(); plotOptionsMachine.setColors(SolidColor.BROWN, SolidColor.GRAY, SolidColor.GREEN, SolidColor.AZURE);

but with no succes…

Is there any other way to accomplish this?


Hi Tiziano,

setColors is used to set the colors that are going to be used for each point in the series when colorByPoint option is enabled. To set a color for the whole series you should use setColor, if you have multiple series with different colors you can create a PlotOptionsColumn instance for each series like and then set the color and add it to the series like this:

        Series series = new ListSeries("John", new Number[] { 5, 3, 4, 7, 2 });
        PlotOptionsColumn plotOptionsSeries = new PlotOptionsColumn();

You could also change the colors for all charts globally by modifying an existing theme or creating a new theme, take a look at this blog post regarding charts styling

It works!

Thank you!