Skip to content

Add contribution graph mode#78

Open
MySTerY1747 wants to merge 18 commits intozincplusplus:masterfrom
MySTerY1747:master
Open

Add contribution graph mode#78
MySTerY1747 wants to merge 18 commits intozincplusplus:masterfrom
MySTerY1747:master

Conversation

@MySTerY1747
Copy link

Goal

Added a new graph display mode, that renders habits in a GitHub-style contribution graph: weeks as columns, and days of the week as rows.

Changes

  • src/ContributionGraph.svelte: New components that build a week by day grid from the date range given.
  • src/HabitTracker.svelte: Adds in a mode setting, which renders the output as a contribution graph if mode === 'graph'
  • src/main.ts: Adds a new setting to the page, mode, which is either set to default or graph
  • styles.css: Add CSS grid layout for the contribution graph.

Usage

The usage works almost exactly the same way as it did before, but there's a new option that users can add, to indicate whether to use default mode or contribution graph mode:

{
    "path": "habits",
    "mode": "graph"
}

Screenshot

image

Copilot AI and others added 8 commits February 27, 2026 09:39
- Add 'mode' setting ('default' | 'graph') to plugin settings
- Create ContributionGraph.svelte component with GitHub-style grid layout
- Update HabitTracker.svelte to conditionally render graph mode
- Add CSS styles for contribution graph cells, labels, and layout
- Add Display mode dropdown to plugin settings tab

Co-authored-by: MySTerY1747 <98713042+MySTerY1747@users.noreply.github.com>
Co-authored-by: MySTerY1747 <98713042+MySTerY1747@users.noreply.github.com>
…t column layout

The template previously iterated dayIndex (outer) then weeks (inner), which
with CSS grid-auto-flow:column placed all Mondays in the first columns, all
Tuesdays next, etc. Now iterates weeks (outer) then days (inner) so each
column correctly shows Mon through Sun of a single week, matching GitHub's
contribution graph layout.

Co-authored-by: MySTerY1747 <98713042+MySTerY1747@users.noreply.github.com>
Co-authored-by: MySTerY1747 <98713042+MySTerY1747@users.noreply.github.com>
Update documentation to reflect changes made with the latest PR, adding GitHub contribution graph mode.
@zincplusplus
Copy link
Owner

I’m not able to look at it this week. I did test it quickly the day you made it and noticed that the months are not aligned with when the months actually start. Try putting a full year and you will se 13 month headers.

I’ll review it properly next week. I love github’s graph but TBH I’m not sure how I feel about the current implementation in HT21. You/we’d need to figure out how to show streaks and multiple habits in one tracker. Plus look all the other features and params and see if they are supported.

I hope this helps keep the ball rolling until I’m back.

@MySTerY1747
Copy link
Author

@zincplusplus Thank you for the feedback. I'll try and implement some of what you mentioned this weekend 👍

Copilot AI and others added 10 commits March 8, 2026 12:54
Co-authored-by: MySTerY1747 <98713042+MySTerY1747@users.noreply.github.com>
…contribution-graph

Add streak functionality to contribution graph mode
Co-authored-by: MySTerY1747 <98713042+MySTerY1747@users.noreply.github.com>
Fix misaligned month labels in contribution graph
…atchLineLength for graph mode

Co-authored-by: MySTerY1747 <98713042+MySTerY1747@users.noreply.github.com>
…xes only

Co-authored-by: MySTerY1747 <98713042+MySTerY1747@users.noreply.github.com>
…between-modes

Refactor some of the logic
@MySTerY1747
Copy link
Author

Hi @zincplusplus

Quick update on the contribution graph PR.

I’ve made several improvements since your initial feedback:

  • Streaks are now supported in graph mode (current streak 🔥 and best streak 🏆 shown in the footer).
  • All existing tracker settings are supported in graph mode and use the same underlying logic as the default mode.
  • Fixed the month header alignment bug (no more extra/13th month when rendering longer ranges).
  • I manually tested with multiple habits and custom date ranges (daysToShow, firstDisplayedDate, lastDisplayedDate) to make sure the behavior matches the default tracker mode.

One thing I’d like to clarify from your earlier comment about “multiple habits in one tracker.”

Right now, if a folder is used as the path, each habit renders as its own contribution graph, one after the other. For example:

{
  "path": "Misc/Habits/Individual",
  "mode": "graph"
}

This produces a stack of graphs, one per habit, which seems consistent with how the default row mode displays multiple habits.

Is this the behavior you had in mind?

Happy to adjust the implementation if needed :))

@zincplusplus
Copy link
Owner

hey. checked it out. I appreciate the enthusiasm for contributing, and no judgment on using AI to write code (I do it too). The issue is that the last update shows it didn't fully grasp how the existing features work, which ends up creating more back-and-forth than necessary for both of us.

Here are some observations
Screenshot 2026-03-11 at 1 59 08 PM

  • streaks are not visible in graph mode https://github.com/zincplusplus/habit-tracker/releases/tag/2.4.0
  • the dots on day 20 and 23 represent when a habit is due next (missing from graph mode)
  • the stats line with emojis clash with the minimalist aesthetic - please remove it
  • habit name styling doesn't match base
  • today is not highlighted
  • the graphs don't scroll in sync
  • there months in the header still don't align with the dates bellow
    • not sure why December shows up at the beginning since the first day is Jan 1st
  • i'd personally remove the mon/wed/fri on the side, but if it says keep it visible while scrolling
  • maybe match the font size in the header with base (also the colors)

I haven't dug into the code yet, but I think getting these right first would be a solid step forward. Happy to clarify anything.

@MySTerY1747
Copy link
Author

Thanks again for the feedback! I genuinely do appreciate it.

I really care about getting this right, and I'll 100% keep trying. Might take a while, but I will get back to you when it's ready 🫡

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants