
2023/09/25 追記: 自分でガントチャートの開始日、終了日を設定できるバージョンの書式設定 も作成してみました。こちらも参考にしてみてください。
上図のような月間ガントチャートを表示する書式設定を作成してみました。
以下、作成方法を記載します。
フィールド定義
リストを作成し、次のフィールドを定義します。
| 列の内部名 | 列の種類 |
|---|---|
| Start | 日付 |
| End | 日付 |
| GanttChart(※何でもOK) | 1行テキスト(※何でもOK) |

列の書式設定(ガントチャートの表示)
ガントチャートを表示するために、列の書式設定をします。
列ヘッダーの [GanttChart] をクリック > [列の設定] > [この列の書式設定] をクリックします。

画面右側に書式設定の画面が表示されるので、[詳細モード] をクリックし、次の JSON をテキストボックスにコピー & ペーストします。

{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"style": {
"display": "flex",
"flex-direction": "column",
"margin": "5px"
},
"children": [
{
"elmType": "div",
"style": {
"display": "flex",
"flex-direction": "row",
"width": "100%",
"margin-bottom": "3px"
},
"attributes": {
"class": "ms-fontColor-themePrimary ms-fontWeight-bold"
},
"children": [
{
"elmType": "span",
"style": {
"width": "=(10 / 31) * 100 + '%'",
"text-align": "left"
},
"txtContent": "1"
},
{
"elmType": "span",
"style": {
"width": "=(10 / 31) * 100 + '%'",
"text-align": "left"
},
"txtContent": "11"
},
{
"elmType": "span",
"style": {
"width": "=(10 / 31) * 100 + '%'",
"text-align": "left"
},
"txtContent": "21"
}
]
},
{
"elmType": "div",
"style": {
"display": "flex",
"width": "100%",
"border": "2px solid",
"height": "20px"
},
"attributes": {
"class": "ms-fontColor-themePrimary"
},
"children": [
{
"elmType": "div",
"style": {
"position": "relative",
"cursor": "pointer",
"width": "=if(getMonth([$Start]) == getMonth([$End]) , ((getDate([$End]) - getDate([$Start]) + 1) / 31) * 100 + '%' , if(getMonth([$End]) > getMonth([$Start]) , ((31 - getDate([$Start]) + 1) / 31) * 100 + '%' , '0px' )",
"left": "=((getDate([$Start]) - 1) / 31) * 100 + '%'"
},
"attributes": {
"class": "ms-bgColor-themePrimary ms-bgColor-themeTertiary--hover"
},
"customCardProps": {
"directionalHint": "topCenter",
"isBeakVisible": true,
"openOnEvent": "hover",
"formatter": {
"elmType": "div",
"style": {
"display": "flex",
"align-items": "center",
"justify-content": "center",
"width": "250px",
"height": "30px",
"margin": "10px",
"font-weight": "bold"
},
"attributes": {
"class": "ms-fontSize-l"
},
"children": [
{
"elmType": "div",
"children": [
{
"elmType": "span",
"txtContent": "[$Start.displayValue]"
},
{
"elmType": "span",
"style": {
"margin-left": "5px",
"margin-right": "5px"
},
"txtContent": "-"
},
{
"elmType": "span",
"txtContent": "[$End.displayValue]"
}
]
}
]
}
}
}
]
}
]
}
[保存] をクリックすると、[GanttChart] 列にガントチャートが表示されます。

ガントチャートの幅を変更したい場合は、次の Twitter の動画を参考に調整ください。
動画のように、びよーんびよーんしてビューの情報を保存したら列幅固定されませんか? pic.twitter.com/lguVBG8XfZ
— てっちゃん (Tetsuya Kawahara) (@techan_k) 2021年5月11日
以上、リストに月間ガントチャートを表示する方法でした。
"年間" ガントチャートを表示したい場合は、次の記事を参照ください。