ApexCharts Gantt Timeline with Range Bars — Free Project Plan Snippet

ApexCharts Gantt Timeline with Range Bars · Charts · Plain HTML, CSS & JS · Live preview

CategoryCharts

What's included

Features

Horizontal range bars
rangeBar series with [start, end] timestamps.
Per-task colours
fillColor on each point keeps row order intact.
Duration labels
Days computed inside the data label formatter.
Today annotation
A dashed x-axis marker with a label.
Custom tooltip
Reads extra fields like team from the data point.
Cascading dependencies
Slipping one task pushes the tasks that depend on it.
UTC-safe dates
No off-by-one shifts across viewer time zones.
Clean grid
Vertical date lines only, no horizontal clutter.

About this UI Snippet

ApexCharts Gantt Chart — Range Bars, a Today Line and Simple Dependencies

Screenshot of the ApexCharts Gantt Timeline with Range Bars snippet rendered live

A Gantt chart answers two questions at once: what happens when, and what happens if something runs late. ApexCharts doesn't ship a dedicated Gantt type, but its rangeBar series with horizontal: true is exactly a list of rows with a start and end on a time axis.

Each point is a row with a range

Every task becomes one data point: x is the row label, y is a [start, end] pair of timestamps. fillColor sets each bar's colour individually, so bars are coloured by owner team without splitting the data into one series per team (which would break row ordering).

Durations and dates without clutter

The data label formatter receives the [start, end] range and prints the duration in days inside each bar. Exact dates live in a custom tooltip, which reads the full data point — including the extra meta field holding the team name.

A today marker

An x-axis annotation draws a dashed red line at the current date with a label. This is often the most-used part of a real project chart: everything left of it should be finished.

Dependencies, kept deliberately simple

Tasks can declare dependsOn. The resolve() function walks the tasks in order and moves any dependant whose start falls before its dependency's end, preserving its duration. "Slip design by 1 week" moves Visual design and re-resolves, so Frontend build, QA and the launch campaign cascade forward. This is a teaching-sized scheduler: it assumes tasks are listed in dependency order and it does not draw dependency arrows.

Dates in UTC

Dates are created with an explicit UTC midnight and the axis uses datetimeUTC: true, so bars don't shift by a day for viewers in other time zones.

Build with AI

Build, Understand, Optimize, and Extend It With AI

Share this snippet with an AI assistant like Claude and ask it to explain how the rangeBar series becomes a Gantt chart and how resolve() cascades a delay. Then ask for improvements: drawing dependency arrows with an SVG overlay, marking the critical path, grouping rows under team headings, or dragging a bar to reschedule it. Ask where the simple ordered-dependency approach would break down in a real plan.

Prompt to recreate it

Copy this into your AI assistant of choice to build the effect from scratch, or as a jumping-off point for your own variant:

text
Build a project Gantt chart with the ApexCharts rangeBar series (loaded from a CDN) in plain HTML, CSS and JavaScript.

Requirements:
- Define eight tasks with a label, UTC start and end dates, an owner team, and an optional dependency on an earlier task.
- Render horizontal range bars on a UTC datetime axis, one row per task, coloured per task by team using per-point fill colours.
- Show each task's duration in days as a label inside its bar and a custom tooltip with task name, team and formatted start and end dates.
- Draw a dashed "Today" vertical annotation line.
- Implement a resolve step that moves any task starting before its dependency ends, keeping its duration.
- Add a button that delays one task by a week, re-runs resolve and updates the chart so dependent tasks cascade forward.

Want to tighten it up first? Run this prompt through the AI Prompt Studio to score it across 8 quality dimensions, catch anti-patterns, and tune the wording for Claude, ChatGPT, or Gemini before you paste it in.

Source Code

Requires
<div class="agt-wrap">
  <div class="agt-card">
    <div class="agt-head">
      <div>
        <div class="agt-title">Website Relaunch — Q4 Plan</div>
        <div class="agt-sub">Bars are coloured by owner team · the dashed line is today</div>
      </div>
      <button class="agt-btn" id="agtSlip" type="button">Slip design by 1 week</button>
    </div>
    <div id="agtChart"></div>
  </div>
</div>

Step by step

How to Use

  1. 1
    Load ApexChartsInclude apexcharts.min.js from the CDN.
  2. 2
    Paste the snippetEight tasks render as horizontal bars on a date axis.
  3. 3
    Hover a barThe tooltip shows task, team and exact dates.
  4. 4
    Slip a taskClick the button; dependent tasks move forward automatically.
  5. 5
    Edit the planChange TASKS: label, start, end, team and optional dependsOn.
  6. 6
    Move the today lineSet TODAY to the current date, for example Date.now().

Real-world uses

Common Use Cases

Project planning
Quarterly roadmaps and launch plans.
Agency timelines
Share phases and ownership with clients.
Release trains
Build, test and rollout windows per team.
Event planning
Venue, marketing and logistics tracks.
Resource views
Swap tasks for people to show assignments.
Related: Gantt Chart Table
A table-based alternative: Gantt Chart Table.
Related: FullCalendar Resource Timeline
For bookable rooms and staff see FullCalendar Resource Timeline.

Got questions?

Frequently Asked Questions

Not as a named type, but a rangeBar series with plotOptions.bar.horizontal set to true renders one bar per row between a start and end value on a datetime axis, which is a Gantt chart.

Set fillColor on each data point. Using one series per category also works, but it can change how rows are grouped and ordered, so per-point colours are simpler for a task list.

Add an entry to annotations.xaxis with x set to the current timestamp, a borderColor and strokeDashArray for a dashed line, and a label.

Each task may name the task it depends on. resolve() walks tasks in order and, if a dependant starts before its dependency ends, moves it to start at that end while keeping its duration. For complex plans with arrows and critical paths, use a dedicated Gantt library.

new Date('2026-10-01') parses as UTC, but other formats parse as local time. Mixing them, or formatting in local time, can shift bars by a day for some viewers. Using explicit UTC dates and datetimeUTC on the axis keeps every viewer on the same calendar day.