Git Product home page Git Product logo

react-gantt's Introduction

react-gantt

npm npm GitHub stars

Gantt chart react component

Please ★ this repo if you found it useful ★ ★ ★

Submit your ReactGantt use cases and I will feature them in the in the used by section

Built by Silicon Hills LLC

index

Silicon Hills offers premium Node and React develpoment and support services. Get in touch at nuevesolutions.com.

Features

  • Multiple steps
  • Custom styles
  • Dynamic bounds

Demo

See a demo

Installation

npm install --save react-gantt

Dependencies

Usage

import ReactGantt, { GanttRow } from 'react-gantt';

class Demo extends Component {
  render() {
    return (
      <ReactGantt
        templates={{
          myTasks: {
            title: 'My Tasks',
            steps: [
              {
                name: 'Task Phase One',
                color: '#0099FF'
              },
              {
                name: 'Task Phase Two',
                color: '#FF9900'
              }
            ]
          }
        }}
        leftBound={moment().set({hour: 0, date: 30, month: 5, year: 2016}).toDate()}
        rightBound={moment().set({hour: 0, date: 29, month: 8, year: 2016}).toDate()}
      >
        <GanttRow
          title="Task 1"
          templateName="myTasks"
          steps={[
            moment().set({hour: 0, date: 1, month: 6, year: 2016}).toDate(),
            moment().set({hour: 0, date: 4, month: 8, year: 2016}).toDate(),
            moment().set({hour: 0, date: 17, month: 8, year: 2016}).toDate()
          ]}
        />
        <GanttRow
          title="Task 1"
          templateName="myTasks"
          steps={[
            moment().set({hour: 0, date: 27, month: 2, year: 2016}).toDate(),
            moment().set({hour: 0, date: 9, month: 7, year: 2016}).toDate(),
            moment().set({hour: 0, date: 22, month: 7, year: 2016}).toDate()
          ]}
        />
      </ReactGantt>
    );
  }
}

Props

ReactGantt

Prop Name Type Behavior
children GanttRow Gantt Rows initialized by you
dateFormat String String format to display dates
dayFormat String Format used when timeline is in 'day' window
debug Boolean Includes extra detailed outputs to show calculated values
hourFormat String Format used when timeline is in 'hourly' window
leftBound Object Date representation of the chart 'beginning' (left-most) date
minuteFormat String Format used when timeline is in 'minute' window
monthFormat String Format used when timeline is in 'monthly' window
rightBound Object Date representation of chart's ending (right-most) date
secondFormat String Format used when timeline is in 'seconds' window
style Object CSS object for chart customization
templates Object Object with keys representing potential states and values for state title and style
timeFormat String Is this used?
timelineStyle Object Object for styles to be used in timeline component, namely the allowed width between ticks
weekFormat String Format used when timeline is in 'weekly' window
yearFormat String Format used when timeline is in 'yearly' window

GanttTimeline

Prop Name Type Behavior
style Object Customize the calculated appearance of the timeline. In pixels: tickWidth, paddingLeft, minWidth
rows Array The parent's GanttRows (is this deprecated?)
scalingFactor Number Allows customization of the calculated # of ticks

GanttRow

Prop Name Type Behavior
barStyle Object Style object for gantt bar
popupStyle Object Style object for popup modal
markerStyle Object Style object for cursor
steps Array Array of steps that bar passes through (needs to exceed the templates steps by 1? Why?)
templateName String Template name to load style and step titles
title String Title to be displayed alongside bar

GanttBar

Prop Name Type Behavior
style Object CSS object for bar styles
steps Array Array of steps that bar passes through (needs to exceed the templates steps by 1? Why?)
templateName String Template name to load style and step titles

GanttPopup

Prop Name Type Behavior
style Object CSS Object for popup style
markerTime Object Time object represnting cursor position on parent GanttBar
activeStep Object Object representing current step cursor is hovering on parent GanttBar
title String Title (same as parent Gantt bar)
titleStyle Object Style for title displayed on pop up

Support

Submit an issue

Screenshots

react-gantt

Contributing

Review the guidelines for contributing

License

MIT License

Jam Risser © 2018

Changelog

Review the changelog

Credits

Used By

  • ModernGreek - The next generation of fraternity and sorority apparel
  • yerbaBuena - a superpowered approach to electronic medical records
  • TaskCluster - task execution framework that supports Mozilla's continuous integration and release processes

Support on Liberapay

A ridiculous amount of coffee ☕ ☕ ☕ was consumed in the process of building this project.

Add some fuel if you'd like to keep me going!

Liberapay receiving Liberapay patrons

react-gantt's People

Contributors

brianweiner avatar clayrisser avatar danilo-cecilia avatar fermayo avatar jamrizzi avatar lavanya881 avatar savalanpour avatar swbullis avatar ucfx avatar xfridrich avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-gantt's Issues

bug

there are a problem when calling componentWillUnmount

image

can't render the gannt chart

Error: Element ref was specified as a string (bar) but no owner was set. This could happen for one of the following reasons:

  1. You may be adding a ref to a function component

  2. You may be adding a ref to a component that was not created inside a component's render method

  3. You have multiple copies of React loaded
    See https://reactjs.org/link/refs-must-have-owner for more information.

    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-gantt": "^2.1.8",
    "moment": "^2.29.1",

Document props

The props need to be documented. If anyone is willing to do this, that would be super helpful.

Moment is not defined

I have installed the React-Gantt-master library in my project but its still giving me the error "moment is not defined".

This is my app.js code.

import { Component } from 'react';
import ReactGantt, { GanttRow } from 'react-gantt';

class App extends Component{
  render() {
    return (
      <ReactGantt
        templates={{
          myTasks: {
            title: 'My Tasks',
            steps: [
              {
                name: 'Task Phase One',
                color: '#0099FF'
              },
              {
                name: 'Task Phase Two',
                color: '#FF9900'
              }
            ]
          }
        }}
        leftBound={moment().set({hour: 0, date: 30, month: 5, year: 2016}).toDate()}
        rightBound={moment().set({hour: 0, date: 29, month: 8, year: 2016}).toDate()}
      >
        <GanttRow
          title="Task 1"
          templateName="myTasks"
          steps={[
            moment().set({hour: 0, date: 1, month: 6, year: 2016}).toDate(),
            moment().set({hour: 0, date: 4, month: 8, year: 2016}).toDate(),
            moment().set({hour: 0, date: 17, month: 8, year: 2016}).toDate()
          ]}
        />
        <GanttRow
          title="Task 1"
          templateName="myTasks"
          steps={[
            moment().set({hour: 0, date: 27, month: 2, year: 2016}).toDate(),
            moment().set({hour: 0, date: 9, month: 7, year: 2016}).toDate(),
            moment().set({hour: 0, date: 22, month: 7, year: 2016}).toDate()
          ]}
        />
      </ReactGantt>
    );
  }
}

export default App;

error

< ReactGantt
^

SyntaxError: Unexpected token '<'
?[90m at Loader.moduleStrategy (internal/modules/esm/translators.js:122:18)?[
39m
?[90m at async link (internal/modules/esm/module_job.js:42:21)?[39m

Props validation failing

Warning: Failed prop type: Invalid prop `titleStyle` of type `object` supplied to `GanttPopup`, expected `string`.
    in GanttPopup (created by GanttRow)
    in GanttRow (created by Demo)
    in tbody (created by ReactGantt)
    in table (created by ReactGantt)
    in div (created by ReactGantt)
    in ReactGantt (created by Demo)
    in div (created by Demo)
    in Demo (created by Route)
    in Route (created by Parent)
    in Switch (created by Parent)
    in Router (created by BrowserRouter)
    in BrowserRouter (created by Parent)
    in Parent

This error is thrown when hovering over the bars.

Show monthly view

Hello,

How can I use months in the header -- for example Jan, Feb etc in the header.

Showing the table on resize only

Uncaught TypeError: Cannot read property 'offsetWidth' of undefined
at ReactGantt.handleResize (index.js:108)
at index.js:93

Can you guide me here little?

Is there support for a horizontal slider/cursor?

Hi Jam,

I'd like to be able to move a slider/cursor back and forth horizontally, which would be indicated with a vertical line. As I move it, I'd get events indicating which tasks the cursor intersects. Is this supported by this timeline?

Use case: We have a 3D model of a building, on which various tasks are scheduled. We can associate the model's objects with tasks on a Gantt timeline. We'd like to have a slider (a vertical line going from the top of the chart to the bottom) that we can move back and forth horizontally. Whenever the slider intersects one or more tasks, we'd like to highlight the model objects associated with those tasks. Does react-gantt currently have functionality to support such a thing?

Thanks!

when i install react-gantt something was wrong,but my global react version is 15.4.2

error code EPEERINVALID
1722 error peerinvalid The package [email protected] does not satisfy its siblings' peerDependencies requirements!
1722 error peerinvalid Peer [email protected] wants react@^15.4.2
1722 error peerinvalid Peer [email protected] wants react@^15.4.2
1722 error peerinvalid Peer [email protected] wants react@^0.14.0 || ^15.0.0-0 || ^16.0.0-0
1722 error peerinvalid Peer [email protected] wants react@^0.14.0 || ^15.0.0
1722 error peerinvalid Peer [email protected] wants react@>=0.13.2 || ^0.14 || ^15.0.0
1722 error peerinvalid Peer [email protected] wants react@^0.14.0 || ^15.0.0
1722 error peerinvalid Peer [email protected] wants react@^0.14.0

Can react-gantt support a slider/cursor?

Hi Jam,

I'd like to be able to move a slider/cursor back and forth horizontally, which would be indicated with a vertical line. As I move it, I'd get events indicating which tasks the cursor intersects. Is this supported by this timeline?

Use case: We have a 3D model of a building, on which various tasks are scheduled. We can associate the model's objects with tasks on a Gantt timeline. We'd like to have a slider (a vertical line going from the top of the chart to the bottom) that we can move back and forth horizontally. Whenever the slider intersects one or more tasks, we'd like to highlight the model objects associated with those tasks. Does react-gantt currently have functionality to support such a thing?

Thanks!

React-native not supported

When I follow your works on example and runs, it cause the following error after react-native run-ios

screenshot 2018-03-23 00 23 53

what should i do ?

change header date format

how i can change header date format from yyyy-mm-dd to any other date format or just insert months name

React-native run-adroid not working

What is wrong?
app is not getting build in to my phone.

on running $react-native run-android on windows cmd

gradle repo is getting downloded and installed while installing application to device I'm getting this error

Exception in thread "main" java.lang.NullPointerException
at org.gradle.wrapper.BootstrapMainStarter.findLauncherJar(BootstrapMain
Starter.java:34)
at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.ja
va:25)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:127)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)

Where does it happen?
it happens on graddle I guess i don't know clearly

How do we replicate the issue?
just use command react-native run-android

How important is this (1-5)?
I am not even able to create a sample hello world app because of this issue.

Expected behavior (i.e. solution)
App should open in my android device

Not work with react@16.

Dependency react-window-resize-listener uses react features which is dropped from react@16 such React.PropTypes and React.createClass methods.

Failed to compile

Failed to compile
./src/App.js
Module not found: Can't resolve 'react-gantt' in 'C:\projects\gantt-diagramm\src'
This error occurred during the build time and cannot be dismissed.

Unmounting a component that contains ReactGantt throws an error

I'm using a switch from react-router to route between pages in my app. However when I try to route away from the page that contains the ReactGantt component I get this error:

Uncaught TypeError: Cannot read property 'removeEventListener' of undefined
at ReactGantt.componentWillUnmount (index.js:100)
at callComponentWillUnmountWithTimer (react-dom.development.js:14280)
at HTMLUnknownElement.callCallback (react-dom.development.js:100)
at Object.invokeGuardedCallbackDev (react-dom.development.js:138)
at invokeGuardedCallback (react-dom.development.js:187)
at safelyCallComponentWillUnmount (react-dom.development.js:14287)
at commitUnmount (react-dom.development.js:14494)
at commitNestedUnmounts (react-dom.development.js:14525)
at unmountHostComponents (react-dom.development.js:14776)
at commitDeletion (react-dom.development.js:14827)

This happens right after the parent component unmounts. Any suggestions on how to fix this?

I'm using the readme example code.
React - 16.4.0,
react-dom - 16.2.0
react-router - 4.3.1
react-gantt - 2.1.4

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.