Search

# Color changing line chart [tutorial]

Share

Let’s learn how to create a color changing line chart using Excel. This is what we will create.

Looks interesting? Read on.

### Why color changing line charts?

I will be honest. These charts offer no new information. The height of line already encodes the information we need. Color is merely an eye candy. But sometimes you may want some eye candy. If so, you can use this tutorial.

### Let’s look at the data:

Let’s say we have some data for 3 months starting 1-SEP-2015 in a table like below. We need to add 3 extra columns – Before, Line & After as shown in the below picture.

What are these 3 columns?

• Before: This is value – 1
• Line: this is simply 1
• After: We first calculate the maximum possible value (let’s say 160) and then subtract value from it. ie 160-value.

### Create a stacked area chart from Before, Line & After data:

Select all three columns (before, line & after) and create a stacked area chart.

This is what we get:

### Fill plot area with red yellow green gradient

• Select plot area of the chart and fill it with a Red-Yellow-Green gradient (see below)

### Fill colors in before, line & after series

• Select before series and fill white color
• Select after series and fill white color
• Select line series and fill it with no color (ie make it transparent)

This is what we get:

### Adjust vertical axis maximum

to 160 (or any other value as used in your calculations earlier)

At this stage, our chart looks like this:

### Clean up and format the chart:

• Adjust horizontal axis labels
• Set up a chart title
• Remove legend

Now, our color changing line chart is ready:

### Download color changing line chart workbook:

Click here to download the workbook. Play with the chart settings & data to understand this chart better.

### Would you use such a chart?

I find very few uses for this chart. Also, when creating this chart using area chart technique, we loose the ability to add grid lines (as they are covered by the white color filled areas).

What about you? Would you use color changing line charts? Please share your thoughts and suggestions in the comments section.

### Get FREE Excel + Power BI Tips

Simple, fun and useful emails, once per week.

Learn & be awesome.

### Welcome to Chandoo.org

Thank you so much for visiting. My aim is to make you awesome in Excel & Power BI. I do this by sharing videos, tips, examples and downloads on this website. There are more than 1,000 pages with all things Excel, Power BI, Dashboards & VBA here. Go ahead and spend few minutes to be AWESOME.

Read my storyFREE Excel tips book

Overall I learned a lot and I thought you did a great job of explaining how to do things. This will definitely elevate my reporting in the future.
Rebekah S
Reporting Analyst

From simple to complex, there is a formula for every occasion. Check out the list now.

Calendars, invoices, trackers and much more. All free, fun and fantastic.

Power Query, Data model, DAX, Filters, Slicers, Conditional formats and beautiful charts. It's all here.

Still on fence about Power BI? In this getting started guide, learn what is Power BI, how to get it and how to create your first report from scratch.

### How to compare two Excel sheets using VLOOKUP? [FREE Template]

You are the boss of ACME Inc. And one day, both of your accounts receivables team members Sara and James come to you with two versions of the customer payment data. How do you compare these two Excel sheets and reconcile the data? In this article, let me explain the step by step process.

## Related Tips

Charts and Graphs

### Make an Impressive Interactive Map Chart in Excel

Charts and Graphs

### How to Create a Dynamic Excel Dashboard in Just 5 Steps

Charts and Graphs

### How to create a fully interactive Project Dashboard with Excel – Tutorial

Charts and Graphs

### 9 Box grid for talent mapping – HR for Excel – Template & Explanation

Charts and Graphs

### 6 Must Know Line Chart variations for Data Analysis

Charts and Graphs

### 14 Responses to “Color changing line chart [tutorial]”

1. Desk Lamp says:

Hi Chandoo,

You can make the line a coloured gradient directly, without the use of area charts.

🙂

• Chandoo says:

Interesting. I did not think about that option. Certainly lot better and simpler than my tutorial. Thanks for sharing it. 🙂

• Lex says:

File not available now..

• Hui... says:

@Lex

It is still working for me ?

Are you on a network that bans downloads?

2. April Du says:

One option is to keep the before (or the actual values?) as area chart with the gradient colouring.

3. It helps when there are a few colors on the chart. For example green for profits and red for losses. Thanks for a tip!

4. Haz says:

Just make a line chart and then change the line color.

5. Mike says:

Would it be possible to change the color based on some other value? For example, if I wanted to chart a stock price and have the color change depending on the trading volume?

6. Hi
Is any one help me to insert values in ms access using vb macros since i'm able to insert values later i'm getting the error.

Below is the syntax
con.execute " insert into copper(EIN,Team_Members_Name,OUC) values('" & Worksheets("Copper").Range("L92").Value & "','" & Worksheets("Copper").Range("m92").Value & "','" & Worksheets("copper").Range("N92") & "')"

7. saleem says:

@chandoo
I have done an Experiment the sensor give me a reading for every 1ms (temp value). I can not Change the sensor Settings. It means that i have rund exp for 16mints so 16*60*1000 = 960000 values so 960000 rows i get. I want to plot the graph for Temp vs Time.
1) I Need to reduce the no of data Point
2) how can i redice the no of rows
3) I want that graph will Show value for 1sec

I want to get the average value after 1sec. how can i do that I want to send you the file i am very new to excel

• Hui... says:

@Saleem

You have asked this question about 10 times now,
Every time I have asked you to:

"If you post the question at the Chandoo.org Forums
http://forum.chandoo.org/

Please attach a file and you will get a more targeted response"

8. Jelena says:

Great post! I use Chart.js, which is JavaScript library for all my projects where charts are needed. It is very simple to use. I recently wrote a tutorial on how to create gradient line charts using Chart.js, you can read on my blog https://blog.vanila.io/chart-js-tutorial-how-to-make-gradient-line-chart-af145e5c92f9 . I hope someone will find it useful. 🙂

9. Miguel says:

Is it possible to have a line chart when there is negative values the line that goes negative (below the X axes) turns for example, red? and if the numbers turn positve that line turns green?

Thanks,

Miguel

10. Tony says:

Hi, How do i achieve this in power bi desktop

### Get FREE Excel & Power-BI Newsletter

One email per week with Excel and Power BI goodness. Join 100,000+ others and get it free.