{"id":23666592,"url":"https://github.com/redsift/d3-rs-svg","last_synced_at":"2025-12-11T06:30:11.325Z","repository":{"id":65599440,"uuid":"57399956","full_name":"redsift/d3-rs-svg","owner":"redsift","description":null,"archived":false,"fork":false,"pushed_at":"2024-03-16T14:58:56.000Z","size":1538,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-02-01T09:03:52.083Z","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/redsift.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":"2016-04-29T16:56:24.000Z","updated_at":"2023-08-15T06:42:35.000Z","dependencies_parsed_at":"2024-06-21T03:54:07.008Z","dependency_job_id":"96884c29-9ab4-4125-a6f3-d23da4f1cdcd","html_url":"https://github.com/redsift/d3-rs-svg","commit_stats":{"total_commits":47,"total_committers":4,"mean_commits":11.75,"dds":0.4042553191489362,"last_synced_commit":"21544addcede7e1879468736e9b08251050a1128"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redsift%2Fd3-rs-svg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redsift%2Fd3-rs-svg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redsift%2Fd3-rs-svg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redsift%2Fd3-rs-svg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/redsift","download_url":"https://codeload.github.com/redsift/d3-rs-svg/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239674899,"owners_count":19678490,"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":[],"created_at":"2024-12-29T07:33:11.837Z","updated_at":"2025-12-11T06:30:11.270Z","avatar_url":"https://github.com/redsift.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# d3-rs-svg\n\n`d3-rs-svg` is a component for creating a SVG 1.1 root element that is compatable with the D3 [margin convention](https://bl.ocks.org/mbostock/3019563). This component is dependent on D3 v4 (Alpha).\n\n## Builds\n\n[![Circle CI](https://circleci.com/gh/Redsift/d3-rs-svg.svg?style=svg)](https://circleci.com/gh/Redsift/d3-rs-svg)\n\nUMD from //static.redsift.io/reusable/d3-rs-svg/latest/d3-rs-svg.umd-es2015.min.js\n\n## Usage\n\n### Browser\n\t\n\t\u003cscript src=\"//static.redsift.io/reusable/d3-rs-svg/latest/d3-rs-svg.umd-es2015.min.js\"\u003e\u003c/script\u003e\n\t\u003cscript\u003e\n\t\tvar svg = d3_rs_svg.html();\n\t\t...\n\t\u003c/script\u003e\n\n### ES6\n\n\timport * as svg from \"@redsift/d3-rs-svg\";\n\tlet eml = svg.html();\n\t...\n\nIf using rollup.js for a browser target, ensure `d3-rs-svg` is part of the global map.\n\t\n### Require\n\n\tvar svg = require(\"@redsift/d3-rs-svg\");\n\tvar eml = svg.html();\n\t...\n\t\nBy convention, the SVG element is meant to be hosted in a HTML node, hence `svg.html()`\n\n### Parameters\n\nName|Description|Transition\n----|-----------|----------\nwidth,height|SVG viewport size, px|Y\nscale|SVG scaling factor, floating point|Y\nmargin|margin convention, Object or integer px|Y\nclassed|SVG custom class|N\nstyle|SVG CSS embed|N\nbackground|Rect background color|Y\ntitle||N\nrole|https://www.w3.org/TR/wai-aria/roles#img|N\n\nParameters that support transition can be animated and chained.\n\n\td3.select('#elm')\n\t\t.call(svg)\t\t\t\t\t// draw the SVG at default (1x) scale\n\t.transition().duration(1000)\n\t\t.call(svg.scale(2.0))\t\t// scale the SVG by 2x\n\t.transition().duration(333)\n\t\t.call(svg.scale(1.0))\t\t// bounce back after 333ms\n\nNote, this form of chaining does not work for parameters that do not support transition. Use the `on('end', ...` event for them.\n\n\tvar el = d3.select('#elm')\n\t\t.call(svg.style('rect{fill: yellow;}'));\n\t\n  \tel.select(svg.self()).select(svg.child())\n      \t.append('rect')\t\t\t\t// add a rect to the SVG we can paint with CSS\n        \t.attr('width', svg.childWidth())\n        \t.attr('height', svg.childHeight());\n  \n\tel.transition().delay(1000).duration(0).on('end', function() {\n\t\t el.transition().duration(1000).delay(500)\n          \t.call(svg.scale(2.0).style('rect{fill: green;}'));\t// this green is applied after 1s of delay but 500ms before the scale changes\n\t});\n\t\n## Accessible features\n\nThis module implements some of the [features described here](https://www.sitepoint.com/tips-accessible-svg/).\t\n\t","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredsift%2Fd3-rs-svg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredsift%2Fd3-rs-svg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredsift%2Fd3-rs-svg/lists"}