Tuesday, January 10, 2006
A web part for rendering Gantt charts
I promised a month ago that I would post a web part for charting WSS data into a Gantt chart. Well, here it is. It looks somewhat like this:
The part allows you to specify a list and view to render. You select the fields from the view that will indicate the start and end date of an item. The third required field is the title field. Because the part works with view fields, you can also use calculated fields to specify the start date, end date or title of the item.
Because I was too lazy to create a custom designer, you have to enter the names of the list, view and fields in a textbox. When you specify incorrect values, the part will show you the available options in it's error message.
So you want to use it? I put up a zip file containing both the sources and binaries. I haven't made an installer, but I suppose that most of you know what to do with a dll and dwp file (otherwise, check here). In your web.config you'll have to add a line for trusting the part like this:
The web part is actually more of a sample of using the underlying GanttCharting library. This will render VML that can be directly included into the HTML (IE only!). The charting library has some features that are not used by the web part, but that you may want to build on:
- aggregation: each GanttItem can have a collection of sub-items. Items with sub-items will be rendered accordingly (see sample in this post)
- links: each item has a LinkUrl property that will be placed on the item. You could have the item link to the edit page of the item
- color: you can color each item as you wish
Labels: sharepoint
So add the StartDate field to your view.
The only time it worked was when I used the default "Event" webpart included in WSS. But since that webpart is not very flexible I would like to create my own task-list.
Each time there is a trouble with by start and due date.
It seems to only happen when you have a ListView of the list open on the page itself. As a workaround, I totally removed any reference to the lists. (In SPPS 2003, add the parameter "?contents=1" to the URL to see a list of all the webparts on the page.)
Once the references were totally removed and not just hidden, the gantt chart worked as expected.
One question. After I set up the fields as you show, I would get an error like:
Start field StartDate is not known. Try one of these: Attachments, LinkTitle, Start_x005f_x0020_Date, DueDate
Changing my 'StartDate' field to match what is in the error resulted in it working. But why the funny field name requirement?
I tried it using a different list and received an error where more fields had the _xxxx_xxxx_ inserted in the error.
What's up with that?
http://www.teuntostring.net/blog/2006/07/at-last-ganttchart-web-part-with.html
I'll pull down the new file and see if that resolves anything.
Curious, any intent to incorporate color?
Color is an interesting thought. Would you want to specify the color globally or per bar?
Some basic colour to blend with the site theme would be neat.
Thanks
My administrator says it cannot be installed because it's designed for 2.0.
Thanks,
Jim
http://www.teuntostring.net/blog/2007/03/gantt-chart-for-wss-3.html
However, read the comments, as it does not seem to work for everyone.
Links to this post:
<< Home



