Skip to content

Support "Square Root" Tower Height Scaling (?scale=sqrt) #6221

@nishtha-agarwal-211

Description

@nishtha-agarwal-211

Feature Description

CommitPulse allows users to scale tower heights using either a linear scale or a logarithmic log scale (?scale=linear or ?scale=log).

  • Linear scaling can cause high-volume days (e.g., 20+ commits) to completely tower over days with 1-2 commits.
  • Logarithmic scaling compresses values so much that the visual difference between a 1-commit day and a 10-commit day is barely noticeable.
    A Square Root (sqrt) scaling model acts as the perfect middle ground. It visually highlights variances in low-to-medium commits while keeping high-volume commits from dominating the grid.

Proposed Solution

  1. Update the scale option validation in lib/validations.ts (streakParamsSchema) to support sqrt as an allowed value.
  2. Locate the tower height computation logic in the codebase (e.g., lib/svg/layout.ts or lib/svg/generator.ts).
  3. Implement the square root scaling formula:
    $$h_{scaled} = h_{max} \times \sqrt{\frac{commits}{maxCommits}}$$
  4. Update parameter lists and descriptions in docs/customization.md.

Definition of Done (DoD)

  • The API accepts ?scale=sqrt without failing back to the default linear scale.
  • Tower heights are calculated correctly according to the square root of the contribution counts.
  • Visual alignment of the isometric towers remains precise and does not clip or overflow.
  • Unit tests are implemented to verify the math is correct for scale=sqrt.

Metadata

Metadata

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions