Timescale in ganttchart
Timescale in ganttchart
If I set the x-scale to f.e. week for a gantt planning tool, the I get a timescale from monday 0:00 up to sunday 23:59.
Is it possible to show only dayparts like form 08:00 up to 17:00 as working time and then skip the 17:00 to 08:00 and go directly to the next day 08:00?
I like to show only the dayparts from f.e. 08:00 to 17:00.
Is that possible?
Is it possible to show only dayparts like form 08:00 up to 17:00 as working time and then skip the 17:00 to 08:00 and go directly to the next day 08:00?
I like to show only the dayparts from f.e. 08:00 to 17:00.
Is that possible?
Hi Hans,
yes, that's possible. This has to be done manually. There is an example of this feature available in TeeChart Pro demo features project (All Features -> Welcome ! -> Chart Styles -> Candle -> Axis Labels no Weekends ).
yes, that's possible. This has to be done manually. There is an example of this feature available in TeeChart Pro demo features project (All Features -> Welcome ! -> Chart Styles -> Candle -> Axis Labels no Weekends ).
Pep Jorge
http://support.steema.com
http://support.steema.com
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Hans,
You should set the sources path to "C:\Program Files\Steema Software\TeeChart 7 for Delphi X\Examples\Features" (Deaful English installation path). Another solution would be openning the full features demo project with Delphi so there you have the source code.
You should set the sources path to "C:\Program Files\Steema Software\TeeChart 7 for Delphi X\Examples\Features" (Deaful English installation path). Another solution would be openning the full features demo project with Delphi so there you have the source code.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hello Hans,
Ok, that's because you are source code customer.
For the demo source code you should download and install the binary installer from the Customer Download Area. This will install TeeChart components, help files, demos, examples, tutorials, etc.
I'm sorry, but that directory doesn't exist.
The instal directory is : C:\Program Files\Steema Software\TeeChart Pro v7.02 Full Source Code\Sources
Ok, that's because you are source code customer.
And the demo file is the executable file I downloaded from the site.
For the demo source code you should download and install the binary installer from the Customer Download Area. This will install TeeChart components, help files, demos, examples, tutorials, etc.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
OK, and now the problem
I can't find All Features -> Welcome ! -> Chart Styles -> Candle -> Axis Labels no Weekends .
I have Chart styles->other->big candle, but no other candle with period blocking.
Hans
I have Chart styles->other->big candle, but no other candle with period blocking.
Hans
Found the candle
Found the candle without weekends.
But I cannot see how to program the skip of timeperiods on the X-scale.
Could you send me that code?
Hans
But I cannot see how to program the skip of timeperiods on the X-scale.
Could you send me that code?
Hans
Code requested
I would like to have some code to create the x-scale without the "night" hours.
Could you please help me, because in the examples I cannot find anything
Hans
Could you please help me, because in the examples I cannot find anything
Hans
Hi, Hans.
I did an example of "removing weekends" a while ago for another customer. Please check the following post.
The example removes whole days, but using the same approach you can also remove hours.
I did an example of "removing weekends" a while ago for another customer. Please check the following post.
The example removes whole days, but using the same approach you can also remove hours.
Marjan Slatinek,
http://www.steema.com
http://www.steema.com
Marjan, thanks
I have a possibility to change between day, week and month, so the x-scale should be recalculated everytime after switching.
I tried to do following to see what happened: "Planbord.Axes.Bottom.Items.Clear;"
But where I tried it, everytime the X-axis were there again.
On_beforedrawaxis
On_beforedrawseries
?
Where can change this? At that place I can try your suggestion of creating new bottom axis.
Hans
I have a possibility to change between day, week and month, so the x-scale should be recalculated everytime after switching.
I tried to do following to see what happened: "Planbord.Axes.Bottom.Items.Clear;"
But where I tried it, everytime the X-axis were there again.
On_beforedrawaxis
On_beforedrawseries
?
Where can change this? At that place I can try your suggestion of creating new bottom axis.
Hans
Hi, Hans.
I'd place the Clear (and repopulation) part in the same procedure you use to switch between different datetime formats. But you must repopulate axis labels (Items) - otherwise TeeChart internal algorithm will take over and generate the "usual" set of labels (no gaps).
I'd place the Clear (and repopulation) part in the same procedure you use to switch between different datetime formats. But you must repopulate axis labels (Items) - otherwise TeeChart internal algorithm will take over and generate the "usual" set of labels (no gaps).
Marjan Slatinek,
http://www.steema.com
http://www.steema.com
Marjan,
I tried something, but only see the labels change and not the gridlines.
I want to skip completely all gridlines and labels during the night.
So the last line to today is 17:00 and the next one(direct to the last ond of 17:00) is the 09:00 of tomorrow.
With each gridline at the same distance I like to see:
09:00 11:00 13:00 15:00 17:00 09:00 11:00 13:00 15:00 17:00 09:00 etc.
1. Is this possible?
2. How to do that? with code examples please.
Hans
I tried something, but only see the labels change and not the gridlines.
I want to skip completely all gridlines and labels during the night.
So the last line to today is 17:00 and the next one(direct to the last ond of 17:00) is the 09:00 of tomorrow.
With each gridline at the same distance I like to see:
09:00 11:00 13:00 15:00 17:00 09:00 11:00 13:00 15:00 17:00 09:00 etc.
1. Is this possible?
2. How to do that? with code examples please.
Hans
help code wanted
Marjan,
Could you please help me?
Hans
Could you please help me?
Hans
Hi, Hans.
Using the *same* approach I quoted couple of posts above this one I was able to plot two days according to your specifications. With slight modifications you can use it for whole week, month, ...
Using the *same* approach I quoted couple of posts above this one I was able to plot two days according to your specifications. With slight modifications you can use it for whole week, month, ...
Code: Select all
private
{ Private declarations }
ValidDates: Array [0..100] of TDate;
DateCount : Integer;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
// generate dates ... you can get this from sql, etc...
DateCount := 10;
// day 1
ValidDates[0] := EncodeDate(2005,1,31)+EncodeTime(9,0,0,0);
ValidDates[1] := EncodeDate(2005,1,31)+EncodeTime(11,0,0,0);
ValidDates[2] := EncodeDate(2005,1,31)+EncodeTime(13,0,0,0);
ValidDates[3] := EncodeDate(2005,1,31)+EncodeTime(15,0,0,0);
ValidDates[4] := EncodeDate(2005,1,31)+EncodeTime(17,0,0,0);
// day 2
ValidDates[5] := EncodeDate(2005,2,1)+EncodeTime(9,0,0,0);
ValidDates[6] := EncodeDate(2005,2,1)+EncodeTime(11,0,0,0);
ValidDates[7] := EncodeDate(2005,2,1)+EncodeTime(13,0,0,0);
ValidDates[8] := EncodeDate(2005,2,1)+EncodeTime(15,0,0,0);
ValidDates[9] := EncodeDate(2005,2,1)+EncodeTime(17,0,0,0);
// populate bottom axis with labels
// in this example user every 3rd label
Chart1.Axes.Bottom.Items.Clear;
for i := 0 to DateCount-1 do
if i mod 2 = 0 then // show every 2nd label - otherwise you might end up with overlapped labels
Chart1.Axes.Bottom.Items.Add(i,DateToStr(ValidDates[i])+#13+TimeToStr(ValidDates[i]));
Chart1.Axes.Bottom.SetMinMax(0,DateCount-1);
Chart1.Axes.Bottom.LabelsAngle := 90;
end;
function FindMatch(value: TDate; pool: Array of TDate; Const lo_bound, hi_bound: Integer): Integer;
var i: Integer;
begin
Result := -1;
for i := lo_bound to hi_bound do
if value=pool[i] then
begin
Result := i;
break;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var xvals: Array[0..6] of TDateTime;
yvals: Array[0..6] of double;
i, xind: Integer;
begin
// this is only sample array (example)
// 1st day data
xvals[0] := EncodeDate(2005,1,31)+EncodeTime(9,0,0,0);
yvals[0] := 5.2;
xvals[1] := EncodeDate(2005,1,31)+EncodeTime(11,0,0,0);
yvals[1] := 7.2;
xvals[2] := EncodeDate(2005,1,31)+EncodeTime(13,0,0,0);
yvals[2] := 1.2;
xvals[3] := EncodeDate(2005,1,31)+EncodeTime(15,0,0,0);
yvals[3] := 5.8;
xvals[4] := EncodeDate(2005,1,31)+EncodeTime(17,0,0,0);
yvals[4] := 5.8;
// 2nd day data
xvals[5] := EncodeDate(2005,2,1)+EncodeTime(9,0,0,0);
yvals[5] := 5.2;
xvals[6] := EncodeDate(2005,2,1)+EncodeTime(13,0,0,0);
yvals[6] := 7.2;
// Add points to series
// Note that points have real date x values =>
// you have to map each value to internal index array
Series1.Clear;
for i := 0 to High(xvals) do
begin
xind := FindMatch(xvals[i],ValidDates,0,DateCount-1);
if xind <> -1 then Series1.AddXY(xind,yvals[i]);
end;
end;
Marjan Slatinek,
http://www.steema.com
http://www.steema.com