Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Bar chart with dynamic data layers

  • Bar chart with dynamic data layers

    Posted by Kristine Jones on May 28, 2020 at 3:49 pm

    Hi helpful AE friends ––

    I’m creating an animated bar chart pulling in dynamic data for daily covid numbers. I have my data in and mapped to a layer, and everything working as it should.

    However, I need to duplicate the bar layer to correlate to the number of rows in the table. If I do this as it is now, I have to manually go through the code of each layer and increment the data row number being called.

    So far my code for the first data plot layer is:

    var h=thisComp.layer("time_series_covid19_confirmed_global.csv")("ADBE Data Group")("Outline")("US")("US 0")/thisComp.layer("Bar Chart Controls").effect("Max Value")("ADBE Slider Control-0001")*100;
    if (numKeys > 1){
    t1 = key(1).time;
    t2 = key(2).time;
    v1 = 0;
    v2 = h;
    [easeOut(time, t1, t2, v1, v2)];
    } else {
    [content("yesterday").content("Trim Paths 1").end] }

    The “US 0” is the digit that would need to increase by one for each layer created.

    1. Is there a way to add javascript to this first layer so that it when it is duplicated the data row increments +1 based on the layer before it?

    2. Is there a script that will automate the duplication of the layers based on the “Number of Rows” found in the data layers?

    Thanks!
    Kristine

    Tomas Bumbulevičius replied 6 years, 3 months ago 2 Members · 1 Reply
  • 1 Reply
  • Tomas Bumbulevičius

    June 6, 2020 at 12:49 pm

    Hey Kristine,

    every duplicated layer appears above of the original layer. With that in mind, I think it would be wise to:
    1. Have only row-related layers in the comp.
    2. After duplication is done, move new layer to the bottom of the stack.
    3. Append your layer name with ‘(“US ” + (index-1) + ““)’ (since your values are starting from 0).
    4. In such case, every new layer will be pointing to different data line.

    As for the script – its doable for sure. All you need to do is just run a loop which does what I described above !

    Find out more:
    Motion Graphics Design & After Effects Tutorials
    On YT
    On VH

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy