Giter Club home page Giter Club logo

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 Vite

index Vite Next generation frontend tooling

Features

  • Multiple steps
  • Custom styles
  • Dynamic bounds
  • zoom
  • drag
  • typescript support

Demo

See a demo

Installation

npm i web-react-gantt --save
# or yarn add  web-react-gantt --save

Dependencies

Usage

import React, { useState } from "react";

import {
  Timeline,
  Activebar,
  getTimeline,
  UnitType,
  ConfigContext,
} from "web-react-gantt";

function App() {
  const [scale, setCount] = useState(30);
  const data = getTimeline(36);
  const unit = 15;
  const type = "hour";
  const pice = UnitType[type] / unit;
  const width = data.length * scale * pice;

  return (
    <div className="App">
      <div className="flex">
        <div className="left">
          <button onClick={() => setCount(scale + 5)}>+</button>

          <button onClick={() => setCount(scale - 5)}>-</button>
        </div>
        <div className="right">
          <ConfigContext.Provider value={{ unit, type, scale, width }}>
            <Timeline data={data} />
            <Activebar name={"活动中"} start={9} end={16} />
            <Activebar name={"活动2"} start={3} end={8} />
          </ConfigContext.Provider>
        </div>
      </div>
    </div>
  );
}

export default App;

Develop

git clone [email protected]:bjtqti/gantt.git

cd web-react-gannt
npm install
npm start

ReactGantt

Timeline

Activebar

Timeline

| Prop Name | Type

width: number; unit: number; scale: number; type: TimelineType; data: TimelineDataProps[]; scale?: number; type?: TimelineType; unit?: number;

Activebar

| Prop Name | Type

start: number; end: number; name?: string;

Screenshots

react-gantt

Contributing

Review the guidelines for contributing

License

MIT License

ouyangli © 2022

Changelog

Review the changelog

Credits

  • ouyangli - Author

gantt's People

Watchers

 avatar

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.