Select to view content in your preferred language

Gantt Chart

1555
4
07-24-2023 05:39 AM
C_McNamara
Occasional Contributor

Has anyone had any success trying to replicate a gantt chart inside the Esri environment? I am working on a few dashboards to track development activity in a U.S. county and am looking to show the relationship between specific date ranges that reflect key milestones during the stages of development. There doesn't seem to be much flexibility on the dashboard side of things to create a chart like this but wondering if anyone has any ideas to build something the looks like a project management-type date/calendar chart.

 

Thx!

4 Replies
jcarlson
MVP Esteemed Contributor

I love a good Dashboard challenge, and I was actually thinking about this very topic recently.

As usual, it's sort of possible, but it's not ideal.

jcarlson_0-1690211516878.png

What you're really seeing there is a 'grouped features' chart split by a field, and one of the series is set to the same color as the chart background.

For each phase of your project, you'd need an attribute corresponding to:

  1. Its sequence in the chart (optionally add a domain to the field so that 1 == 'Name of the First Phase', etc).
  2. The start date of the item
  3. The duration

Using a Data Expression, you can then iterate over your features and for any sequence > 1, add a "filler" item with the start date equal to the minimum date of your chart and a duration equal to the difference between that start date and the actual item's start date.

Unfortunately, there's not an easy way to get the value axis to show dates.

Not perfect, but it could work in a pinch.

- Josh Carlson
Kendall County GIS
C_McNamara
Occasional Contributor

Oh, very interesting! Working on this now... I have another one for ya. I am making a new FeatureSet to calculate the Date Difference (DateDiff) but my table produces no records. Any idea what I'm doing wrong?

// Write an expression that returns a FeatureSet.
// Documentation: https://arcg.is/3c419TD
// Samples: https://arcg.is/38SEWWz

var sets = [
FeatureSetByPortalItem(Portal('https://www.arcgis.com/'),'813d2b59e4684462a03eaa945fabc471',3,['*'],true)
]
var combinedDict = { 
  'fields': [ 
    {name: "APNO", type:"esriFieldTypeString" },
    {name: "APPROJKEY", type: "esriFieldTypeDouble" },
    {name: "REL_APNO", type: "esriFieldTypeString" },
    {name: "REL_APPROJKEY", type: "esriFieldTypeDouble" },
    {name: "REL_APDESC", type: "esriFieldTypeString" },
    {name: "REL_ACCEPTDATE", type: "esriFieldTypeDate" },
    {name: "REL_PBDATE", type: "esriFieldTypeDate" },
    {name: "TIMEDIFF", type: "esriFieldTypeDouble" },

  ], 
  geometryType: "", 
  features: [],
};

for (var set in sets) {
    for (var feat in sets[set]) {
        Push(
            combinedDict['features'],
            {attributes: {
                APNO: feat["APNO"],
                APPROJKEY: feat["APPROJKEY"],
                REL_APNO: feat["REL_APNO"],
                REL_APPROJKEY: Number(feat["REL_APPROJKEY"]),
                REL_APDESC: feat["REL_APDESC"],
                REL_ACCEPTDATE: feat["REL_ACCEPTDATE"],
                REL_PBDATE: feat["REL_PBDATE"],
                TIMEDIFF: DateDiff(feat["REL_PBDATE"], feat["REL_ACCEPTDATE"], "days"),
                
                 
                
            }}
        )
    }
}

return FeatureSet(Text(combinedDict))

 

jcarlson
MVP Esteemed Contributor

Oh, I know why! Dates in FeatureSets have to be wrapped in Number(your_date) otherwise the feature gets dropped.

- Josh Carlson
Kendall County GIS
C_McNamara
Occasional Contributor

You are the best, Esri should start paying you lol. I hope I can buy you a beer one day. Cheers!