Hi Guys, last week we have imported a csv file in After Effects and used it to create an animated bar chart. Well, that was not enough, so today I am going to show you how to use expressions to move the bars depending on their value and create a real, data driven, Bar Chart Race ! Of course I am going to let you download the project. My name is Claudio Barba and I welcome you on my Motion Design channel!
So, what is new this week? First of all, I have introduced a main control layer, with the main parameters. It contains the number of data rows of the CSV file, the number of rows, and the colors associated with each column in the bar chart.
Please Subscribe to my Email List to get the Free Project. I will just send a newsletter every now and then about the latest offers of my scripts for After Effects and other free After Effects or Premiere Pro Content!
You can download the Sample Data Driven Bar Chart Race project for After Effects here 🙂
You can get the Complete SCRIPT Version of BARBACHART – Bar chart race for after effects here: https://claudiobarba.gumroad.com/
The main Control layer is called CTRL. It contains some sliders and color picker effects for the initial setup. Lines is the total number of data rows in the CSV file, excluding the titles, Columns is the total number of columns (all included). If After Effects is showing some expressions errors, you might have to put the correct numbers on these sliders.
For each bar, we need four layers, for instance for the first one we need:
- 1: this is the rectangle shape layer
- v1: this is the current value shown on the right of the rectangle
- t1: the label of the chart, on the left side, which corresponds to the name of the column in the CSV.
- c1: this is the control layer of the bar. The main calculations are contained here on the sliders. We have the interpolated current value, the current and following value in the table, and finally the current and following position of the bar, as the bar are interchanging their position, ordered by value descending.
Every time we need to add a column, we just need to
- add the column in the csv file, which is linked to the project
- duplicate this set of 4 layers, respecting the naming convention
- modify the lines value in the main control layer.
If you still think that this is not really something you can do in After Effects, you might want to try dynamic animated charts on Flourish or similar paying solutions.