Hi,
i'm using TeeChart Pro 2012 VCL (i'm pretty new in it) with Delphi XE2.
I add to a gantt serie 20 to 30 objects, by code using "AddGantt" method, and i wish to control a little better how it is displayed.
1. How can i force the drawing of the Gantt so it will not be displayed under the bottom axis Or on it (Only up)?
2. Which property do i need to use in order to control the spacing between each Gantt object? Sometimes i will draw 3 objects, other times it can be 20 or more, so esthetically speaking it will be nice if the spacing between the items could be kept.
3. There is a way to catch the new value of an extremity (right or left) of a Gantt object after it was modified by mouse(expanded or contracted)?
Best regards
Laurent
Gantt chart and display
Re: Gantt chart and display
Hi Laurent and welcome,
I'm not sure to understand what do you exactly mean. Could you please attach some screenshot or image showing it?AB Prod wrote:1. How can i force the drawing of the Gantt so it will not be displayed under the bottom axis Or on it (Only up)?
You should play with the axes scale for this. When the scale is automatic, the minimum and maximum are internally calculated to fit the values that are going to be drawn. Knowing the values that can be drawn, you can set the appropriate stale manually with SetMinMax function.AB Prod wrote:2. Which property do i need to use in order to control the spacing between each Gantt object? Sometimes i will draw 3 objects, other times it can be 20 or more, so esthetically speaking it will be nice if the spacing between the items could be kept.
Yes. The TGanttSeries has StartValues and EndValues TChartValueLists that store the star and end values of the gantt points. Note these values are TDateTimes, and delphi stores them as Doubles so you may have to transform them.AB Prod wrote:3. There is a way to catch the new value of an extremity (right or left) of a Gantt object after it was modified by mouse(expanded or contracted)?
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Gantt chart and display
Hi Yeray,
tnx for the welcome and the answers.
I'm attaching a snapshot about the first question.
About 2, i will check it.
About 3, i need TDateTime so it is perfect.
Best regards
Laurent
tnx for the welcome and the answers.
I'm attaching a snapshot about the first question.
About 2, i will check it.
About 3, i need TDateTime so it is perfect.
Best regards
Laurent
- Attachments
-
- Look at the bottom of the snapshot, there is much more data under the bottom axis, and i wish to display it from the bottom axis up and not form top like it is done now.
- Gantt_bottom_axis.JPG (176.62 KiB) Viewed 9805 times
Re: Gantt chart and display
Hi,
i found my mistake about my first question, i set the following values upon creation of the form:
// chtResults.LeftAxis.StartPosition := 0;
// chtResults.LeftAxis.EndPosition := 200;
By removing it, i now see data displayed above the bottom axis!
I tried what you wrote for the second point, it is ok now, but still i found it odd, that when setting the following (initialization stuff):
chtResults.LeftAxis.Automatic := False; // necessary for manual set of Min/Max
chtResults.LeftAxis.SetMinMax(0, 30);
then later adding the Gantt object (via AddGantt) that i do not need to recalculate the max value?
chtResults.LeftAxis.SetMinMax(0, 30*FPos); // this line in fact glue all the objects in the same area of the TChart making a mess
By commenting this line, the display got exactly the look i intend.
And for my third question, the TChartValueLists hold all the objects drawn on my Gantt chart isn't it? I can iterate through it to get the values of each Gantt object?
BR
Laurent
i found my mistake about my first question, i set the following values upon creation of the form:
// chtResults.LeftAxis.StartPosition := 0;
// chtResults.LeftAxis.EndPosition := 200;
By removing it, i now see data displayed above the bottom axis!
I tried what you wrote for the second point, it is ok now, but still i found it odd, that when setting the following (initialization stuff):
chtResults.LeftAxis.Automatic := False; // necessary for manual set of Min/Max
chtResults.LeftAxis.SetMinMax(0, 30);
then later adding the Gantt object (via AddGantt) that i do not need to recalculate the max value?
chtResults.LeftAxis.SetMinMax(0, 30*FPos); // this line in fact glue all the objects in the same area of the TChart making a mess
By commenting this line, the display got exactly the look i intend.
And for my third question, the TChartValueLists hold all the objects drawn on my Gantt chart isn't it? I can iterate through it to get the values of each Gantt object?
BR
Laurent
Re: Gantt chart and display
Hi Laurent,
I'm not sure to understand what are you trying to do here, what is FPos?
However, it seems it works as you expected right now. Otherwise, don't hesitate to let us know and please try to arrange a simple example project we can runa s-is to reproduce the situation here.
Great!AB Prod wrote:i found my mistake about my first question, i set the following values upon creation of the form:
// chtResults.LeftAxis.StartPosition := 0;
// chtResults.LeftAxis.EndPosition := 200;
By removing it, i now see data displayed above the bottom axis!
Note you don't need to set the Automatic property before calling SetMinMax method; it only should be set if you were going to set the Minimum and Maximum properties directly.AB Prod wrote:I tried what you wrote for the second point, it is ok now, but still i found it odd, that when setting the following (initialization stuff):
chtResults.LeftAxis.Automatic := False; // necessary for manual set of Min/Max
chtResults.LeftAxis.SetMinMax(0, 30);
then later adding the Gantt object (via AddGantt) that i do not need to recalculate the max value?
chtResults.LeftAxis.SetMinMax(0, 30*FPos); // this line in fact glue all the objects in the same area of the TChart making a mess
By commenting this line, the display got exactly the look i intend.
I'm not sure to understand what are you trying to do here, what is FPos?
However, it seems it works as you expected right now. Otherwise, don't hesitate to let us know and please try to arrange a simple example project we can runa s-is to reproduce the situation here.
Right. For example, this would move one hour forward all the Gantt values in a TGanttSeries:AB Prod wrote:And for my third question, the TChartValueLists hold all the objects drawn on my Gantt chart isn't it? I can iterate through it to get the values of each Gantt object?
Code: Select all
procedure TForm1.Button1Click(Sender: TObject);
var i: Integer;
begin
for i:=0 to Series1.Count-1 do
begin
Series1.StartValues[i]:=Series1.StartValues[i]+DateTimeStep[dtOneHour];
Series1.EndValues[i]:=Series1.EndValues[i]+DateTimeStep[dtOneHour];
end;
Chart1.Draw;
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Gantt chart and display
Hi,
tnx for the piece of code on the series.
About the SetMaxMin: tnx for the precision.
The "FPos" is an integer incremented (+1) on each AddGantt call, to avoid all the objects to be drawn on the same position. It seems logic to me that setting the Min/Max by code that the Max must be updated each time i add a Gantt object, somehow the max should increase each time, no?
BR
Laurent
tnx for the piece of code on the series.
About the SetMaxMin: tnx for the precision.
The "FPos" is an integer incremented (+1) on each AddGantt call, to avoid all the objects to be drawn on the same position. It seems logic to me that setting the Min/Max by code that the Max must be updated each time i add a Gantt object, somehow the max should increase each time, no?
BR
Laurent
Re: Gantt chart and display
Hi Laurent,
However, setting Automatic to false (or calling SetMinMax function, that sets Automatic to false) you are who has to control it. Imagine you have some thousand points in a series but you only want to show a hundred at a time. This could be done with a SetMinMax call. And then you could have a button to scoll to the next hundred points simply calling SetMinMax with different arguments.
In your case, you just have to adjust the axis each time you add a point (or gantt value).
If you still find problems with it, please try to arrange a simple example project we can run as-is to reproduce the situation here.
Thanks in advance.
When the Automatic property is set to true this works as you describe: the axs minimum and maximum are internally calculated to fit all the values in the series associated to that axis.AB Prod wrote:It seems logic to me that setting the Min/Max by code that the Max must be updated each time i add a Gantt object, somehow the max should increase each time, no?
However, setting Automatic to false (or calling SetMinMax function, that sets Automatic to false) you are who has to control it. Imagine you have some thousand points in a series but you only want to show a hundred at a time. This could be done with a SetMinMax call. And then you could have a button to scoll to the next hundred points simply calling SetMinMax with different arguments.
In your case, you just have to adjust the axis each time you add a point (or gantt value).
If you still find problems with it, please try to arrange a simple example project we can run as-is to reproduce the situation here.
Thanks in advance.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |