{"id":16386396,"url":"https://github.com/tmcw/d3-axis-for-react","last_synced_at":"2025-03-16T16:30:54.536Z","repository":{"id":52897510,"uuid":"356361341","full_name":"tmcw/d3-axis-for-react","owner":"tmcw","description":"d3-axis for React","archived":false,"fork":false,"pushed_at":"2023-07-13T00:16:33.000Z","size":38,"stargazers_count":68,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-16T01:55:48.604Z","etag":null,"topics":["d3","react","visualization"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tmcw.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"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":"2021-04-09T18:14:56.000Z","updated_at":"2024-05-26T17:02:59.000Z","dependencies_parsed_at":"2024-10-27T10:59:33.994Z","dependency_job_id":null,"html_url":"https://github.com/tmcw/d3-axis-for-react","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmcw%2Fd3-axis-for-react","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmcw%2Fd3-axis-for-react/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmcw%2Fd3-axis-for-react/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmcw%2Fd3-axis-for-react/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tmcw","download_url":"https://codeload.github.com/tmcw/d3-axis-for-react/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243822283,"owners_count":20353499,"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":["d3","react","visualization"],"created_at":"2024-10-11T04:17:09.689Z","updated_at":"2025-03-16T16:30:54.164Z","avatar_url":"https://github.com/tmcw.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# d3-axis-for-react\n\nUsing d3 to build charts in React is mostly a wonderful experience. But\nit's hard to use `d3-axis` with React: it internally uses d3's selection\nsystem, so if you're creating your charts in React with JSX, you can't.\n\nThis is `d3-axis`, but for React. As direct a port as you can get. You can\nessentially read the [API Reference](https://github.com/d3/d3-axis#api-reference)\nfor d3-axis, and translate it directly to this component: for every d3-style\nsetter function, use a prop. The `scale` argument that you provide to\nthe axis method is a `scale` prop.\n\n- **Tiny**: No dependencies. React is a peerDependency and this package does not depend on d3.\n- **No new opinions**: Same API as d3, just with props instead of methods.\n- **No animation**: d3's axis system supports transitioning. This does not: that's\n  out of scope.\n- **No canvas**: d3-axis is compatible with Canvas thanks to d3's selection/context\n  system. This component only targets SVG.\n- **TypeScript included**: written in TypeScript, includes types.\n- **Compatible with server-side rendering**: this doesn't use `useEffect` or any\n  hooks: instead of using d3 to create DOM, this uses React.\n\n### Installation\n\nThis is the `d3-axis-for-react` package on NPM, so:\n\n```sh\n$ yarn add d3-axis-for-react\n# or\n$ npm install d3-axis-for-react\n```\n\n### Translation example:\n\nTraditional d3 style:\n\n```js\nd3.axisBottom(x)\n  .ticks(d3.timeMonth.every(3))\n  .tickFormat(d =\u003e d \u003c= d3.timeYear(d) ? d.getFullYear() : null)\n```\n\nWith d3-axis-for-react\n\n```jsx\n\u003cAxis\n  scale={x}\n  ticks={d3.timeMonth.every(3)}\n  tickFormat={d =\u003e d \u003c= d3.timeYear(d) ? d.getFullYear() : null} /\u003e\n```\n\n### Examples\n\n- [Line chart](https://codesandbox.io/s/d3-axis-for-react-line-chart-example-dnbwd)\n- [Index chart](https://codesandbox.io/s/d3-axis-for-react-index-chart-example-v0pe0)\n- [Bar chart](https://codesandbox.io/s/bar-chart-example-d1j5e)\n\n### [📚 API documentation](./docs/README.md)\n\n---\n\nDevelopment supported by [Earthrise Media](https://www.earthgenome.org/earthrise/).\nAdapted from [d3-axis](https://github.com/d3/d3-axis), written by Mike Bostock,\nlicensed MIT.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftmcw%2Fd3-axis-for-react","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftmcw%2Fd3-axis-for-react","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftmcw%2Fd3-axis-for-react/lists"}