Colors repeating on the chart - how to get more colors?

Hi guys,

I have a chart with 12 categories and I've noticed colors are repeating after 7th category. How can I extend the range of colors available so that each category has it's own bar chart color?
I've tried adding a piece of code for this forum but I just get errors (some sort of array with item.color etc.).

Best regards,
L,

Dear @Lav_Radis,
You can always change theme in Dashboard -> Style section. Different themes use different colors.

Let me know if the themes don't work for you - we can help with the code, but themes are an easier option.

HI Nikita, thnx for the idea, but I alredy tried it and the colors repeat on all of them as far as I can tell.
Can you give me some code examples to extend the range of colors or assign a color based on category value?

Best regards,
L.

You can try the following. It goes under Dashboard > Advanced.

Tried that one, nothing happens ...

What chart type are you using?

I use the vertical bar chart type

It should work. Make sure you use the correct apostrophe.


And make sure you add this to your preRender handler.

var handlers = {};
handlers.preRender = function(config, logger) {
  logger.debug('Configuration: ', config);
      
      config.series[0].color = '#eeeeee';
      config.series[1].color = '#eeeeee';
      config.series[2].color = '#eeeeee';
      config.series[3].color = '#eeeeee';
      config.series[4].color = '#333333';
      config.series[5].color = '#333333';
      
      return true;
    }

The one above will result in the one below.

1 Like

oh that worked! thanx!!!

1 Like