Thanks for helping me guys both of you gave cool tips for the solution.
The first(0) and the last(7 – it’s same like the first ) group of data are not important they are just containers. And finally I made it with createPath() not trimming.
here’s a gif (the design needs some adjusting but it works)
https://media.giphy.com/media/SULCqXRiwj5AIexNKf/giphy.gif
slide= thisComp.layer("BarControls").effect("DataGroups")("Slider")+1;
h = new Array();
for(i=0; i <4; i++) {
h1 = footage("04_2_YourCSV.csv").dataValue([slide,i]);
h.push([h1]);
}
function myArrayMax(arr) {
return Math.max.apply(null, arr);
}
vMax = myArrayMax(h);
slide0= thisComp.layer("BarControls").effect("DataGroups")("Slider");
h00 = new Array();
for(i=0; i <4; i++) {
h0 = footage("04_2_YourCSV.csv").dataValue([slide0,i]);
h00.push([h0]);
}
function myArrayMax(arr) {
return Math.max.apply(null, arr);
}
v0Max = myArrayMax(h00);
v1 = footage("04_2_YourCSV.csv").dataValue([slide,0]);
v0 = footage("04_2_YourCSV.csv").dataValue([slide0,0]);
x0 = (v0/v0Max)*1353;
x1 = (v1/vMax)*1353;
s0 = Math.floor(slide);
s1 = Math.ceil(slide);
end = linear(slide, s0, s1, x0, x1);
createPath(points = [[0,0], [end,0]], inTangents = [], outTangents = [], is_closed = false);