5,316,172 members and growing! (17,876 online)
Email Password   helpLost your password?
Languages » VB.NET » General     Intermediate License: The Code Project Open License (CPOL)

Gantt Chart

By Adagio.81

Adds an easy to use Gantt Chart to your application
VB, Windows, .NET 2.0, .NETVisual Studio, VS2005, Dev

Posted: 3 Oct 2007
Updated: 3 Oct 2007
Views: 34,786
Announcements
Want a new Job?



Search    
Advanced Search
Sitemap
24 votes for this Article.
Popularity: 6.15 Rating: 4.45 out of 5
1 vote, 4.2%
1
1 vote, 4.2%
2
2 votes, 8.3%
3
1 vote, 4.2%
4
19 votes, 79.2%
5
Note: This is an unedited contribution. If this article is inappropriate, needs attention or copies someone else's work without reference then please Report This Article
Screenshot - PIC2007102743269504.jpg

Introduction

This component makes it easy to add a Gantt Chart to your application. You just need three lines of code to get it working

The Gantt Chart includes these features:

  • The columns are automatically shown based on the width of the component and the time between the start date and end date. If there's more than 2 days between those dates, it will only show the date, otherwise it will show the time of the day (with min. 5 minutes apart)
  • You can set the color (incl. hover color) for each bar individually
  • The Gantt Chart automatically shows a custom scroll bar when it contains more rows that the visible area allows
  • You can easily obtain information about the bar when hovering your mouse above one
  • An easy to use multi row tooltiptext

Background

I tried to find a good free and easy Gantt Chart to use in my project, but didn't have any luck. Then I decided to make one myself, which actually was easier than I thought it would be

Using the code

To get the Gantt Chart component to show something you only need this:

// GanttChart1.FromDate = New Date(2007, 12, 12, 0, 0, 0)
// GanttChart1.ToDate = New Date(2007, 12, 24, 0, 0, 0)
// GanttChart1.AddChartBar("Row 1", Nothing, New Date(2007, 12, 12), 
    New Date(2007, 12, 16), Color.Aqua, Color.Khaki, 0))

As mentioned above this component also includes a multiline tooltiptext

// With GanttChart2
//      Dim toolTipText As New List(Of String)
//      toolTipText.Add("Time:")
// 
//      .ToolTipTextTitle = .MouseOverRowText
// 
//      .ToolTipText = toolTipText
// 
//     End With

When a tooltiptext-row includes the line is automatically bolded

It is also possible to save the Gantt Chart to an image file

// GanttChart2.SaveImage("C:\TestImage.jpg")

The included .zip file contains a project showing how to use it's different features

History

Version 0.54

The Gantt Chart can now be saved to an image file

---

Version 0.53

ScrollBar added to component

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Adagio.81



Location: Denmark Denmark

Other popular VB.NET articles:

Article Top
Sign Up to vote for this article
You must Sign In to use this message board.
FAQ FAQ Noise ToleranceSearch Search Messages 
 Layout  Per page   
 Msgs 1 to 25 of 43 (Total in Forum: 43) (Refresh)FirstPrevNext
Subject  Author Date 
GeneralRefresh Gantt ChartmemberUniBond9:49 7 Jun '08  
QuestionMonths of the yearmemberMember 40307994:35 2 Apr '08  
GeneralRe: Months of the yearmembertingspain23:12 13 Apr '08  
GeneralFeature suggestion..memberJohnny J.3:54 20 Dec '07  
GeneralRe: Feature suggestion..memberAdagio.812:10 14 Feb '08  
GeneralThe download link doesnt workmemberjaved008922:51 10 Dec '07  
QuestionPossible for a web form application?memberadb95hxo6:55 30 Nov '07  
AnswerRe: Possible for a web form application?memberMember 35728715:26 2 May '08  
QuestionToolTip TextmemberJonRoperUK3:02 22 Nov '07  
Generalused as library and included in other projectmemberden.ria12:24 21 Nov '07  
GeneralRe: used as library and included in other projectmemberAdagio.8122:58 21 Nov '07  
GeneralRe: used as library and included in other projectmemberden.ria16:15 22 Nov '07  
GeneralRe: used as library and included in other projectmemberAdagio.813:32 26 Nov '07  
GeneralRe: used as library and included in other projectmemberden.ria13:47 26 Nov '07  
GeneralRe: used as library and included in other projectmemberden.ria17:06 26 Nov '07  
GeneralRe: used as library and included in other projectmemberAdagio.812:56 28 Nov '07  
Generalresize the imagememberden.ria16:34 20 Nov '07  
GeneralRe: resize the imagememberAdagio.810:00 21 Nov '07  
GeneralRe: resize the imagememberden.ria9:42 21 Nov '07  
GeneralRe: resize the imagememberden.ria12:21 21 Nov '07  
QuestionProblem with ToolTipText?memberKenn Minear17:51 19 Nov '07  
AnswerRe: Problem with ToolTipText?memberAdagio.8123:58 20 Nov '07  
GeneralRe: Problem with ToolTipText?memberKenn Minear22:29 4 Dec '07  
GeneralMore FeaturesmemberSorin Dolha1:01 27 Oct '07  
QuestionHow do I add this to a project?memberItsBill10:41 18 Oct '07  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 3 Oct 2007
Editor: Sean Ewington
Copyright 2007 by Adagio.81
Everything else Copyright © CodeProject, 1999-2008
Web20 | Advertise on the Code Project