Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Creating a Gantt chart in Stata

    I figured this was safe to ask, since I searched for "Gantt" in the forum and saw 0 entries. Also did a little Googling that turned up nothing. Seemed like a pretty niche application, so I thought folks here would know if it had been done.

    I don't have a specific application in mind, but I like working in Stata, and was thinking it would be neat if I could create and maintain project management tools in Stata, like Gantt charts and other spreadsheets I create regularly. Wondering if anyone's done something like that.

    Thanks!

    -Matt
    ****************************
    Survey Methodologist
    California Health Interview Survey

  • #2
    I think that would yield to twoway rbar. I think you would need each interval as a pair of values in an observation.

    W.S. Cleveland in one of his books re-did such a graph using the data from https://www.ncbi.nlm.nih.gov/pubmed/7352291 but I can't find the original data either on his website or in my files.

    So, the challenge is to post a suitable data example.

    Comment


    • #3
      Hi,
      as many sponsors like Gantt charts, some people may find it useful to produce them using Stata. So here is an example relying on twoway rbar, as previously suggested. Naturally, twoway allows to add all kinds of things (e.g., milestones).

      Code:
      clear
      input str8 task beg end t str3 ml
      "Task 1.1" 1 4 1 ""    // tasks of working package 1
      "Task 1.2" 3 5 1 ""
      "Task 1.3" 5 8 1 ""
      "Task 2.1" 8 12 2 ""    // tasks of working package 2
      "Task 2.2" 10 12 2 ""
      "Task 2.3" 10 14 2 ""
      "Task 1.3" . 8 3 "M1"    // milestones
      "Task 2.3" . 14 3 "M2"
      end
      encode task , gen(tsk)
      
      tw (rbar beg end tsk if t==1, barw(.2) hor) (rbar beg end tsk if t==2, barw(.2) hor) ///
          (sc tsk end if t==3 , msy(D) msiz(large) mc(black) mlabel(ml) mlabp(2)) ///
          , ysc(rev) ylab(,val angle(0)) yti("") xti(Elapsed time [month]) ///
          leg(r(1) lab(1 "WP 1") lab(2 "WP 2") lab(3 Milestones)) sch(s2mono)
      Click image for larger version

Name:	gantt.png
Views:	1
Size:	50.9 KB
ID:	1465747

      Comment

      Working...
      X