Data Visualization - Simple Bar Charts

Steps to follow along with the above video.

Bar charts are a staple in MoGraph Client work. This tutorial will show you how to quickly set up a Dynamic bar chart rig that can connect to a Google Sheet to make client revisions a breeze.

Import your CSV or Google Sheet data. The steps to do that can be found HERE.

Connecting to a Google Sheet is a PRO feature, but you can create the same rig with a regular CSV on the Starter License. This will make updating the data a bit more manual, but still a powerful setup.

Alt/Option click on the Shape Tool to create a Rectangle Shape in the center of the comp. Rename it to something like Base Bar. Add an Align Deformer to that Rectangle Shape with the Y Value set to 1. You can style the corners or colors however you want. I've connected a Color Array so that each bar will have it's own unique color, and adjusted the Corner Radius to make it look nice.

Alt/Option click on the Text Tool to create a Text LAyer in the center of the comp. Rename it to something like Titles. Center both Align Attributes, uncheck both Auto boxes on the Text Box Size Attribute, check the Shrink To Fit Attribute, and finally set the Font Size Attribute to be something super large like 225. When you uncheck the Auto Width/Height, the pivot point will move, so make sure to add an Align Deformer with the Y Attribute set to -1. After this, you can adjust the Text Box Size Width/Height Attributes to size the text however you need, and reposition it relative to the Rectangle Shape. (You can also uncheck Allow Word Breaks as well if that's what you are in to). Setting up the text in this way will do a simple auto format on the text coming in from the Google Sheet to keep the sizes generally looking consistent.

Group your Rectangle Shape and Text layers together, and name that folder something like Base Element.

Pull in 2 copies of your Spreadsheet Data from the Assets window (CSV or Google Sheet), and rename them to something like Data and Names/Titles. Make sure each Spreadsheet Utility has the Column Title Attribute set accordingly (In my example 'Type' and 'Amount'). Connect the Output of the Names Spreadsheet Utility into the Text Box's String Attribute, and the output of the Data Spreadsheet Utility into the Rectangle Shape's Height Attribute.

Spreadsheet Utilities include a handy feature where you can remap data for sizing purposes. Change the REMAPPING Attribute on the Data Spreadsheet Utility from None to Number Range. Keep the Source Minimum at 0, and set the Source Maximum to be whatever your highest data point is in the Google Sheet. It's a good idea to bake this into the sheet by creating a column on the side and using the function =MAX(range). the Minimum can stay 0, and set the Maximum to be the height in pixels you want your tallest bar to be (In my case 500).

Select your Base Element folder, Alt/Option click on the Duplicator button (this will create a new Duplicator with the Base Element folder set to it's Input Shapes Attribute). Set the Distribution Attribute to Linear. Connect the Row Count Attribute from the Data Spreadsheet Utility into the Count Attribute of the Duplicator, set the Size Mode to Step, and adjust the Size Attribute so that things look nice.

If your titles look weird you can go back to your Titles Text Layer and adjust the settings to your taste. In my example I set the Text Box Height attribute to 117.

If you need to refresh your sheet, just right click on your Spreadsheets in the Assets Window, and select Reload.

Animating this setup is fairly straight forward, but we do need to change our rig a little bit.

Create a Value Blend and name it something like "Animation Driver". Connect the Output of the Data Spreadsheet Utility into the Value Blend's Second Value Attribute, and leave the First Value at 0. Connect the Output of the Value Blend into the Base Shape's Height Attribute. Animate the Strength Attribute on the Value Blend from 0-100% over however many frames you need (In my example I did 12 frames). Add some Easing to your keyframes to make things nice and smooth. In the Duplicator, add a Stagger Behavior to the Shape Time Offset Attribute (Right Click > Add Behavior > Stagger) and set it's Maximum Attribute to 0, and it's Minimum Attribute to a negative number. In my example I use -8 so that there would be some overlap in each bars animation. Negative numbers in the Shape Time Offset attribute will stagger the animations to be one after the other, starting after frame 0.

You can check out my plugin Create Duplicator Sequence to create these types of duplicated overlapping animations faster.

Support me - If you want to support the content I’m making, the easiest way to support is to subscribe and share my Youtube channel. If you are learning Cavalry you can buy some of my tutorial Cavalry files here, and I am also making my own plugins for Cavalry here.

Previous
Previous

Data Vis 101 - Dynamic Bar Chart Count

Next
Next

Data Visualization - Importing the data