-
Dynamic CSV Line Chart AE
Hi everyone, I’m working with an expression that automatically generates a Line Chart from a CSV file.
The expression works fine, but it always assumes the range of the data goes from zero to the maximum value.
I would like to have control of the minimum value too, so for example if the values in the CSV file go from 215 to 645, I can just start the graph at 215 and avoid all the empty space from 0 to 215.
The expression the line uses is:
values = [];
slider = thisComp.layer(“Line Controller”).effect(“End Row”)(“Slider”)-1;
for(i=0;i<=slider;i++) {
values.push(thisComp.layer(“subs.csv”)(“Data”)(“Outline”)(“Subs_1”)(“Subs_1 ” + i).value);
}
a=Math.max.apply(null, values);
start = thisComp.layer(“Line Controller”).effect(“Start Row”)(“Slider”);
end = thisComp.layer(“Line Controller”).effect(“End Row”)(“Slider”);
tanR = thisComp.layer(“Line Controller”).effect(“Tangent Radius”)(“Slider”);
xpos = thisComp.layer(“Line Controller”).effect(“xpos”)(“Slider”);
ypos = thisComp.layer(“Line Controller”).effect(“ypos”)(“Slider”);
x = xpos – 960;
y = ypos – 540;
pts = new Array();
inTan = new Array();
outTan = new Array();
Mult = thisComp.layer(“Line Controller”).effect(“Multiply Y”)(“Slider”);
Maxi=thisComp.layer(“Line Controller”).effect(“End Row”)(“Slider”);
for(i = start; i < end; i++) {
ptX = x + (i*(1450/Maxi));
ptY = y – (linear(footage(“subs.csv”).dataValue([1,i]), 0, a, 100, 700));
pts.push([ptX,ptY]);
inTan.push([-tanR, 0]);
outTan.push([tanR, 0]);
}
createPath(pts,inTan,outTan,false);
Does anyone know how to address this?
Thanks in advance for any help!
Gab
Sorry, there were no replies found.