Marjan,
The scales seems ok now, but:
0. The timgrid (under the lines) is not the same as what the chart shows. This is difficult for handling mouseclicks, read and edit the Gantt serie items, etc.
1. I use addganttcolor instead of addXY and with addganttcolor I don't see any Gantt appear in the chart. The
2. I have lines on every 2 hours over 7 days. What to do with adding gantts if the time of the serievalue is in between the lines? f.e. if you have lines at 08:00 , 10:00, 12:00,etc and a gantt starting time at 09:37?
3. How do you manage the reading of the series on mouseclicks?
4. How do you manage the reading of the chart(timescale display) on mousemovement?
Hans
Timescale in ganttchart
Still not working
Marjan,
Do you have time to check my above mentioned "new" problem?
Thanks,
Hans
Do you have time to check my above mentioned "new" problem?
Thanks,
Hans
please help us, we are waiting for weeks now
Marjan,
Do you have time to check my above mentioned "new" problem?
Thanks,
Hans
Do you have time to check my above mentioned "new" problem?
Thanks,
Hans
Hi, Hans.
Re #0 : What exactly do you mean by "time grid" ? Chart and series OnMouse and OnClick events will (as usual) return clicked series point index. Because you used sequential values for x values, in your case ValueIndex is equal to point x value. You'll have to store actual datetime (x) in separate array and then make the connection by yourself.
Re #1 : If you're using AddGanttColor method then you're specifying start and end point for "x value" so you'll have to apply the same rules as for single point -> collect all valid dates, then use the approach I suggested, but this time for start and end x value.
Re #2 : Hmm... You'll have to recreate valid datetime array and repopulate series with data. Using the trick I showed you. It can get complicated, but eventually you'll still be able to get the results you're after.
Re #3 & #4: Use Series OnClick event to retrieve clicked point ValueIndex (index). Then use this integer value to find a match in your datetime arrays (or in series YValues values, if you need the vertical position of each Gannt bar).
Re #0 : What exactly do you mean by "time grid" ? Chart and series OnMouse and OnClick events will (as usual) return clicked series point index. Because you used sequential values for x values, in your case ValueIndex is equal to point x value. You'll have to store actual datetime (x) in separate array and then make the connection by yourself.
Re #1 : If you're using AddGanttColor method then you're specifying start and end point for "x value" so you'll have to apply the same rules as for single point -> collect all valid dates, then use the approach I suggested, but this time for start and end x value.
Re #2 : Hmm... You'll have to recreate valid datetime array and repopulate series with data. Using the trick I showed you. It can get complicated, but eventually you'll still be able to get the results you're after.
Re #3 & #4: Use Series OnClick event to retrieve clicked point ValueIndex (index). Then use this integer value to find a match in your datetime arrays (or in series YValues values, if you need the vertical position of each Gannt bar).
Marjan Slatinek,
http://www.steema.com
http://www.steema.com
Extra Code requested
It looks like we have to write complete new tables, indexes, coordinates,etc. Very complex.
Re #1 Could you give some delphi code for the Addganttcolor? This is what I don't understand and tried, but not succeeded. Based on your example.
Thanks
Hans
Re #1 Could you give some delphi code for the Addganttcolor? This is what I don't understand and tried, but not succeeded. Based on your example.
Thanks
Hans
Hi, Hans.
1) generate the list of all "valid" (date)time values
2) for each x value find a match in the ValidDate array and then use returned index as point x value.
For AddGanttColor this only means that you have to map Gantt bar start and end value:
Sure, no problem. The idea is the same as for simple x-y series type (as outlined in my prevous posts):some delphi code for the Addganttcolor?
1) generate the list of all "valid" (date)time values
2) for each x value find a match in the ValidDate array and then use returned index as point x value.
For AddGanttColor this only means that you have to map Gantt bar start and end value:
Code: Select all
// + code from my previous posts
var startxvals: Array[0..1] of TDateTime;
endxvals: Array[0..1] of TDateTime;
yvals: Array[0..1] of double;
i,sind,eind: Integer;
begin
// 1st Gannt bar
startxvals[0] := EncodeDate(2005,1,31)+EncodeTime(9,0,0,0);
endtxvals[0] := EncodeDate(2005,1,31)+EncodeTime(11,0,0,0);
yvals[0] := 1;
// 2nd Gannt bar
startxvals[1] := EncodeDate(2005,1,31)+EncodeTime(13,0,0,0);
endtxvals[1] := EncodeDate(2005,1,31)+EncodeTime(15,0,0,0);
yvals[0] := 0;
Series1.Clear;
for i := 0 to High(startxvals) do
begin
sind := FindMatch(startxvals[i],ValidDates,0,DateCount-1);
eind := FindMatch(endxvals[i],ValidDates,0,DateCount-1);
if (sind <> -1) and (eind <> -1) then Series1.AddGanttColor(sind,eind,yvals[i],clTeecolor);
end;
Marjan Slatinek,
http://www.steema.com
http://www.steema.com