webdevpuneet.com

ApexCharts Gantt Timeline with Range Bars — Free Project Plan Snippet

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

CategoryCharts

Copy & paste

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>

Extend with AI

Take This Snippet Further With AI

The AI prompt for this one is for Patreon supporters ($3 a month), along with a site with no ads. Supporters enter the passcode once and it is remembered in this browser.

· Become a supporter

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.

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 and roadmap planning
Lay out a quarter's work as rows of range bars. The dashed today line shows at a glance what should already be finished.
Agency client timelines
Share phases and ownership with clients, using team colours so each bar's owner is clear without a legend lookup.
Release trains
Plan build, test and rollout windows for each team. Dependencies push later tasks when one runs late, showing how a delay ripples through the schedule.
Event planning tracks
Run venue, marketing and logistics as parallel tracks, with duration labels computed in the data label formatter so every bar states how many days it spans.
Resource and workload views
Swap tasks for people to show assignments across weeks, using the same rangeBar structure with horizontal: true and team-coloured points.
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.