Select to view content in your preferred language

Create Gantt chart in ArcGIS Dashboards with data expressions

142
1
a week ago
DarrenLloyd__DOIT
Regular Contributor

I would like to create a Gantt chart in ArcGIS Dashboards to track dates/ duration days for a permitting timeline project. We have a permit process that requires multiple groups submit permits for a single location. Since Gantt charts are not native to the dashboard, I am planning to use a data expression. I found a post that references using data expressions to make a "quasi" Gantt chart, but I could use a little more specific assistance in the data types needed and execution of the data expression.

https://community.esri.com/t5/arcgis-dashboards-questions/gantt-chart/td-p/1310961

For example, I have a table with date fields and duration days.
Name = Traffic Study
Initial Assessment Date = 6/6/25
Initial Assessment Days = 8
Review Start Date = 7/7/25
Review Period Days = 45

I appreciate the help!

@jcarlson 

@C_McNamara 

 

0 Kudos
1 Reply
Neal_t_k
Frequent Contributor

@DarrenLloyd__DOIT   I have done something kind of similar but I preprocessed the data set to prior to importing it.  For example instead of each row having a start date and a duration, I made a row for each day in the duration. So for your example it would be something like this

Traffic Study  Initial Assessment  6/6/25

Traffic Study  Initial Assessment  6/7/25

Traffic Study  Initial Assessment  6/8/25 and so on

You would then have to assign an arbitrary value to each of your "Names" to get the separation. You can do this all with a new data expression. However it still comes out pretty rough looking and, at least as far as I took it, I wasn't able get different colors for the different "names" so I had to add a table to equate the labels with the name and types. Below is  the expression, table and setup as well as the sample data set I made. Hopefully that gives you some ideas if you choose to pursue.

Neal_t_k_0-1762442652119.png

Neal_t_k_1-1762442748100.png

var portal = Portal('https://www.arcgis.com');
var fs = FeatureSetByPortalItem(portal, '<itemID>', 0, ['Name', 'EventType', 'EDate', 'Duration_', 'Number']);//number is an assignment to separate entries 

var features = [];

for (var row in fs) {
    var name = row.Name;
    var eventType = row.EventType;
    var startDate = row.EDate;
    var duration = row.Duration_;
    var number1 = row.Number;

    // Properly skip invalid rows
    if (IsEmpty(name) || IsEmpty(eventType) || IsEmpty(startDate) || IsEmpty(duration)) {
        continue;
    }

    for (var i = 0; i < duration; i++) {
        var currentDate = DateAdd(startDate, i, "days");

        Push(features, {
            attributes: {
                Name: name,
                EventType: eventType,
                Date: currentDate,
                Number: number1,
                DateText: Text(currentDate, "YYYY-MM-DD"),
                Label: name +'-'+eventType
            }
        });
    }
}


// Return using FeatureSet(Text(...)) pattern
return FeatureSet(Text({
    fields: [
        { name: "Name", type: "esriFieldTypeString" },
        { name: "EventType", type: "esriFieldTypeString" },
        { name: "Date", type: "esriFieldTypeDate" },
        { name: "Number", type: "esriFieldTypeInteger" },
        { name: "DateText", type: "esriFieldTypeString" },
        { name: "Label", type: "esriFieldTypeString" }
    ],
    geometryType: "",
    features: features
}));

 

0 Kudos