Recent

Author Topic: Color price in TOpenHighLowCloseSeries  (Read 5289 times)

Arthurus

  • New Member
  • *
  • Posts: 23
Color price in TOpenHighLowCloseSeries
« on: November 25, 2012, 09:45:39 am »
Hello,

In TOpenHighLowCloseSeries, how do I put red at the price if it move down and blue if it move up?

thanks.

---------------
Hola, En el TOpenHighLowCloseSeries ¿cómo pongo de color rojo el palito si el precio baja con respecto al dia anterior y azul si sube? Gracias.
---------------

Ask

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 687
Re: Color price in TOpenHighLowCloseSeries
« Reply #1 on: November 26, 2012, 08:07:01 am »
Since r39379, use DownLinePen property

Arthurus

  • New Member
  • *
  • Posts: 23
Re: Color price in TOpenHighLowCloseSeries
« Reply #2 on: November 26, 2012, 07:17:47 pm »
O.k.  Thanks.

Arthurus

  • New Member
  • *
  • Posts: 23
Re: Color price in TOpenHighLowCloseSeries
« Reply #3 on: November 27, 2012, 04:06:17 pm »
Hello,
I've tried it and it doesn't go well. In this example, the second tick should be blue and Red leaves.
Code: [Select]
procedure TForm1.Button1Click(Sender: TObject);
var ylist: array [1..4] of Double;
begin
  Chart1.Margins.Bottom := 20;     // Margenes
  Chart1.Margins.Left := 20;
  Chart1.Margins.Right := 20;
  Chart1.Margins.Top := 20;

  Chart1OpenHighLowCloseSeries1.TickWidth := 5;  // Ancho del tick
  Chart1OpenHighLowCloseSeries1.ListSource.YCount := 4;

  Chart1OpenHighLowCloseSeries1.LinePen.Color:=clBlue;
  Chart1OpenHighLowCloseSeries1.LinePen.Width:=3;
  Chart1OpenHighLowCloseSeries1.DownLinePen.Color:=clRed;
  Chart1OpenHighLowCloseSeries1.DownLinePen.Width:=3;

  ylist[1] := 10.9;  // O
  ylist[2] := 10.2;  // C             // O C H L
  ylist[3] := 11;    // H
  ylist[4] := 9.9;   // L
  Chart1OpenHighLowCloseSeries1.AddXY(1, 9.9, ylist);

  ylist[1] := 11;
  ylist[2] := 10.9;
  ylist[3] := 11.3;
  ylist[4] := 10.4;
  Chart1OpenHighLowCloseSeries1.AddXY(2, 10.4, ylist);

  ylist[1] := 10.5;
  ylist[2] := 10.7;
  ylist[3] := 11.2;
  ylist[4] := 10.3;
  Chart1OpenHighLowCloseSeries1.AddXY(3, 10.3, ylist);

  ylist[1] := 10.7;
  ylist[2] := 10.4;
  ylist[3] := 11.7;
  ylist[4] := 10.2;
  Chart1OpenHighLowCloseSeries1.AddXY(4, 10.2, ylist);
end;

Anyway, the ideal was that it could choose the color of the individual tick. Imagine I want that the ticks above average are blue and those who go down here to Red:
(Photo of my program in Delphi with TeeChart)
http://img233.imageshack.us/img233/3669/probamedia.jpg

To do this you would operate the fifth parameter of the AddXY function:

Chart1OpenHighLowCloseSeries1.AddXY(4, 10.2, ylist,'',clRed);
or
Chart1OpenHighLowCloseSeries1.AddXY(4, 10.2, ylist,'',clBlue);

With this we would have total control in the color of the tick

Best regards


---------------------------------------------------------------------------------------------
Spanish:
Ya lo he probado y no va bien. En este ejemplo, el segundo tick debería ser azul y sale rojo.

De todas formas, lo ideal era que se pudiera elegir el color del tick individual. Imagina que quiero que los ticks por encima de una media sean azules y los que van por abajo rojo como aquí:
(Foto de mi programa en Delphi con TeeChart)
http://img233.imageshack.us/img233/3669/probamedia.jpg

Para ello tendría que funcionar el quinto parámetro de la función AddXY:

Con esto tendríamos control total en el color del tick

Un saludo

Ask

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 687
Re: Color price in TOpenHighLowCloseSeries
« Reply #4 on: November 28, 2012, 04:30:23 am »
Quote
the second tick should be blue and Red leaves.
Did you modify YIndex properties? By default, y values are ordered "Low, Open, Close, High",
which does not correspond to comments in your code.

Quote
the ideal was that it could choose the color of the individual tick
Done in r39398
« Last Edit: November 28, 2012, 06:20:51 pm by Ask »

Arthurus

  • New Member
  • *
  • Posts: 23
Re: Color price in TOpenHighLowCloseSeries
« Reply #5 on: November 29, 2012, 10:38:51 am »
Perfect!

But the order of YIndex are not correct:

http://imageshack.us/photo/my-images/5/ordenohlc.jpg/

If I change the order go wrong the tick:

http://imageshack.us/photo/my-images/211/ordenohlcmal.jpg/

I use Win32.

Best Regard.

Ask

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 687
Re: Color price in TOpenHighLowCloseSeries
« Reply #6 on: November 29, 2012, 11:27:09 am »
Quote
the order of YIndex are not correct:
Yes, this is what I have told in previous message, Y values are incorrectly assigned in your code.
Note that YIndex is zero-based, and AddXY receives zeroth Y value and a list of the rest
as a separate arguments.

 

TinyPortal © 2005-2018