Coder Social home page Coder Social logo

gantt-task-react's Introduction

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";

let tasks: Task[] = [
    {
      start: new Date(2020, 1, 1),
      end: new Date(2020, 1, 2),
      name: 'Idea',
      id: 'Task 0',
      progress: 45,
      isDisabled: true,
      styles: { progressColor: '#ffbb54', progressSelectedColor: '#ff9e0d' },
    },
    ...
];
<Gantt tasks={tasks} />

You may handle actions

<Gantt
  tasks={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 Name Type Description
tasks* Task Tasks array.
EventOption interface Specifies gantt events.
DisplayOption interface Specifies view type and display timeline language.
StylingOption interface Specifies chart and global tasks styles

EventOption

Parameter Name Type Description
onDoubleClick (task: Task) => any Specifies the function to be executed on the taskbar onDoubleClick event.
onTaskDelete (task: Task) => void/Promise Specifies the function to be executed on the taskbar on Delete button press event.
onDateChange (task: Task) => void/Promise Specifies the function to be executed when drag taskbar event on timeline has finished.
onProgressChange (task: Task) => void/Promise Specifies the function to be executed when drag taskbar progress event has finished.
timeStep number A time step value for onDateChange. Specify in milliseconds.

DisplayOption

Parameter Name Type Description
viewMode enum Specifies the time scale. Quarter Day, Half Day, Day, Week(ISO-8601, 1st day is Monday), Month.
locale string Specifies the month name language. Able formats: ISO 639-2, Java Locale.

StylingOption

Parameter Name Type Description
headerHeight number Specifies the header height.
columnWidth number Specifies the time period width.
rowHeight number Specifies the task row height.
barCornerRadius number Specifies the taskbar corner rounding.
barFill number Specifies the taskbar occupation. Sets in percent from 0 to 100.
handleWidth number Specifies width the taskbar drag event control for start and end dates.
fontFamily string Specifies the application font.
fontSize string Specifies the application font size.
barProgressColor string Specifies the taskbar progress fill color globally.
barProgressSelectedColor string Specifies the taskbar progress fill color globally on select.
barBackgroundColor string Specifies the taskbar background fill color globally.
barBackgroundSelectedColor string Specifies the taskbar background fill color globally on select.
arrowColor string Specifies the relationship arrow fill color.
arrowIndent number Specifies the relationship arrow right indent. Sets in px
todayColor string Specifies the current period column fill color.
getTooltipContent ** Specifies the Tooltip for selected taskbar.

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

Task

Parameter Name Type Description
id* string Task id.
name* string Task display name.
start* Date Task start date.
end* Date Task end date.
progress* number Task progress. Sets in percent from 0 to 100.
dependencies string[] Specifies the parent dependencies ids.
styles object Specifies 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.
isDisabled bool Disables all action for current task.
fontSize string Specifies the taskbar font size locally.

*Required

License

MIT

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.