Set Colors with a Condition

You can create a condition to set colors. There are two types of conditions. One is to create a condition based on the original (raw) values, and another is to create a condition based on the Y-Axis values that are already aggregated.

Sample Data

We'll use this Stock Price. You can download it from this page.

These are stock price data for several tech companies such as Apple, Google, etc. In this data, each row represents each company's daily stock price.

1. Conditional Color based on Column Values

Here is a chart showing the number of employees by job role.

Now, we want to see how many of the employee for each job role are less than 30 years old.

Assign 'Age' to the Color.

Since the 'Age' column is numeric data type it automatically categorize it by dividing into 5 groups each of which has the equal range.

Now, click on the Green text to open the Color configuration dialog.

Select 'Logical Condition' as the Grouping Type.

Then, create a condition.

Lastly, assign colors for TRUE and FALSE based on the condition.

Now the chart shows the number of employee who are less than 30 years old in each Job Role.

The TRUE is showing up at the top and the FALSE is at the bottom by default.

You can change this by selecting 'Bottom to Top' for both 'Sort By' and 'Legend Direction' in the Color configuration dialog.

2. Conditional Color based on Aggregated Values (Y-Axis Values)

Here is a chart that shows weeky increase or decrease of Apple's stock price.

Now, let's say we want to show the positive values, which means an increase from the previous week, as Green, and the negative values as Red. One thing to note is that we want to create such condition based on the aggregated values that are shown as the bars.

First, assign 'Y Axis Values' to the Color.

Then, click the Green text.

In the 'Color & Grouping' dialog, select 'Logical Condition' as the Grouping Type.

Then, click the 'Create' button to create a condition.

This time, we create a condition of 'The current Y-Axis value is greater than or equal to 0'.

Then, we can setup the colors for a case of the condition being TRUE and a case of being FALSE.

Once you click the Apply button, you'll get the chart with the conditional formatting applied.

Export Chart Image
Output Format
PNG SVG
Background
Set background transparent
Size
Width (Pixel)
Height (Pixel)
Pixel Ratio