{"id":27302358,"url":"https://github.com/davidctj/react-plotlyjs-ts","last_synced_at":"2025-04-12T02:18:00.951Z","repository":{"id":57342545,"uuid":"102359069","full_name":"davidctj/react-plotlyjs-ts","owner":"davidctj","description":"A react-typescript component for Plotly.JS graphs.","archived":false,"fork":false,"pushed_at":"2020-02-29T07:45:19.000Z","size":63,"stargazers_count":15,"open_issues_count":3,"forks_count":10,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-12T02:17:56.108Z","etag":null,"topics":["plotlyjs","react","react-plotlyjs","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/davidctj.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":"2017-09-04T12:29:51.000Z","updated_at":"2025-01-12T21:35:48.000Z","dependencies_parsed_at":"2022-09-16T02:50:19.449Z","dependency_job_id":null,"html_url":"https://github.com/davidctj/react-plotlyjs-ts","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidctj%2Freact-plotlyjs-ts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidctj%2Freact-plotlyjs-ts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidctj%2Freact-plotlyjs-ts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidctj%2Freact-plotlyjs-ts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidctj","download_url":"https://codeload.github.com/davidctj/react-plotlyjs-ts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248505917,"owners_count":21115354,"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":["plotlyjs","react","react-plotlyjs","typescript"],"created_at":"2025-04-12T02:18:00.260Z","updated_at":"2025-04-12T02:18:00.941Z","avatar_url":"https://github.com/davidctj.png","language":"TypeScript","readme":"# React-PlotlyJS-Typescript [![npm version](https://badge.fury.io/js/react-plotlyjs-ts.svg)](https://badge.fury.io/js/react-plotlyjs-ts)\n\nA react-typescript component for Plotly.JS graphs.\n\nSelf-redraw when props changed. \n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://github.com/davidctj/react-plotlyjs-ts/blob/master/images/example.png\" /\u003e\n\u003c/p\u003e\n\n## Usage\n\n```bash\n$ npm i -S react react-dom typescript\n$ npm i -D @types/plotly.js\n$ npm i -S plotly.js react-plotlyjs-ts\n```\n\n```typescript\nimport * as React from 'react';\nimport PlotlyChart from 'react-plotlyjs-ts';\n\nclass App extends React.Component {\n    public handleClick = (evt: any) =\u003e alert('click')\n    public handleHover = (evt: any) =\u003e alert('hover')\n\n    public render() {\n        const data = [\n            {\n                marker: {\n                    color: 'rgb(16, 32, 77)'\n                },\n                type: 'scatter',\n                x: [1, 2, 3],\n                y: [6, 2, 3]\n            },\n            {\n                name: 'bar chart example',\n                type: 'bar',\n                x: [1, 2, 3],\n                y: [6, 2, 3],\n            }\n        ];\n        const layout = {\n            annotations: [\n                {\n                    text: 'simple annotation',\n                    x: 0,\n                    xref: 'paper',\n                    y: 0,\n                    yref: 'paper'\n                }\n            ],\n            title: 'simple example',\n            xaxis: {\n                title: 'time'\n            },\n        };\n        return (\n            \u003cPlotlyChart data={data}\n                         layout={layout}\n                         onClick={this.handleClick}\n                         onHover={this.handleHover}\n            /\u003e\n        );\n    }\n}\n\nexport default App;\n```\n\n## Documentation\nDefine PlotlyChart props below:\n```typescript\n   config?: any;\n    data: any;\n    layout?: any;\n    onClick?: (event: plotly.PlotMouseEvent) =\u003e void;\n    onBeforeHover?: (event: plotly.PlotMouseEvent) =\u003e void;\n    onHover?: (event: plotly.PlotMouseEvent) =\u003e void;\n    onUnHover?: (event: plotly.PlotMouseEvent) =\u003e void;\n    onSelected?: (event: plotly.PlotSelectionEvent) =\u003e void;\n```\n* data, layout, config are the same as in the [plotly.js](https://www.npmjs.com/package/plotly.js).\n* \u003cb\u003eonClick, onBeforeHover, onHover, onUnHover, onSelected\u003c/b\u003e are on event functions. \nUse ES6 destructuring to get the points and event.\n\n\n## Todo\nAdd testing\n\n## Thanks\nInspired by [React-PlotlyJS](https://github.com/benjeffery/react-plotlyjs), many thanks!","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidctj%2Freact-plotlyjs-ts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidctj%2Freact-plotlyjs-ts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidctj%2Freact-plotlyjs-ts/lists"}