Skip to content

Repository files navigation

gantt-task-react

Interactive Gantt Chart for React with TypeScript.

example

Install

npm install gantt-task-react

How to use it

import{Gantt,Task,EventOption,StylingOption,ViewMode,DisplayOption}from'gantt-task-react';import"gantt-task-react/dist/index.css";lettasks: Task[]=[{start: newDate(2020,1,1),end: newDate(2020,1,2),name: 'Idea',id: 'Task 0',progress: 45,isDisabled: true,styles: {progressColor: '#ffbb54',progressSelectedColor: '#ff9e0d'},},
...
];<Gantttasks={tasks}/>

You may handle actions

<Gantttasks={tasks}viewMode={view}onDateChange={onTaskChange}onTaskDelete={onTaskDelete}onProgressChange={onProgressChange}onDoubleClick={onDblClick}/>

How to run example

cd ./example
npm install
npm start

Gantt Configuration

GanttProps

Parameter NameTypeDescription
tasks*TaskTasks array.
EventOptioninterfaceSpecifies gantt events.
DisplayOptioninterfaceSpecifies view type and display timeline language.
StylingOptioninterfaceSpecifies chart and global tasks styles

EventOption

Parameter NameTypeDescription
onDoubleClick(task: Task) => anySpecifies the function to be executed on the taskbar onDoubleClick event.
onTaskDelete(task: Task) => void/PromiseSpecifies the function to be executed on the taskbar on Delete button press event.
onDateChange(task: Task) => void/PromiseSpecifies the function to be executed when drag taskbar event on timeline has finished.
onProgressChange(task: Task) => void/PromiseSpecifies the function to be executed when drag taskbar progress event has finished.
timeStepnumberA time step value for onDateChange. Specify in milliseconds.

DisplayOption

Parameter NameTypeDescription
viewModeenumSpecifies the time scale. Quarter Day, Half Day, Day, Week(ISO-8601, 1st day is Monday), Month.
localestringSpecifies the month name language. Able formats: ISO 639-2, Java Locale.

StylingOption

Parameter NameTypeDescription
headerHeightnumberSpecifies the header height.
columnWidthnumberSpecifies the time period width.
rowHeightnumberSpecifies the task row height.
barCornerRadiusnumberSpecifies the taskbar corner rounding.
barFillnumberSpecifies the taskbar occupation. Sets in percent from 0 to 100.
handleWidthnumberSpecifies width the taskbar drag event control for start and end dates.
fontFamilystringSpecifies the application font.
fontSizestringSpecifies the application font size.
barProgressColorstringSpecifies the taskbar progress fill color globally.
barProgressSelectedColorstringSpecifies the taskbar progress fill color globally on select.
barBackgroundColorstringSpecifies the taskbar background fill color globally.
barBackgroundSelectedColorstringSpecifies the taskbar background fill color globally on select.
arrowColorstringSpecifies the relationship arrow fill color.
arrowIndentnumberSpecifies the relationship arrow right indent. Sets in px
todayColorstringSpecifies the current period column fill color.
getTooltipContent**Specifies the Tooltip for selected taskbar.

**(task:Task, fontSize:string , fontFamily:string) => JSX.Element;

Task

Parameter NameTypeDescription
id*stringTask id.
name*stringTask display name.
start*DateTask start date.
end*DateTask end date.
progress*numberTask progress. Sets in percent from 0 to 100.
dependenciesstring[]Specifies the parent dependencies ids.
stylesobjectSpecifies the taskbar styling settings locally. Object is passed with the following attributes:
- backgroundColor: String. Specifies the taskbar background fill color locally.
- backgroundSelectedColor: String. Specifies the taskbar background fill color locally on select.
- progressColor: String. Specifies the taskbar progress fill color locally.
- progressSelectedColor: String. Specifies the taskbar progress fill color globally on select.
isDisabledboolDisables all action for current task.
fontSizestringSpecifies the taskbar font size locally.

*Required

License

MIT

About

Gantt chart for React with Typescript

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages