Help with piechart

Hi Adalo Community,

I’m building a nutrition dashboard and I’m running into an issue with the Pie Chart component.

Goal
Show a pie chart with 3 slices (Protein / Carbs / Fat) for the last 30 days, based on the user’s logged entries.

My current data structure
Collection: Voeding – Macros

  • Date (Datum)

  • Macro name (Macro – naam) e.g., “Eiwitten”, “Koolhydraten”, “Vetten”

  • Macro value (Macro – waarde) (Number)

  • User (relationship) / Created By (logged in user)

Each day I store 3 records (one per macro), so over 7 days there are ~21 records.

Issue
The Pie Chart treats each record as a separate slice, so I get duplicate labels (e.g., “Koolhydraten” appears multiple times). There is no built-in way to group by label and sum values inside the chart. I also sometimes see “Other” when a label is empty.

What I’ve tried

  • Filtering to Logged In User (works, but doesn’t solve duplicates)

  • Date filter (last 7 days) (works, but still duplicates)

  • Slice Label = Macro – naam, Slice Value = Macro – waarde

Questions

  1. Is there any supported way to make the Pie Chart aggregate records with the same label (group-by + sum)?

  2. If not, what’s the recommended Adalo-only workaround (without external tools like Make/Xano)?

    • Is the recommended approach to create a small “summary” collection (3 rows per user) and update those totals on screen load?
  3. Any best practices to avoid the “Other” category (I assume it’s caused by null/empty labels)?

Aloha Roelt,

It sounds like the Adalo Pie Chart component is visualizing your raw records rather than performing “Group By” or “Sum” aggregations. To get that clean 3-slice chart, you need a data structure that mirrors exactly what you want to see: one row per macro type.

I know you mentioned wanting to avoid external tools, but I find that using a “middleware” approach often saves hours of headache. However, I’ve included a native Adalo workaround as well.

1. The “Middleware” Approach (Fastest & Most Scalable)

You can use n8n (which takes about 2 minutes to spin up on Railway using a template) to act as your data aggregator.

  • The Flow: When the user views the dashboard, trigger an n8n workflow via an Adalo Custom Action.

  • The Logic: n8n pulls the last 30 days of records from Adalo, sums them by “Macro Name,” and then:

    • Option A: Updates a specific “Summary” collection in Adalo (3 rows per user) that the chart is linked to.

    • Option B: Sends the data to an external serverless function (like a Chart.js wrapper) and displays the chart via a Web Portal component.

2. The “Summary Collection” (Native Adalo Workaround)

If you want to stay strictly inside Adalo, you’ll need to “pre-calculate” the totals to avoid database bloat:

  • Step 1: Create a MacroSummary collection with properties: User, MacroName, and TotalValue.

  • Step 2: Every time a user adds a new nutrition log, add a second action to that submit button. This action should update the corresponding record in the MacroSummary collection (e.g., Current Summary > TotalValue + New Value).

  • Step 3: Point your Pie Chart to this MacroSummary collection instead of the raw logs. This ensures the chart only ever sees 3 records per user.

Let me know if that is helpful or if you’d like to see how I’ve structured my own external integrations for similar projects! -Michael

1 Like

Thank you for your help. This helped a lot!

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.