Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

React wrapper for ApexGantt library

License

NotificationsYou must be signed in to change notification settings

apexcharts/react-apexgantt

Repository files navigation

React wrapper forApexGantt - A JavaScript library to create interactive Gantt charts.

Installation

npm install react-apexgantt apexgantt# oryarn add react-apexgantt apexgantt

License Setup

If you have a commercial license, set it once at app initialization before rendering any charts:

import{setApexGanttLicense}from"react-apexgantt";// call this at the top of your appsetApexGanttLicense("your-license-key-here");

Example with React app entry point:

// main.tsx or index.tsximportReactfrom"react";importReactDOMfrom"react-dom/client";import{setApexGanttLicense}from"react-apexgantt";importAppfrom"./App";// set license before renderingsetApexGanttLicense("your-license-key-here");ReactDOM.createRoot(document.getElementById("root")!).render();

Quick Start

importReactfrom"react";import{ApexGanttChart}from"react-apexgantt";functionApp(){consttasks=[{id:"task-1",name:"Project Planning",startTime:"01-01-2024",endTime:"01-08-2024",progress:75,},{id:"task-2",name:"Development",startTime:"01-09-2024",endTime:"01-20-2024",progress:40,dependency:"task-1",},];return<ApexGanttCharttasks={tasks}viewMode="week"height="500px"/>;}

API Reference

Props

PropTypeDescription
tasksTaskInput[]Array of tasks to display
optionsGanttUserOptionsApexGantt configuration options
widthstring | numberChart width
heightstring | numberChart height
viewModeViewModeView mode: 'day', 'week', 'month', 'quarter', 'year'
theme'light' | 'dark'Color theme
classNamestringCSS class name
styleCSSPropertiesInline styles

Events

EventTypeDescription
onTaskUpdate(detail) => voidFired when a task is being updated
onTaskUpdateSuccess(detail) => voidFired after successful task update
onTaskDragged(detail) => voidFired when a task is dragged
onTaskResized(detail) => voidFired when a task is resized

Ref Methods

constganttRef=useRef<ApexGanttHandle>(null);// Available methodsganttRef.current?.update(options);ganttRef.current?.updateTask(taskId,data);ganttRef.current?.zoomIn();ganttRef.current?.zoomOut();ganttRef.current?.destroy();

Custom Hooks

useGanttData

Parse external data into ApexGantt format:

import{useGanttData}from"react-apexgantt";consttasks=useGanttData({data:apiData,parsing:{id:"task_id",name:"task_name",startTime:"start_date",endTime:"end_date",},});

Testing Examples Locally

To test the examples and verify the wrapper works correctly:

# 1. Build the package firstnpm run build# 2. Setup and run test appcd test-appnpm installnpm run dev

The test app will be available athttp://localhost:5173

The test app includes:

  • Basic Example: Simple Gantt with zoom controls
  • Advanced Example: Data parsing, view mode switching, theme toggle
  • Events Example: Interactive testing of drag, resize, and update events

About

React wrapper for ApexGantt library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp