Gantt Bar
Overview
- Draws a bar from a start date to an end date across the cell
- Places every bar on a shared window, so rows line up like a schedule
- Turns a task or phase list into a mini Gantt view
- Reads two date columns – a start and an end
- The window around today is set in the JSON and easy to change
- Applied as column-formatting JSON on the end-date column, so it changes nothing about the underlying data
Common Use Cases
- Project phases with start and end dates
- Task durations on a plan
- Campaign or event run periods
- Booking or reservation spans
- Assignment or coverage windows
- Any pair of dates you want shown as a duration bar
Details
- Design Pattern: Dates & Time
- Format Scope: Column
Required Columns
| Display name | Column type | Internal name |
|---|---|---|
| Phase | Single line of text | [Title] |
| Start | Date and time | [Start] |
| End | Date and time | [End] |
Prerequisites
- Build a list with these columns before you paste the JSON.
- Then populate each row with a start date and an end date.
- The JSON reads the start date from the Start column, so its internal name in brackets must match the JSON exactly – or rename [$Start] in the JSON to your own column.
- Apply the formatting to the end-date column, not to the Start column.
- The chart shows a fixed window of about 15 days before today through 75 days after today – dates outside that range are pulled to the nearest edge.
How to Apply JSON code
- On the End column, open the column header menu, choose Column settings, then Format this column.
- Switch to Advanced mode.
- Paste the JSON below and click Save.
JSON Code
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"style": {
"display": "flex",
"align-items": "center",
"width": "100%",
"height": "100%",
"box-sizing": "border-box"
},
"children": [
{
"elmType": "div",
"style": {
"position": "relative",
"width": "100%",
"height": "14px",
"min-height": "14px",
"max-height": "14px",
"background-color": "#eeecea",
"border-radius": "7px",
"overflow": "hidden",
"box-sizing": "border-box"
},
"children": [
{
"elmType": "div",
"style": {
"display": "=if(if(@currentField == '', false, if([$Start] == '', false, true)), 'block', 'none')",
"position": "absolute",
"top": "0",
"height": "100%",
"border-radius": "7px",
"background-color": "#0f6cbd",
"left": "=(if((((Number(Date([$Start])) - Number(@now)) / 86400000) + 15) / 90 * 100 < 0, 0, if((((Number(Date([$Start])) - Number(@now)) / 86400000) + 15) / 90 * 100 > 100, 100, (((Number(Date([$Start])) - Number(@now)) / 86400000) + 15) / 90 * 100))) + '%'",
"width": "=((if((((Number(Date(@currentField)) - Number(@now)) / 86400000) + 15) / 90 * 100 < 0, 0, if((((Number(Date(@currentField)) - Number(@now)) / 86400000) + 15) / 90 * 100 > 100, 100, (((Number(Date(@currentField)) - Number(@now)) / 86400000) + 15) / 90 * 100))) - (if((((Number(Date([$Start])) - Number(@now)) / 86400000) + 15) / 90 * 100 < 0, 0, if((((Number(Date([$Start])) - Number(@now)) / 86400000) + 15) / 90 * 100 > 100, 100, (((Number(Date([$Start])) - Number(@now)) / 86400000) + 15) / 90 * 100)))) + '%'"
}
}
]
}
]
}
Common Questions About the Gantt Bar
What is the Gantt Bar built with?
It is built with a standard Microsoft List (SharePoint list) and a small piece of column-formatting JSON. There is no custom development, no SPFx solution, and no third-party tools. It is the kind of clean, maintainable formatting Greg Zelfond builds for teams that want a compact schedule bar in one column without ongoing development overhead.
What columns does it need?
It needs two Date columns: a start date and an end date, where the JSON is applied. Add any label column such as the phase name for context.
Does this design use any custom development or third-party tools?
No. It uses only out-of-the-box SharePoint column formatting, which Microsoft supports natively. That keeps it stable and easy to maintain, and nothing breaks when SharePoint is updated. Out-of-the-box is the only way Greg builds, so you can own and extend the design yourself for years.
If LookBook 365 is code-free and out-of-the-box, why does this example include JSON?
Because SharePoint formatting JSON is not custom code – it is a native configuration feature built into lists and libraries. It is declarative: it only describes how an existing column looks, and cannot run scripts, reach external services, or change your data. Nothing is deployed and nothing breaks when Microsoft updates SharePoint, and you can edit or remove it anytime. That is why LookBook 365 treats it as out-of-the-box and low risk.
How is the window decided?
The bars are placed on a rolling window around today, set in the JSON. Widen or shift that window so your project range fills the bar nicely, or store the start date in the Start column and let the bar span to the end.
Can Greg build a design like this for our lists?
Yes – this is exactly the kind of work Greg Zelfond does. As an independent SharePoint consultant and Microsoft MVP, he designs out-of-the-box list and library formatting like this so your team can read and maintain it without a developer. Reach out through the contact page to talk about your lists.
