{"id":32400685,"url":"https://github.com/hunter-ji/calendar-heatmap","last_synced_at":"2026-04-18T10:34:32.452Z","repository":{"id":318920822,"uuid":"1076972008","full_name":"hunter-ji/calendar-heatmap","owner":"hunter-ji","description":"A lightweight JavaScript library for rendering calendar heatmaps.","archived":false,"fork":false,"pushed_at":"2025-10-16T05:54:39.000Z","size":156,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-25T09:33:30.970Z","etag":null,"topics":["calendar-heatmap","heatmap","javascript","javascript-library","javascript-plugin","typescript"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hunter-ji.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-15T15:40:07.000Z","updated_at":"2025-10-16T05:50:38.000Z","dependencies_parsed_at":"2025-10-17T07:22:12.503Z","dependency_job_id":"44489ac7-5e1c-4b3b-a576-fe23394ec2bb","html_url":"https://github.com/hunter-ji/calendar-heatmap","commit_stats":null,"previous_names":["hunter-ji/calendar-heatmap"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hunter-ji/calendar-heatmap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hunter-ji%2Fcalendar-heatmap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hunter-ji%2Fcalendar-heatmap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hunter-ji%2Fcalendar-heatmap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hunter-ji%2Fcalendar-heatmap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hunter-ji","download_url":"https://codeload.github.com/hunter-ji/calendar-heatmap/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hunter-ji%2Fcalendar-heatmap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31966034,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T00:39:45.007Z","status":"online","status_checked_at":"2026-04-18T02:00:07.018Z","response_time":103,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["calendar-heatmap","heatmap","javascript","javascript-library","javascript-plugin","typescript"],"created_at":"2025-10-25T09:29:10.320Z","updated_at":"2026-04-18T10:34:32.428Z","avatar_url":"https://github.com/hunter-ji.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Calendar Heatmap\n\n![Screenshot of Calendar Heatmap](./Screenshot.jpeg)\n\nEnglish | [简体中文](./README.zh-CN.md) \n\nCalendar Heatmap is a lightweight JavaScript library for rendering calendar heatmaps. It works in any modern browser, supports multiple time windows, and ships as a single dependency-free bundle.\n\n## Features\n- Render yearly, monthly, weekly, or rolling recent-day grids\n- Configure square size, gaps, and color scales (arrays or custom functions)\n- Localize weekday labels, tooltips, and legend captions via built-in language packs\n- Trim large grids automatically to fit narrower containers\n- Works with raw arrays of `{ date, value }` style data objects\n\n## Installation\n```bash\nnpm install calendar-heatmap\n# or\nyarn add calendar-heatmap\n```\n\nYou can also load the bundled `index.js` directly via a `\u003cscript\u003e` tag.\n\n## Quick Start\n```html\n\u003cdiv id=\"heatmap\"\u003e\u003c/div\u003e\n\u003cscript type=\"module\"\u003e\n\timport CalendarHeatmap from 'calendar-heatmap';\n\n\tconst data = [\n\t\t{ date: '2025-01-01', value: 5 },\n\t\t{ date: '2025-01-02', value: 3 },\n\t\t{ date: '2025-01-04', value: 9 }\n\t];\n\n\tconst heatmap = new CalendarHeatmap('#heatmap', data, {\n\t\tview: 'year',\n\t\tlanguage: 'en',\n\t\tlegend: true\n\t});\n\n\t// Update later\n\theatmap.setOptions({ view: 'recent', recentDays: 30 });\n\u003c/script\u003e\n```\n\n## API\n\n### Constructor\n```ts\nnew CalendarHeatmap(container, data?, options?)\n```\n- `container`: CSS selector or DOM node to mount into\n- `data`: array of `{ date | day | dateString, value | count }`\n- `options`: see below\n\n### Options\n| Option | Type | Default | Description |\n| --- | --- | --- | --- |\n| `view` | `'year' \\| 'month' \\| 'week' \\| 'recent'` | `'year'` | Layout preset |\n| `year` | `number` | current year | Target year for `year`/`month` views |\n| `month` | `number` | current month | Zero-based month index |\n| `weekStart` | `0 \\| 1` | `0` | First weekday (`0` Sunday, `1` Monday) |\n| `recentDays` | `number` | `7` | Number of trailing days for `recent` view |\n| `startDate` | `Date \\| string` | today | Anchor date for `week` view |\n| `squareSize` | `number` | `14` | Pixel size of each day cell |\n| `squareGap` | `number` | `2` | Gap between cells |\n| `colorScale` | `string[] \\| (value, max) =\u003e string | { color, level }` | GitHub green palette | Mapping from values to colors |\n| `maxValue` | `number \\| null` | max of data | Upper bound for scale calculations |\n| `legend` | `boolean` | `false` | Render color legend |\n| `tooltip` | `boolean` | `true` | Enable hover tooltip |\n| `locale` | `string \\| string[]` | browser default | ICU locale for date formatting |\n| `language` | `string` | `'en'` | Language pack key (see below) |\n\n### Methods\n- `setOptions(options)` – merge new options and rerender\n- `setData(data)` – replace data and rerender\n- `replaceData(data)` – alias of `setData`\n- `updateData(data)` – update existing entries (if implemented)\n- `setValue(date, value)` – helper to change a single day\n- `render()` – force rerender\n- `destroy()` – remove DOM nodes and tooltips\n\n### Language Packs\nCalendar Heatmap ships with these language keys:\n\n| Key | Locale | Description |\n| --- | --- | --- |\n| `en` | `en-US` | English |\n| `zh-cn` | `zh-CN` | Simplified Chinese |\n| `zh-tw` | `zh-TW` | Traditional Chinese |\n| `ja` | `ja-JP` | Japanese |\n| `fr` | `fr-FR` | French |\n| `de` | `de-DE` | German |\n| `ko` | `ko-KR` | Korean |\n| `es` | `es-ES` | Spanish |\n| `it` | `it-IT` | Italian |\n\nUse aliases such as `zh`, `zh-Hans`, `en-GB`, etc. to select the closest match automatically. The active pack controls weekday labels, tooltip text, and legend captions.\n\nCustom packs can be registered by mutating `CalendarHeatmap.languages`:\n\n```js\nCalendarHeatmap.languages['pt-br'] = {\n\tlocale: 'pt-BR',\n\tlegend: { less: 'Menos', more: 'Mais' },\n\tweekdays: ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb'],\n\ttooltip: (value, dateLabel) =\u003e `${value} em ${dateLabel}`\n};\n```\n\n## Development\n- Clone the repo and install dependencies with `npm install`\n- Run `npm run build` (if available) or open `tests/index.html` in a browser for manual testing\n- Linting/tests are minimal; contributions welcome\n\n## License\nMIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhunter-ji%2Fcalendar-heatmap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhunter-ji%2Fcalendar-heatmap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhunter-ji%2Fcalendar-heatmap/lists"}