Skip to content

The scope chart renders blank when the series has a single bucket #175

Closed

Description

@imshashank

On a workspace where every issue was created in the same week, the "Scope and completed over time" card draws nothing. The card, the legend and the two date labels all render, and the plot area is empty. It reads as a chart that failed to load, and people report it as one.

It is not a loading failure. It is a one point series being asked to draw a line.

Why it happens

scopeSeries in packages/core/src/analytics/distribution.ts buckets issues by week between the first created_at and the last completion. A workspace whose history fits inside one week gets exactly one bucket, so series.length === 1.

That array reaches linePath in apps/web/src/features/charts/geometry.ts:

export function linePath(values: readonly number[], max: number): string {
  if (values.length === 0) return '';
  return values
    .map((value, index) => {
      const command = index === 0 ? 'M' : 'L';
      return `${command}${chartX(index, values.length).toFixed(2)} ${chartY(value, max).toFixed(2)}`;
    })
    .join(' ');
}

With one value the output is a single M160.00 6.00. A path that is only a move command has no length, so SVG paints nothing. areaPath then closes a zero width shape, which also paints nothing.

ScopeSection guards on series.length === 0 and shows a sensible empty state, so the zero case is handled. The one case falls straight through.

What to do

Draw something for a single point. The two reasonable options, in order of preference:

  1. Render a dot. When values.length === 1, emit a small circle at chartX(0, 1) and chartY(value, max) instead of a path. This is honest: there is one observation and here is where it sits.
  2. Emit a flat segment. Repeat the point so the path spans the width. Simpler, but it implies a trend across time that the data does not contain, so prefer the dot.

Whichever you pick, Histogram and BurndownChart in the same directory share this geometry and have the same hole. Check them and fix them in the same change.

Files

  • apps/web/src/features/charts/geometry.ts
  • apps/web/src/features/charts/line-chart.tsx
  • apps/web/src/features/charts/burndown-chart.tsx is in apps/web/src/features/analytics/
  • apps/web/src/features/charts/histogram.tsx

Reproducing it

bun run db:seed loads a demo workspace whose issues span enough time to hide this. The quickest reproduction is a unit test:

expect(linePath([5], 10)).not.toBe('M160.00 6.00');

Tests

A test in apps/web/tests/features/charts/geometry.test.ts covering zero, one and many points. There is currently no test file for geometry.ts, so this is also a small coverage win.

Read CONTRIBUTING.md first. bun run verify must be green, and there are no comments in code.

Activity

  1. added
    bug
    good first issue
    help wanted
    ready
    p2 medium
    area: analytics
    on Aug 8, 2026
  2. added
    size: small
    points: 1
    on Aug 8, 2026
  3. imshashank commented on Aug 15, 2026

    @imshashank
    ContributorAuthor

    Still a live bug, but the reproduction in the description no longer exists. Re-baselining rather than closing.

    What changed. The planning cockpit in #309 replaced the analytics charts. The "Scope and completed over time" card came from scope-section.tsx, which nothing imports any more, and its replacement apps/web/src/features/analytics/charts/line-plot.tsx renders a <circle> per point alongside the path. A single-bucket series paints a dot there, which is option 1 from this issue. scopeSeries in distribution.ts is also no longer on the shipping path.

    What is still broken. linePath in apps/web/src/features/charts/geometry.ts is unchanged, and apps/web/src/features/charts/line-chart.tsx still draws only linePath and areaPath with no point markers. Verified on 3ba32cb. So a one-point series still paints nothing, on two surfaces that still ship:

    • apps/web/src/app/(app)/projects/[slug]/layout.tsx, the project overview chart
    • apps/web/src/features/sprints/cycle-board.tsx, the sprint board chart

    A new project or a fresh sprint is exactly the case that produces one bucket, so this is now easier to hit than the original workspace-wide version, not harder.

    Revised scope. Same fix, different files. Render a marker when values.length === 1 in line-chart.tsx, or handle it in geometry.ts and let both callers benefit. histogram.tsx shares the geometry and should be checked in the same change. burndown-chart.tsx is no longer rendered, so it can be skipped or deleted.

    The suggested unit test still stands as written:

    expect(linePath([5], 10)).not.toBe('M160.00 6.00');

    apps/web/tests/features/charts/geometry.test.ts still does not exist, so the coverage win is still there. This is still a good first issue.

  4. ayam04 commented on Aug 29, 2026

    @ayam04
    Contributor

    Taking this one. Going with option 1 from the issue: emit a small circle for a single-point series (honest rendering, no implied trend). Will check Histogram and Burndown consumers of linePath/areaPath per the note.

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: analyticsbuggood first issuehelp wantedp2 mediumpoints: 1readysize: small

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions