|
|
Comments and Discussions
|
|
 |

|
in My project, I have list item. for each item have gantt chart.
when user click on item, system will load grantt chart'item.
I meet problem when user click other item the your lib need to deplay time for refesh and draw chart again.
How to add waitting cursors when your lib draw chart ( I had add cursors in my code but it not effect).
|
|
|
|

|
Here is a very simple example how to add text to the center of each bar. You can adjust to fit your application, create a new sub to populate from your data source or add a new property 'bar.text' etc.
After the code in GanttChart.vb
grfx.DrawRectangle(Pens.Black, obRect)
grfx.FillRectangle(obBrush, obRect)
Add this:
Dim txt As String = "raz" & ControlChars.CrLf & "dwa" & ControlChars.CrLf & "trzy"
Dim txtFont As New Font("Arial", 10)
Dim txtWidth As Integer = grfx.MeasureString(txt, txtFont).Width
Dim txtHeight As Integer = grfx.MeasureString(txt, txtFont).Height
Dim barWidth As Integer = bar.TopLocation.Right.X - bar.TopLocation.Left.X
If txtWidth < barWidth And txtHeight < barHeight Then
grfx.DrawString(txt, txtFont, Brushes.Black, (barWidth / 2 - txtWidth / 2) + bar.TopLocation.Left.X, (barHeight / 2 - txtHeight / 2) + bar.TopLocation.Left.Y)
End If
This will only work if the text will fit inside the bar. My bars are 108 pixels tall so i can fit several lines but if yours are small or the default size, try one line
|
|
|
|

|
In the example chart 1 contians days while the upper only month, how to control it???
|
|
|
|

|
Currently it is only controlled automatically based on the time between first date and last date. You might want to look at the function GetFullHeaderList
|
|
|
|

|
Kanon Adrian
Fandt din kode ved et tilf�lde - lige hvad jeg manglede
/Morten
|
|
|
|

|
Er glad for at du kan bruge det
|
|
|
|

|
Why two almost identical for loops ?
The bar is not yet needed!!!
The foreach Loop is needless
The Speed will increase dramatically
Optimised version:
Private Sub DrawNetHorizontal(ByVal grfx As Graphics)
Dim FUN As String = "DrawNetHorizontal"
Dim index As Integer = 0
Dim width As Integer = 0
Try
If shownHeaderList Is Nothing Then Exit Sub
If shownHeaderList.Count = 0 Then Exit Sub
index = 0
width = (widthPerItem * shownHeaderList.Count) + barStartLeft
For index = 0 To GetIndexChartBar("QQQQQQ")
Try
grfx.DrawLine(lineColor, 0, barStartTop + (barHeight * index) + (barSpace * index), width, barStartTop + (barHeight * index) + (barSpace * index))
Catch EXC As Exception
End Try
Next
lastLineBottomStop = barStartTop + (barHeight * (index - 1)) + (barSpace * (index - 1))
Catch EXC As Exception
End Try
End Sub
Greetings
vmeyer
|
|
|
|

|
Hi, is there a way to show text on bars permanently?
|
|
|
|

|
Hello,
got it running now, found the dll.
how can i achieve a larger vertical spacing for the bars or even broaden them ?
Greetings
mjfuchs
|
|
|
|

|
Hi,
try to change the code line:
Private barHeight As Integer = 9
in GanttChart Class. If you increase the value the bars get heigher.
If you need more space between the bars lines change the code line:
Private barSpace As Integer = 5
Have a nice day.
modified 4-Nov-12 8:46am.
|
|
|
|

|
Hello,
i found this an liked it very much. I am using VB 2010 Express and whenn starting the sample it works. but i do get the following message:
Warnung 1 Der Typ "TestApplication.GanttChart" wurde nicht gefunden. Stellen Sie sicher, dass auf die Assembly, die diesen Typ enthält, verwiesen wird. Wenn dieser Typ Teil Ihres Entwicklungsprojekts ist, stellen Sie sicher, dass das Projekt mithilfe der Einstellungen für die aktuelle Plattform oder eine beliebige CPU erstellt wurde. 0 0
My Questions:
How do i get rid off that message because i want to write a deliverable application ?
Where do i find the control object to integrate it in my own applications/forms ?
Are there any references /DLL or anything to load to get the control ?
Greetings Matthias
|
|
|
|

|
Hello,
how to make signatures on blocks?
Sorry, My English is bad!
|
|
|
|

|
Hi there,
Firstly big thanks to Adagio.81 for your contribution and time in making this control!
I've converted the GanttChart to C#, but I'm having difficulty with it if anyone can help on these 2 issues (class added below)?
1) Initially it was causing VS to crash so I've temporarily excluded the paint method from firing when in design mode
2) It's loading all bars with 1 pixel width irrespective of the values you put in?
Sample Bars:
ganttChart1.FromDate = new System.DateTime(2009, 1, 1, 0, 0, 0);
ganttChart1.ToDate = new System.DateTime(2009, 12, 31, 0, 0, 0);
List lst = new List();
lst.Add(new BarInformation("Row 1", new System.DateTime(2009, 1, 1), new System.DateTime(2009, 5, 1), Color.Gray, Color.LightGray, 0));
lst.Add(new BarInformation("Row 2", new System.DateTime(2009, 1, 1), new System.DateTime(2009, 7, 1), Color.Gray, Color.LightGray, 1));
lst.Add(new BarInformation("Row 3", new System.DateTime(2009, 5, 1), new System.DateTime(2009, 8, 1), Color.Gray, Color.LightGray, 2));
lst.Add(new BarInformation("Row 2", new System.DateTime(2009, 10, 1), new System.DateTime(2009, 12, 1), Color.Gray, Color.LightGray, 3));
lst.Add(new BarInformation("Row 1", new System.DateTime(2009, 8, 1), new System.DateTime(2009, 11, 1), Color.Gray, Color.LightGray, 4));
foreach (BarInformation bar in lst)
{
ganttChart1.AddChartBar(bar.RowText, bar, bar.FromTime, bar.ToTime, bar.Color, bar.HoverColor, bar.Index);
}
Class:
http://pastebin.com/RdttF899
Kind Regards
Chris
___________________________
"There are 10 types of people in the world.
Those that understand binary... and those that don't!"
|
|
|
|

|
Hi again,
I've posted new changes to the C# version of the Gantt Chart - http://pastebin.com/b6HsgvXN[^]
It's now displaying the bars and layout correctly. I'm currently working on (adding) a "BarChanging" event for the control.
Will keep you posted.
Kind Regards
Chris
___________________________
"There are 10 types of people in the world.
Those that understand binary... and those that don't!"
|
|
|
|

|
Hallo great Project - very nice How can i add more Rows? I trying this for testing..... Dim lst As New List(Of BarInformation) lst.Add(New BarInformation("Row 1", New Date(2011, 7, 3), New Date(2011, 7, 5), Color.Aqua, Color.Khaki, 0)) lst.Add(New BarInformation("Row 2", New Date(2011, 7, 1), New Date(2011, 7, 2), Color.AliceBlue, Color.Khaki, 1)) lst.Add(New BarInformation("Row 3", New Date(2011, 7, 5), New Date(2011, 7, 7), Color.Violet, Color.Khaki, 2)) lst.Add(New BarInformation("Row 4", New Date(2011, 7, 3), New Date(2011, 7, 5), Color.Aqua, Color.Khaki, 3)) lst.Add(New BarInformation("Row 5", New Date(2011, 7, 6), New Date(2011, 7, 5), Color.Aqua, Color.Khaki, 3)) but the row 5 overwrite row 4. Can you help me?
|
|
|
|

|
Try to change the row index number for the last row. Both row 4 and 5 is set to use row index 3
Color.Aqua, Color.Khaki, 3))
The bolded part is the row index. Change that number to 4 and it will add a new row. The first row has index 0, second row has index 1, etc
Hope that helped
|
|
|
|
|

|
How Can add another text column HELP
|
|
|
|
|

|
I found the code that caused the ghost bars and I fixed it for you:
If bar.StartValue < FromDate Then
lengthTimeSpan = endValue - FromDate
Else
lengthTimeSpan = endValue - bar.StartValue
End If
Now bars won't draw when they don't need to be drawn.
|
|
|
|

|
Hello,
First of all I wanted to thank you for your amazing control, it has been a real life-saver for me!
I have been trying to make the chart bar a bit "dynamic", I can increase / decrease the days, go to month view, etc...
But I have encountered a small glitch, when I navigate to the next day there is a bar that shouldn't be there (also nothing happens when I hover over it)
This my example: I added an event on the 25th of december, from 10 to 12.
public Chart()
{
InitializeComponent();
ganttChart1.FromDate = new DateTime(2012, 12, 24, 08, 0, 0);
ganttChart1.ToDate = new DateTime(2012, 12, 24, 18, 0, 0);
DateTime test = new DateTime(2012, 12, 25, 10, 00, 00);
DateTime test2 = new DateTime(2012, 12, 25, 12, 00, 00);
ganttChart1.AddChartBar("Row 1", null, test, test2, Color.Aqua, Color.Khaki, 0);}
ganttChart1.AddChartBar("Row 2", null, test, test2, Color.Red, Color.DarkRed, 1);
This appears correctly like this: [^]
Now I used this code to navigate to the next day:
private void button1_Click(object sender, EventArgs e)
{
DateTime newFrom = ganttChart1.FromDate.AddDays(1);
DateTime newTo = ganttChart1.ToDate.AddDays(1);
ganttChart1.FromDate = newFrom;
ganttChart1.ToDate = newTo;
ganttChart1.PaintChart();
ganttChart1.Refresh();
}
But when I click that button, a strange chart bar appears from the beginning of the Gantt Chart (no matter what the start hour is), it's also the exact same length as the normal event on the previous day. http://localhostr.com/file/f2HdDA2/gantt_2.png[^]
I have no idea what's causing this. This "Ghost" chart bar doesn't appear when I go back in the days or when I go to month view.
private void button2_Click(object sender, EventArgs e)
{
DateTime newFrom = ganttChart1.FromDate.AddDays(-1);
DateTime newTo = ganttChart1.ToDate.AddDays(-1);
ganttChart1.FromDate = newFrom;
ganttChart1.ToDate = newTo;
ganttChart1.PaintChart();
ganttChart1.Refresh();
}
private void btnMaand_Click(object sender, EventArgs e)
{
DateTime newFrom = new DateTime(ganttChart1.FromDate.Year, ganttChart1.FromDate.Month,1);
DateTime newTo = new DateTime(ganttChart1.ToDate.Year, ganttChart1.ToDate.Month, 31);
ganttChart1.FromDate = newFrom;
ganttChart1.ToDate = newTo;
ganttChart1.PaintChart();
ganttChart1.Refresh();
}
I'm sorry to bother you with this problem, but I can't figure it out.
Thanks,
Thomas
|
|
|
|

|
Do you have c# version??I want to study it.Thanks!
|
|
|
|
|

|
Not working very well. The tool tips are buggy but good work anyway.
modified 31-Dec-11 1:35am.
|
|
|
|

|
thanks maan if only you knew how manny lives you have saved you are a hero
|
|
|
|

|
Exactly what I was about to write. Massive timesave and excellent tool.
|
|
|
|

|
i need some help i need to add a text box for adding date ranges near row number column
can u help me with that i really need this help
|
|
|
|

|
hj Adagio
I want to use this chart in C# form for studying
Could you help me convert this code?
Thanks so much!^^
|
|
|
|

|
I don't have a C# version of this code available, can't help you there, sorry
But you can try to get some help from the vb.net to C# converters that are available. They aren't going to make it perfect, but might help you convert it
|
|
|
|
|

|
rongconmocrang wrote: I want to use this chart in C# form for studying
Could you help me convert this code? Hi, Check this blog post .NET Code Conversion[^]
|
|
|
|

|
I learn VB.Net and GDI+ just to make ganttchart and s curve in my application, and you open my view widely by this code and nice control. Thank you. May God bless you for success life.
|
|
|
|

|
Thanks, glad you like it
I'm not good at GDI+ either, but I did learn a lot from doing this project
|
|
|
|

|
Exactly what I needed!
Managed to modify it a bit, adding a type to the barinformation which now displays in the tooltip.
And changed the line with comment ' The minimum interval of time between the headers ' to use 15 minutes so it has a more logical time scale in day view.
Sorry to hear you lost interest in further development, the control certainly fills a gap.
If anyone adopts this project and builds the horizontal ruler that would be great!
|
|
|
|

|
Glad you could use it and modify it to fit your needs
While I haven't lost interest in the project, there just isn't enough time to continue work on this project. I would love to do some more work on it, but I have tons of other higher priority projects at the moment
|
|
|
|

|
Dear Adagoi
This is very nice and Usefull Control u made...
There were Lots of Limitation in Crystal Report for Gantt Chart
bt you made is easy and Proper..
Great job....
Thanks Again...
Wish you Success ahead
Sandip Mevada
|
|
|
|
|
|

|
Thanks
|
|
|
|

|
I need this code for c#,I want to study,
my email:lawdoor@126.com
thanks
thanks
|
|
|
|
|

|
Hi Adagio,
great control. Tried it and made some changes.
Added properties:
Private m_bShowHeader As Boolean = True
Private m_bShowRowInfo As Boolean = False
Private m_bShowNetHorizontal As Boolean = True
Private m_bShowNetVertical As Boolean = True
Private m_bShowGrid As Boolean = True
* Disable the header
* Ability to show text under each bar (extra list)
* Disable the grid
* Change barspace
* Change BarHeight
* Extension to object to put text in each bar with alignments Left, Center and Right
Bug 1:
I noted that when the date-time does not start with a full hour (like 17:00) but with minutes (like 16:53) than the bars don't start at the correct position. But I haven't found the time yet to debug this.
Bug 2:
The control crashes when the form is minimized.
Cause : Resize event inside the control should be changed as follows
If lastLineStop > 0 Then
If Me.Width = 0 Then
'--- Prevent Crash when application is minimized. Function cause exceptions.
Else
objBmp = New Bitmap(Me.Width - barStartRight, lastLineStop, Imaging.PixelFormat.Format24bppRgb)
objGraphics = Graphics.FromImage(objBmp)
End If
End If
Loved the way you used the regions to make you code very comprehensible.
Really great job.
Rene
|
|
|
|

|
How does the 'Change bar with mouse' work? Can you move the endpoints of a bar with the mouse? I've tried but doesn't seem to work.
|
|
|
|

|
Sir. I want to show the graph in a ticks(100ns) way.
I set the starting time and ending time as follow:
.FromDate = New Date(1)
.ToDate = New Date(9999999999)
, and the result shows the column "1-1 0:00(starting time) to 0:15(ending time)."
Was there any mistake I did?
Could I have it to 1~9999999999 ?
Thanks
|
|
|
|

|
very nice article, can u guide me how can i add horizontal scrollar... thanks in advance
|
|
|
|

|
Is there any news about horizontal scrollbar?
|
|
|
|

|
Sorry, unfortunately no, I haven't really had time to improve on this yet. Don't expect any more updates :(
|
|
|
|

|
Maybe you can hor. scroll via two buttons. Just change start and end date. This should work
|
|
|
|

|
I am use vb.net 2008 is a develop appliction. but i can't use componant this?
Please hlep me?
If Them have advice for free grant chart. please tell me.
|
|
|
|

|
Great job...
If you have new version of the control then please upload it.
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.
|
Adds an easy to use Gantt chart to your application.
| Type | Article |
| Licence | CPOL |
| First Posted | 3 Oct 2007 |
| Views | 207,984 |
| Downloads | 12,325 |
| Bookmarked | 222 times |
|
|