{"id":21919722,"url":"https://github.com/gilf/qwik-d3","last_synced_at":"2025-06-11T14:38:37.374Z","repository":{"id":208057296,"uuid":"720683343","full_name":"gilf/qwik-d3","owner":"gilf","description":"A small library exposes a d3 container that you can use in order to incorporate d3 generated visualization inside your qwik project. It also includes some pre made diagrams.","archived":false,"fork":false,"pushed_at":"2023-12-08T13:06:27.000Z","size":458,"stargazers_count":19,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-21T19:48:39.699Z","etag":null,"topics":["charts","d3","data-visualization","qwik","svg","vizualisation"],"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/gilf.png","metadata":{"files":{"readme":"README.md","changelog":null,"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,"zenodo":null}},"created_at":"2023-11-19T08:59:13.000Z","updated_at":"2025-04-05T17:15:08.000Z","dependencies_parsed_at":"2025-04-21T08:02:42.004Z","dependency_job_id":null,"html_url":"https://github.com/gilf/qwik-d3","commit_stats":null,"previous_names":["gilf/qwik-d3"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gilf%2Fqwik-d3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gilf%2Fqwik-d3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gilf%2Fqwik-d3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gilf%2Fqwik-d3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gilf","download_url":"https://codeload.github.com/gilf/qwik-d3/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gilf%2Fqwik-d3/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259280877,"owners_count":22833467,"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":["charts","d3","data-visualization","qwik","svg","vizualisation"],"created_at":"2024-11-28T20:10:18.192Z","updated_at":"2025-06-11T14:38:37.346Z","avatar_url":"https://github.com/gilf.png","language":"TypeScript","readme":"# qwik-d3 ⚡️\n\n\u003cimg src=\"https://github.com/gilf/qwik-d3/blob/main/images/qwik-d3-small.jpg\" alt=\"qwik-d3\" width=\"124px\" height=\"124px\"\u003e\nA small library that exposes a D3.js container. You can use the container in order to incorporate D3.js generated visualization inside your Qwik project.\n\n---\n\n## Installation\n\nYou can run \n```\nnpm i qwik-d3 \n```\nMake sure that you also install d3 library because it's a peer dependency.\n\n## Usage\n\nThe library exposes a component named D3Container.\nThe component expects three props:\n- data - the data that should be used inside the graph. \n- create - a QRL function that will be responsible to create the d3 visualization inside the container.\n- options - a Record\u003cstring, string\u003e that is used to pass configurations to the create function\n\nFor example inside your Qwik component you have a list and a createGraph QRL:\n\n```jsx\nconst data = [...];\nconst handleCreation = $(createGraph);\nreturn (\n    \u003cD3Container data={data} create={handleCreation} options={{ fill: 'black' }} /\u003e\n);\n```\n\n## Other Exposed Components\n### BubblePlot \nPre-made bubble plot diagram with a few configuration options such as cx, cy and r for the size of the bubbles.\n```jsx\nconst bubbleData = [\n    { country: \"Afghanistan\", continent: \"Asia\", lifeExp: 43.828, pop: 31889923, gdpPercap: 974.5803384 },\n    { country: \"Albania\",continent: \"Europe\", lifeExp:76.423, pop: 3600523, gdpPercap: 5937.029526 },\n    ...\n];\nreturn (\n    \u003cBubblePlot data={bubbleData} xAxisDomain={[0, 10000]} yAxisDomain={[0, 90]} zAxisDomain={[0, 1310000000]}\n            cx=\"gdpPercap\" cy=\"lifeExp\" r=\"pop\" fill=\"#69b3a2\" stroke=\"black\" opacity={0.7} /\u003e\n);\n```\n### Histogram\nPre-made histogram graph with options to set the thresholds and column in the single object.\n```jsx\nconst histogramData = [\n    { price: 100 },\n    { price: 70 },\n    ...\n];\nreturn (\n    \u003cHistogram data={histogramData} column=\"price\" xAxisDomain={[0, 150]} fill=\"#69b3a2\" thresholds={70} /\u003e\n);\n```\n### PieChart\nPre-made pie chart. \n```jsx\nconst pieData = {a: 9, b: 20, c:30, d:8, e:12}; \nreturn (\u003cPieChart data={pieData} withLabels withTooltip stroke=\"black\" opacity={0.7} /\u003e);\n```\n### BarPlot\nPre-made bar plot.\n```jsx\nconst barPlotData = [{ country: 'USA', value: 12394 },\n    { country: 'Russia', value: 6148 }, \n    { country: 'UK', value: 1214 }\n];\nreturn (\n    \u003cBarPlot data={barPlotData} yAxisDomain={[0, 13000]} fill=\"#69b3a2\" xAxis=\"country\" /\u003e\n);\n```\n### Network\nPre-made network diagram.\n```jsx\nconst networkData = {\n    \"nodes\": [\n        {\n            \"id\": 1,\n            \"name\": \"A\"\n        },\n        {\n            \"id\": 2,\n            \"name\": \"B\"\n        },\n        ...\n    ],\n    \"links\": [\n        {\n            \"source\": 1,\n            \"target\": 2\n        },\n        {\n            \"source\": 1,\n            \"target\": 5\n        },\n        ...\n    ]\n};\nreturn (\n    \u003cNetwork data={networkData} linkStroke=\"#aaa\" nodeFill=\"#69b3a2\" nodeR={20} /\u003e\n);\n```\n### LineChart\nPre-made line chart.\n```jsx\nconst lineChartData = [{\n    date: '2013-04-28',\n    value: 135.98,\n}, {\n    date: '2013-04-29',\n    value: 147.49,\n}, ...];\nreturn (\n    \u003cLineChart data={lineChartData} stroke=\"steelblue\" strokeWidth={1.5} /\u003e\n);\n```\n### generateTooltip \nA helper function that helps to add a tooltip without any style to a d3 generated visualization.\n\nIn the next example pieSlices is the d3 generated pie slices in a pie chart: \n```javascript\nif (options.withTooltip) {\n    const { addTooltip, removeTooltip } = generateTooltip(\"pie-chart-tooltip\", \"tooltip\");\n    pieSlices.on(\"mouseover\", (d, arc: any) =\u003e {\n        addTooltip(arc.data[0], d.pageX, d.pageY);\n    }).on(\"mouseout\", () =\u003e {\n        removeTooltip();\n    });\n}\n```\nThe function accepts two arguments:\n- A unique id for the tooltip\n- A class name to add to the generated tooltip which can be used to style the tooltip element.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgilf%2Fqwik-d3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgilf%2Fqwik-d3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgilf%2Fqwik-d3/lists"}