Chart Group by

Hi there,
I want to present data in Graph by showing how many items exist from each category.
For example, there are 5 coffee type, 10 alcohol type, 3 energy drink type.
Data is saved in a database and each product belongs to a category. I want to display how many products of each category. Tried with repeat etc but with no success.

Thank you!

yep i have tried and asked here before
you must to make a view in mysql

There is also group by formatter - it might help

You need to server action query similar to this

select count(groupname), groupname from products inner join products.groupid = groups.groupid group by groupname

It is similar to this video on charting data but you need a join in the query to link the products data table and the group table

1 Like

Where can I find this group by formatter? It isn’t on server side as far as I know.

On the client side I can see lots of formatters (like trim, sub, split), just not the group by formatter.

Select your data query as below

Click the magic wand

image

Right click your connection and “Where” appears in the Conditional Menu Item and “Group by” in the collections.

image

1 Like

Hi all, I am trying to create a line graph as per the image attached. In the graph I need to group by one of the columns in each row of data. My SQL query works fine in Wappler and provides the correct result but the line graph just plots all my data together. I can’t seem to get the data to group so as to display multiple lines. I have tried to use the group by formatter as mentioned by Hyperbytes, but this returns a graph with NaN values. Anyone any ideas, am I just making a mistake somewhere?

Have you tried creating multiple data sets as below?

image

The GUI allows for up to 9 sets, not sure if you could manually edit more in

1 Like

Thanks for the reply. It really needs to be dynamically generated to be honest. Depending on which user is logged in there could be a different number of lines required. Is this a limitation of the line graph do you know?

Certainly the component has limitation but without more info I can’t really comment further. I suspect the answer lies in generating custom data-sets via the query rather than customising the component to the data but on the basis of a picture of a chart it’s hard to be specific on anything