 |
|
 |
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.
|
|
|
|
 |
|
 |
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
|
|
|
|
 |
|
 |
Glad you like it
I also spent a lot of time trying to find a good gantt chart control that was easy to use, but wasn't really able to find one that fitted to my needs, but at least now there's a decent one around for free for everybody to use
|
|
|
|
 |
|
|
 |
|
 |
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
|
|
|
|
 |