Copy link to clipboard
Copied
I am looking to create a line chart graph that has the ability to be able to be zoomed in and out of (animated). I need to be able to scale the x and y dimensions freely. Here is the rub: I would like all of the elements (text, lines, shapes etc) being scaled to NOT DISTORT.
example: I have a line graph where the bottom x value are let's say 12 months (Jan thru Dec - that 12 separate text boxes)
Then the vertical lefT line are let's say dollars amounts , let's say zero through $100 found up the left side.. (that's five text boxes).
Not of course I have a line path/shape expressing whatever info values in the center .
Now say I would like to animated a zoom into just the last month (Sat from Nov through Dec or something ) , but I want to keep the left vertical $ values the same.? Easy enough.. I split the x and y values of the scale property of a master null that I have parented all of my chart elements to.
The problem is.. now all of my chart elements are scaled disproportionately. In fact I don't want them to scale at all. I would like my text to not grow. (If the words are say 25 points I want the to stay 25 points). I ONLY want the position values of all of my chart elements to scale in accordance to them being a child of a master null (that is performing the scaling)
I have successfully achieved this with the texts elements actually by using an expression that negates the size scaling of the text while maintaining the position scalinng.
s = [];
parentScale = parent.transform.scale.value;
for (i = 0; i < parentScale.length; i++){
s[i] = (parentScale[i]== 0) ? 0 : value[i]*100/parentScale[i];
}
s
But for some reason this script does not work on shapes..only text. So my lines , and anybother graphics are getting distorted when I scale (zoom) into my chart
Anyone have any ideas on this? Thanks for reading .
Copy link to clipboard
Copied
Scale is a two-dimensional property, so which one is it even referencing? It's always scale[0] for X and scale[1] for Y and the output needs to be [s,s] or [s,value[1]] and [value[0],s], respectivley. That said, the scenario you describe is best handled by not scaling at all but rather manipulating all the necessary info directly with sliders like spacing of the ticks and value ranges, in respective pre-comps if need be. This solves all your issues and avoids having to compensate anything, including potentially having to add a ton of extra keyframes when in-between values go whacky.
Mylenium
Copy link to clipboard
Copied
Thanks.. I need to be able to zoom in for both depending on different charts.
I sort of figured this out. Basically I add a script to the scale value of each of my data layers (example: 1971, 1972, 1973 etx... and in the Vertical column: $10, $20, $30, $40 etc etc..) So now, all of these text layers has an expression in their respective scale properties that tells that layer to scale inversely to their parent. I then Child these layers to a master parent Null. This parent Null will act as the master scale. So Now when I "zoom in" to part of the chart using this Master Null.. The distance of my values scale relative to one another BUT. the size of my text remains constant. Voila!