-
Bar chart with dynamic data layers
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