Specific colors for values in a chart


#1

Hi, I’d like to know if I can assign a specific color to an exact value in a visualization’s data. How can I do that?, is it possible?


#2

Actually yes, you can do something like this:

let color = cf.Color();
// setting the color for different attribute values
color.match({
    'your_value_1': 'red',
    'your_value_2': 'blue',
    'your_value_3': '#FFF'
});

yourViz.set("color", color);

With that configuration You assign specific colors to attribute values in your chart.


#3

I understand, but I have a Multimetric Bars, so can this setting be applied to specific metrics?


#4

Then you can use a config by metric like this one:

let color = cf.Color();
// setting the color for different metric names
color.match({
    "metric1": "red",
    "metric2": "blue",
    "Transactions": "#f4589d" // Using the count metric
});

yourViz.set("color", color);

#5

Man that is really easy, thanks