How to scale down the SharePoint Gantt view

fullyearIn 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;}

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:
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!

89 thoughts on “How to scale down the SharePoint Gantt view

  1. 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.

  2. 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!!

  3. 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.

  4. 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.

    • Did you find a solution for this – to make Gantt View window render only today and greater without having to move the slider?

  5. 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.

  6. 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”.

  7. 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.

  8. 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!


    from Holland

  9. 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…

  10. 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?

  11. Pingback: SharePoint Gantt View: adjusting the scale « The Central Solutions Team Blog

  12. 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.

  13. Pingback: Adding a Toggle Daily/Weekly Tasks button to the Project Tasks list « SharePoint NutBag’s Weblog

  14. Pingback: A slider for the Gantt view « Path to SharePoint

  15. 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.

  16. 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?


  17. 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?

  18. 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

  19. 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.

  20. 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.

    • Great postings on this site everyone, very helpfull for a non SP expert like myself.

      I was trying to delete the task listing myself adding the comment ‘.ms-summarystandardbody {Display: none;}’ in a content editor web part to my gantt view, but for some reason this comment text just remains in the content editor web part and does not change anything in my gantt chart.

      Do you have a clue what I could have done wrong?

      Thanks in advance!


        • Sorrt Christophe, but my knowledge goes so far that I do not even know what a style tag is considered to be. What I did is I copied the comment .ms-summarystandardbody {Display: none;} into the content editor web part, source editor. Just like what I did with another solution to change the date view at the top of the gant. But in this case it did not work, whereas with the date view it did work.
          Should I enter this code in another place?

  21. 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

    • I would agree with the replies already posted. Would you expect MS to let you do scheduling easily and bypass its Project Server application?

  22. 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;}

    • 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?

  23. heres a quicked hacked together way of displaying months only, probably something better, but it works.

    var months=new Array(“Jan”,”Feb”,”Mar”,”Apr”,”May”,”Jun”,”Jul”,”Aug”,”Sep”,”Oct”,”Nov”,”Dec”);
    var gccount=0;
    var gcolumns=new Array();
    var d=$(this).text().split(“/”,3);
    d[2] = d[2].replace(“20″,”‘”);
    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]){

    .ms-ganttInnerTable IMG {width:7px;}
    .ms-ganttDetailTimeUnitRow {display:none;}
    .ms-ganttMajorTimeUnitHeaderCell {writing-mode:tb-rl;filter:flipv fliph;}

    • 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?

      • @ Fooms
        Thank you for replying, could you please give us some additional instructions on how to implement the code? Thank you!

        • 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=";}{/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 });


          and than change the InnerTable IMG width to 2px.

    • Hi Fooms,

      Thanks for your post and magic script 🙂
      With this code we are displaying the month in the last column/week of the month. Is there any chance to show the month in the first week of the month (when the month changes)?

      Thanks a lot again for your very helpful script 😉

  24. 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.

  25. 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?

    • 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?

  26. 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?


  27. Does this montly js mentioned work in SP 2010? I tried but not working. Can you please tell is there anything that i am missing?

  28. SP 2010 has Zoom in/zoom out buttons but my requirement is preserve the state i.e. if i want preserve monthly scale than how can i achieve this on the web part.
    Current OOB feature does not allow to preserve the state. Is there any way to do this?

  29. is there anyway to limit the way the script works to just one of n gantt view on a single page?

    e.g. i have to gantt views based on two different list displayed on one page

    ideally I’d like to have 1 in default day/week scale and one in week/month

    tried playing around with adding page view web part and pointing that to another page that has the CEWP with the script, but can’t control it enough to exclude nav left, right and top


    • ali, that’s how css works: it applies to classes of elements. It is usually seen as an advantage, your case is an exception.
      There are various ways to handle your issue (the PVWP is one of them), but the bottom line is that you’ll need to write custom code to make it work.
      You could also consider using my Gantt slider, to draw a dynamic timeline. Search my blog for the free version, or contact me directly for other options.

  30. Thats very interesting being able to modify views. Do you know how to alter the normal calendar views on sharepoint so that their is a term by term view rather than month, week or day. Being able to see 10 weeks at a time (with no weekends) is important for my school. Is this difficult to do? Currently we are using sharepoint 2003 but upgrading to 2010 shortly.

    • Peter: in SP 2007, I used the Easy Tabs to display multiple calendar views on the same page. It seems harder to do in SharePoint 2010, I haven’t yet figured out how to point to a specific month.

  31. So, this is pretty cool. Can this same thing be done with a SharePoint list? Would it be possible to display column names vertically rather than horitzontally? This would be great in saving space and displaying more information at a glance.

    • You could apply the css to list columns, but 1/ not sure what would happen to the context menu (sort, filter) and 2/ this only works in Internet Explorer.

  32. Thanks for such a informative post.
    Do you know if there is any way to show the columns by Quarters (Q1, Q2, Q3, Q4)?

    • Max, there are other variations of this Gantt solution. Some are published on this blog (use search), others are available in my online workshops or one-on-one sessions.

  33. Hi

    Ive used this code and it works exactly as i wanted it to, however it removes some of our options on the top of the Sharepoint site within the page that i apply the code, the option we are loosing the the MySite function within Sharepoint, do you have any ideas how i can make the code work without removing the MySite feature?

    Thanks in advance

    • Sorry, I have no idea. I see nothing in these few lines that could hurt the rest of the page. Are you sure it’s not due to another customization?

  34. Hi,

    Thanks for a SUPER great forum. Im currently building a list of approval dates for a certain list of countries. This should be visuable, therefore I stared out using the Gantt view.

    I have tried to work with some of your suggestions to get the date-view scaled down! GREAT!

    My issue is:
    All approval dates starts a same time: (lets say t=0) Will it be possible to get it shown in the gantt chart like this starting from the same point and then on a weekly basis.

    Argentina (6 weeks)
    Australia (12 weeks)
    Austria (3 weeks)

    I think my issue is kind of the same as Laura’s issue

    Thank you soo much in advance

  35. Thanks for the solution. It was precisely what I needed for correctly displaying an annual project schedule timeline. Those of you who take the time to write up solutions that others can use are appreciated more than you will ever know!

  36. I read the CEWP link and have used the Content Editor Web Part, but I don’t understand what it means to use CEWP to drop the code onto the page. I’m in the Task View with its default Gantt chart. If I added a new CEWP to this page and pasted in your code, how does it know what the source data is?

    Thank you.

  37. Oh, I get it! The CEWP adds code to the whole page, not just its own specific little box. So it doesn’t make anything show up on its own; it modifies what you see in the Gantt chart that follows. So I’m not the sharpest crayon in the box. 😉 Great tutorial.

    • Well, it didn’t take you long to figure it out 🙂

      Most of the techniques in my blog are based on such “progressive enhancement”, that’s why I don’t repeat the details on every post.

      • Hi Christophe,
        I’m looking for a solution to display “hour scale” on 1/2 days…
        I didn’t find anything in the lot of post.
        Do you know an issue…

  38. Hi christophe, may I get the code for the live demo version, the link that you’ve posted dont seem to work

  39. Hi Christophe,

    I was used your program code in my case .
    but now , we have a requirement for this what is yellow line as current time,
    I want to change this yellow line that is current time to red line or others colors line .
    could you have any idea to do this .


  40. Hi Christophe,

    Can you provide me the code to group the dates by month, so far I have use your code to align the dates and the percentage grouping, but now I’m very interesting to group things by month, Thanks a lot.

  41. Hi Christophe,
    This is really useful! I was wondering whether is possible to set up this code in the way to brake down the timeline by hours. My project tasks are very short, should becompleted in few hours. I would like to use it as a status report, but I cannot brake down the tasks by hours.
    Any help is welcomed.


    • I think I’ve seen that but it was long ago and I can’t remember where. Also, double scrolling (horizontal+vertical) is really difficult so most likely you’ll have to give up one to get the other.

Comments are closed.