{"id":28092428,"url":"https://github.com/kevinwang15/treebox","last_synced_at":"2025-05-13T13:14:31.810Z","repository":{"id":38693713,"uuid":"330943537","full_name":"KevinWang15/treebox","owner":"KevinWang15","description":"an interactive TreeMap visualization - Please star if you like this project","archived":false,"fork":false,"pushed_at":"2024-07-21T04:05:47.000Z","size":8090,"stargazers_count":56,"open_issues_count":5,"forks_count":6,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-05-13T13:14:23.483Z","etag":null,"topics":["canvas","canvas2d","data","javascript","treemap","visualization"],"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/KevinWang15.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}},"created_at":"2021-01-19T10:30:01.000Z","updated_at":"2025-05-01T12:37:23.000Z","dependencies_parsed_at":"2022-09-16T06:50:29.464Z","dependency_job_id":null,"html_url":"https://github.com/KevinWang15/treebox","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KevinWang15%2Ftreebox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KevinWang15%2Ftreebox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KevinWang15%2Ftreebox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KevinWang15%2Ftreebox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KevinWang15","download_url":"https://codeload.github.com/KevinWang15/treebox/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253948503,"owners_count":21988961,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["canvas","canvas2d","data","javascript","treemap","visualization"],"created_at":"2025-05-13T13:14:31.097Z","updated_at":"2025-05-13T13:14:31.801Z","avatar_url":"https://github.com/KevinWang15.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# treebox\n\n![](https://raw.githubusercontent.com/KevinWang15/treebox/master/design/logo.png)\n\nTreebox is an interactive TreeMap visualization\n\n- weight-aware multi-level hierarchical treemap layout\n- click on a block to zoom in / \"esc\" to zoom out\n- smooth transition\n- uses canvas \u0026 requestAnimationFrame for performance\n- customize text / color / weight\n- fires events (so you can implement tooltip, etc.)\n- no dependency (5kb gzipped)\n- MIT license\n\n# DEMO\n\n![](https://raw.githubusercontent.com/KevinWang15/treebox/master/demo.png)\n\n![](https://raw.githubusercontent.com/KevinWang15/treebox/master/demo.gif)\n\n# try it\n\n```bash\ngit clone https://github.com/KevinWang15/treebox\ncd treebox\nyarn install\nyarn start\n```\n\n# use it\n\n```bash\nnpm i @kevinwang15/treebox\n```\n\n```javascript\nexport function genData(layers = 4) {\n  const result = [];\n\n  for (let i = 0; i \u003c 7; i++) {\n    const children = layers - 1 \u003e 0 ? genData(layers - 1) : null;\n    result.push({\n      text: `${layers}-${i}`,\n      color: ({ ctx, hovering, item, bounds }) =\u003e \"red\",\n      children,\n      weight: children ? null : Math.floor(10 * (1 + 2 * Math.random())),\n    });\n  }\n\n  return result;\n}\n```\n\n```javascript\nimport TreeBox from \"@kevinwang15/treebox\";\n\nconst pixelRatio = 2;\n\n\u003cdiv\n  ref={(domElement) =\u003e {\n    const treebox = new TreeBox({\n      pixelRatio,\n      data: genData(),\n      domElement,\n      eventHandler: console.log,\n    });\n\n    window.addEventListener(\"resize\", () =\u003e {\n      treebox.repaint();\n    });\n\n    document.addEventListener(\"keydown\", (e) =\u003e {\n      if (e.key === \"Escape\") {\n        treebox.zoomOut();\n      }\n    });\n  }}\n/\u003e;\n```\n\n# Roadmap\n\n- more customization options\n- github.io page\n- automated testing\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevinwang15%2Ftreebox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkevinwang15%2Ftreebox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevinwang15%2Ftreebox/lists"}