SmartChart

Content Type: Widget
Categories: Visualization,Data

Overview

SmartChart eliminates the gap between your Mendix data and a meaningful chart. Instead of writing OQL queries, creating non-persistable entities, and building aggregation microflows, you drop SmartChart on a page, point it at any data source, pick two attributes — and it handles the rest automatically.

What it does

SmartChart runs a full GROUP BY aggregation engine in the browser, directly on the object list Mendix already delivers to every widget. It groups rows by any category attribute, applies your chosen aggregation function (Sum, Count, Average, Min, Max, or Count Distinct), sorts and filters the results, and renders an interactive chart — all without a single line of OQL or Java.

It also recommends the best chart type for your data automatically. Time-series data becomes a Line chart. A handful of categories becomes a Pie. One aggregated total becomes a large KPI Card. Everything else becomes a Bar. You can override the recommendation at any time.

Key capabilities

  • OQL replacement — GROUP BY, SUM, COUNT, AVG, MIN, MAX, COUNT DISTINCT, TopN, and ORDER BY, all configured through dropdowns. No query editor, no non-persistable entity, no microflow.
  • Date binning — group DateTime attributes by Day, ISO Week, Month, Quarter, Year, or Day of Week. Equivalent to OQL MONTH() / YEAR() / QUARTER(), normalised across all database vendors.
  • Pivot series — turn a second categorical attribute into coloured series dynamically. One bar per Product inside each Region cluster, one line per Department across months — the OQL PIVOT that doesn't exist in OQL.
  • Additional series — plot multiple numeric measures side by side on the same chart (e.g. Revenue and Units Sold per Region).
  • Association traversal — any attribute picker accepts a Mendix association path. Use SalesData_Product / Product / Product.Name as a pivot dimension without any extra retrieval.
  • Stacked mode — stack bar or area series for part-of-whole composition views.
  • KPI Card — auto-selected or forced, displays a single aggregated metric as a large formatted number with K/M abbreviations. Perfect for dashboard summary tiles.

Typical use cases

  • Sales dashboards — revenue by region, product, or sales rep; trend over time; top 10 customers
  • HR reporting — headcount by department, leave requests by month, turnover rate by quarter
  • Operations — order volume by status, average fulfilment time by warehouse, defect count by category
  • Finance — expense breakdown by cost centre, monthly budget vs actuals, year-over-year comparison
  • Any situation where you previously reached for OQL + a custom microflow just to draw a bar chart

How it connects to Mendix

SmartChart uses the standard Mendix Pluggable Widget API. It receives a typed ListValue from the runtime — the same object list any DataGrid or other widget receives. Mendix enforces all entity access rules and XPath constraints before the data reaches the widget. SmartChart never bypasses security and requires no additional server configuration.

 

Documentation

SmartChart

Mendix Pluggable Widget

Technical Reference• Configuration Guide •Demo Playbook

 

Version

1.0.0

Date

April 2026

Platform

Mendix 10.x

 

SmartChart is a zero-configuration data visualisation widget for Mendix. It replaces the need for OQL queries, custom microflows, or third-party chart libraries by performing GROUP BY aggregation, date binning, pivot series, and intelligent chart-type recommendation — all in the browser, directly from any Mendix data source.

 

 

1.How SmartChart Connects to Mendix

 

1.1  The Mendix Pluggable Widget Contract

Mendix pluggable widgets are React components that receive typed props injected by the Mendix Client runtime. SmartChart declares its data contract in SmartChart.xml, which Studio Pro compiles into strongly-typed TypeScript definitions (SmartChartProps.d.ts). No manual HTTP calls, no REST APIs, no custom Java actions are required.

 

Key principle: SmartChart never fetches data itself. Mendix fetches it; SmartChart receives it as a ready-made list of objects with resolved attribute values.

 

1.2  Data Flow — Step by Step

 

#

Layer

What happens

1

Studio Pro

Developer drops SmartChart on a page, selects a data source (XPath / association / microflow), and maps attribute pickers.

2

Mendix Runtime (Java)

On page load the runtime evaluates the XPath or microflow, applies security constraints, and serialises the resulting object list to JSON.

3

Mendix Client (JS)

The client deserialises the JSON into ListValue / ListAttributeValue objects and injects them into the widget as React props.

4

SmartChart (React)

The widget reads props.dataSource.items (an ObjectItem[]), calls attr.get(item).value per row, runs the aggregation engine, and renders with Apache ECharts.

5

Browser

ECharts draws the interactive SVG/Canvas chart. Tooltips, zoom, and legend toggle work without any round-trips to the server.

 

1.3  Key Mendix API Types Used

 

Type

Package

Role in SmartChart

ListValue

mendix/components

Represents the data source result — exposes .items (ObjectItem[]) and .status (loading | available | unavailable).

ListAttributeValue<T>

mendix/components

Typed accessor for a single attribute column. Call .get(item) to get a DynamicValue<T> containing .value and .status.

ObjectItem

mendix/components

An opaque reference to one row in the list. Passed to attribute accessors to read values.

DynamicValue<T>

mendix/components

The result of attr.get(item). Has .value (T | undefined) and .status ("loading" | "available" | "unavailable").

Big

big.js

Mendix Decimal / Long / Integer attributes come as Big instances. SmartChart converts with Number(String(big)).

 

1.4  Association / Reference Traversal

SmartChart's attribute pickers declare <associationTypes> in the widget XML, which tells Studio Pro to allow association-path expressions like:

 

MyFirstModule.SalesData_Product / MyFirstModule.Product / MyFirstModule.Product.Name

 

Mendix resolves the join server-side and delivers the associated attribute value pre-fetched on each ObjectItem — the widget calls .get(item).value and receives the Product Name string directly, with no extra retrieval needed.

 

Important: Association traversal requires that your data source actually loads the linked object. If the SalesData row has no Product set, the value will be null, and SmartChart will bin it into an "(empty)" series bucket. Always verify your data linkage before debugging the widget.

 

1.5  Security

SmartChart receives only the data Mendix decides to send. All entity-access rules, XPath constraints, and row-level security are enforced by the Mendix runtime before the object list reaches the widget. The widget cannot bypass or escalate beyond what the current user session is authorised to see.

 

 

2.How SmartChart Replaces OQL

 

2.1  Why OQL Exists — and Why It Is Hard

Mendix OQL (Object Query Language) lets developers write SQL-like queries to aggregate data — SUM, COUNT, GROUP BY, HAVING, JOIN. It is powerful but has friction:

 

  • Needs a non-persistable entity: you must create a separate entity to hold the query results.
  • Needs a Java action or microflow: to execute the OQL and map results to the NP entity.
  • No live interactivity: filters require wiring up microflow parameters and re-querying.
  • Pivot tables require custom code: OQL has no PIVOT operator; developers must write loops.
  • Date truncation functions vary: MONTH(), YEAR(), QUARTER() syntax differs across DB vendors.

 

SmartChart moves all of this to the client side, using the same data source Mendix already provides to every widget.

 

2.2  OQL Equivalency Table

 

OQL / SQL concept

SmartChart equivalent

Where to configure

SELECT AGG(measure) FROM entity

Primary measure (Y-axis) + Aggregation function

Data tab

GROUP BY category

Category (X-axis / group-by)

Data tab

SUM / COUNT / AVG MIN / MAX

Aggregation function dropdown

Data tab

COUNT(DISTINCT col)

"Count distinct values"

Data tab

SELECT s1, s2, s3 ...

Additional series list

Data tab

PIVOT col INTO series

Pivot series by (optional)

Data tab

MONTH(date_col) YEAR(date_col) QUARTER(date_col)

Date grouping dropdown

Data tab

ORDER BY total DESC

Sort by value (descending)

Filtering & Sorting tab

FETCH FIRST N ROWS

Top N results

Filtering & Sorting tab

JOIN entity ON assoc

Association path in attribute picker

Any attribute field

 

2.3  The Aggregation Engine

The aggregator (src/utils/aggregator.ts) runs entirely in the browser after Mendix delivers the object list. Its pipeline is:

 

  1. Iterate items: read each row's categoryAttr and bin into a category key (with optional date truncation via binDate()).
  2. Collect buckets: for each (category, series) cell, accumulate raw numeric values in an array.
  3. Apply aggregation: call applyAgg(values[], fn) — SUM / COUNT / AVG / MIN / MAX / COUNT DISTINCT.
  4. Sort: chronological for dates, DOW order for day-of-week, total-descending for sortByValue.
  5. TopN: slice categories to the first N after sorting.
  6. Return AggregatedResult: { categories[], series[{ name, values[] }], isDateCategory, rawCount }.

 

Performance note: The engine is O(n) in the number of rows. For typical Mendix datasets (< 10,000 rows) it runs in under 5 ms. For very large datasets, apply XPath constraints on the data source to pre-filter server-side before the widget receives items.

 

2.4  Pivot Mode

When "Pivot series by" is set, the engine switches from STANDARD to PIVOT mode. Instead of using fixed measure attributes as series, it dynamically discovers all unique values of the pivot attribute and creates one series per value:

 

SELECT Region, Product.Name, SUM(Revenue)

FROM SalesData

GROUP BY Region, Product.Name

→ Pivot Product.Name into columns

 

This is equivalent to a SQL PIVOT or a spreadsheet PivotTable. Each unique Product Name becomes one coloured bar or line in the chart.

 

 

3.Configuration Reference

 

3.1  Data Tab — All Properties

 

Property

Required

Default

Description

Data source

Yes

Entity list — XPath, association, or microflow return.

Category (X-axis / group-by)

Yes

Attribute to group rows by. Accepts String, Enum, DateTime, Integer, Long. Supports association paths.

Date grouping

No

None

When category is DateTime: None / Day / ISO Week / Month / Quarter / Year / Day of Week.

Primary measure (Y-axis)

Yes

Numeric attribute to aggregate. Accepts Integer, Long, Decimal. Supports association paths.

Primary measure label

No

"Value"

Legend / tooltip label for the primary series.

Aggregation function

No

Auto (Sum)

Sum / Count / Average / Min / Max / Count distinct. Auto = Sum.

Pivot series by

No

(none)

Dynamically creates one series per unique value of this attribute. Mutually exclusive with Additional series. Supports association paths.

Additional series

No

(none)

List of extra numeric attributes to plot as separate series alongside the primary. Ignored when Pivot is set.

 

3.2  Filtering & Sorting Tab

 

Property

Type

Default

Description

Top N results

Integer

0 (all)

After aggregation, keep only the top N categories ranked by total value. Set 0 to show all.

Sort by value (descending)

Boolean

false

Reorder categories so the highest-value group appears first (like ORDER BY total DESC).

 

3.3  Appearance Tab

 

Property

Type

Default

Description

Chart type

Enum

Auto

Auto / Bar / Line / Pie-Donut / KPI Card. Auto uses the built-in recommender logic (see Section 4).

Stacked series

Boolean

false

Stack bar or area series instead of side-by-side. Works for Bar and Line chart types.

Title

String

(none)

Optional heading displayed above the chart.

Height (px)

Integer

400

Fixed pixel height for the chart container.

Show legend

Boolean

true

Display the ECharts legend below the chart.

 

3.4  Auto Chart-Type Recommender

When Chart type = Auto, the recommender (src/utils/chartRecommender.ts) inspects the aggregated result and picks the best visualisation:

 

Condition (checked in order)

Chart selected

Rationale

0 categories returned

Bar

Safe empty-state default.

Multiple series AND date axis

Line

Time-series with multiple trends.

Multiple series AND non-date axis

Bar

Grouped comparison.

1 category, 1 series

KPI Card

Single number is most readable as a large metric.

Date axis, 1 series

Line

Time-series trend.

6 or fewer categories, 1 series

Pie / Donut

Part-of-whole relationship with few slices.

Everything else

Bar

Default — works at any cardinality.

 

Override at any time: Set Chart type to Bar, Line, Pie/Donut, or KPI Card to lock the type regardless of data shape. The recommender only runs when Chart type = Auto.

 

 

4.Demo Playbook

 

The following scenarios demonstrate SmartChart's key capabilities in a live Mendix environment. Each builds on the same SalesData → Product domain model used in development.

 

4.1  Pre-Requisites

 

  • Domain model: Entity SalesData { Region (String), Revenue (Decimal) } with a *–1 reference SalesData_Product to Product { Name (String), QTY (Integer) }.
  • Sample data: At least 5–6 SalesData rows across 3 regions, each linked to a Product (use a Reference Selector on the edit form to set the link).
  • Data grid: Optional — a DataGrid 2 on the same page showing Region, Revenue, Product/Name helps confirm the data before the chart renders.
  • SmartChart widget: deployed and visible in the Studio Pro toolbox under Visualization.

 

4.2  Demo 1 — Revenue by Region (Bar)

Goal: show how SmartChart replaces a manual OQL GROUP BY in 30 seconds.

 

  1. Data source: SalesData, by Database (XPath — no constraint).
  2. Category: SalesData.Region (String).
  3. Primary measure: SalesData.Revenue (Decimal).
  4. Aggregation: Sum.
  5. Chart type: Auto (will auto-select Bar).

 

Expected result: a bar chart with one bar per region, height = sum of Revenue. Say: "This is the equivalent of SELECT Region, SUM(Revenue) FROM SalesData GROUP BY Region — without writing a single line of OQL or creating a non-persistable entity."

 

4.3  Demo 2 — Top 3 Regions (TopN + Sort)

Goal: demonstrate ORDER BY + FETCH FIRST without microflows.

 

Starting from Demo 1, open the widget configuration:

  1. Sort by value: Enable (Sort by value descending = Yes).
  2. Top N: Set to 3.
  3. Save and run. The chart now shows only the 3 highest-revenue regions, highest first.

 

Say: "OQL equivalent: ORDER BY SUM(Revenue) DESC FETCH FIRST 3 ROWS ONLY — configured in two clicks."

 

4.4  Demo 3 — Revenue by Product per Region (Pivot)

Goal: show OQL-style two-dimension pivot without any query.

 

  1. Reset Top N to 0 and Sort by value to No.
  2. Pivot series by: Select SalesData_Product / Product / Product.Name.
  3. Chart type: Bar (or Auto — recommender will choose Bar for multi-series).
  4. Stacked series: Try both off (grouped) and on (stacked).

 

Expected result: clustered bars — one cluster per Region on the X-axis, one coloured bar per Product inside each cluster. Say: "This is PIVOT Product.Name INTO series — something OQL cannot do natively at all."

 

Data tip: for an impressive pivot, ensure at least 2 different products appear in the same region. With only one product per region, the pivot still works but produces one bar per cluster — visually identical to a simple bar chart.

 

4.5  Demo 4 — Monthly Revenue Trend (Date Binning + Line)

Goal: show MONTH() / YEAR() date truncation that varies across OQL database vendors.

 

Add a SaleDate (DateTime) attribute to SalesData and populate a year's worth of rows, then:

  1. Category: SalesData.SaleDate.
  2. Date grouping: Month.
  3. Aggregation: Sum.
  4. Chart type: Auto (recommender picks Line for date axis).

 

Expected result: a smooth line chart with X-axis labels YYYY-MM, plotted in chronological order. Switch Date grouping to Quarter or Year to collapse the bins. Say: "This replaces OQL MONTH() / YEAR() / QUARTER() — which behave differently on PostgreSQL, HSQLDB, and SQL Server. SmartChart normalises it all client-side."

 

4.6  Demo 5 — KPI Card (Single Metric)

Goal: show auto-KPI for an executive summary number.

 

  1. Data source: SalesData.
  2. Category: Region — but add an XPath constraint [Region = 'North'].
  3. Aggregation: Sum. Chart type: Auto.

 

Expected result: a large formatted KPI number (e.g. "100" or "1.2K"). The recommender detects 1 category → 1 number → KPI Card. Say: "Perfect for dashboard summary tiles — no separate widget needed."

 

4.7  Demo 6 — Additional Series (Multi-Measure Bar)

Goal: show multiple measure attributes side-by-side (no pivot — fixed series).

 

  1. Data source: SalesData.
  2. Category: Region.
  3. Primary measure: Revenue. Label: "Revenue".
  4. Additional series: Add one entry — Measure = SalesData_Product/Product.QTY, Label = "Units Sold".
  5. Chart type: Bar.

 

Expected result: two bars per region — one for Revenue, one for Units Sold. Say: "Two SELECT columns in one chart — SELECT Region, SUM(Revenue), SUM(QTY) FROM ... GROUP BY Region."

 

 

5.Technical Deep Dive

 

5.1  File Structure

 

File

Purpose

src/SmartChart.xml

Widget contract — property declarations, types, data source references. Studio Pro reads this to build the configuration panel.

typings/SmartChartProps.d.ts

Auto-generated TypeScript types derived from the XML. Never edit manually — regenerated on build.

src/SmartChart.tsx

Entry point React component. Reads props, guards loading/unavailable states, calls aggregator, resolves chart type, renders ChartRenderer.

src/utils/aggregator.ts

The OQL-equivalent engine. GROUP BY, date binning, pivot, aggregation, sort, TopN — all pure functions with no side effects.

src/utils/chartRecommender.ts

Pure function that maps an AggregatedResult to a ChartType (bar/line/pie/kpi) using data-shape heuristics.

src/components/ChartRenderer.tsx

Renders the ECharts instance. Handles multi-series, stacked mode, KPI card formatting, legend, title.

src/SmartChart.editorConfig.ts

Studio Pro design-time validation. Flags mutually exclusive settings (e.g. Pivot + Additional series).

src/ui/SmartChart.css

Scoped CSS for loading/empty states and KPI card typography.

 

5.2  SmartChart.xml — Key Declarations

Three XML patterns are essential for Mendix pluggable widget attribute pickers:

 

Association traversal

Adding <associationTypes> allows the attribute picker to accept paths that cross a reference:

 

<property key="seriesByAttr" type="attribute" dataSource="dataSource" required="false">

<caption>Pivot series by (optional)</caption>

<description>...</description>

<attributeTypes>

<attributeType name="String"/>

<attributeType name="Enum"/>

</attributeTypes>

<associationTypes>

<associationType name="Reference"/>

</associationTypes>

</property>

 

Nested object list (Additional series)

Properties inside an isList="true" object block must be wrapped in a <propertyGroup> and must reference the parent data source with ../dataSource:

 

<property key="series" type="object" isList="true" required="false">

<caption>Additional series</caption>

<description>...</description>

<properties>

<propertyGroup caption="Series">

<property key="measureAttr" type="attribute"

dataSource="../dataSource" required="true">

...

</property>

</propertyGroup>

</properties>

</property>

 

XSD element order

Studio Pro validates against custom_widget.xsd which requires this order inside <property>: caption → category (optional) → description → attributeTypes → associationTypes → properties. Violating the order produces "invalid child element" XSD errors.

 

5.3  Aggregator Type Signatures

 

export type AggregateFunction =

"auto" | "sum" | "count" | "avg" | "min" | "max" | "countDistinct";

 

export type DateGrouping =

"none" | "day" | "week" | "month" | "quarter" | "year" | "dayOfWeek";

 

export interface AggregatedResult {

categories: string[]; // X-axis labels

series: SeriesData[]; // one per measure / pivot value

isDateCategory: boolean; // true when category is DateTime

rawCount: number; // total rows processed

}

 

export function aggregateData(

items: ObjectItem[],

categoryAttr: ListAttributeValue<string | Date | Big>,

primaryMeasure:ListAttributeValue<Big>,

primaryLabel: string,

extraSeries: ExtraSeries[],

aggFn: AggregateFunction,

topN: number,

sortByValue: boolean,

dateGrouping: DateGrouping,

seriesByAttr?: ListAttributeValue<string | Big | boolean>

): AggregatedResult

 

5.4  Rendering — Apache ECharts

ChartRenderer.tsx uses ECharts 5.x via the echarts npm package (tree-shaken — only the components needed are imported). The chart option object is rebuilt on every React render cycle — no imperative setOption diffing is needed because ECharts handles the transition animation automatically.

 

  • Stacked mode: each SeriesData entry includes stack: "total" when props.stacked = true.
  • KPI card: rendered as a plain <div> — ECharts is not used. The value is formatted with K / M abbreviations (formatKPI).
  • Colour palette: ECharts default — 10 colours cycling. Consistent across series because series order in the output array is deterministic (insertion order of first-seen pivot values).
  • Tooltip: axis-type tooltip on hover — shows all series values for the hovered category.

 

5.5  Known Constraints and Workarounds

 

Constraint

Workaround

Client-side aggregation — all rows fetched

Apply XPath constraints on the data source to pre-filter server-side. Use TopN to limit rendered categories.

No HAVING clause (post-aggregation filter)

Pre-filter with XPath, or set TopN which implicitly drops low-value groups after sorting.

Pivot + Additional series are mutually exclusive

Studio Pro shows a validation error if both are set simultaneously. Remove one before saving.

Association traversal requires data to be linked

If a row has no associated object, the pivot/category value resolves to null and is binned as "(empty)". Check your data linkage and edit forms.

ReferenceSet (*–*) not yet supported on pivot

The <associationTypes> declaration includes only Reference. ReferenceSet would produce multiple values per row — a future enhancement. Use a flat denormalised attribute for now.

Pie / Donut only works for single series

If multi-series data is forced to Pie, ChartRenderer falls back to Bar automatically.

 

 

6.Quick Reference Card

 

Tear off and keep on your desk during demos.

 

I want to...

Configure this

Sum / count all rows per category

Aggregation = Sum (or Count)

Average per group

Aggregation = Average

See only the biggest groups

Sort by value = Yes, Top N = 5

Group monthly / quarterly

Date grouping = Month / Quarter

Split bars by a second dimension

Pivot series by = <attribute>

Show two numeric columns side by side

Additional series — add entries

Stack bars into 100% view

Stacked series = Yes + Chart type = Bar

Force a line chart

Chart type = Line

Show one big KPI number

Chart type = KPI Card (or Auto with 1 group)

Traverse an association

Pick attribute path in any selector (e.g. Entity_Ref/Entity/Attr)

 

6.1  Troubleshooting

 

Symptom

Likely cause & fix

Pie chart when grouped bars expected

Pivot produced only 1 series (all rows same pivot value, or association not set). Check browser console for [SmartChart] warnings. Verify data linkage.

"(empty)" series appears

Some rows have no value for the pivot attribute (null association). Edit those rows and set the reference, or accept the empty grouping.

Green bar at zero height

Additional series attribute resolves to null for all rows (e.g. association not populated). Check data linkage.

XSD error in Studio Pro

Element order inside <property> is wrong. Required: caption → description → attributeTypes → associationTypes → properties.

"Property category cannot be empty" error

Nested series properties not wrapped in <propertyGroup caption="...">. Add the wrapper in SmartChart.xml.

"Invalid property path 'dataSource'" error

Nested attribute inside object list must use dataSource="../dataSource" (parent-relative path), not dataSource="dataSource".

No data / empty chart

Data source status is "unavailable" or items is empty. Check XPath constraint, entity access rules, and whether sample data exists.

 

 

SmartChart — OQL for Everyone

No queries. No NP entities. No custom Java actions. Just configure and visualise.

 

Releases

Version: 1.0.0
Framework Version: 11.6.0
Release Notes:

SmartChart — Mendix Pluggable Widget

 

**Auto-recommends the best chart type and aggregates data like OQL — no query writing, no non-persistable entities, no custom Java actions needed.**

 

 

 

## Overview

 

SmartChart is a zero-configuration data visualisation widget for Mendix . Drop it on any page, point it at a data source, pick two attributes — and it automatically groups your data, aggregates the values, chooses the right chart type, and renders an interactive chart powered by Apache ECharts.

 

It replaces the traditional OQL → NP entity → microflow → chart widget pipeline entirely.

 

| Traditional Mendix approach | SmartChart |

|---|---|

| Write OQL query | ✗ Not needed |

| Create non-persistable entity | ✗ Not needed |

| Build aggregation microflow | ✗ Not needed |

| Map results to chart widget | ✗ Not needed |

| **Drop widget, pick attributes** | ✅ That's it |

 

---

 

## Features

 

- **Auto chart recommendation** — picks Bar, Line, Pie/Donut, or KPI Card based on your data shape

- **Client-side GROUP BY** — groups rows by any String, Enum, DateTime, Integer, or Long attribute

- **6 aggregation functions** — Sum, Count, Average, Min, Max, Count Distinct

- **Date binning** — group DateTime values by Day, ISO Week, Month, Quarter, Year, or Day of Week

- **Pivot series** — turn a second categorical attribute into coloured series (the OQL PIVOT that doesn't exist in OQL)

- **Additional series** — plot multiple numeric measures side by side on the same chart

- **TopN + Sort** — ORDER BY total DESC + FETCH FIRST N rows, in two checkbox clicks

- **Association traversal** — use paths like `SalesData_Product/Product/Name` in any attribute picker

- **Stacked mode** — stack bar or area series instead of side-by-side

- **KPI Card** — large formatted metric for dashboard tiles (auto-selected or forced)

- **Interactive tooltips** — hover to see all series values per category

- **Zero dependencies on the server** — all aggregation runs in the browser; Mendix security is fully respected

 

---

 

## Supported Chart Types

 

| Type | When auto-selected | When to force |

|---|---|---|

| **Bar** | Multiple categories, multiple series | Comparisons at any scale |

| **Line** | DateTime category axis | Trend over time |

| **Pie / Donut** | ≤ 6 categories, single series | Part-of-whole proportions |

| **KPI Card** | Single aggregated value | Executive summary tiles |

 

---

 

## Installation

 

### From Mendix Marketplace

1. Open your project in Studio Pro.

2. Click the **Marketplace** icon (shopping bag) in the top bar.

3. Search for **SmartChart**.

4. Click **Download** — the widget appears in your toolbox under **Visualization**.

 

### Manual install

1. Copy `SmartChart.mpk` into your project's `widgets/` folder.

2. In Studio Pro: **F4** (or App → Synchronize App Directory).

3. The widget appears under **Visualization** in the toolbox.

 

---

 

## Quick Start

 

1. Drag **SmartChart** onto a page inside a DataView or directly on the page.

2. **Data source**: select your entity list (XPath, association, or microflow).

3. **Category (X-axis)**: pick the attribute to group rows by (e.g. `Region`).

4. **Primary measure (Y-axis)**: pick the numeric attribute to aggregate (e.g. `Revenue`).

5. Run the app — SmartChart does the rest.

 

---

 

## Configuration

 

### Data tab

 

| Property | Required | Default | Description |

|---|---|---|---|

| Data source | ✅ | — | Entity list — XPath, association, or microflow |

| Category (X-axis / group-by) | ✅ | — | Attribute to group rows by. Supports association paths. |

| Date grouping | | None | When category is DateTime: Day / ISO Week / Month / Quarter / Year / Day of Week |

| Primary measure (Y-axis) | ✅ | — | Numeric attribute to aggregate (Integer, Long, Decimal). Supports association paths. |

| Primary measure label | | "Value" | Legend / tooltip label for the primary series |

| Aggregation function | | Auto (Sum) | Sum / Count / Average / Min / Max / Count Distinct |

| Pivot series by | | (none) | Turn each unique value of this attribute into a separate coloured series. Supports association paths. |

| Additional series | | (none) | Extra numeric measures to plot alongside the primary series |

 

### Filtering & Sorting tab

 

| Property | Default | Description |

|---|---|---|

| Top N results | 0 (all) | Show only the N highest-value categories after aggregation |

| Sort by value (descending) | false | Order categories highest-first (like ORDER BY total DESC) |

 

### Appearance tab

 

| Property | Default | Description |

|---|---|---|

| Chart type | Auto | Auto / Bar / Line / Pie-Donut / KPI Card |

| Stacked series | false | Stack bars/areas instead of side-by-side |

| Title | (none) | Optional chart heading |

| Height (px) | 400 | Fixed pixel height of the chart |

| Show legend | true | Display the ECharts legend |

 

---

 

## OQL Equivalency

 

| OQL / SQL | SmartChart |

|---|---|

| `SELECT AGG(measure) FROM entity` | Primary measure + Aggregation function |

| `GROUP BY category` | Category (X-axis) |

| `SUM / COUNT / AVG / MIN / MAX` | Aggregation function dropdown |

| `COUNT(DISTINCT col)` | "Count distinct values" |

| `PIVOT col INTO series` | Pivot series by |

| `MONTH() / YEAR() / QUARTER()` | Date grouping |

| `ORDER BY total DESC` | Sort by value = Yes |

| `FETCH FIRST N ROWS` | Top N results |

| `JOIN entity ON association` | Association path in attribute picker |

 

---