Adding dates as a second line to a candle sticks graph

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Shimon
Newbie
Newbie
Posts: 22
Joined: Tue Nov 04, 2008 12:00 am

Adding dates as a second line to a candle sticks graph

Post by Shimon » Thu Nov 06, 2008 9:15 pm

* I use TeeChart 8.0.4 Pro with Delphi 2009 to display candle stick series.
* I use DateValues = False for x values and controls the labels manually.

Three questions -

1. How do I add the date line when I use time for the labels ? You can see in the image attached.
The date should have a tick mark and text below the regular x labels.

2. I use TCursorTool to add a horizontal line to the graph, can I make it be behind my candles BUT before the grid lines ?

3. Now with Line Series graph - When I add points to the graph which are not monospaced (on x) a grid lines are created,
can I control the frequency of the y grid lines ? (so they will be mono spaced)

PS - I tries to attach an image but didnt find a way Is there any?

Thanks for your help

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Nov 07, 2008 9:33 am

Hi Shimon,
1. How do I add the date line when I use time for the labels ? You can see in the image attached.
The date should have a tick mark and text below the regular x labels.
The easiest way is setting axes DateTimeFormat like this:

Code: Select all

  Chart1.Axes.Bottom.DateTimeFormat:='hh:mm:ss' + #13 + '|' + #13 + 'MM/dd';
  Chart1.MarginBottom:=7;
2. I use TCursorTool to add a horizontal line to the graph, can I make it be behind my candles BUT before the grid lines ?
In that case you'd better use TColorLineTool which has DrawBehind property:

Code: Select all

  ChartTool1.Axis:=Chart1.Axes.Left;
  ChartTool1.Value:=6;
  ChartTool1.DrawBehind:=true;
3. Now with Line Series graph - When I add points to the graph which are not monospaced (on x) a grid lines are created,
can I control the frequency of the y grid lines ? (so they will be mono spaced)
Yes. Grid lines depend on axis labels. You can set axis labels like this:

Code: Select all

  Series1.AddXY(0, 5, 'point 1');
  Series1.AddXY(2, 7, 'point 1');
  Series1.AddXY(3, 2, 'point 1');
  Series1.AddXY(5, 8, 'point 1');

  Chart1.Axes.Bottom.LabelStyle:=talValue;
PS - I tries to attach an image but didnt find a way Is there any?
You can send us your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Shimon
Newbie
Newbie
Posts: 22
Joined: Tue Nov 04, 2008 12:00 am

Display a date only once per new day

Post by Shimon » Mon Nov 10, 2008 10:43 am

I have implemented your suggestion but have a new issue.

Now every label has time and date parts.

I would like that the date part will be displayed only once per a new day, this will reduce redundant information to the user.

Of course when I say once per a new day I mean once per a new DISPLAYED day, so if because zooming option that label isn't display than the next should display the date.

How can I accomplish that ?

I will upload - 'ShimonInvestSoftDateOnePerDay.png' so you can understand easily my needs.

Thanks!

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Nov 10, 2008 10:55 am

Hi Shimon,

You should set DateTime Increment to one day as told in Tutorial 4 - Axis Control. You'll find tutorials at TeeChart's program group.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Shimon
Newbie
Newbie
Posts: 22
Joined: Tue Nov 04, 2008 12:00 am

Post by Shimon » Mon Nov 10, 2008 12:07 pm

Narcís thanks for your prompt reply.

But you didn't understand what I meant.

I have uploaded a new image to clarify : ShimonInvestSoftDateOnePerDay_Goal.png

I wouldn't like to change the increment and to keep it auto, but I would like it to display the date part only when strictly needed.

For example if values are (22:00 19/11), (23:00 19:/11) (0:00 20/11)

Display should be

22:00 23:00 00:00
19/11 (nothing) 20/11

Thanks

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Nov 10, 2008 2:12 pm

Hi Shimon,

Sorry. Ok, now I see what you mean. In that case you should use the OnGetAxisLabel event and manually LabelText to fit your needs.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Shimon
Newbie
Newbie
Posts: 22
Joined: Tue Nov 04, 2008 12:00 am

Post by Shimon » Mon Nov 10, 2008 2:52 pm

The OnGetAxisLabel is called for all the VALUES in the range > min and < max my X (bottom axis).

BUT not ALL VALUES are DISPLAYED because of overlapping and zoom options and size of text...

So if I will set only one label within the day with the date (e.g. '21:23' + #13 + '11-30') then it might (because of zoom) not be displayed and there will be a day which does not appear.

Any solution?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Nov 10, 2008 3:44 pm

Hi Shimon,

OnGetAxisLabel event is also called when zooming/unzooming so I'd set labels as suggested in my first reply and dynamically customize them on each chart paint:

Code: Select all

procedure TForm1.Chart1GetAxisLabel(Sender: TChartAxis;
  Series: TChartSeries; ValueIndex: Integer; var LabelText: String);
begin
  if Sender = Chart1.Axes.Bottom then
  begin
      LabelText:=ParseYourLabelsHere(LabelText);
  end;
end;
Alternativelly you can use custom labels as shown in the All Features\Welcome!\Axes\Labels\Custom Labels in the new features demo, available at TeeChart's program group.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply