In SharePoint, one limitation of the Gantt view is that there is no option to adjust the scale. Only a couple weeks are visible on your screen.
How can we change this to view 6 months or one year? Last month, I showed how to shrink a month calendar. Today’s the turn of the Gantt view.
The method
Just like the calendar, the Gantt view has a bone structure: images invisible to the naked eye with a width of 16 pixels. So once again we’ll apply our Jivaro-like technique and reduce their size using CSS.
As usual, use a CEWP to drop the code on your page.
An example of code
Here is an example of CSS for Internet Explorer:
<style type="text/css">
.ms-ganttInnerTable IMG {width:2px;}
.ms-ganttDetailTimeUnitRow * {display:none;}
.ms-ganttInnerTable .ms-ganttMajorTimeUnitHeaderCell {writing-mode: tb-rl;filter: flipv fliph;border:0;}
</style>
What this code does:
- change the images width from 16 to 2 pixels.
- remove the display of weekdays
- rotate the dates to display them vertically
Note that with the new scale, the rounded edges are not visible anymore, and milestones shrink too. Also, this won’t work in other browsers like Firefox as they won’t rotate the text.
For a wider scale, just change the images width, for example:
.ms-ganttInnerTable IMG {width:4px;}
Update – I have set up a live demo:
http://8002.freesharepoint2007.com/Lists/Gantt/GanttDefault.aspx
Use the slider to modify the Gantt’s width.
To take this further
My example is very simple and CSS only. You can create better effects and improve cross-browser compatibility with a pinch of JavaScript. For example, we could imagine to include a slider to make the scale dynamic.
And of course the same technique applies if on the contrary you want to expand the scale!
If you are looking for other features, like color coding or task grouping, check out this other method.
Update: the script to add a slider to the Gantt view is available here!

32 comments
Comments feed for this article
November 8, 2008 at 1:16 pm
Charlie Epes
Christophe:
You continue to amaze me in your pursuit of customization and alternate solutions. By this I mean that the solutions are wonderful but your thirst for meaningful alternatives is more noteworthy.
November 9, 2008 at 7:35 am
Greg
How sad am I? I can’t wait until tomorrow to try this out!
I agree with Charlie but add that your desire to share your alternative solutions in such well structured via this site is noteworthiest!!
November 10, 2008 at 4:31 pm
Anonymous
Realy nice Dude, you hav one of the best customize blogs out there! This one worked perfect for my needs. If you can figure out how to make it scalable, and show us how it would be better than best.
November 10, 2008 at 8:17 pm
Brian
Agree with others. Great work. I have reaped the benefits from several of your columns. I like the approach here on the Gantt view. However, there is one irritation I have about this view, even with your “upgrade.” I wish the initial view would slide the chart to today’s date, as opposed to being left justified (the best way for me to put it). In other words, I have a project going all the way back to January of 2007. When you bring up the view, you have to move the slider quite a bit to the right to get yourself to the current date. I’ve learned a heck of a lot about Javascript and CSS over the past several months, but I can’t figure out a way around this. Not asking you for a solution, by any means. Just venting. Thanks again, and keep up the good work.
November 11, 2008 at 8:29 am
Christophe
Thanks guys
Brian: as you have seen in other posts on my blog, it’s not easy to deal with “Today”. With the OOTB features, the easiest way is to use a filter. For example, you could display two filtered Gantt views next to each other on your page, one with the tasks before today and the other with the tasks after today.
You may also consider my other Gantt method – mentionned in the post – which offers more flexibility.
November 13, 2008 at 2:45 pm
Bertrand
Stunning !
Could you change the date format to something like 13 Nov 08 ?
November 13, 2008 at 3:24 pm
Christophe
Bertrand: the only way I can think of is to add some Javascript that converts date formats. You can certainly find this on the Web, try for example a search with “Javascript date format”.
November 14, 2008 at 12:23 pm
Bertrand
I found a simpler solution by changing the Locale in the Site settings. This does not allow to choose between formats, but at least, dates can be correctly interpreted. Thanks again.
November 14, 2008 at 12:35 pm
Christophe
OK, in this case the change is for the whole site, not just the Gantt.
Good tip anyway, thanks for sharing!
November 21, 2008 at 11:27 am
Charlotte
Hi Christophe,
Love your work. Your blog is one of the best out there. I think that the OOTB Project Tasks list is one of the most inflexible and unsufficient web parts out there. Your post helps a lot. Hope microsoft is reading too. I also have a question, is it possible to tweak the javascript to show month names only, horizontaly. For major projects like we have, a month view is all you need. A second question; The web part only shows 10 projects, otherwise you get to scroll down. Is this adjustable? Maybe I am missing something here.
Anyway, your work is the best!
Regards,
Charlotte
from Holland
November 21, 2008 at 1:42 pm
Christophe
Thanks Charlotte!
This post was about CSS only. I intend to write another one including Javascript that will show more options. But I have nothing ready for publishing yet…
December 1, 2008 at 7:28 am
charlotte joy
your work is helpful in my studies i hope you
keep doing this…..
December 26, 2008 at 12:07 pm
Manjunath V
Christophe,
Thanks a lot for what you do and publish on this blog !! It has helped me immensely (me = non technical newbie).
This is what I am following up on:
Like Charlotte Joy, I am looking at a way to tweak the code so that the Gantt View shows just the month names horizontally. I am a program manager and have several projects running at the same time. All I want to do is to show a month’s view to the users on my Program Update Site.
Can you please help and post a solution for the same?
January 6, 2009 at 2:54 pm
SharePoint Gantt View: adjusting the scale « The Central Solutions Team Blog
[...] means to adjust the project timescale and found this blog post by Christophe at Path to SharePoint How to scale down the SharePoint Gantt view. It’s a simple, quick and flexible solution which requires you [...]
January 6, 2009 at 5:12 pm
Lisa M
Hi Cristophe,
This scaled down Gantt works great! Is there a way to keep the dates visible at the top of the Gantt view while scrolling through the items? I can only see the dates for about the first 9 items on my list of 58 items.
Thanks for creating such a great site.
January 7, 2009 at 12:11 am
Christophe
Lisa, see if this post from Paul Grenier works for you:
http://www.endusersharepoint.com/?p=1083
January 20, 2009 at 10:57 am
Adding a Toggle Daily/Weekly Tasks button to the Project Tasks list « SharePoint NutBag’s Weblog
[...] tasks rather than the default daily view. This can be achieved though writing CSS script such as Path To SharePoint explains., however the users want a button to toggle between a daily view and a weekly view [...]
January 21, 2009 at 5:17 pm
A slider for the Gantt view « Path to SharePoint
[...] I did not build the slider. I simply took an existing one offered by the jQuery UI library, and combined it with my technique to scale down the Gantt view. [...]
January 28, 2009 at 12:29 pm
Tarcisio
Is possible create a gantt chart separeted by monthly?
Thanks!
January 28, 2009 at 2:13 pm
Christophe
Tarcisio: separated…horizontally or vertically?
Horizontally: you could set up a filter that selects the tasks for a given month.
Vertically: feasible, but it would require a little effort. Have you seen my slider demo? You could imagine something similar where, instead of resizing the chart, moving the slider would move the Gantt to the next month.
February 9, 2009 at 9:25 pm
cloudno9
great work. I have learned a lot. I saw your live site that has slider and Jan ‘09 view. Is it possible that I can have Gantt on Monthly basis, what I meant is at the top its shows me Jan ‘09 and second line is wk1, wk2, wk3, wk4? and reapeat the same witheach month.
Also are you going to put that slider sample on the net also?
TIA
February 10, 2009 at 2:41 am
Christophe
The slider script is already published:
http://pathtosharepoint.wordpress.com/2009/01/21/a-slider-for-the-gantt-view/
For your need: I suggest that you add a column with the month and filter according to that column.
February 10, 2009 at 8:02 pm
cloudno9
Thankx Christophe,
I am newbie to Moss 2007, if you dont mind walking me through the suggestion you are making, i will appreciate that. Also when i put the slider in i got 4 jan, 4 feb , 4 march and so on columns. can i only have one column for each month?
February 17, 2009 at 11:22 pm
ArtV
Is there an easy way to “scale up” the display? For example, to show days of the week with hour by hour granularity? We’d like to set up tasks for a 2 or 3 day roll out plan and display them in a gantt view. Thanks
February 18, 2009 at 2:09 am
Christophe
ArtV: not with the OOTB Gantt view, as the returned data don’t have the granularity you need.
Take a look at this other option:
http://pathtosharepoint.wordpress.com/2008/10/29/gantt-view-first-test/
May 11, 2009 at 10:18 pm
mike
Hi Chris,
Great stuff. We’ve just started using Sharepoint and your solution for the gantt chart is what we’re looking for. Is there a simple way to format the date to be in the mm/dd/yyyy so that it is consistent (instead of 5/3/2009, 5/10/2009 it would be 05/03/2009, 05/10,2009) etc. or Mar 09 within the css code itself? Thanks for your help.
June 12, 2009 at 3:05 pm
Jay M
Hey there,
Would you please provide the code for your live demo? http://8002.freesharepoint2007.com/Lists/Gantt/GanttDefault.aspx I love the slider and date format “Jan 09″
Thank you so much! Your work is awesome!!
Jay
June 13, 2009 at 2:40 am
Christophe
Jay, the link is at the bottom of the post.
August 17, 2009 at 7:42 am
Aaron
If you wish to just hide the task listing under the ghant chart, ie to display the gannt chart only , under the code
place the following;
.ms-summarystandardbody {Display: none;}
You now have only the gannt chart.
August 17, 2009 at 7:47 am
Aaron
http://tiny.cc/mz3tV
September 11, 2009 at 10:10 pm
Joe A
Your site is great! This is probably a simple question but I am new at this. How would I remove the task list under the Gantt. It forces me to have a list one column. I actually have a different webpart view that I prefer to add to the page but then it gets redundant. Thanks Joe
September 13, 2009 at 11:46 pm
Aaron
Joe A – refer to http://tiny.cc/mz3tV to remove the task listing.