Turn Rows Into Groups: Materialized Aggregation Arrives in CanvasXpress

If you've ever worked in Tableau, you know the move: drag a dimension onto Rows, drop a measure onto the sheet, and watch your data collapse into one row per group — each measure automatically summed, averaged, or reduced however you choose. It's one of the most-used data-prep gestures in analytics, and until now CanvasXpress users had to reach for external tooling to get that exact result before visualizing it.

That gap is closed. CanvasXpress now ships Flexible Aggregation — a true group-by reshape that collapses your dataset's samples into group keys, reduces every variable with a function you control, and hands the result back as an ordinary dataset ready for any chart type, filter, or calculated field you already use.

What makes this different from summarization you already had

CanvasXpress has long supported summaryType and groupingFactors, which draw grouped bar or box-plot summaries at render time using one global statistic. That's great for a quick visual rollup, but it has two limits: the underlying matrix never actually changes, and every variable is squeezed through the same function.

Materialized Aggregation solves both problems:

Render-time summaryType Materialized Aggregation
Output Visual only — matrix unchanged A genuinely new, smaller dataset
Function One global statistic Per-variable function, with a default
Downstream use Chart-specific Works with filters, calc fields, saved selections, any graph type
Persistence Config-driven Serialized, reproducible, restorable

In other words: this isn't a chart option, it's a data transformation. Once applied, the group keys are your samples — everything else in CanvasXpress treats the aggregated data exactly like data you loaded from a file.

How it works

Open the Data menu on any chart and choose Aggregate…. The dialog walks you through three decisions:

  1. Group by — pick one or more sample annotations to group on. Categorical annotations are surfaced first, since they make the most natural group keys (cohort, treatment arm, region, and so on).
  2. Default function — choose the statistic applied to every variable unless overridden: mean, median, sum, min, max, count, standard deviation, or "first."
  3. Per-measure overrides — expand the variable list to assign a different function to any individual variable. Want sum for revenue but mean for satisfaction score in the same aggregation? That's exactly what the overrides panel is for.

As you adjust these settings, the dialog gives you a live preview: how many groups the result will contain, a sample of the new group labels, and — importantly — a note about any sample annotations that can't survive the collapse. Non-grouping annotations are kept only when their value is constant within every group; otherwise they're dropped, and the dialog tells you so before you commit. Group counts, variables, and annotations don't lie to you after the fact.

Click Apply, and the chart re-renders against the new, smaller matrix.

It behaves like real data — because it is

Once aggregated, the resulting dataset flows into everything downstream exactly like a freshly loaded file:

This composability is deliberate: aggregation is designed to be the last step in a data-prep chain. If you've already built calculated fields or applied binning, aggregation reduces those derived columns too, so your group-level summaries reflect the full pipeline, not just the raw import.

Fully reproducible, fully persistent

A common frustration with in-tool data reshaping is losing it the moment you reload. Materialized Aggregation is designed against that failure mode:

If you change your mind, the dialog's Remove button restores the original, un-collapsed dataset — including any calculated fields you had defined — rather than trying to "un-average" numbers that can't be reversed.

A quick look at the round trip

The aggregation itself is driven entirely from the Data menu dialog, but once applied, standard CanvasXpress calls work with the result the same way they always have:

var cx = new CanvasXpress("chartCanvas", data, config);

// After applying an aggregation via the Data menu's "Aggregate…" dialog:
var currentConfig = cx.getConfig();   // reflects the active aggregation
cx.setDimensions(800, 500);           // resize as usual — grouped data, same API

Nothing about the surrounding workflow changes. That's the point: aggregation is a data-shape decision, not a new rendering mode, so every API call, export, and interaction you already rely on keeps working unmodified.

Why this matters

Group-by-and-reduce is one of the most fundamental moves in exploratory analysis, and it's historically meant leaving your visualization tool to do prep work in a spreadsheet or notebook before coming back to plot the result. With Materialized Aggregation, that round trip disappears. You can go from raw samples to grouped, per-measure summaries — sum here, median there — without leaving the chart, and the result stays fully plottable, filterable, and reproducible for as long as you need it.

Give it a try from the Data menu the next time you catch yourself wishing your rows would just collapse into groups. They finally can.