3 Replies Latest reply on Mar 29, 2018 6:42 AM by stibinator

    Average An Array

    duanew68417658 Level 1

      I'm building what basically amounts to a dynamic Capture.JPGbar graph chart.


      I have 10 bars that are all on separate slider controls, and with that the bar scales on Y relative to the number the slider is on.

      -- bar 1 goes to 60%, then bar 1 is scaled up on Y to 60%


      What I would like to do is be able to grab the data from all 10 bars and dynamically show the average in real time as the bars are being animated.


      Although, maybe this would be something easier to do with the newer JSON functions?


      I've included a photo for visual representation.


      Any help is appreciated, thanks in advance.

        • 1. Re: Average An Array
          Mylenium Most Valuable Participant

          Not sure why this has to be complicated. A simple addition of all values divided by the number of bars, possibly some rounding, like it has been done for cewnturies.



          • 2. Re: Average An Array
            duanew68417658 Level 1

            Because I would like an outside JSON file to be updated dynamically by people that don't know how to use Ae. So I guess unless JSON or Javascript has been written for "cewnturies", your solution won't work.

            Thanks for being less than remotely helpful though.

            • 3. Re: Average An Array

              The average will be calculated from the values of the bars, whether using one of their properties in the composition, or by averaging out the data that drives them. And I'm guessing that you know how to calculate an average, so what you're really asking is how to drive the value of the bars from JSON. Have you read the Adobe docs on how to use JSON to drive expressions? Might be the first place to start, and then come back if you've got specific questions.