Skip to content

A NULL first-dimension value is still dropped by the multi-dimension pivot branch of buildChartSeries (the sibling of #4466) #4497

Description

@yinlianghui

What

#4466 fixed the single-dimension branch of packages/core/src/utils/chart-series.ts: a row whose category value is null is now mapped to an explicit bucket label so the group renders instead of vanishing. The 2+ dimensions, single measure pivot branch, ten lines above it, still has the original shape and was deliberately left out of that card's ruled scope.

Mechanism

The pivot branch buckets by String(xRaw ?? '') but writes the RAW value into the emitted row:

const xId = String(xRaw ?? '');
if (!byX.has(xId)) byX.set(xId, { [xKey]: xRaw });

So a null first-dimension value produces { status: null, Low: 3 }, which reaches recharts with a null category — the same input that drew zero marks in #4466. Pinned as current behaviour (not asserted as correct) in packages/core/src/utils/chart-series.nullCategory.test.ts, in the case "leaves the multi-dimension pivot branch exactly as it was", so any future change to it has to be deliberate.

The second dimension has a related but distinct question: gId is String(row[groupKey] ?? '') and a '' group is skipped entirely (if (gId !== '' ...)), so a null SERIES value is dropped from the series list while its measure column is still written onto the row under the '' key. Whether that should also become a bucket, or stay dropped, is a separate judgement from the x-axis one.

Why it was not fixed in #4466's PR

The card's ruling scoped the fix to the located cause (the single-dimension branch) and listed "multi-dimension branch unaffected" among its must-not-change controls. Applying the single-dimension answer to the pivot on the way past would have changed a branch nothing had measured, so it was pinned instead.

Suggested shape (not prescriptive)

NULL_CATEGORY_LABEL / ChartSeriesOptions.nullCategoryLabel already exist in @object-ui/core and both consumers already pass a localized label, so the x-axis half is likely small. It needs its own measurement first: the pivot's xId map key and the emitted row value are two different things today, and the drill-through inverse (findChartSeriesRow's multi-dimension arm) has to move with whatever is decided.

Found while implementing #4466; filed unassigned rather than fixed, per that card's surface.


Generated by Claude Code

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions