Hi,
In Mendix Charts (Line / Bar / Pie widgets) there is no built-in setting to automatically show missing categories with value 0. The chart only renders data that exists in the dataset returned to the widget. So if August or October does not exist in the returned list, the chart simply skips those months.
Because of that, the correct solution is not a chart setting, but preparing the dataset before sending it to the chart so that all months exist with value 0 when no data is found.
Below is the standard approach most Mendix developers use.
Example entity:
ChartMonthlyData
Attributes:
Month (String or Enum)Year (Integer)Count (Integer)This entity will be used to build the dataset sent to the chart.
Example microflow:
MF_GetMonthlyChartData
Steps:
Step 1 – Create a list containing all 12 months
Loop from 1 → 12 and create objects like:
Month | Count |
Jan | 0 |
Feb | 0 |
Mar | 0 |
... | ... |
Dec | 0 |
So initially all months already exist with Count = 0.
Step 2 – Retrieve actual data
Retrieve your real data from database.
Example:
SELECT Month, COUNT(User) GROUP BY Month
Or retrieve entity records filtered by the selected Year.
Step 3 – Update the month values
Loop through the real data and update the matching month object.
Example logic:
For each RetrievedRecord
Find MonthObject in MonthlyList
ChangeObject:
Count = RetrievedRecord.Count
Now months without data will remain 0, and months with data will have their correct count.
Set the chart Data source = Microflow
Use the list returned by MF_GetMonthlyChartData.
Configure:
Category (X-axis) → Month
Value (Y-axis) → Count
Even if the database contains:
June = 2 July = 1 Sep = 3 Nov = 1
The dataset sent to the chart will be:
Jan 0 Feb 0 Mar 0 Apr 0 May 0 Jun 2 Jul 1 Aug 0 Sep 3 Oct 0 Nov 1 Dec 0
So the chart always shows all months, and missing months automatically display 0.
This behavior is expected because Mendix Charts simply visualize the dataset they receive. They do not generate missing categories automatically.
So the correct Mendix approach is to prepare the data in a microflow before sending it to the chart.
If you want, I can also show you a clean microflow structure used in production Mendix apps for monthly charts (very optimized for performance).