How can we rearrange and summarize some data stored by Gravity Survey form before creating chart

Hi there,

I have a question. Suppose we have a survey of 3 questions and every question has the option (i) Strongly Agree, (ii) Agree, (iii) Neutral, (iv) Disagree and (v) Strongly Disagree.

There are 9 users attends the survey from the 3 countries. They are from the USA, UK, and Australia.

Table 1

Country Question 1 Question 2 Question 3
USA Strongly Agree Neutral Strongly Disagree
Australia Disagree Agree Strongly Agree
UK Agree Neutral Disagree
USA Strongly Agree Neutral Strongly Disagree
UK Disagree Agree Strongly Agree
USA Agree Neutral Disagree
Australia Strongly Agree Neutral Strongly Disagree
UK Disagree Agree Strongly Agree
Australia Agree Neutral Disagree

Here you can see from the above Table 1 that the selection of total (i) Strongly Agree, (ii) Agree, (iii) Neutral, (iv) Disagree and (v) Strongly Disagree from the 3 countries are like the bellow.

Table 2

Country Strongly Agree Agree Neutral Disagree Strongly Disagree
USA 3 1 3 2 2
Australia 2 2 3 2 2
UK 2 3 1 3 0

The above calculation of table 2 needs to do manually. How can I get this automatically from Table 1 and how can I show this by pie or bar charts?

When user input from form normally we get those data like table 1 and after that, it needs to change automatically like table 2 and need to show a chart from table 2. Now we make a table to table 2 by excel by some manual calculation. The calculations from table one to table 2 are hidden, no need to show table 2 anywhere.

We need to show a chart presentation from a gravity survey form. To show the chart we try by two WordPress plugins Maxicharts and GFCharts. They are calculated directly from data stored within Gravity Forms. When Gravity Forms creates a CSV file that has the same source.

The chart that creates directly from gravity store data that is not required. Before creating this chart the source table needs some change. We need to summarize some data and filtering some data before showing a chart like the above table 1 to table 2.
To edit the data stored with Gravity Forms using code we can use the Gravity Forms API. This has extensive documentation: https://docs.gravityforms.com/api-functions/. We can use the gform_save_field_value filter in the theme functions.php file or a custom functions plugin to change the value just before it is saved to the database. See the following page of the documentation for usage examples: https://docs.gravityforms.com/gform_save_field_value/.

So please tell how can we make the calculation from table 1 to table 2 automatically after submitting an entry from the user and get a pie or bar chart from table 2?

Hey there, I’d be happy to look into getting things working. I’m familiar with GFCharts and thoroughly know the Gravity Forms API. Although, I’m not convinced that altering the data when saving is the way to go. I believe the data should, ideally, be changed at the presentation level instead. Can you mail me at gennady[at]kovshenin[dot]com so we can discuss? Thanks.

1 Like