Display Gantt Charts
Overview
This sample displays the record list in the To Do App in the form of a Gantt chart:
- The Gantt chart will display if there are one or more records in the list.
- The colors set in the Gantt chart will vary according to the value of the "Priority" field of the To Do App.
- The Gantt chart will be displayed on the Header Space Element of the App, which lies above the list of records.
Sample Image
The Gantt chart is displayed when the user navigates to the Record List page of the App.
Prepare the App
Create the form
Create an App
with the following fields.
Field Type | Field Name | Field Code | Notes |
---|---|---|---|
Text | To Do | To_Do | |
Date | From | From | |
Date | To | To | |
Drop-down | Priority | Priority | Set the following 6 options: "A", "B", "C", "D", "E", "F" |
Set the Libraries
CSS
This example uses the
jQuery.Gantt
library found in the
Kintone CDN
. Set the following URL into the Upload CSS File for PC option of the App's
JavaScript and CSS Customization settings
.
- https://js.kintone.com/jquerygantt/20210106/css/style.css
JavaScript
This example uses
jQuery
v3.6.0 and
jQuery.Gantt
libraries found in the
Kintone CDN
. Set the following URL into the Upload JavaScript for PC option of the App's
JavaScript and CSS Customization settings
.
https://js.kintone.com/jquery/3.6.0/jquery.min.js https://js.kintone.com/jquerygantt/20210106/jquery.fn.gantt.min.js
Sample Code
Set the JavaScript file
Prepare the following JavaScript code in a text editor and navigate to the Kintone App's settings. Upload the file into the Upload JavaScript for PC option of the
JavaScript and CSS Customization settings
.
|
|
Set the CSS file
Prepare the following CSS in a text editor and navigate to the Kintone App's settings. Upload the file into the Upload CSS for PC option of the
JavaScript and CSS Customization settings
.
|
|
Update the Settings
The files set in the
JavaScript and CSS Customization settings
should look like the following.
Attention
Caution: The order in which JavaScript and CSS are uploaded to an app matters. In this example, ensure that the jQuery and the jQueryGantt libraries are uploaded before the sample JavaScript file. The order of the uploads can be changed by clicking and dragging on the arrows for each item on the Upload JavaScript / CSS page.
Click Save, and then on Update App. Add a few records into the App and navigate to the Record List page. A Gantt Chart should be displayed above the list of records. Bar charts within the Gantt Chart should be displayed depending on the fields set within each record.