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!

49 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.
January 28, 2010 at 2:44 pm
Tony
Christopher, This “Gantt” view utilizing the Months is great and I could use that. (http://www.pathtosharepoint.com/Gantt/Lists/Project%20Tasks/gantt.aspx)
Could I get the code that you have used on this site.
January 30, 2010 at 4:11 am
Christophe
Tony, how did you get there
This is part of our Gantt online workshop.
March 4, 2010 at 2:27 am
jordon8844
Thanks for such a informative post.
I was having trouble with something as follow and hope you could help me with this?
http://www.go4sharepoint.com/Forum/sharepoint-msproject-432.aspx
Thanks in advance.
March 5, 2010 at 11:27 am
Christophe
I would agree with the replies already posted. Would you expect MS to let you do scheduling easily and bypass its Project Server application?
March 29, 2010 at 6:01 am
Amir
Great work! I implemented your solution for vertical dates, but our resolution is of months rather then weeks. Is there a simple way to change the time scale for months? Something similar to the original week code but by month or even year.
.ms-ganttInnerTable IMG {width:2px;}
.ms-ganttDetailTimeUnitRow * {display:none;}
.ms-ganttInnerTable .ms-ganttMajorTimeUnitHeaderCell {writing-mode: tb-rl;filter: flipv fliph;border:0;}
April 15, 2010 at 9:10 pm
Deb
It even works in Firefox!
Thanks.
April 19, 2010 at 6:41 pm
Sue-Li
Do you have code available for this:
http://8002.freesharepoint2007.com/Lists/Gantt/GanttDefault.aspx
We really need a solution for a gnatt chart with a monthly view. Please let me know, thank you!
April 21, 2010 at 5:41 pm
Sue-Li
Actually,
That link above doesn’t really solve the problem, mostly we just need a gnatt chart monthly view, I just notices your gnatt is still organized by weeks. Is there a way to get that fixed, or possible a soltion to buy?
April 26, 2010 at 7:31 pm
Fooms
heres a quicked hacked together way of displaying months only, probably something better, but it works.
$(document).ready(function(){
var months=new Array(“Jan”,”Feb”,”Mar”,”Apr”,”May”,”Jun”,”Jul”,”Aug”,”Sep”,”Oct”,”Nov”,”Dec”);
var gccount=0;
var gcolumns=new Array();
$(“.ms-ganttMajorTimeUnitHeaderCell”).each(function(){
var d=$(this).text().split(“/”,3);
d[2] = d[2].replace(“20″,”‘”);
gccount++;
gcolumns[gccount] = months[d[0]-1]+d[2];
});
for(var n=0;n<gccount;n++){
for (var a=n+1;a<gccount+1;a++){
if (gcolumns[n]==gcolumns[a]){
gcolumns[n]=""}
}
}
gccount=0;
$(".ms-ganttMajorTimeUnitHeaderCell").each(function(){
gccount++;
$(this).html(gcolumns[gccount]);
});
});
.ms-ganttInnerTable IMG {width:7px;}
.ms-ganttDetailTimeUnitRow {display:none;}
.ms-ganttMajorTimeUnitHeaderCell {writing-mode:tb-rl;filter:flipv fliph;}
April 27, 2010 at 9:35 am
Amir
I am not sure if I implemented this correctly. Being a non-programmer, I assumed the upper part is a JS, so I wrapped it with tag (and the other part as CSS).
This did not work for me. The page appeared just the same as without the code at the top. Do I miss something?
May 4, 2010 at 5:01 pm
Sue-Li
@ Fooms
Thank you for replying, could you please give us some additional instructions on how to implement the code? Thank you!
May 5, 2010 at 2:54 pm
Fooms
ah sorry it stripped the scipt tags when posting the code, this is all based off some modified code of chirtophe’s so just look at one of his jquery examples if you get confused, but simply just add(and replace the {‘s with <'s when you do) {script src="http://jquery.com/src/jquery-latest.js"}{/script} at the top, than eclose the javascript in a script tag and the 3 lines of css in a css tag and that'll make it work,
if you want to shrink it even a bit more than add this into the script section just above the last });
$(".ms-ganttDetailTimeUnitRow").each(function(){
$(this).html("");
});
and than change the InnerTable IMG width to 2px.
May 20, 2010 at 3:37 am
Mukul
Is there a by which i can change the view to hourly rather then dates/weeks on gantt chart.
Example, if one of my task is for 4 hours i need to see a bar on the gantt chart rather than a diamond. This can be done only if my timescale is in hours for each day.
June 4, 2010 at 4:11 am
Christophe
You’ll need to use a custom rendering tool, as the SP Gantt doesn’t have this level of granularity.
June 9, 2010 at 11:00 am
Mark Uden
I’ve modified the code to address two issues I had.
Firstly, I couldn’t be sure which date format my users would see, so I added a extra loop through the header cells to check if middle section of the date was greater than 12, indicating that it must be day, not a month. This sets a variable called “monthIndex” to the number of the array element the code should use when extracting the month. I’m not sure this is bullet-proof, but the Gantt chart covers a long period so it should be okay.
Secondly, I wanted just one header cell per month, so the code compares the month of “this” header cell to the previous one. If they are the same, the colspan of the previous one is increased and this” header cell is removed.
I’m only just starting with jQuery, and I don’t have much experience in JavaScript, so it probably needs improving, but it works for now.
Two things I’m not sure about… How do I set the slidebar default “zoom” to something other than 100%? I’ve tried setting it to 35% in my code, but it doesn’t work until I click the slidebar. Also, is it necessary to use the freesharepoint2007 jQuery libraries or will the ordinary Google ones suffice?
June 15, 2010 at 9:07 am
Christophe
Mark, you should use your own jQuery files, or the Google ones, not mine. Make sure you pick the right version.
Did you try startvalue:35?
August 23, 2010 at 3:42 pm
Laura
The rotating aspect is great!
Our Company goes by “T weeks” (not sure where the “t” comes from)
So this week is T-1. next week T-2 and so on. We go by this so we know how far out a project is planned. Something in T-4 is 4 weeks from now.
Also something to mention is that the dates for a project for next week (T-2) will become T-1 next week.
That being said is there a way to add a line to the columns so that it displays 8/22/2010 and below it T-1? And so it updates next week to show T-1 under it when next weeks comes?
Thanks,
Laura