Can I paint graph with gaps for TCandleSeries?

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
actforex
Newbie
Newbie
Posts: 3
Joined: Fri Jan 09, 2009 12:00 am

Can I paint graph with gaps for TCandleSeries?

Post by actforex » Tue Jan 19, 2010 8:56 am

Hello. Can I paint graph with gaps for TCandleSeries in CandleStyle := csLine mode? AddNull method doesn't work. Example is attached in candle_test.zip.
Attachments
candle_test.zip
(3.3 KiB) Downloaded 218 times

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Can I paint graph with gaps for TCandleSeries?

Post by Yeray » Wed Jan 20, 2010 9:32 am

Hi actforex,

No, I'm afraid TCandleseries' csLine mode doesn't allow null points. But you could transform your TCandleseries to be a TLineSeries. Here it is an example from the beginning:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var Series_Candle: TCandleSeries;
    CandleCopy: TChartSeries;
begin
  Chart1.View3D:=false;

  Series_Candle:=Chart1.AddSeries(TCandleSeries.Create(self)) as TCandleSeries;

  Series_Candle.AddCandle(1, 5, 15, 4, 10);
  Series_Candle.AddCandle(2, 8, 10, 1, 6);
  Series_Candle.AddNull(3);
  Series_Candle.AddCandle(4, 8, 14, 5, 10);
  Series_Candle.AddCandle(5, 6, 10, 6, 7);

  CandleCopy:=CloneChartSeries(Series_Candle);
  ChangeSeriesType(CandleCopy,TLineSeries);

  Series_Candle.Active:=false;
end;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

actforex
Newbie
Newbie
Posts: 3
Joined: Fri Jan 09, 2009 12:00 am

Re: Can I paint graph with gaps for TCandleSeries?

Post by actforex » Thu Jan 21, 2010 10:52 am

Thank you, but this is not exactly what's needed. If possible, please include this task in the development plan. This is a minor fix, but it would be very helpful for us.

So far I have managed to solve the problem by actually adding two lines into TCandleSeries.DrawValue:

begin
if IsNull(ValueIndex) then //TF02013524
begin
OldP.X := MaxInt; // (!)
Exit;
end;
...
if FCandleStyle=csLine then // Line
begin
...
if (ValueIndex<>tmpFirst) and (OldP.X <> MaxInt) then // (!)
...

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Can I paint graph with gaps for TCandleSeries?

Post by Yeray » Thu Jan 21, 2010 3:38 pm

Hi actforex,

Thank you for the suggestion. I've added it to the wish list to be studied for inclusion asap (TV52014649).
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

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

Re: Can I paint graph with gaps for TCandleSeries?

Post by Narcís » Mon Feb 01, 2010 4:06 pm

Hi actforex,

Just wanted to let you know that I fixed TV52014649 for the next maintenance release.

You can implemented the fix in DrawValue method pending candles with CandleStyle=csLine like this:

Code: Select all

    if FCandleStyle=csLine then  // Line
    begin
      P:=TeePoint(tmpX,YClose);

      tmpFirst:=FirstDisplayedIndex;

      if (ValueIndex<>tmpFirst) and (not IsNull(ValueIndex)) then
      begin
        if not IsNull(ValueIndex-1) then
        begin
          AssignVisiblePenColor(Self.Pen,tmpColor);
          BackMode:=cbmTransparent;
          if View3D then LineWithZ(OldP,P,MiddleZ)
                    else Line(OldP,P);
        end;

        OldP:=P;
      end
      else if ValueIndex=tmpFirst then OldP:=P;
    end
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