Copy link to clipboard
Copied
Hi everyone,
i´m currently trying to path a graph from a CSV file in after effects, but i´m still having a few problems. When importing the CSV file into after effects, it shows as one group (time;cases;...;...)
instead of having each of these in a different group (when importing it as a TSV file it does split it up into different groups, but it cant turn the results into numeric values).
When working with the TSV File the code works but only gives me a straight line a the bottom. Is there anything more wrong with my code?
var numberOfPoints = thisComp.layer("data all.tsv")("Data")("Number of Rows");
var spacingForPoints = thisComp.width / numberOfPoints;
var startingSpaceX = 0;
var thePath = content("Shape 1").content("Path 1").path;
var maximumYValue = effect("MaximumYValue")("Slider");
var lineHeight = 0;
var arrayOfPoints = [];
for(var i = 0; i < numberOfPoints; i++) {
var data = thisComp.layer("data all.tsv");
var S_down = data.footage("data all.tsv").dataValue([1,i])
lineHeight = linear(S_down, 0, effect("MaximumYValue")("Slider"), content("Shape 1").content("Stroke 1").strokeWidth/2, thisComp.height)*-1;
arrayOfPoints[i] = [startingSpaceX, lineHeight];
startingSpaceX += spacingForPoints;
}
thePath.createPath(points=arrayOfPoints, inTangents=[], outTangents=[], is_closed=false);
Happy for help! Thanks!
Copy link to clipboard
Copied
Well, you have semicolons, not commas. Whatever program you use appears to make an oopsie when exporting the data and you need to check that.
Mylenium
Copy link to clipboard
Copied
Thanks, fixing that already seemed to work. Onto to my next problem: i was following a tutorial when writing a code and i wont get any further errors. Why does it only show a straight line instead of showing the graph. The code is the exact same as in the tutorial.
Copy link to clipboard
Copied
Without any idea about your actual data and what tutorial you are referring to nobody can tell you much. Chances are the values simply need to be multiplied with a fixed facto to produce distinct peaks and valleys in the graph, but of course there could be any number of other issues just as well.
Mylenium