0.0.8 • Published 2 years ago

web-react-gantt v0.0.8

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

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 git@github.com: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

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago