Skip to content
This repository was archived by the owner on Nov 4, 2026. It is now read-only.
This repository was archived by the owner on Nov 4, 2026. It is now read-only.

Dataset chart: visualise the second dimension as grouped series (multi-dim charts) #1759

Closed

Description

@os-zhuang

Problem

Dataset-bound chart rendering (introduced in #1757 / objectstack-ai/objectstack#1890) only honours the first dimension. When a chart's dataset selects two dimensions (e.g. dimensions: ['status', 'priority']), queryDataset correctly returns the full status × priority grouping, but the renderer maps xAxisKey = dimensions[0] and series = values, so:

  • the X axis repeats the first-dimension label once per second-dimension bucket (e.g. Backlog, Backlog, Done, Done, …), and
  • the second dimension is not visualised at all — no per-priority colour/group/legend.

The data is all there; the second dimension is just invisible. This is a pre-existing limitation of the dashboard DatasetWidget that the chart-view renderer (ObjectChart) inherited.

Proposed fix

When dimensions.length >= 2 (and a single measure), pivot the long-format result into wide-format and derive one series per second-dimension value:

  • xAxisKey = dimensions[0]
  • series = distinct values of dimensions[1] (one coloured/grouped bar series each)
  • cell value = values[0]

Apply consistently in both ObjectChart (plugin-charts) and DatasetWidget (plugin-dashboard) — ideally via a shared buildChartSeries(rows, dimensions, values, fields) helper so numbers/labels stay identical across surfaces.

Edge cases to define: 2 dims + N measures (ambiguous — fall back to measures-as-series on dim0), >2 dims (use first two), missing second-dim buckets (zero-fill).

Verification

showcase Task → "Hours by Status (Chart)" (dimensions: ['status','priority']) should render grouped/coloured bars by priority with a priority legend.

Refs objectstack-ai/objectstack#1890, #1757

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions