{"id":23666654,"url":"https://github.com/redsift/d3-rs-table","last_synced_at":"2025-10-31T19:02:36.778Z","repository":{"id":65599426,"uuid":"57146095","full_name":"redsift/d3-rs-table","owner":"redsift","description":"D3.js HTML Table Reusable Chart","archived":false,"fork":false,"pushed_at":"2018-02-04T20:51:08.000Z","size":103,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":19,"default_branch":"master","last_synced_at":"2024-04-09T15:18:42.693Z","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":null,"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":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-04-26T16:53:50.000Z","updated_at":"2017-06-30T10:50:24.000Z","dependencies_parsed_at":"2023-01-31T06:45:15.529Z","dependency_job_id":null,"html_url":"https://github.com/redsift/d3-rs-table","commit_stats":null,"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-table","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redsift%2Fd3-rs-table/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redsift%2Fd3-rs-table/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redsift%2Fd3-rs-table/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/redsift","download_url":"https://codeload.github.com/redsift/d3-rs-table/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239674999,"owners_count":19678509,"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:28.404Z","updated_at":"2025-10-15T01:27:05.785Z","avatar_url":"https://github.com/redsift.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# d3-rs-table\n\n`d3-rs-table` is a component that can map a 2D matrix to an old school `table/tr/td` layout. It serves as a simple example demonstrating the implementation of our reusable chart model for D3 at [Redsift](https://redsift.io/?utm_source=github\u0026utm_medium=readme\u0026utm_campaign=oss) and a baseline for comparing view/data binding approaches for other frameworks. Note, this does not utilise `d3.transition()`. This component is dependent on D3 v4 (Alpha).\n\n## Builds\n\n[![Circle CI](https://circleci.com/gh/Redsift/d3-rs-table.svg?style=svg)](https://circleci.com/gh/Redsift/d3-rs-table)\n\nUMD from //static.redsift.io/reusable/d3-rs-table/latest/d3-rs-table.umd-es15.min.js\n\n## Usage\n\n### Data Format\n\n\tvar data = [ \t\n\t\t\t\t\t[ 'a', 'b', ... ], \n\t\t\t\t\t[ '1', '2', ... ], \n\t\t\t\t\t... \n\t\t\t\t]\n\nIn this model, the first entry is the first row of the table.\n\n### Call\n\nAssuming data compatible with the layout above is available:\n\n\tvar tbl = d3_rs_table.html();\n\td3.select('body').datum(data).call(tbl);\t\n\nUpdating is simply mutating the `data` array and calling `d3.select('body').datum(data).call(tbl)` with the same reusable component instance.\n\n## Usage\n\n`headerRow0` -\u003e true, header is the first row. false, header is the first col. null/undefined, no header.\n\n`text` -\u003e data formatting function.\n\n## Comparing\n\nAny fair comparison against this component in other presentation frameworks should include the following features:\n\n- Ability to change the dimensions of the data array and rebind the presentation.\n- Support ragged arrays via the update flow i.e. arrays where the rows of the array may be of different sizes and have this reflect in the generated DOM.\n- Ability to customise the text presentation on demand via a callback. E.g. in the example, the instance of the component constructed uses a function to format the number to 2 decimal places via `var tbl = htmlTable().text((d) =\u003e d.toFixed(2))`.\n- Ability to optionally render the first row or first column of the data set as a `th` element instead of a `td`. While style can be achieved using CSS, this demonstrates the ability to express sophisticated DOM element generation rules.\n\nOther points to consider:\n\n- Sparse arrays should be treated as expected i.e. empty cells should be created for `null` data elements.\n- The DOM should be allowed to render between every update using an approach suitable for the framework in question.\n- Use a type stable array when running the benchmark e.g. arrays of floats in the reference example.\n\n## Performance\n\nOne of the primary uses of this component is testing performance of the DOM binding. A monolithic version of the test is available [here](https://static.redsift.io/blog/performance-04-16/ZWMamp.html) or as a [Codepen here](http://codepen.io/rahulpowar/full/ZWMamp/). The times embedded are not fully representative, as they only measure the time spent in the data binding portion of the library. Developer tools e.g. `Chrome Timeline \u003e Capture \u003e JS/Paint`, provides a more complete picture. Typically a 2500 item data array binds in 8 to 13 ms in Chrome 49 and corresponds to a 25fps once layout, update and paint are done. Safari 9 has a JS time of 3 to 5 ms. Times on a mobile device are visibly slower but acceptable with 16 ms JS times on iOS 9.x with Mobile Safari.\n\n## D3 v4 vs v3\n\nOne interesting observation when using the D3 v4 Alpha is that the performance averages improve by ~15% with comparable standard deviations. [D3.js v4 Alpha](http://codepen.io/rahulpowar/full/ZWMamp/) vs [D3.js v3 Release](http://codepen.io/rahulpowar/full/VaGBaz/), note a minor change to the `d3.timer` API between v3 and v4.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredsift%2Fd3-rs-table","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredsift%2Fd3-rs-table","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredsift%2Fd3-rs-table/lists"}