Skip to content

[BUG] Make trends chart follow or lock period navigation #46

Open

Description

@Wikijito7

Describe the bug
In trends mode, period navigation changes the usage summary but the chart remains anchored to the same trailing window. The chart therefore appears static while the selected month, week, or day changes.

To Reproduce

  1. Open /usage and enable trends with g.
  2. Navigate to another period with the left/right arrow keys.
  3. Compare the selected period in the header with the periods and values shown in the chart.
  4. Repeat in month, week, and day granularity.

Expected behavior
Define and implement one consistent trends interaction model, controlled by an experiment flag so both options can be evaluated:

  • selected: the trend window is anchored to the selected period; navigating periods updates the chart.
  • static: the chart remains anchored to the current trailing window; period navigation is disabled or hidden while trends are active.

Use OPENCODE_MODEL_USAGE_TRENDS_MODE=selected|static as the comparison flag. Month/week/day granularity switching should remain available in both modes and update the chart granularity. Add deterministic tests for both behaviors and document the selected UX after evaluation.

Media

Additional context
computeTrendSeries() currently uses Date.now() as its reference point and does not receive the selected period offset. The existing trends feature was introduced in #8.

Activity

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

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions