mirror of
https://github.com/hustcc/echarts-for-react.git
synced 2025-12-08 20:16:09 +00:00
* docs: update readme * chore: add ga * chore: add baidu tongji * chore: remove baidu zhanzhang meta * chore: update slogan
1.7 KiB
1.7 KiB
| title | order | hero | footer | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ECharts for React - 全网开发者下载量最高的 ECharts 的 React 组件封装 | 1 |
|
Open-source MIT Licensed | Copyright © 2021-present |
安装
$ npm install echarts-for-react
使用
import React from 'react';
import ReactECharts from 'echarts-for-react';
const Page: React.FC = () => {
const options = {
grid: { top: 8, right: 8, bottom: 24, left: 36 },
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
},
yAxis: {
type: 'value',
},
series: [
{
data: [820, 932, 901, 934, 1290, 1330, 1320],
type: 'line',
smooth: true,
},
],
tooltip: {
trigger: 'axis',
},
};
return <ReactECharts option={options} />;
};
export default Page;
最终结果:
import React from 'react';
import ReactECharts from 'echarts-for-react';
const Page: React.FC = () => {
const options = {
grid: { top: 8, right: 8, bottom: 24, left: 36 },
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
},
yAxis: {
type: 'value',
},
series: [
{
data: [820, 932, 901, 934, 1290, 1330, 1320],
type: 'line',
smooth: true,
},
],
tooltip: {
trigger: 'axis',
},
};
return <ReactECharts option={options} />;
};
export default Page;
反馈
请访问 GitHub。