{"id":15091613,"url":"https://github.com/caldwellc/d3-brush-handles","last_synced_at":"2026-02-21T00:03:14.965Z","repository":{"id":248874990,"uuid":"822603337","full_name":"caldwellc/d3-brush-handles","owner":"caldwellc","description":"d3 brush handles","archived":false,"fork":false,"pushed_at":"2024-08-05T12:52:46.000Z","size":390,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-22T10:48:47.538Z","etag":null,"topics":["brush","d3","d3-js","d3js","handle","handlebars","handles"],"latest_commit_sha":null,"homepage":"https://caldwellc.github.io/d3-brush-handles/","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/caldwellc.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}},"created_at":"2024-07-01T13:09:18.000Z","updated_at":"2024-08-05T12:52:50.000Z","dependencies_parsed_at":"2024-07-17T16:51:39.340Z","dependency_job_id":"6368046e-8fb5-4180-adca-8a91816b9503","html_url":"https://github.com/caldwellc/d3-brush-handles","commit_stats":{"total_commits":18,"total_committers":1,"mean_commits":18.0,"dds":0.0,"last_synced_commit":"64b43aec773aa58d8e8ae7c061e0273d0d3b1726"},"previous_names":["caldwellc/d3-brush-handles"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/caldwellc/d3-brush-handles","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caldwellc%2Fd3-brush-handles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caldwellc%2Fd3-brush-handles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caldwellc%2Fd3-brush-handles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caldwellc%2Fd3-brush-handles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/caldwellc","download_url":"https://codeload.github.com/caldwellc/d3-brush-handles/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caldwellc%2Fd3-brush-handles/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29668640,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-20T23:24:07.480Z","status":"ssl_error","status_checked_at":"2026-02-20T23:24:06.202Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["brush","d3","d3-js","d3js","handle","handlebars","handles"],"created_at":"2024-09-25T10:42:06.894Z","updated_at":"2026-02-21T00:03:14.947Z","avatar_url":"https://github.com/caldwellc.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# d3-brush-handles\n\nLibrary for adding handles to a one-dimensional [d3 brush](https://github.com/d3/d3-brush) along the x-dimension.\n\n[![npm version](https://badge.fury.io/js/d3-brush-handles.svg)](https://badge.fury.io/js/d3-brush-handles)\n\n\n# Example\n[See it in action here](https://caldwellc.github.io/d3-brush-handles/)\n\n![Brush Example](https://github.com/caldwellc/d3-brush-handles/blob/main/brush-example.png?raw=true)\n\n# add to d3 brush in browser\n```html\n\u003c!DOCTYPE html\u003e\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/d3@7\"\u003e\u003c/script\u003e\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/d3-brush-handles@1.0.1\"\u003e\u003c/script\u003e\n\u003chtml\u003e\n    \u003cbody\u003e\n        \u003cdiv id=\"chart-div\"\u003e\u003c/div\u003e\n        \u003cscript\u003e\n            // create chart\n            let width = 600;\n            let height = 400;\n\n            const margin = { top: 10, right: 30, bottom: 30, left: 40 };\n            width = width - margin.left - margin.right,\n            height = height - margin.top - margin.bottom;\n\n            // append the svg object to the body of the page\n            var svg = d3.select(\"#chart-div\")\n                .append(\"svg\")\n                .attr(\"width\", width + margin.left + margin.right)\n                .attr(\"height\", height + margin.top + margin.bottom)\n                .append(\"g\")\n                .attr(\"transform\",\n                    \"translate(\" + margin.left + \",\" + margin.top + \")\");\n\n            const maxX = 1000;\n\n            // add x axis\n            const x = d3.scaleLinear()\n                .domain([0, maxX])\n                .range([0, width]);\n\n            svg.append(\"g\")\n                .attr(\"transform\", \"translate(0,\" + height + \")\")\n                .call(d3.axisBottom(x));\n\n            // generate random data\n            const data = [];\n            for (let i = 0; i \u003c 1000; i++) {\n              data.push(Math.random() * maxX);\n            }\n\n            // create bins\n            const bin = d3.bin()\n                .domain(x.domain())\n                .thresholds(x.ticks(20));\n\n            const bins = bin(data);\n\n            // add y axis\n            const y = d3.scaleLinear()\n                .domain([0, d3.max(bins, function (d) { return d.length; })])\n                .range([height, 0]);\n\n            svg.append(\"g\")\n                .call(d3.axisLeft(y));\n\n            // append the bar rectangles to the svg element\n            svg.selectAll(\"rect\")\n                .data(bins)\n                .enter()\n                .append(\"rect\")\n                .attr(\"x\", 1)\n                .attr(\"transform\", function (d) { return \"translate(\" + x(d.x0) + \",\" + y(d.length) + \")\"; })\n                .attr(\"width\", function (d) { return x(d.x1) - x(d.x0) - 1; })\n                .attr(\"height\", function (d) { return height - y(d.length); })\n                .style(\"fill\", \"#69b3a2\")\n\n            // add a brush container to the chart\n            const brushContainer = svg.append(\"g\");\n\n            // create the brush\n            const brush = d3.brushX().extent([[0, 0], [width, height]]);\n            brushContainer.call(brush);\n\n            // move brush to the initial position\n            const initialPosition = [100, 200];\n            brushContainer.call(brush.move, initialPosition);\n\n            const handleWidth = 6;\n            const handleHeight = 20;\n\n            // add handles to the brush\n            window.d3BrushHandles.addHandlesToBrushX(brush, brushContainer, s =\u003e s.selection, height, handleWidth, handleHeight, initialPosition);\n        \u003c/script\u003e\n    \u003c/body\u003e\n\u003c/html\u003e\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaldwellc%2Fd3-brush-handles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcaldwellc%2Fd3-brush-handles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaldwellc%2Fd3-brush-handles/lists"}