Qlik Community

Qlik Design Blog

All about product and Qlik solutions: scripting, data modeling, visual design, extensions, best practices, etc.

Announcements
Support Case Portal has moved to Qlik Community! Read the FAQs to start exploring Support resources.
Henric_Cronström

Have you ever wanted to create a Gantt chart in QlikView, only to find out that this chart type is not one of the pre-defined charts? Then you should be happy to learn that it is possible to create a Gantt chart and that it is not very difficult.

 

To be able to create this chart, you need some type of event in the data model, where each event has a start date (or time) and possibly also an end date. Further, an event should belong to some grouping, typically a project or a phase in time.

 

Gantt.png

 

Given the above, we can now start making the graph:

  • Create a bar chart with the appropriate event grouping as dimension (e.g., project, phase, or other group of events)
  • Add the duration of the project as expression: Max(EndDate)-Min(StartDate). If you only have one date per event, you just replace both StartDate and EndDate with the date that you have. The duration will then be the time between the first event and the last.
  • Add the start of the project as an offset to the bars: Min(StartDate). [Chart Properties-Expressions-The plus sign to the left of the Expression-Bar Offset]
  • Set the graph orientation to horizontal bars. [Chart Properties-Style-Orientation]
  • Remove the “Force 0” option. This option will force the start of the time axis to be Dec 30th 1899. [Chart Properties-Axes-Expression Axes-Force 0]
  • Format the expression axis labels as dates or as months (e.g. M/D/YY or YYYY MMM). [Chart Properties-Number-Date]

 

Now you should have a Gantt chart. If you want to improve the way it looks, you may want to consider the following suggestions:

  • Add a grid. [Chart Properties-Axes-Expression Axes-Show grid]
  • If you want a label on each bar, add a second expression defining the text for the label and use this as “Value on Data Points.” [Chart Properties-Expressions-Display Options]  Don’t forget to disable the “Bar” option for this expression. This is the first check box in the Display Options group.
  • If the chart shows a range which is too large, add static min and static max to define the display range of the expression, e.g. Min(StartDate)-5 and Max(EndDate)+40, respectively. The additional distance on the upper limit is to leave space for the text. The unit is number of days. [Chart Properties-Axes-Scale]
  • If you have a second dimension, you can add this too. But if you do, make sure you use the “Grouped” option and not “Stacked.” The latter does not work well with bar offsets. [Chart Properties-Style-Subtype]
  • You may want to use the same color within each value of the first dimension, e.g., one color per project. One good way to define the color (e.g. RGB values) is to do it already in the dimension table in the script and use this color in a color function in the bar background color, e.g. RGB (ProjR,ProjG,ProjB). [Chart Properties-Expressions-The plus sign to the left of the Expression-Background Color]

 

This Gantt chart solves most cases where you need to display that duration of a group of events. Should you need a more complex Gantt chart, you may need to make it as an extension object instead.

 

HIC

56 Comments
Not applicable

An example attached to the blog post would be great!

Thank you, Mr. Cronström!

6,117 Views
Henric_Cronström

Got it. Due to technical constraints we can currently not attach files to the blog posts, but we are looking into how we best can solve this problem. I'll make an example and I will post it somewhere. Let me get back on this.

HIC

0 Likes
6,117 Views
Not applicable

Simplest way is to add inside the blog text a link to a document uploaded in Qlikcommunity. But of course, adding attachments would be the elegant solution.

0 Likes
6,117 Views
Henric_Cronström

Example file for this can be found under http://community.qlik.com/docs/DOC-3113

HIC

6,117 Views
Not applicable

Henric, skulle ni vara intresserade av att göra en demo med vår Gantt chart? www.bryntum.com/products/gantt

Den kan enkelt kopplas till vilken datakälla som helst och är väldigt interaktiv. Om det låter intressant hjälper jag gärna till och bygger en prototyp.

Med vänlig hälsning,

Mats (mats@bryntum.com)

0 Likes
6,117 Views
Henric_Cronström

The example under http://community.qlik.com/docs/DOC-3113 has been updated. With descriptions for both grouped and stacked Gantt bar charts.

HIC

0 Likes
6,117 Views
lms
Employee
Employee

Hi Henric

Great post! You mention that if a more complex Gantt chart is needed than an extension object is required. Well a dedicated QlikView Gantt extension object is available. The latest release is version 1.4, with the recent functionality allowing you to select multiple time scales, as shown here:

Summarised.jpg

The extension object can be downloaded from Community at the following link http://community.qlik.com/docs/DOC-3427

I am keen for others to try it and provide feedback through community (as comments) so I can add the functionality that people actually want and resolve any bugs there may be.

0 Likes
4,401 Views
samvile18
Creator III
Creator III

Hi Henric,

I've been trying to use your example to give me a stacked Gantt chart over two dimensions. I can't however get it working, all I ever seem to get is a blank graph.

Have you experienced this before as I'm really struggling with getting this to work.

This is the link to the latest QVW I have

http://community.qlik.com/message/274553

0 Likes
4,401 Views
andyquirin
Partner
Partner

Hi Henric,

Thanks for posting this forum - it made it super easy to build my first Gantt chart. All was well until we upgraded to QV11 SR2 today and it broke all of my Gantt Charts:

Instead of my expression date range starting at the start date of the earliest project, it begins at the year 1900. Something has to be wrong with how the expression is offset. Is anyone else have a similar issue?

broken gantt.jpg

Thanks,

Andy

0 Likes
4,401 Views
Henric_Cronström

I have seen this problem intermittently also before SR2. Then I solved it by using static Min and static Max (under Properties-Axes). See third bullet in the second bullet listing of the post above.

HIC

4,401 Views