Skip to content

A chart builder over the dimensions the engine already supports #182

Closed as not planned

Description

@imshashank

The chart engine supports ten x-axis dimensions and can segment any of them by any other. The analytics page hardcodes five combinations of that and hides the rest.

From packages/core/src/analytics/schemas.ts:

export const CHART_DIMENSIONS = [
  'state', 'state_group', 'assignee', 'project', 'label',
  'priority', 'estimate', 'cycle', 'created_month', 'completed_month',
] as const;

buildChart takes an xAxis and an optional segment and pivots correctly for any pair. That is up to a hundred charts. The page ships four distributions and one breakdown, all fixed at build time.

So nobody can ask "issues by priority, stacked by state", or "completed per month by team", even though the SQL to answer both already runs in production.

What to build

A chart builder on the analytics page, or on a tab of it:

  • Pick an x axis from the ten dimensions.
  • Optionally pick a segment to stack by.
  • Pick a measure, issues or points.
  • Inherit the page scope and date range from the header controls.
  • Render as bars, stacked bars, or a table.
  • Save it. saved_analytics_view and the savedAnalyticsView* schemas and functions in packages/core/src/analytics/saved-view.ts already exist and are already wired to /api/analytics/views. SavedViewBar in apps/web/src/features/analytics/saved-view-bar.tsx renders saved views today. So persistence is done, and this issue is about giving people something worth saving.

POST /api/analytics/chart already accepts exactly this request shape and returns a ChartResult. The route is sixteen lines and does no work of its own. You are building a UI for an API that is already live.

Details that matter

  • Label the dimensions in human language. state_group and created_month are internal names. There is a labels.ts in apps/web/src/features/analytics/ doing some of this for state groups already.
  • Not every pair is meaningful. created_month segmented by completed_month is technically valid and reads as noise. You do not have to prevent it, but ordering the list so the useful dimensions come first is worth doing.
  • Cardinality. Segmenting by label on a workspace with two hundred labels produces a chart with two hundred series. Cap the segments, group the tail, and say that you did.
  • Empty results. A combination with no data should say so rather than rendering an axis with nothing in it.

Files

  • apps/web/src/features/analytics/ for the new UI
  • apps/web/src/app/api/analytics/chart/route.ts, existing, probably unchanged
  • packages/core/src/analytics/schemas.ts for the dimension list
  • packages/core/src/analytics/saved-view.ts for persistence

Scope note

This depends on the date range and scope picker issues in the same milestone in the sense that it should inherit them, but it does not have to wait for them. Build it against the workspace scope and wire the header controls in when they land.

Activity

  1. added
    enhancement
    help wanted
    p2 medium
    area: analytics
    on Aug 8, 2026
  2. moved this to Backlog in Orbit roadmapon Aug 8, 2026
  3. added
    size: large
    points: 8
    on Aug 8, 2026
  4. imshashank commented on Aug 15, 2026

    @imshashank
    ContributorAuthor

    Still open, but the ground under it moved. Worth reading before anyone starts.

    What changed. The planning cockpit in #309 replaced the analytics page with four fixed lenses (overview, sprints, projects, people) driven by analyticsQuerySchema, which carries a range, a filter group, a measure, a comparison and a focus. So the page is no longer "four hardcoded distributions and one breakdown", but it is still a fixed set of questions rather than a builder.

    What is still true. buildChart still supports the ten dimensions listed here with any pair segmented, CHART_DIMENSIONS in packages/core/src/analytics/schemas.ts is unchanged, and POST /api/analytics/chart still accepts chartRequestSchema and returns a ChartResult. So the premise holds: there is a general engine behind a page that exposes a fixed slice of it. Nobody can still ask for "issues by priority, stacked by state".

    What is now wrong in the description. Three things:

    1. Persistence is no longer done. This issue says saved views are wired and the work is only the UI. savedDashboardConfigSchema now stores an analyticsQuerySchema, which has no concept of an x axis or a segment, so a saved chart needs a config shape that does not exist yet. Adding one alongside kind: 'dashboard' is the natural move, but it is work this issue currently assumes away.
    2. chartRequestSchema has no range or filter. Add a date range filter to analytics, in the engine and the UI #177 added both to the lens query model and deliberately left chartRequestSchema alone. So "inherit the page scope and date range from the header controls" is not wiring, it is extending the chart engine to accept what the toolbar produces. That is the largest piece of this issue now and it was not in the original estimate.
    3. labels.ts and saved-view-bar.tsx still exist, but distribution-section.tsx and measure-toggle.tsx, referenced as the surrounding pattern, are dead code.

    Revised shape. The builder is now most naturally a fifth lens rather than a tab bolted next to the existing ones, sharing the toolbar so range, filter and measure come for free. That makes point 2 above a prerequisite rather than an optional nicety.

    Everything in "details that matter" still applies unchanged: human labels for state_group and created_month, ordering the useful dimensions first, capping segment cardinality and saying so, and an explicit empty state.

  5. imshashank commented on Sep 6, 2026

    @imshashank
    ContributorAuthor

    Closing as not planned for now. The lens rebuild in #309 answers most of the questions this was for, and nobody has asked for a free-form builder since. The engine still supports it (buildChart, CHART_DIMENSIONS), so this reopens the day somebody has a chart they cannot get from a lens.

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

    area: analyticsenhancementhelp wantedp2 mediumpoints: 8size: large

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions