{"id":13481712,"url":"https://github.com/1wheel/d3-starterkit","last_synced_at":"2026-03-02T06:31:03.410Z","repository":{"id":28343903,"uuid":"31857396","full_name":"1wheel/d3-starterkit","owner":"1wheel","description":"Snippets and conventions for d3 ","archived":false,"fork":false,"pushed_at":"2018-03-27T20:59:27.000Z","size":157,"stargazers_count":124,"open_issues_count":0,"forks_count":24,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-15T21:40:42.685Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/1wheel.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":"2015-03-08T16:51:51.000Z","updated_at":"2024-10-13T20:59:36.000Z","dependencies_parsed_at":"2022-09-19T23:23:14.416Z","dependency_job_id":null,"html_url":"https://github.com/1wheel/d3-starterkit","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/1wheel/d3-starterkit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1wheel%2Fd3-starterkit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1wheel%2Fd3-starterkit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1wheel%2Fd3-starterkit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1wheel%2Fd3-starterkit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/1wheel","download_url":"https://codeload.github.com/1wheel/d3-starterkit/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1wheel%2Fd3-starterkit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29994121,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-02T01:47:34.672Z","status":"online","status_checked_at":"2026-03-02T02:00:07.342Z","response_time":60,"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":[],"created_at":"2024-07-31T17:00:54.625Z","updated_at":"2026-03-02T06:31:03.388Z","avatar_url":"https://github.com/1wheel.png","language":"JavaScript","funding_links":[],"categories":["Utils","InfoVis Libraries"],"sub_categories":["Placeholder Content"],"readme":"# This repo is no longer being updated!\n\n# Template code lives at [d3-init](https://github.com/1wheel/d3-init)\n\n# Library code merged into [d3-jetpack](https://github.com/gka/d3-jetpack)\n\n\n# d3-starterkit\nSnippets and conventions for starting a new d3 project without a fuss. Includes [d3](http://d3js.org/), [lodash](http://underscorejs.org/), [d3-jetpack](https://github.com/gka/d3-jetpack), some handy css and a few convenience functions. [Short example](http://bl.ocks.org/1wheel/3dfee2b74943398f0550) and [longer blog post](http://roadtolarissa.com/data-exploration/).\n\nThis branch uses d3 verison 4, see the [d3v3 branch](https://github.com/1wheel/d3-starterkit/tree/d3v3) to use with d3 version 3. \n\n#### selection.dataAppend\n\nInstead of making an empty selection, binding data to it, taking the enter selection and appending elements as separate steps:\n\n```js\nvar circles = svg.selectAll('circle')\n    .data(data)\n    .enter()\n    .append('circle')\n```\n\nUse `dataAppend`:\n\n```js\nvar circles = svg.dataAppend(data, 'circle')\n```\n\n#### selection.selectAppend\n\nSelect or append a single element. Always returning the selection:\n\n```js\nvar g = svg.selectAll('g')\n    .data([null])\n    .call(function(sel) {\n      sel.enter().append('g')\n    })\n\n```\n\nUse `selectAppend`:\n\n```js\nvar g = el.selectAppend('g')\n```\n\n#### d3.attachTooltip\n\nAttaches a light weight tooltip that prints out all of an objects properties on mouseover. No more `\u003e d3.select($0).datum()`! Assumes that a `\u003cdiv class='tooltip'\u003e\u003c/div\u003e` and the tooltip css exist on the page – see [index](https://github.com/1wheel/d3-starterkit/blob/master/index.html) for an example.\n\n```js\ncircles.call(d3.attachTooltip)\n```\n\nFor formated tooltips, update the html of the tooltip on mouseover:\n\n```js\ncircles\n    .call(d3.attachTooltip)\n    .on('mouseover', function(d){\n      d3.select('.tooltip').html(template(d)) })\n```\n\nIf your fancy tooltip requires lots of markup, using a [template](http://underscorejs.org/#template) might be easier than building a complex html tree with d3.\n\n#### d3.conventions\n`d3.conventions()` appends an `svg` element with a `g` element according to the  [margin convention](http://bl.ocks.org/mbostock/3019563) to the page and returns an object with the following properties:\n\n`totalWidth`, `totalHeight`, `margin`: size of the `svg` and its margins\n\n`width`, `height`: size of `svg` inside of margins. \n\n`parentSel`: `d3.selection` of the element the `svg` was appended to. Defaults to `d3.select(\"body\")`, but like every other returned value, can be specified by passing in an object: `d3.conventions({parentSel: d3.select(\"#graph-container\"), totalHeight: 1300})` appends an svg to `#graph-container` with a height of 1300.\n\n`svg`: `g` element translated to make room for the margins\n\n`x`: Linear scale with a range of `[0, width]`\n\n`y`: Linear scale with a range of `[height, 0]`\n\n`xAxis`: Axis with scale set to x and orient to \"bottom\"\n\n`yAxis`: Axis with scale set to y and orient to \"left\"\n\n`drawAxis`: Call to append axis group elements to the svg after configuring the domain. Not configurable.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1wheel%2Fd3-starterkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F1wheel%2Fd3-starterkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1wheel%2Fd3-starterkit/lists"}