{"id":13531529,"url":"https://github.com/lloydzhou/rc-echart","last_synced_at":"2026-01-12T05:12:31.140Z","repository":{"id":62748832,"uuid":"562226412","full_name":"lloydzhou/rc-echart","owner":"lloydzhou","description":"React component wrapper for Apache ECharts based on TypeScript.","archived":false,"fork":false,"pushed_at":"2023-11-09T20:26:43.000Z","size":442,"stargazers_count":12,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-03T09:17:30.193Z","etag":null,"topics":["chart","charting-library","charts","echarts","react","tsx","typescript","visualization"],"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/lloydzhou.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}},"created_at":"2022-11-05T17:29:46.000Z","updated_at":"2024-11-26T21:48:01.000Z","dependencies_parsed_at":"2023-11-23T21:46:33.267Z","dependency_job_id":"a0dac07b-7d6a-402d-851a-8379627622ac","html_url":"https://github.com/lloydzhou/rc-echart","commit_stats":null,"previous_names":["lloydzhou/tsxecharts"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lloydzhou%2Frc-echart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lloydzhou%2Frc-echart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lloydzhou%2Frc-echart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lloydzhou%2Frc-echart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lloydzhou","download_url":"https://codeload.github.com/lloydzhou/rc-echart/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248402538,"owners_count":21097331,"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":["chart","charting-library","charts","echarts","react","tsx","typescript","visualization"],"created_at":"2024-08-01T07:01:03.734Z","updated_at":"2026-01-12T05:12:26.063Z","avatar_url":"https://github.com/lloydzhou.png","language":"TypeScript","funding_links":[],"categories":["Frameworks"],"sub_categories":["React Component"],"readme":"# rc-echart\nReact component wrapper for [Apache ECharts](https://github.com/apache/echarts) based on TypeScript.  \n\u003ca href=\"https://www.npmjs.com/package/rc-echart\"\u003e\u003cimg alt=\"NPM Package\" src=\"https://img.shields.io/npm/v/rc-echart.svg?style=flat-square\"\u003e\u003c/a\u003e\n\u003ca href=\"https://www.npmjs.com/package/rc-echart\"\u003e\u003cimg alt=\"NPM Size\" src=\"https://img.shields.io/bundlephobia/minzip/rc-echart\"\u003e\u003c/a\u003e\n\u003ca href=\"https://www.npmjs.com/package/rc-echart\"\u003e\u003cimg alt=\"NPM Downloads\" src=\"https://img.shields.io/npm/dm/rc-echart?logo=npm\u0026style=flat-square\"\u003e\u003c/a\u003e\n\u003ca href=\"/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/github/license/lloydzhou/rc-echart?style=flat-square\" alt=\"MIT License\"\u003e\u003c/a\u003e\n\n## 项目设计\n1. 参考[vuecharts3](https://github.com/lloydzhou/vuecharts)对echarts进行封装\n2. 将echarts官方抽象的`series`以及其他的一些组件抽象成为`React`的组件使用，每一个组件负责管理自己的配置项。\n3. 这些配置项统一的合并到`Chart`画布组件。再统一的通过`chart.setOption`更新到图表上\n\n\n## 安装\n```\nyarn add rc-echart echarts\n```\n\n## Components\n\n1. 定义一个`Chart`组件作为画布\n2. 将[echarts官方配置项](https://echarts.apache.org/zh/option.html#title)每一个配置项使用统一的工厂函数构造成`React Component`\n3. 项目导出组件列表\n\n||导出组件|\n|---|---|\n|series|`Line`, `Bar`, `Pie`, `Scatter`, `EffectScatter`, `Radar`, `Tree`, `Treemap`, `Sunburst`, `Boxplot`, `Candlestick`, `Heatmap`, `Map`, `Parallel`, `Lines`, `Graph`, `Sankey`, `Funnel`, `Gauge`, `PictorialBar`, `ThemeRiver`, `Custom`|\n|axis|`XAxis`, `YAxis`, `Polar`, `RadiusAxis`, `AngleAxis`, `RadarAxis`, `ParallelCoordinates`(`parallel`), `ParallelAxis`, `SingleAxis`, `Calendar`|\n|dataZoom|`DataZoom`, `Inside`, `Slider`|\n|visualMap|`VisualMap`, `Continuous`, `Piecewise`|\n|graphic|`Graphic`, `Group`, `Image`, `Text`, `Rect`, `Circle`, `Ring`, `Sector`, `Arc`, `Polygon`, `Polyline`, `GraphicLine`(`graphic.elements-line`), `BezierCurve`|\n|other|`Title`, `Legend`, `Grid`, `Tooltip`, `AxisPointer`, `Toolbox`, `Brush`, `Geo`, `Timeline`, `Dataset`, `Aria`|\n|gl|`Globe`, `Geo3d`, `Mapbox3d`, `Grid3D`, `XAxis3D`, `YAxis3D`, `ZAxis3D`, `Scatter3D`, `Bar3D`, `Line3D`, `Lines3D`, `Map3D`, `Surface`, `Polygons3D`, `ScatterGL`, `GraphGL`, `FlowGL`|\n\n\n\n## DEMO\n[online demo](https://codesandbox.io/s/tsxecharts-demo-r9wi86?file=/src/App.tsx)  \n\n```\nimport 'echarts'\nimport { Chart, Line, Bar, Title, Grid, XAxis, YAxis, Tooltip } from 'rc-echart'\n\nfunction App() {\n\n  return (\n    \u003cdiv className=\"App\"\u003e\n      \u003cChart width={800}\u003e\n        \u003cGrid top={100} /\u003e\n        \u003cTitle text=\"顶部标题\" subtext=\"顶部小标题\" left=\"center\" top={10} /\u003e\n        \u003cTitle text=\"底部标题\" top=\"bottom\" left=\"center\" /\u003e\n        \u003cBar name=\"data1\" data={[0.32, 0.45, 0.2]} /\u003e\n        \u003cBar name=\"data2\" data={[0.2, 0.5, 0.3]} /\u003e\n        \u003cLine name=\"data2\" data={[0.2, 0.5, 0.3]} /\u003e\n        \u003cXAxis data={['x1', 'x2', 'x3']} /\u003e\n        \u003cYAxis /\u003e\n        \u003cTooltip trigger=\"axis\" /\u003e\n      \u003c/Chart\u003e\n    \u003c/div\u003e\n  )\n}\n\n```\n\n![image](https://user-images.githubusercontent.com/1826685/174950158-e5f8258d-b0b9-4c39-be90-7eefbb7667f0.png)\n\n\n## 自定义组件\n\n1. 通过自定义组件实现官方切换图像的[example](https://echarts.apache.org/examples/zh/editor.html?c=treemap-sunburst-transition)\n\n```\nfunction TreemapSunburstTransition() {\n\n  const [type, setType] = useState('')\n  const [data, setData] = useState()\n  const interval = useRef()\n  const id = 'echarts-package-size'\n\n  useEffect(() =\u003e {\n    const url = \"https://fastly.jsdelivr.net/gh/apache/echarts-website@asf-site/examples/data/asset/data/echarts-package-size.json\"\n    fetch(url).then(res =\u003e res.json()).then(data =\u003e {\n      setData(data.children)\n      let type = ''\n      console.log('data.value', data.children)\n      interval.current \u0026\u0026 clearInterval(interval.current);\n      // @ts-ignore\n      interval.current = setInterval(function () {\n        setType(type = type === 'treemap' ? 'sunburst' : 'treemap')\n        console.log('state.type', type)\n      }, 3000);\n    })\n    return () =\u003e interval.current \u0026\u0026 clearInterval(interval.current)\n  }, [])\n\n  if (type === 'treemap') {\n    return \u003cTreemap id={id} animationDurationUpdate={1000} roam={false} nodeClick={undefined} data={data} universalTransition label={{show: true}} breadcrumb={{show: false}} /\u003e\n  }\n  return \u003cSunburst id={id} radius={['20%', '90%']} animationDurationUpdate={1000} nodeClick={undefined} data={data} universalTransition label={{show: false}} itemStyle={{borderWidth: 1, borderColor: 'rgba(255,255,255,.5)'}} /\u003e\n}\n\n\nfunction App() {\n\n  return (\n    \u003cdiv className=\"App\"\u003e\n      \u003cChart width={800}\u003e\n        \u003cTreemapSunburstTransition /\u003e\n      \u003c/Chart\u003e\n    \u003c/div\u003e\n  )\n}\n```\n\n![](https://fastly.jsdelivr.net/gh/apache/echarts-website@asf-site/examples/data/thumb/treemap-sunburst-transition.webp?_v_=1655181358610)\n\n## echarts-gl demo\n[echarts-gl demo](https://codesandbox.io/s/tsxecharts-gl-demo-n20g3n?file=/src/App.tsx)  \n\n![image](https://user-images.githubusercontent.com/1826685/220146605-23cda247-4d5f-400e-8d09-10b44f3cef24.png)\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flloydzhou%2Frc-echart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flloydzhou%2Frc-echart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flloydzhou%2Frc-echart/lists"}