f2react

1.0.7 • Public • Published

f2react

简单封装 F2 以便在React中使用.

NPM version npm download

示例Demo

组件安装

$ npm i @antv/f2 --save
$ npm i f2react --save

组件使用

import createF2 from 'f2react';
 
const data = [
  { x: '1951 年', y: 38 },
  { x: '1952 年', y: 52 },
  { x: '1956 年', y: 61 },
  { x: '1957 年', y: 145 },
  { x: '1958 年', y: 48 },
  { x: '1959 年', y: 38 },
  { x: '1960 年', y: 38 },
  { x: '1962 年', y: 38 },
];
 
const Bar = createF2((chart) => {
  chart.interval().position('x*y');
  chart.render();
});
 
React.render(
  <Bar
    width={this.state.width}
    height={this.state.height}
    data={data}
  />
);

属性说明

详细使用见 f2 的官方API

名称 类型 默认值 描述
width number(必须) 图表宽度
height number(必须) 图表高度
data arrayOf(object) (必须) 数据源
configs any createF2((chart, configs))中的参数

Dependencies (1)

Dev Dependencies (17)

Package Sidebar

Install

npm i f2react

Weekly Downloads

1

Version

1.0.7

License

ISC

Unpacked Size

8.4 kB

Total Files

3

Last publish

Collaborators

  • beautycss