Okay
  Public Ticket #3767913
Creating charts from a wpdatatables that gets data from gravity forms
Open

Comments

  • Fatlind started the conversation

    Hi,

    I need assistance in creating a wpDataChart to visualize how many times each radio button selection has been repeated across form entries in wpDataTables. I want to achieve the following:

    1. Group the entries by the radio button selection (e.g., "Milan", "Barcelona", etc.).
    2. Count the frequency of each unique radio button selection (e.g., how many times "Milan" appears, how many times "Barcelona" appears).
    3. Create a wpDataChart that accurately reflects this data, ideally in a bar chart or pie chart format, displaying the count of each selection.
    Example of the Data:

    Here is a sample of the data I have in the table:

    • Milan
    • Milan
    • Milan
    • Barcelona
    • Inter
    • Milan
    • Barcelona
    • ManUtd
    • ManUtd
    • Barcelona
    • Inter

    I would like to generate a table where each radio button selection (e.g., "Milan", "Barcelona", etc.) is grouped, and the count of how many times each selection appears is displayed next to it. For example:

    Milan ---- 4

    Barcelona ---- 3 

    Inter ---- 2 

    ManUtd ---- 2

    My Questions:
    • How can I group the entries by the radio button selection and count the frequency of each selection in wpDataTables?
    • Is there a way to create a wpDataChart that will use this grouped data to display the frequency of each selection?


  •  1,846
    Miloš replied

    Hello,

    Yes, i believe we have a useful example to show you of a similar use-case.

    This is an example where a user needed to make a Survey Form, and each user would have multiple choices,

    which gets saved by the Form,

    they wanted to make a summed up Chart that shows how many times each choice will repeat.

    -

    We solve this by adding a hidden number field to the Gravity Form,

    that will always have a predefined value of 1 to prepopulate every row of data and it will be used as a "counter" for how many times each choice will repeat.

    Here is my basic example,  i have a multi-select field in a Gravity Form, 

    and we add a hidden number field :

    1476878896.png

    Then I made a few choices by the visitors, on the page with the Form to populate some data.

    This is the linked table :

    8607598731.png

    Now, we will make a chart , and we enable "Chart Grouping" , so that all values that have the same value will group up to add up how many times they repeat  for the chart.

    Here is an example of a pie chart from the data,

    3833896169.png

    and here is an example with a Bar chart

    1645498782.png

    Let me know if that works for your use-case.

     Thank you

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables