4 Replies Latest reply: Aug 3, 2011 2:54 AM by Chris Brain RSS

    Charting delta/difference between adjacent data points

    Chris Brain

      This sounds like it should be easy but I can't quite see how/where to do it.

       

      Lets say I have a simple line chart plotting day vs number of likes on a Facebook page - what I would like to plot is actually day vs the change in number of likes since the previous day (or data point).

       

      Is there a way I can describe this in the expression?

        • Charting delta/difference between adjacent data points
          Karthik G

          Hi Chris,

           

              Can  we have a sample of your data set?

           

          Assuming the data set to be the following :

                  

                FB_Data:

                 Day     Likes

                    1          10

                    2          30

                    3          34

                    4          39

           

          So, on plotting this on a line chart, it would be simple as you told.

           

          When you load the above data like this :

           

          Load

          Day,

          Likes,

          if(isNull(peek(Likes)),Likes,peek(Likes)) as Change

          Resident

          FB_Data;

           

          and plot the graph Day vs Change, probably you might get your solution.

           

          Am not able to test this right now, but hope this should work.

           

          Check and revert back.

           

           

          Regards,

          -Karthik

            • Charting delta/difference between adjacent data points
              Chris Brain

              Hi,

               

              Thanks for the initial hints.

               

              I would like to solve this outside of the loadscript if possible, 2 main reasons:

              - I think the above would rely in the data being loaded in the correct order I needed for the chart.

              - I would have to add this load script for every field I wanted this for.

               

              I tried using the peek method in the expression value for the chart but I don't think it's available there.

               

              So I am still stuck - here is some sample data as requested.

               

              Time     Value

              01/08/2011 14:11          19209

              01/08/2011 15:16          19213

              01/08/2011 16:11          19217

              01/08/2011 17:11          19216

              01/08/2011 18:11          19219

              01/08/2011 19:11          19222

              01/08/2011 02:11          19193

              01/08/2011 20:11          19222

              01/08/2011 21:11          19227

              01/08/2011 22:11          19231

              01/08/2011 23:11          19231

              01/08/2011 03:11          19193

              01/08/2011 04:11          19194

              01/08/2011 05:11          19197

              01/08/2011 06:11          19197

              01/08/2011 07:11          19198

              01/08/2011 08:11          19197

              01/08/2011 09:11          19197

              02/08/2011 00:11          19233

              02/08/2011 01:11          19233

               

              Any further hints greatly appreciated!