Zooming into an infographic line chart (making it scalable?)
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 .
