Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity › Forums › Adobe After Effects Expressions › Dynamic CSV Line Chart AE

  • Dynamic CSV Line Chart AE

    Posted by Gabriel Granda on August 25, 2021 at 11:57 am

    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

    Gabriel Granda replied 5 years, 1 month ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

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