1.1.0 • Published 2 years ago

@j.k.bi/react-gantt v1.1.0

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

NPM Version License ISC Gitter Nodejs npm.io

Table of Contents

  1. Install
  2. Usage
  3. Api
  4. Browser Support

Install

npm i @j.k.bi/react-gantt

NPM

Usage

View the demo »

import GanttReact from '@j.k.bi/react-gantt'

const config = {
    title: "业务甘特图",
    width: 800,
    height: 600,
    showPercent: 0.2, // 显示百分比
    showStartPercent: 0.0, // 起始位置百分比
    startDate: '2021-03-31 22:15', // 图表起始日期
    endDate: '2021-04-02 23:45', // 图表终点日期
    nodes: [
        {
            id: '1',
            name: '小鹿1', // 任务所属人姓名
            yAxis: '任务1', // 任务名
            value: {
                startTime: '2021-03-31 23:00',
                endTime: '2021-04-01 02:25',
            },
            // averageTime: 3600000,  // 任务完成平均时间 - 毫秒
            // highlightPoints: [{ // 错误点
            //     time: '2021-04-01 02:10',
            // }]
        }, {
            id: '2',
            name: '小李', // 任务所属人姓名
            yAxis: '任务2', // 任务名
            value: {
                startTime: '2021-04-01 10:25',
                endTime: '2021-04-01 22:25',
            },
            averageTime: 3600000,  // 任务完成平均时间 - 毫秒
            highlightPoints: []
        }, {
            id: '3',
            name: '看电影', // 任务所属人姓名
            yAxis: '任务3', // 任务名
            value: {
                startTime: '2021-04-01 22:25',
                endTime: '2021-04-02 22:25',
            },
            averageTime: 3600000,  // 任务完成平均时间 - 毫秒
            highlightPoints: []
        },
    ]
}
...
<GanttReact config={config} />

API

propstypedefaultdescription
titleString""title for this chart
widthNumber800chart width
heightNumber600chart height
showPercentNumber0.2the percent to show this chart, 0.2 mean zoom in 5x and slider width is 1/5 of total
showStartPercentNumber0the slider start position
startDateStringDate stringe.g. '2021-03-31 22:15', chart start date
endDateStringDate stringe.g. '2021-03-31 22:15', chart end date
nodesArray.<{}>[]list of task object

Dependencies

NameBundle sizeBundle size (gzip)Dependencies
classnamesnpm.ionpm.ionpm.io
dayjsnpm.ionpm.ionpm.io
react-calendarnpm.ionpm.ionpm.io

Browser Support

IEChromeFirefoxOperaSafari
Edge 12+ ✔Chrome 31.0+ ✔Firefox 31.0+ ✔Opera 30.0+ ✔Safari 7.0+ ✔

License

React Gantt is licensed under a ISC License.